thermalBaffle1DFvPatchScalarField<solidType>:: thermalBaffle1DFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mappedPatchBase ( p.patch(), p.boundaryMesh().mesh().name(), NEARESTPATCHFACE, dict.lookup("samplePatch"), 0.0 ), mixedFvPatchScalarField(p, iF), TName_("T"), baffleActivated_(dict.lookupOrDefault<bool>("baffleActivated", true)), thickness_(), Qs_(p.size(), 0), solidDict_(dict), solidPtr_(), QrPrevious_(p.size(), 0.0), QrRelaxation_(dict.lookupOrDefault<scalar>("relaxation", 0)), QrName_(dict.lookupOrDefault<word>("Qr", "none")) { fvPatchScalarField::operator=(scalarField("value", dict, p.size())); if (dict.found("thickness")) { thickness_ = scalarField("thickness", dict, p.size()); } if (dict.found("Qs")) { Qs_ = scalarField("Qs", dict, p.size()); } if (dict.found("QrPrevious")) { QrPrevious_ = scalarField("QrPrevious", dict, p.size()); } if (dict.found("refValue") && baffleActivated_) { // Full restart refValue() = scalarField("refValue", dict, p.size()); refGrad() = scalarField("refGradient", dict, p.size()); valueFraction() = scalarField("valueFraction", dict, p.size()); } else { // Start from user entered data. Assume zeroGradient. refValue() = *this; refGrad() = 0.0; valueFraction() = 0.0; } }
Foam::constHTemperatureFvPatchScalarField:: constHTemperatureFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchField<scalar>(p, iF), Tinf_("Tinf", dict, p.size()), h_("h", dict, p.size()) { refValue() = Tinf_; refGrad() = 0.0; valueFraction() = 0.0; if (dict.found("value")) { fvPatchField<scalar>::operator= ( Field<scalar>("value", dict, p.size()) ); } else { fvPatchField<scalar>::operator=(refValue()); } }
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField:: totalFlowRateAdvectiveDiffusiveFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchField<scalar>(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), rhoName_(dict.lookupOrDefault<word>("rho", "none")), massFluxFraction_(dict.lookupOrDefault<scalar>("massFluxFraction", 1.0)) { refValue() = 1.0; refGrad() = 0.0; valueFraction() = 0.0; if (dict.found("value")) { fvPatchField<scalar>::operator= ( Field<scalar>("value", dict, p.size()) ); } else { fvPatchField<scalar>::operator=(refValue()); } }
Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), radiationCoupledBase(p, dict), TName_(dict.lookupOrDefault<word>("T", "T")) { if (dict.found("value")) { refValue() = scalarField("value", dict, p.size()); } else { refValue() = 0.0; } // zero gradient refGrad() = 0.0; valueFraction() = 1.0; fvPatchScalarField::operator=(refValue()); }
filmPyrolysisRadiativeCoupledMixedFvPatchScalarField:: filmPyrolysisRadiativeCoupledMixedFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), dict), filmRegionName_ ( dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties") ), pyrolysisRegionName_ ( dict.lookupOrDefault<word>("pyrolysisRegion", "pyrolysisProperties") ), TnbrName_(dict.lookup("Tnbr")), QrName_(dict.lookup("Qr")), convectiveScaling_(dict.lookupOrDefault<scalar>("convectiveScaling", 1.0)), filmDeltaDry_(readScalar(dict.lookup("filmDeltaDry"))), filmDeltaWet_(readScalar(dict.lookup("filmDeltaWet"))) { if (!isA<mappedPatchBase>(this->patch().patch())) { FatalErrorIn ( "filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::" "filmPyrolysisRadiativeCoupledMixedFvPatchScalarField\n" "(\n" " const fvPatch& p,\n" " const DimensionedField<scalar, volMesh>& iF,\n" " const dictionary& dict\n" ")\n" ) << "\n patch type '" << p.type() << "' not type '" << mappedPatchBase::typeName << "'" << "\n for patch " << p.name() << " of field " << dimensionedInternalField().name() << " in file " << dimensionedInternalField().objectPath() << exit(FatalError); } fvPatchScalarField::operator=(scalarField("value", dict, p.size())); if (dict.found("refValue")) { // Full restart refValue() = scalarField("refValue", dict, p.size()); refGrad() = scalarField("refGradient", dict, p.size()); valueFraction() = scalarField("valueFraction", dict, p.size()); } else { // Start from user entered data. Assume fixedValue. refValue() = *this; refGrad() = 0.0; valueFraction() = 1.0; } }
Foam::MarshakRadiationFixedTMixedFvPatchScalarField:: MarshakRadiationFixedTMixedFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), Trad_("Trad", dict, p.size()), emissivity_(readScalar(dict.lookup("emissivity"))) { refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_); refGrad() = 0.0; if (dict.found("value")) { fvPatchScalarField::operator= ( scalarField("value", dict, p.size()) ); } else { fvPatchScalarField::operator=(refValue()); } }
Foam::fixedEnthalpyFluxTemperatureFvPatchScalarField:: fixedEnthalpyFluxTemperatureFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchField<scalar>(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), rhoName_(dict.lookupOrDefault<word>("rho", "none")), Tinf_("Tinf", dict, p.size()) { refValue() = Tinf_; refGrad() = 0.0; valueFraction() = 0.0; if (dict.found("value")) { fvPatchField<scalar>::operator= ( Field<scalar>("value", dict, p.size()) ); } else { fvPatchField<scalar>::operator=(refValue()); } }
thermalBaffle1DFvPatchScalarField<solidType>:: thermalBaffle1DFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), TName_("T"), baffleActivated_(readBool(dict.lookup("baffleActivated"))), thickness_(scalarField("thickness", dict, p.size())), Qs_(scalarField("Qs", dict, p.size())), solidDict_(dict), solidPtr_(new solidType(dict)) { if (!isA<mappedPatchBase>(this->patch().patch())) { FatalErrorIn ( "thermalBaffle1DFvPatchScalarField::" "thermalBaffle1DFvPatchScalarField" "(" "const fvPatch&,\n" "const DimensionedField<scalar, volMesh>&, " "const dictionary&" ")" ) << "\n patch type '" << patch().type() << "' not type '" << mappedPatchBase::typeName << "'" << "\n for patch " << patch().name() << " of field " << dimensionedInternalField().name() << " in file " << dimensionedInternalField().objectPath() << exit(FatalError); } fvPatchScalarField::operator=(scalarField("value", dict, p.size())); if (dict.found("refValue") && baffleActivated_) { // Full restart refValue() = scalarField("refValue", dict, p.size()); refGrad() = scalarField("refGradient", dict, p.size()); valueFraction() = scalarField("valueFraction", dict, p.size()); } else { // Start from user entered data. Assume zeroGradient. refValue() = *this; refGrad() = 0.0; valueFraction() = 0.0; } }
CFDHAMfluidMoistureCoupledMixedFvPatchScalarField:: CFDHAMfluidMoistureCoupledMixedFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), dict), wnbrName_(dict.lookupOrDefault<word>("wnbr", "none")), TnbrName_(dict.lookupOrDefault<word>("Tnbr", "none")), QrNbrName_(dict.lookupOrDefault<word>("QrNbr", "none")), QrName_(dict.lookupOrDefault<word>("Qr", "none")), QsNbrName_(dict.lookupOrDefault<word>("QsNbr", "none")), QsName_(dict.lookupOrDefault<word>("Qs", "none")) { if (!isA<mappedPatchBase>(this->patch().patch())) { FatalErrorIn ( "CFDHAMfluidMoistureCoupledMixedFvPatchScalarField::" "CFDHAMfluidMoistureCoupledMixedFvPatchScalarField\n" "(\n" " const fvPatch& p,\n" " const DimensionedField<scalar, volMesh>& iF,\n" " const dictionary& dict\n" ")\n" ) << "\n patch type '" << p.type() << "' not type '" << mappedPatchBase::typeName << "'" << "\n for patch " << p.name() << " of field " << dimensionedInternalField().name() << " in file " << dimensionedInternalField().objectPath() << exit(FatalError); } fvPatchScalarField::operator=(scalarField("value", dict, p.size())); if (dict.found("refValue")) { // Full restart refValue() = scalarField("refValue", dict, p.size()); refGrad() = scalarField("refGradient", dict, p.size()); valueFraction() = scalarField("valueFraction", dict, p.size()); } else { // Start from user entered data. Assume fixedValue. refValue() = *this; refGrad() = 0.0; valueFraction() = 1.0; } }
surfaceChargeCoupledFvPatchScalarField:: surfaceChargeCoupledFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), dict), neighbourFieldName_(dict.lookup("neighbourFieldName")), surfCharge_(readScalar(dict.lookup("surfaceCharge"))), myEpr_(readScalar(dict.lookup("myEpr"))), nbrEpr_(readScalar(dict.lookup("nbrEpr"))) { if (!isA<mappedPatchBase>(this->patch().patch())) { FatalErrorIn ( "surfaceChargeCoupledFvPatchScalarField::" "surfaceChargeCoupledFvPatchScalarField\n" "(\n" " const fvPatch& p,\n" " const DimensionedField<scalar, volMesh>& iF,\n" " const dictionary& dict\n" ")\n" ) << "\n patch type '" << p.type() << "' not type '" << mappedPatchBase::typeName << "'" << "\n for patch " << p.name() << " of field " << dimensionedInternalField().name() << " in file " << dimensionedInternalField().objectPath() << exit(FatalError); } fvPatchScalarField::operator=(scalarField("value", dict, p.size())); if (dict.found("refValue")) { // Full restart refValue() = scalarField("refValue", dict, p.size()); refGrad() = scalarField("refGradient", dict, p.size()); valueFraction() = scalarField("valueFraction", dict, p.size()); } else { // Start from user entered data. Assume fixedValue. refValue() = *this; refGrad() = 0.0; valueFraction() = 1.0; } }
void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs() { if (updated()) { return; } const label patchI = patch().index(); const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>(phiName_); const fvsPatchField<scalar>& phip = patch().patchField<surfaceScalarField, scalar>(phi); tmp<vectorField> n = patch().nf(); const Field<scalar>& magS = patch().magSf(); const volVectorField& U = db().lookupObject<volVectorField>("U"); vectorField Uc(U.boundaryField()[patchI].patchInternalField()); Uc -= n()*(Uc & n()); if (phi.dimensions() == dimVelocity*dimArea) { refValue() = Uc + n*phip/magS; } else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchField<scalar>& rhop = patch().lookupPatchField<volScalarField, scalar>(rhoName_); refValue() = Uc + n*phip/(rhop*magS); } else { FatalErrorIn ( "pressureInletOutletParSlipVelocityFvPatchVectorField::" "updateCoeffs()" ) << "dimensions of phi are not correct" << nl << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalError); } valueFraction() = 1.0 - pos(phip); mixedFvPatchVectorField::updateCoeffs(); }
void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs() { if (updated()) { return; } const fvPatchScalarField& pmu = patch().lookupPatchField<volScalarField, scalar>(muName_); const fvPatchScalarField& prho = patch().lookupPatchField<volScalarField, scalar>(rhoName_); const fvPatchField<scalar>& ppsi = patch().lookupPatchField<volScalarField, scalar>(psiName_); Field<scalar> C1 ( sqrt(ppsi*constant::mathematical::piByTwo) * (2.0 - accommodationCoeff_)/accommodationCoeff_ ); Field<scalar> pnu(pmu/prho); valueFraction() = (1.0/(1.0 + patch().deltaCoeffs()*C1*pnu)); refValue() = Uwall_; if (thermalCreep_) { const volScalarField& vsfT = this->db().objectRegistry::lookupObject<volScalarField>(TName_); label patchi = this->patch().index(); const fvPatchScalarField& pT = vsfT.boundaryField()[patchi]; Field<vector> gradpT(fvc::grad(vsfT)().boundaryField()[patchi]); vectorField n(patch().nf()); refValue() -= 3.0*pnu/(4.0*pT)*transform(I - n*n, gradpT); } if (curvature_) { const fvPatchTensorField& ptauMC = patch().lookupPatchField<volTensorField, tensor>(tauMCName_); vectorField n(patch().nf()); refValue() -= C1/prho*transform(I - n*n, (n & ptauMC)); } mixedFixedValueSlipFvPatchVectorField::updateCoeffs(); }
void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs() { if (updated()) { return; } const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>(phiName_); const fvsPatchField<scalar>& phip = patch().patchField<surfaceScalarField, scalar>(phi); tmp<vectorgpuField> n = patch().nf(); const gpuField<scalar>& magSf = patch().magSf(); // Get the tangential component from the internalField (zero-gradient) vectorgpuField Ut(patchInternalField()); Ut -= n()*(Ut & n()); if (phi.dimensions() == dimVelocity*dimArea) { refValue() = Ut + n*phip/magSf; } else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchField<scalar>& rhop = patch().lookupPatchField<volScalarField, scalar>(rhoName_); refValue() = Ut + n*phip/(rhop*magSf); } else { FatalErrorIn ( "pressureInletOutletParSlipVelocityFvPatchVectorField::" "updateCoeffs()" ) << "dimensions of phi are not correct" << nl << " on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalError); } valueFraction() = 1.0 - pos(phip); mixedFvPatchVectorField::updateCoeffs(); }
void solidDirectionMixedFvPatchVectorField::evaluate(const Pstream::commsTypes) { if (!this->updated()) { this->updateCoeffs(); } Field<vector> normalValue = transform(valueFraction(), refValue()); //- no correction //Field<vector> gradValue = //this->patchInternalField() + refGrad()/this->patch().deltaCoeffs(); //- non-ortho corrected gradValue const fvPatchField<tensor>& gradField = patch().lookupPatchField<volTensorField, tensor> ( "grad(" +fieldName_ + ")" ); vectorField n = patch().nf(); vectorField delta = patch().delta(); vectorField k = delta - n*(n&delta); Field<vector> gradValue = this->patchInternalField() + (k&gradField.patchInternalField()) + refGrad()/this->patch().deltaCoeffs(); Field<vector> transformGradValue = transform(I - valueFraction(), gradValue); Field<vector>::operator=(normalValue + transformGradValue); fvPatchField<vector>::evaluate(); }
Foam::tmp<Foam::Field<vector> > solidDirectionMixedFvPatchVectorField::snGrad() const { Field<vector> pif = this->patchInternalField(); //- fixedValue snGrad with no correction // return (*this - patchInternalField())*this->patch().deltaCoeffs(); Field<vector> normalValue = transform(valueFraction(), refValue()); const fvPatchField<tensor>& gradField = patch().lookupPatchField<volTensorField, tensor> ( "grad(" +fieldName_ + ")" ); vectorField n = this->patch().nf(); vectorField delta = this->patch().delta(); //- correction vector vectorField k = delta - n*(n&delta); Field<vector> gradValue = (this->refGrad()/this->patch().deltaCoeffs()) + (pif) + (k&gradField.patchInternalField()); Field<vector> transformGradValue = transform(I - (this->valueFraction()), gradValue); Field<vector> patchValue = normalValue + transformGradValue; return ( patchValue - ((this->patchInternalField()) + (k&gradField.patchInternalField())) )*this->patch().deltaCoeffs(); }
// Update the coefficients associated with the patch field void nusseltFvPatchScalarField::updateCoeffs() { if (updated()) { return; } scalarField Tinternal = patchInternalField(); // Lookup temperature diffusivity of the patch const fvPatchField<scalar>& DT = this->patch().lookupPatchField<volScalarField, scalar>(DTName_); // Calculate flux scalarField tempFlux = alpha_*(Tinternal - Tinf_); refValue() = neg(tempFlux)* min ( Tinternal - tempFlux/(DT*patch().deltaCoeffs()), Tinf_ ) + pos(tempFlux)* max ( Tinternal - tempFlux/(DT*patch().deltaCoeffs()), Tinf_ ); refGrad() = -tempFlux; valueFraction() = pos(tempFlux); mixedFvPatchScalarField::updateCoeffs(); }
solidDirectionMixedFvPatchVectorField::solidDirectionMixedFvPatchVectorField ( const fvPatch& p, const DimensionedField<vector, volMesh>& iF, const dictionary& dict ) : directionMixedFvPatchVectorField(p, iF, dict), fieldName_(dimensionedInternalField().name()) { Field<vector> normalValue = transform(valueFraction(), refValue()); Field<vector> gradValue = this->patchInternalField() + refGrad()/this->patch().deltaCoeffs(); //- non-ortho corrected gradValue //- gradField will not have been created so I must do this during updateCoeffs /*const fvPatchField<tensor>& gradField = patch().lookupPatchField<volTensorField, tensor>("grad(" +fieldName_ + ")"); vectorField n = patch().nf(); vectorField delta = patch().delta(); vectorField k = delta - n*(n&delta); Field<vector> gradValue = this->patchInternalField() + (k&gradField.patchInternalField()) + refGrad()/this->patch().deltaCoeffs(); */ Field<vector> transformGradValue = transform(I - valueFraction(), gradValue); Field<vector>::operator=(normalValue + transformGradValue); }
void Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs() { if (this->updated()) { return; } const scalarField& alphap = patch().lookupPatchField<volScalarField, scalar> ( phaseName_ ); const uniformDimensionedVectorField& g = db().lookupObject<uniformDimensionedVectorField>("g"); // scalar rhor = 1000; // scalarField alphap1 = max(min(alphap, 1.0), 0.0); // valueFraction() = alphap1/(alphap1 + rhor*(1.0 - alphap1)); valueFraction() = max(min(alphap, 1.0), 0.0); refValue() = pRefValue_ + rho_*((g.value() & patch().Cf()) - (g.value() & pRefPoint_)); mixedFvPatchScalarField::updateCoeffs(); }
Foam::wallHeatTransferFvPatchScalarField::wallHeatTransferFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), Tinf_("Tinf", dict, p.size()), alphaWall_("alphaWall", dict, p.size()) { refValue() = Tinf_; refGrad() = 0.0; valueFraction() = 0.0; if (dict.found("value")) { fvPatchField<scalar>::operator= ( scalarField("value", dict, p.size()) ); } else { evaluate(); } }
void Foam::MarshakRadiationFvPatchScalarField::updateCoeffs() { if (this->updated()) { return; } // Since we're inside initEvaluate/evaluate there might be processor // comms underway. Change the tag we use. int oldTag = UPstream::msgType(); UPstream::msgType() = oldTag+1; // Temperature field const scalarField& Tp = patch().lookupPatchField<volScalarField, scalar>(TName_); // Re-calc reference value refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp); // Diffusion coefficient - created by radiation model's ::updateCoeffs() const scalarField& gamma = patch().lookupPatchField<volScalarField, scalar>("gammaRad"); const scalarField temissivity = emissivity(); const scalarField Ep(temissivity/(2.0*(2.0 - temissivity))); // Set value fraction valueFraction() = 1.0/(1.0 + gamma*patch().deltaCoeffs()/Ep); // Restore tag UPstream::msgType() = oldTag; mixedFvPatchScalarField::updateCoeffs(); }
void Foam::constHTemperatureFvPatchScalarField::updateCoeffs() { if (this->updated()) { return; } // scalarField K_ = patch().lookupPatchField<volScalarField, scalar>("K"); const fvMesh& mesh = patch().boundaryMesh().mesh(); const solidThermo& thermo = mesh.lookupObject<solidThermo>("thermophysicalProperties"); scalarField K_(thermo.kappa(patch().index())); refValue() = Tinf_; refGrad() = 0.0; valueFraction() = 1.0/(1.0 + K_/max(h_,SMALL)*patch().deltaCoeffs()); mixedFvPatchField<scalar>::updateCoeffs(); }
void Foam::mixedInternalEnergyFvPatchScalarField::updateCoeffs() { if (updated()) { return; } const basicThermo& thermo = db().lookupObject<basicThermo> ( "thermophysicalProperties" ); const label patchi = patch().index(); mixedFvPatchScalarField& Tw = refCast<mixedFvPatchScalarField> ( const_cast<fvPatchScalarField&>(thermo.T().boundaryField()[patchi]) ); Tw.evaluate(); valueFraction() = Tw.valueFraction(); refValue() = thermo.e(Tw.refValue(), patchi); refGrad() = thermo.Cv(Tw, patchi)*Tw.refGrad() + patch().deltaCoeffs()* ( thermo.e(Tw, patchi) - thermo.e(Tw, patch().faceCells()) ); mixedFvPatchScalarField::updateCoeffs(); }
void mixedUnburntEnthalpyFvPatchScalarField::updateCoeffs() { if (updated()) { return; } const hhuCombustionThermo& thermo = db().lookupObject<hhuCombustionThermo> ( "thermophysicalProperties" ); const label patchi = patch().index(); mixedFvPatchScalarField& Tw = refCast<mixedFvPatchScalarField> ( const_cast<fvPatchScalarField&>(thermo.Tu().boundaryField()[patchi]) ); Tw.evaluate(); valueFraction() = Tw.valueFraction(); refValue() = thermo.hu(Tw.refValue(), patchi); refGrad() = thermo.Cp(Tw, patchi)*Tw.refGrad() + patch().deltaCoeffs()* ( thermo.hu(Tw, patchi) - thermo.hu(Tw, patch().faceCells()) ); mixedFvPatchScalarField::updateCoeffs(); }
void mixedSubsonicSupersonicOutletFvPatchScalarField::updateCoeffs() { if (updated()) { return; } const fvPatchField<scalar>& Tp = patch().lookupPatchField<volScalarField, scalar>(TName_); const fvPatchField<vector>& Up = patch().lookupPatchField<volVectorField, vector>(UName_); const basicThermo& thermo = db().lookupObject<basicThermo>("thermophysicalProperties"); const volScalarField Cp = thermo.Cp(); const volScalarField Cv = thermo.Cv(); const vectorField normalVector = patch().nf(); const fvPatchField<scalar>& Cpp = patch().patchField<volScalarField, scalar>(Cp); const fvPatchField<scalar>& Cvp = patch().patchField<volScalarField, scalar>(Cv); refValue() = fixedValue_; forAll(Tp, patchI) { scalar Map = mag(normalVector[patchI] & Up[patchI]) /sqrt((Cpp[patchI]/Cvp[patchI])*(Cpp[patchI]-Cvp[patchI])*Tp[patchI]); valueFraction()[patchI] = pos(Map-1.0) ? 0.0 : 1.0; }
void Foam::SRFFreestreamVelocityFvPatchVectorField::updateCoeffs() { if (updated()) { return; } // Get reference to the SRF model const SRF::SRFModel& srf = db().lookupObject<SRF::SRFModel>("SRFProperties"); word ddtScheme ( this->dimensionedInternalField().mesh() .ddtScheme(this->dimensionedInternalField().name()) ); if (ddtScheme == fv::steadyStateDdtScheme<scalar>::typeName) { // If not relative to the SRF include the effect of the SRF if (!relative_) { refValue() = UInf_ - srf.velocity(patch().Cf()); } // If already relative to the SRF simply supply the inlet value // as a fixed value else { refValue() = UInf_; } } else { scalar time = this->db().time().value(); scalar theta = time*mag(srf.omega().value()); refValue() = cos(theta)*UInf_ + sin(theta)*(srf.axis() ^ UInf_) - srf.velocity(patch().Cf()); } // Set the inlet-outlet choice based on the direction of the freestream valueFraction() = 1.0 - pos(refValue() & patch().Sf()); mixedFvPatchField<vector>::updateCoeffs(); }
smoluchowskiJumpTFvPatchScalarField::smoluchowskiJumpTFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), accommodationCoeff_(readScalar(dict.lookup("accommodationCoeff"))), Twall_("Twall", dict, p.size()) { if ( mag(accommodationCoeff_) < SMALL || mag(accommodationCoeff_) > 2.0 ) { FatalIOErrorIn ( "smoluchowskiJumpTFvPatchScalarField::" "smoluchowskiJumpTFvPatchScalarField" "(" " const fvPatch&," " const DimensionedField<scalar, volMesh>&," " const dictionary&" ")", dict ) << "unphysical accommodationCoeff_ specified" << "(0 < accommodationCoeff_ <= 1)" << endl << exit(FatalError); } if (dict.found("value")) { fvPatchField<scalar>::operator= ( scalarField("value", dict, p.size()) ); } else { fvPatchField<scalar>::operator=(patchInternalField()); } if (dict.found("gamma")) { gamma_ = readScalar(dict.lookup("gamma")); } else { gamma_ = 1.4; } refValue() = *this; refGrad() = 0.0; valueFraction() = 0.0; }
nusseltFvPatchScalarField::nusseltFvPatchScalarField ( const fvPatch& p, const DimensionedField<scalar, volMesh>& iF, const dictionary& dict ) : mixedFvPatchScalarField(p, iF), DTName_(dict.lookup("DT")), Tinf_(readScalar(dict.lookup("Tinf"))), alpha_("alpha", dict, p.size()) { if (dict.found("value")) { fvPatchField<scalar>::operator= ( scalarField("value", dict, p.size()) ); } else { fvPatchField<scalar>::operator=(patchInternalField()); } refValue() = *this; refGrad() = 0.0; valueFraction() = 0.0; if (Tinf_ < SMALL) { FatalIOErrorIn ( "nusseltFvPatchScalarField::nusseltFvPatchScalarField\n" "(\n" " const fvPatch&,\n" " const DimensionedField<scalar, volMesh>&,\n" " const dictionary&\n" ")", dict ) << "unphysical Tinf specified (Tinf = 0 or negative)" << exit(FatalError); } if (min(alpha_) < -SMALL) { FatalIOErrorIn ( "nusseltFvPatchScalarField::nusseltFvPatchScalarField\n" "(\n" " const fvPatch&,\n" " const DimensionedField<scalar, volMesh>&,\n" " const dictionary&\n" ")", dict ) << "unphysical alpha specified (alpha = 0 or negative)" << endl << exit(FatalError); } }
void pressureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs() { if (updated()) { return; } const surfaceScalarField& phi = db().lookupObject<surfaceScalarField>(phiName_); const fvsPatchField<scalar>& phip = patch().patchField<surfaceScalarField, scalar>(phi); vectorField n = patch().nf(); scalarField ndmagS = (n & inletDir_)*patch().magSf(); if (phi.dimensions() == dimVelocity*dimArea) { refValue() = inletDir_*phip/ndmagS; } else if (phi.dimensions() == dimDensity*dimVelocity*dimArea) { const fvPatchField<scalar>& rhop = patch().lookupPatchField<volScalarField, scalar>(rhoName_); refValue() = inletDir_*phip/(rhop*ndmagS); } else { FatalErrorIn ( "pressureDirectedInletOutletVelocityFvPatchVectorField::" "updateCoeffs()" ) << "dimensions of phi are not correct" << "\n on patch " << this->patch().name() << " of field " << this->dimensionedInternalField().name() << " in file " << this->dimensionedInternalField().objectPath() << exit(FatalError); } valueFraction() = 1.0 - pos(phip); mixedFvPatchVectorField::updateCoeffs(); }
void rotatingPressureInletOutletVelocityFvPatchVectorField:: calcTangentialVelocity() { vector axisHat = omega_/mag(omega_); vectorField tangentialVelocity = (-omega_) ^ (patch().Cf() - axisHat*(axisHat & patch().Cf())); vectorField n = patch().nf(); refValue() = tangentialVelocity - n*(n & tangentialVelocity); }
void Foam::phaseHydrostaticPressureFvPatchScalarField::operator= ( const fvPatchScalarField& ptf ) { fvPatchScalarField::operator= ( valueFraction()*refValue() + (1 - valueFraction())*ptf ); }