ENH: use simpler lookupPatchField form

This commit is contained in:
Mark Olesen
2023-01-02 09:33:00 +01:00
parent 35dae3fc3b
commit 27a7ae2d1d
94 changed files with 325 additions and 517 deletions

View File

@ -165,14 +165,10 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
return; return;
} }
const fvPatchScalarField& pmu = const auto& pmu = patch().lookupPatchField<volScalarField>(muName_);
patch().lookupPatchField<volScalarField, scalar>(muName_); const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_);
const fvPatchScalarField& prho = const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_); const auto& pU = patch().lookupPatchField<volVectorField>(UName_);
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>(psiName_);
const fvPatchVectorField& pU =
patch().lookupPatchField<volVectorField, vector>(UName_);
// Prandtl number reading consistent with rhoCentralFoam // Prandtl number reading consistent with rhoCentralFoam
const dictionary& thermophysicalProperties = const dictionary& thermophysicalProperties =

View File

@ -155,12 +155,9 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
return; return;
} }
const fvPatchScalarField& pmu = const auto& pmu = patch().lookupPatchField<volScalarField>(muName_);
patch().lookupPatchField<volScalarField, scalar>(muName_); const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_);
const fvPatchScalarField& prho = const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>(psiName_);
Field<scalar> C1 Field<scalar> C1
( (
@ -187,8 +184,8 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
if (curvature_) if (curvature_)
{ {
const fvPatchTensorField& ptauMC = const auto& ptauMC =
patch().lookupPatchField<volTensorField, tensor>(tauMCName_); patch().lookupPatchField<volTensorField>(tauMCName_);
vectorField n(patch().nf()); vectorField n(patch().nf());
refValue() -= C1/prho*transform(I - n*n, (n & ptauMC)); refValue() -= C1/prho*transform(I - n*n, (n & ptauMC));

View File

@ -104,11 +104,8 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
return; return;
} }
const fvPatchField<scalar>& psip = const auto& psip = patch().lookupPatchField<volScalarField>(psiName_);
patch().lookupPatchField<volScalarField, scalar>(psiName_); const auto& pp = patch().lookupPatchField<volScalarField>(pName_);
const fvPatchField<scalar>& pp =
patch().lookupPatchField<volScalarField, scalar>(pName_);
operator==(psip*pp); operator==(psip*pp);

View File

@ -88,26 +88,29 @@ kappa
case mtLookup: case mtLookup:
{ {
if (mesh.foundObject<volScalarField>(kappaName_))
{ {
return patch().lookupPatchField<volScalarField, scalar> const auto* ptr =
( mesh.cfindObject<volScalarField>(kappaName_);
kappaName_
); if (ptr)
{
return patch().patchField(*ptr);
}
} }
else if (mesh.foundObject<volSymmTensorField>(kappaName_))
{ {
const symmTensorField& KWall = const auto* ptr =
patch().lookupPatchField<volSymmTensorField, scalar> mesh.cfindObject<volSymmTensorField>(kappaName_);
(
kappaName_
);
const vectorField n(patch().nf()); if (ptr)
{
const symmTensorField& KWall = patch().patchField(*ptr);
return n & KWall & n; const vectorField n(patch().nf());
return n & KWall & n;
}
} }
else
{ {
FatalErrorInFunction FatalErrorInFunction
<< "Did not find field " << kappaName_ << "Did not find field " << kappaName_
@ -117,9 +120,6 @@ kappa
<< " or volSymmTensorField." << " or volSymmTensorField."
<< exit(FatalError); << exit(FatalError);
} }
break; break;
} }
@ -131,10 +131,8 @@ kappa
mesh.lookupObject<phaseSystem>("phaseProperties") mesh.lookupObject<phaseSystem>("phaseProperties")
); );
tmp<scalarField> kappaEff auto tkappaEff = tmp<scalarField>::New(patch().size(), Zero);
( auto& kappaEff = tkappaEff.ref();
new scalarField(patch().size(), 0.0)
);
forAll(fluid.phases(), phasei) forAll(fluid.phases(), phasei)
{ {
@ -142,10 +140,10 @@ kappa
const fvPatchScalarField& alpha = phase.boundaryField()[patchi]; const fvPatchScalarField& alpha = phase.boundaryField()[patchi];
kappaEff.ref() += alpha*phase.kappaEff(patchi)(); kappaEff += alpha*phase.kappaEff(patchi)();
} }
return kappaEff; return tkappaEff;
break; break;
} }
@ -161,9 +159,11 @@ kappa
} }
} }
return scalarField(0); // Return zero-sized (not nullptr)
return tmp<scalarField>::New();
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -308,12 +308,11 @@ updateCoeffs()
scalarField& Tp = *this; scalarField& Tp = *this;
const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField& const auto& nbrField =
nbrField = refCast refCast
<const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField> <
( const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_) >(nbrPatch.lookupPatchField<volScalarField>(TnbrName_));
);
// Swap to obtain full local values of neighbour internal field // Swap to obtain full local values of neighbour internal field
scalarField TcNbr(nbrField.patchInternalField()); scalarField TcNbr(nbrField.patchInternalField());
@ -330,13 +329,13 @@ updateCoeffs()
scalarField qr(Tp.size(), 0.0); scalarField qr(Tp.size(), 0.0);
if (qrName_ != "none") if (qrName_ != "none")
{ {
qr = patch().lookupPatchField<volScalarField, scalar>(qrName_); qr = patch().lookupPatchField<volScalarField>(qrName_);
} }
scalarField qrNbr(Tp.size(), 0.0); scalarField qrNbr(Tp.size(), 0.0);
if (qrNbrName_ != "none") if (qrNbrName_ != "none")
{ {
qrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(qrNbrName_); qrNbr = nbrPatch.lookupPatchField<volScalarField>(qrNbrName_);
mpp.distribute(qrNbr); mpp.distribute(qrNbr);
} }

View File

@ -89,17 +89,10 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
return; return;
} }
const fvsPatchField<scalar>& phip = const auto& phip = patch().lookupPatchField<surfaceScalarField>("phi");
patch().lookupPatchField<surfaceScalarField, scalar>("phi"); const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia");
const auto& Up = patch().lookupPatchField<volVectorField>("U");
const fvsPatchField<scalar>& phiap = const auto& Uap = patch().lookupPatchField<volVectorField>("Ua");
patch().lookupPatchField<surfaceScalarField, scalar>("phia");
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>("U");
const fvPatchField<vector>& Uap =
patch().lookupPatchField<volVectorField, vector>("Ua");
operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap)); operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap));

View File

@ -90,11 +90,8 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const fvsPatchField<scalar>& phiap = const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia");
patch().lookupPatchField<surfaceScalarField, scalar>("phia"); const auto& Up = patch().lookupPatchField<volVectorField>("U");
const fvPatchField<vector>& Up =
patch().lookupPatchField<volVectorField, vector>("U");
scalarField Un(mag(patch().nf() & Up)); scalarField Un(mag(patch().nf() & Up));
vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL)); vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL));

View File

@ -152,14 +152,9 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
db().lookupObject<IOdictionary>("thermalProperties"); db().lookupObject<IOdictionary>("thermalProperties");
const fvPatchField<scalar>& rho = const auto& rho = patch().lookupPatchField<volScalarField>("rho");
patch().lookupPatchField<volScalarField, scalar>("rho"); const auto& rhoE = patch().lookupPatchField<volScalarField>("E");
const auto& nu = patch().lookupPatchField<volScalarField>("nu");
const fvPatchField<scalar>& rhoE =
patch().lookupPatchField<volScalarField, scalar>("E");
const fvPatchField<scalar>& nu =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField E(rhoE/rho); scalarField E(rhoE/rho);
scalarField mu(E/(2.0*(1.0 + nu))); scalarField mu(E/(2.0*(1.0 + nu)));
@ -176,8 +171,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
vectorField n(patch().nf()); vectorField n(patch().nf());
const fvPatchField<symmTensor>& sigmaD = const auto& sigmaD = patch().lookupPatchField<volSymmTensorField>("sigmaD");
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
gradient() = gradient() =
( (
@ -187,11 +181,10 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
if (thermalProperties.get<bool>("thermalStress")) if (thermalProperties.get<bool>("thermalStress"))
{ {
const fvPatchField<scalar>& threeKalpha= const auto& threeKalpha =
patch().lookupPatchField<volScalarField, scalar>("threeKalpha"); patch().lookupPatchField<volScalarField>("threeKalpha");
const fvPatchField<scalar>& T = const auto& T = patch().lookupPatchField<volScalarField>("T");
patch().lookupPatchField<volScalarField, scalar>("T");
gradient() += n*threeKalpha*T/twoMuLambda; gradient() += n*threeKalpha*T/twoMuLambda;
} }

View File

@ -152,14 +152,9 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
"mechanicalProperties" "mechanicalProperties"
); );
const fvPatchField<scalar>& rho = const auto& rho = patch().lookupPatchField<volScalarField>("rho");
patch().lookupPatchField<volScalarField, scalar>("rho"); const auto& rhoE = patch().lookupPatchField<volScalarField>("E");
const auto& nu = patch().lookupPatchField<volScalarField>("nu");
const fvPatchField<scalar>& rhoE =
patch().lookupPatchField<volScalarField, scalar>("E");
const fvPatchField<scalar>& nu =
patch().lookupPatchField<volScalarField, scalar>("nu");
scalarField E(rhoE/rho); scalarField E(rhoE/rho);
scalarField mu(E/(2.0*(1.0 + nu))); scalarField mu(E/(2.0*(1.0 + nu)));
@ -172,11 +167,8 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
vectorField n(patch().nf()); vectorField n(patch().nf());
const fvPatchField<symmTensor>& sigmaD = const auto& sigmaD = patch().lookupPatchField<volSymmTensorField>("sigmaD");
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD"); const auto& sigmaExp = patch().lookupPatchField<volTensorField>("sigmaExp");
const fvPatchField<tensor>& sigmaExp =
patch().lookupPatchField<volTensorField, tensor>("sigmaExp");
gradient() = gradient() =
( (

View File

@ -205,10 +205,8 @@ void Foam::CLASS::updateCoeffs()
); );
const scalarField& phip = const scalarField& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar> this->patch().template lookupPatchField<surfaceScalarField>("phi");
(
"phi"
);
this->valueFraction() = 1.0 - pos0(phip); this->valueFraction() = 1.0 - pos0(phip);
PARENT::updateCoeffs(); PARENT::updateCoeffs();

View File

@ -150,11 +150,11 @@ void turbulentMixingLengthDissipationRateInletFvPatchScalarField::updateCoeffs()
const scalar Cmu75 = pow(Cmu_, 0.75); const scalar Cmu75 = pow(Cmu_, 0.75);
const fvPatchScalarField& kp = const auto& kp =
patch().lookupPatchField<volScalarField, scalar>(kName_); patch().lookupPatchField<volScalarField>(kName_);
const fvsPatchScalarField& phip = const auto& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_); patch().lookupPatchField<surfaceScalarField>(this->phiName_);
this->refValue() = (Cmu75/mixingLength_)*pow(kp, 1.5); this->refValue() = (Cmu75/mixingLength_)*pow(kp, 1.5);
this->valueFraction() = 1.0 - pos0(phip); this->valueFraction() = 1.0 - pos0(phip);

View File

@ -139,11 +139,11 @@ void turbulentMixingLengthFrequencyInletFvPatchScalarField::updateCoeffs()
const scalar Cmu25 = pow(Cmu, 0.25); const scalar Cmu25 = pow(Cmu, 0.25);
const fvPatchScalarField& kp = const auto& kp =
patch().lookupPatchField<volScalarField, scalar>(kName_); patch().lookupPatchField<volScalarField>(kName_);
const fvsPatchScalarField& phip = const auto& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_); patch().lookupPatchField<surfaceScalarField>(this->phiName_);
this->refValue() = sqrt(kp)/(Cmu25*mixingLength_); this->refValue() = sqrt(kp)/(Cmu25*mixingLength_);
this->valueFraction() = 1.0 - pos0(phip); this->valueFraction() = 1.0 - pos0(phip);

View File

@ -141,16 +141,13 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
return; return;
} }
const auto& phi = db().lookupObject<surfaceScalarField>(phiName_); const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
scalarField Un(phip/patch().magSf()); scalarField Un(phip/patch().magSf());
if (phi.dimensions() == dimMass/dimTime) if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_); Un /= patch().lookupPatchField<volScalarField>(rhoName_);
} }
if (uniformJump_) if (uniformJump_)
@ -185,7 +182,7 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs()
{ {
setJump setJump
( (
jump()*patch().lookupPatchField<volScalarField, scalar>(rhoName_) jump()*patch().lookupPatchField<volScalarField>(rhoName_)
); );
} }

View File

@ -186,7 +186,7 @@ void atmTurbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
} }
const scalarField& alphaEffp = const scalarField& alphaEffp =
patch().lookupPatchField<volScalarField, scalar>(alphaEffName_); patch().lookupPatchField<volScalarField>(alphaEffName_);
const scalar t = db().time().timeOutputValue(); const scalar t = db().time().timeOutputValue();
const scalar Cp0 = Cp0_->value(t); const scalar Cp0 = Cp0_->value(t);

View File

@ -124,10 +124,7 @@ void Foam::inletOutletFaPatchField<Type>::updateCoeffs()
} }
const Field<scalar>& phip = const Field<scalar>& phip =
this->patch(). template lookupPatchField<edgeScalarField, scalar> this->patch().template lookupPatchField<edgeScalarField>(phiName_);
(
phiName_
);
this->valueFraction() = 1.0 - pos(phip); this->valueFraction() = 1.0 - pos(phip);

View File

@ -156,23 +156,13 @@ template<class Type>
Foam::tmp<Foam::scalarField> Foam::tmp<Foam::scalarField>
Foam::advectiveFvPatchField<Type>::advectionSpeed() const Foam::advectiveFvPatchField<Type>::advectionSpeed() const
{ {
const surfaceScalarField& phi = const auto& phip =
this->db().objectRegistry::template lookupObject<surfaceScalarField> this->patch().template lookupPatchField<surfaceScalarField>(phiName_);
(phiName_);
fvsPatchField<scalar> phip = if (phip.internalField().dimensions() == dimMass/dimTime)
this->patch().template lookupPatchField<surfaceScalarField, scalar>
(
phiName_
);
if (phi.dimensions() == dimMass/dimTime)
{ {
const fvPatchScalarField& rhop = const auto& rhop =
this->patch().template lookupPatchField<volScalarField, scalar> this->patch().template lookupPatchField<volScalarField>(rhoName_);
(
rhoName_
);
return phip/(rhop*this->patch().magSf()); return phip/(rhop*this->patch().magSf());
} }

View File

@ -38,11 +38,8 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
{ {
if (this->cyclicPatch().owner()) if (this->cyclicPatch().owner())
{ {
const surfaceScalarField& phi = const auto& phip =
db().lookupObject<surfaceScalarField>(phiName_); patch().lookupPatchField<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
scalarField Un(max(phip/patch().magSf(), scalar(0))); scalarField Un(max(phip/patch().magSf(), scalar(0)));
@ -77,9 +74,9 @@ void Foam::fanFvPatchField<Foam::scalar>::calcFanJump()
} }
} }
if (phi.dimensions() == dimMass/dimTime) if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_); Un /= patch().lookupPatchField<volScalarField>(rhoName_);
} }
if (nonDimensional_) if (nonDimensional_)

View File

@ -153,23 +153,20 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
} }
// Retrieve flux field // Retrieve flux field
const auto& phi = db().lookupObject<surfaceScalarField>(phiName()); const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName());
const auto& phip = patch().patchField<surfaceScalarField, scalar>(phi);
const int dir = 2*direction_ - 1; const int dir = 2*direction_ - 1;
// Average volumetric flow rate // Average volumetric flow rate
scalar volFlowRate = 0; scalar volFlowRate = 0;
if (phi.dimensions() == dimVolume/dimTime) if (phip.internalField().dimensions() == dimVolume/dimTime)
{ {
volFlowRate = dir*gSum(phip); volFlowRate = dir*gSum(phip);
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
const scalarField& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName());
patch().lookupPatchField<volScalarField, scalar>(rhoName());
volFlowRate = dir*gSum(phip/rhop); volFlowRate = dir*gSum(phip/rhop);
} }
else else
@ -218,7 +215,7 @@ void Foam::fanPressureFvPatchScalarField::updateCoeffs()
totalPressureFvPatchScalarField::updateCoeffs totalPressureFvPatchScalarField::updateCoeffs
( (
p0() - dir*pdFan, p0() - dir*pdFan,
patch().lookupPatchField<volVectorField, vector>(UName()) patch().lookupPatchField<volVectorField>(UName())
); );
} }

View File

@ -166,8 +166,8 @@ void Foam::fixedNormalInletOutletVelocityFvPatchVectorField::updateCoeffs()
if (fixTangentialInflow_) if (fixTangentialInflow_)
{ {
const fvsPatchField<scalar>& phip = const auto& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField>(phiName_);
valueFraction() += neg(phip)*(I - valueFraction()); valueFraction() += neg(phip)*(I - valueFraction());
} }

View File

@ -105,8 +105,7 @@ void Foam::fixedPressureCompressibleDensityFvPatchScalarField::updateCoeffs()
return; return;
} }
const fvPatchField<scalar>& pp = const auto& pp = patch().lookupPatchField<volScalarField>(pName_);
patch().lookupPatchField<volScalarField, scalar>(pName_);
const dictionary& thermoProps = const dictionary& thermoProps =
db().lookupObject<IOdictionary>("thermodynamicProperties"); db().lookupObject<IOdictionary>("thermodynamicProperties");

View File

@ -218,8 +218,8 @@ void Foam::flowRateInletVelocityFvPatchVectorField::updateCoeffs()
// Mass flow-rate // Mass flow-rate
if (db().foundObject<volScalarField>(rhoName_)) if (db().foundObject<volScalarField>(rhoName_))
{ {
const fvPatchField<scalar>& rhop = const auto& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
updateValues(rhop); updateValues(rhop);
} }

View File

@ -200,8 +200,8 @@ void Foam::flowRateOutletVelocityFvPatchVectorField::updateCoeffs()
// Mass flow-rate // Mass flow-rate
if (db().foundObject<volScalarField>(rhoName_)) if (db().foundObject<volScalarField>(rhoName_))
{ {
const fvPatchField<scalar>& rhop = const auto& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
updateValues(rhop); updateValues(rhop);
} }

View File

@ -106,23 +106,18 @@ void Foam::fluxCorrectedVelocityFvPatchVectorField::evaluate
zeroGradientFvPatchVectorField::evaluate(); zeroGradientFvPatchVectorField::evaluate();
const surfaceScalarField& phi = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
const vectorField n(patch().nf()); const vectorField n(patch().nf());
const Field<scalar>& magS = patch().magSf(); const Field<scalar>& magS = patch().magSf();
if (phi.dimensions() == dimVolume/dimTime) if (phip.internalField().dimensions() == dimVolume/dimTime)
{ {
operator==(*this - n*(n & *this) + n*phip/magS); operator==(*this - n*(n & *this) + n*phip/magS);
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
operator==(*this - n*(n & *this) + n*phip/(rhop*magS)); operator==(*this - n*(n & *this) + n*phip/(rhop*magS));
} }

View File

@ -121,10 +121,7 @@ void Foam::freestreamPressureFvPatchScalarField::updateCoeffs()
} }
const Field<vector>& Up = const Field<vector>& Up =
patch().template lookupPatchField<volVectorField, vector> patch().template lookupPatchField<volVectorField>(UName_);
(
UName_
);
valueFraction() = 0.5 + 0.5*(Up & patch().nf())/mag(Up); valueFraction() = 0.5 + 0.5*(Up & patch().nf())/mag(Up);

View File

@ -126,10 +126,7 @@ void Foam::inletOutletFvPatchField<Type>::updateCoeffs()
} }
const Field<scalar>& phip = const Field<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar> this->patch().template lookupPatchField<surfaceScalarField>(phiName_);
(
phiName_
);
this->valueFraction() = 1.0 - pos0(phip); this->valueFraction() = 1.0 - pos0(phip);

View File

@ -169,14 +169,14 @@ void Foam::inletOutletTotalTemperatureFvPatchScalarField::updateCoeffs()
return; return;
} }
const fvPatchVectorField& Up = const auto& Up =
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField>(UName_);
const fvsPatchField<scalar>& phip = const auto& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_); patch().lookupPatchField<surfaceScalarField>(this->phiName_);
const fvPatchField<scalar>& psip = const auto& psip =
patch().lookupPatchField<volScalarField, scalar>(psiName_); patch().lookupPatchField<volScalarField>(psiName_);
scalar gM1ByG = (gamma_ - 1.0)/gamma_; scalar gM1ByG = (gamma_ - 1.0)/gamma_;

View File

@ -135,8 +135,7 @@ void Foam::interstitialInletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const fvPatchField<scalar>& alphap = const auto& alphap = patch().lookupPatchField<volScalarField>(alphaName_);
patch().lookupPatchField<volScalarField, scalar>(alphaName_);
operator==(inletVelocity_/alphap); operator==(inletVelocity_/alphap);
fixedValueFvPatchVectorField::updateCoeffs(); fixedValueFvPatchVectorField::updateCoeffs();

View File

@ -904,11 +904,7 @@ void Foam::mappedPatchFieldBase<Type>::mappedWeightField
if (!fieldName.empty()) if (!fieldName.empty())
{ {
thisWeights.ref() *= thisWeights.ref() *=
patchField_.patch().template lookupPatchField patchField_.patch().template lookupPatchField<volScalarField>
<
volScalarField,
scalar
>
( (
fieldName fieldName
).patchInternalField(); ).patchInternalField();

View File

@ -127,8 +127,10 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs()
nbrMesh nbrMesh
).boundary()[mpp.samplePolyPatch().index()]; ).boundary()[mpp.samplePolyPatch().index()];
scalarList phi = scalarList phi
nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_); (
nbrPatch.lookupPatchField<surfaceScalarField>(nbrPhiName_)
);
mpp.distribute(phi); mpp.distribute(phi);
@ -147,8 +149,7 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs()
} }
else if (phiName.dimensions() == dimMass/dimTime) else if (phiName.dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
// mass flow-rate // mass flow-rate
operator==(n*U/rhop); operator==(n*U/rhop);

View File

@ -117,7 +117,7 @@ Foam::movingWallVelocityFvPatchVectorField::Uwall() const
scalarField phip scalarField phip
( (
p.patchField<surfaceScalarField, scalar>(fvc::meshPhi(U)) p.patchField<surfaceScalarField>(fvc::meshPhi(U))
); );
const vectorField n(p.nf()); const vectorField n(p.nf());

View File

@ -126,10 +126,7 @@ void Foam::outletInletFvPatchField<Type>::updateCoeffs()
} }
const Field<scalar>& phip = const Field<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar> this->patch().template lookupPatchField<surfaceScalarField>(phiName_);
(
phiName_
);
this->valueFraction() = pos0(phip); this->valueFraction() = pos0(phip);

View File

@ -132,8 +132,10 @@ void Foam::outletPhaseMeanVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
scalarField alphap = scalarField alphap
patch().lookupPatchField<volScalarField, scalar>(alphaName_); (
patch().lookupPatchField<volScalarField>(alphaName_)
);
alphap = max(alphap, scalar(0)); alphap = max(alphap, scalar(0));
alphap = min(alphap, scalar(1)); alphap = min(alphap, scalar(1));

View File

@ -142,10 +142,7 @@ void Foam::phaseHydrostaticPressureFvPatchScalarField::updateCoeffs()
} }
const scalarField& alphap = const scalarField& alphap =
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>(phaseFraction_);
(
phaseFraction_
);
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
meshObjects::gravity::New(db().time()); meshObjects::gravity::New(db().time());

View File

@ -177,10 +177,9 @@ void Foam::plenumPressureFvPatchScalarField::updateCoeffs()
( (
internalField().name() internalField().name()
).oldTime().boundaryField()[patch().index()]; ).oldTime().boundaryField()[patch().index()];
const fvPatchField<vector>& U =
patch().lookupPatchField<volVectorField, vector>(UName_); const auto& U = patch().lookupPatchField<volVectorField>(UName_);
const fvsPatchField<scalar>& phi = const auto& phi = patch().lookupPatchField<surfaceScalarField>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
// Get the timestep // Get the timestep
const scalar dt = db().time().deltaTValue(); const scalar dt = db().time().deltaTValue();

View File

@ -151,23 +151,18 @@ void Foam::pressureDirectedInletOutletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const surfaceScalarField& phi = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
tmp<vectorField> n = patch().nf(); tmp<vectorField> n = patch().nf();
tmp<scalarField> ndmagS = (n & inletDir_)*patch().magSf(); tmp<scalarField> ndmagS = (n & inletDir_)*patch().magSf();
if (phi.dimensions() == dimVolume/dimTime) if (phip.internalField().dimensions() == dimVolume/dimTime)
{ {
refValue() = inletDir_*phip/ndmagS; refValue() = inletDir_*phip/ndmagS;
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
refValue() = inletDir_*phip/(rhop*ndmagS); refValue() = inletDir_*phip/(rhop*ndmagS);
} }

View File

@ -141,23 +141,18 @@ void Foam::pressureDirectedInletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const surfaceScalarField& phi = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
tmp<vectorField> n = patch().nf(); tmp<vectorField> n = patch().nf();
tmp<scalarField> ndmagS = (n & inletDir_)*patch().magSf(); tmp<scalarField> ndmagS = (n & inletDir_)*patch().magSf();
if (phi.dimensions() == dimVolume/dimTime) if (phip.internalField().dimensions() == dimVolume/dimTime)
{ {
operator==(inletDir_*phip/ndmagS); operator==(inletDir_*phip/ndmagS);
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
operator==(inletDir_*phip/(rhop*ndmagS)); operator==(inletDir_*phip/(rhop*ndmagS));
} }

View File

@ -121,11 +121,7 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const surfaceScalarField& phi = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
tmp<vectorField> n = patch().nf(); tmp<vectorField> n = patch().nf();
const Field<scalar>& magSf = patch().magSf(); const Field<scalar>& magSf = patch().magSf();
@ -134,14 +130,13 @@ void Foam::pressureInletOutletParSlipVelocityFvPatchVectorField::updateCoeffs()
vectorField Ut(patchInternalField()); vectorField Ut(patchInternalField());
Ut -= n()*(Ut & n()); Ut -= n()*(Ut & n());
if (phi.dimensions() == dimVolume/dimTime) if (phip.internalField().dimensions() == dimVolume/dimTime)
{ {
refValue() = Ut + n*phip/magSf; refValue() = Ut + n*phip/magSf;
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
refValue() = Ut + n*phip/(rhop*magSf); refValue() = Ut + n*phip/(rhop*magSf);
} }

View File

@ -175,7 +175,7 @@ void Foam::pressureInletOutletVelocityFvPatchVectorField::updateCoeffs()
} }
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField>(phiName_);
valueFraction() = neg(phip)*(I - sqr(patch().nf())); valueFraction() = neg(phip)*(I - sqr(patch().nf()));

View File

@ -109,23 +109,18 @@ void Foam::pressureInletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const surfaceScalarField& phi = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
tmp<vectorField> n = patch().nf(); tmp<vectorField> n = patch().nf();
const Field<scalar>& magS = patch().magSf(); const Field<scalar>& magS = patch().magSf();
if (phi.dimensions() == dimVolume/dimTime) if (phip.internalField().dimensions() == dimVolume/dimTime)
{ {
operator==(n*phip/magS); operator==(n*phip/magS);
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
operator==(n*phip/(rhop*magS)); operator==(n*phip/(rhop*magS));
} }

View File

@ -121,23 +121,18 @@ void Foam::pressureNormalInletOutletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const surfaceScalarField& phi = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
tmp<vectorField> n = patch().nf(); tmp<vectorField> n = patch().nf();
const Field<scalar>& magS = patch().magSf(); const Field<scalar>& magS = patch().magSf();
if (phi.dimensions() == dimVolume/dimTime) if (phip.internalField().dimensions() == dimVolume/dimTime)
{ {
refValue() = n*phip/magS; refValue() = n*phip/magS;
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
refValue() = n*phip/(rhop*magS); refValue() = n*phip/(rhop*magS);
} }

View File

@ -222,10 +222,7 @@ void Foam::pressurePIDControlInletVelocityFvPatchVectorField::updateCoeffs()
const scalar deltaT(db().time().deltaTValue()); const scalar deltaT(db().time().deltaTValue());
// Get the flux field // Get the flux field
const surfaceScalarField& phi const auto& phi = db().lookupObject<surfaceScalarField>(phiName_);
(
db().lookupObject<surfaceScalarField>(phiName_)
);
// Update the old-time quantities // Update the old-time quantities
if (timeIndex_ != db().time().timeIndex()) if (timeIndex_ != db().time().timeIndex())
@ -244,10 +241,9 @@ void Foam::pressurePIDControlInletVelocityFvPatchVectorField::updateCoeffs()
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phi.dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhoField = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
rho = gSum(rhoField*patch().magSf())/gSum(patch().magSf()); rho = gSum(rhop*patch().magSf())/gSum(patch().magSf());
} }
else else
{ {

View File

@ -131,21 +131,17 @@ updateCoeffs()
return; return;
} }
const auto& phi = db().lookupObject<surfaceScalarField>(phiName_); const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi);
const vectorField n(patch().nf()); const vectorField n(patch().nf());
if (phi.dimensions() == dimVolume/dimTime) if (phip.internalField().dimensions() == dimVolume/dimTime)
{ {
refValue() = (phip/patch().magSf())*n; refValue() = (phip/patch().magSf())*n;
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
refValue() = (phip/(rhop*patch().magSf()))*n; refValue() = (phip/(rhop*patch().magSf()))*n;
} }
@ -164,7 +160,7 @@ updateCoeffs()
if (alphaName_ != "none") if (alphaName_ != "none")
{ {
const scalarField& alphap = const scalarField& alphap =
patch().lookupPatchField<volScalarField, scalar>(alphaName_); patch().lookupPatchField<volScalarField>(alphaName_);
const scalarField alphaCut(pos(alphap - alphaMin_)); const scalarField alphaCut(pos(alphap - alphaMin_));
valueFraction() = max(alphaCut, valueFraction()); valueFraction() = max(alphaCut, valueFraction());

View File

@ -189,13 +189,13 @@ void Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::updateSnGrad
} }
const scalarField& rhop = const scalarField& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
const scalarField& phip = const scalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField>(phiName_);
const vectorField& Up = const vectorField& Up =
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField>(UName_);
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
meshObjects::gravity::New(db().time()); meshObjects::gravity::New(db().time());
@ -226,7 +226,8 @@ void Foam::prghPermeableAlphaTotalPressureFvPatchScalarField::updateSnGrad
if (alphaName_ != "none") if (alphaName_ != "none")
{ {
const scalarField& alphap = const scalarField& alphap =
patch().lookupPatchField<volScalarField, scalar>(alphaName_); patch().lookupPatchField<volScalarField>(alphaName_);
tmp<scalarField> alphaCut(pos(alphap - alphaMin_)); tmp<scalarField> alphaCut(pos(alphap - alphaMin_));
valueFraction() = 1 - alphaCut; valueFraction() = 1 - alphaCut;
} }

View File

@ -147,10 +147,8 @@ void Foam::prghPressureFvPatchScalarField::updateCoeffs()
return; return;
} }
const scalarField& rhop = patch().lookupPatchField<volScalarField, scalar> const scalarField& rhop =
( patch().lookupPatchField<volScalarField>(rhoName_);
rhoName_
);
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
meshObjects::gravity::New(db().time()); meshObjects::gravity::New(db().time());

View File

@ -122,16 +122,16 @@ void Foam::prghTotalHydrostaticPressureFvPatchScalarField::updateCoeffs()
} }
const scalarField& rhop = const scalarField& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
const scalarField& ph_rghp = const scalarField& ph_rghp =
patch().lookupPatchField<volScalarField, scalar>(ph_rghName_); patch().lookupPatchField<volScalarField>(ph_rghName_);
const scalarField& phip = const scalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField>(phiName_);
const vectorField& Up = const vectorField& Up =
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField>(UName_);
operator== operator==
( (

View File

@ -154,13 +154,13 @@ void Foam::prghTotalPressureFvPatchScalarField::updateCoeffs()
} }
const scalarField& rhop = const scalarField& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
const scalarField& phip = const scalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField>(phiName_);
const vectorField& Up = const vectorField& Up =
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField>(UName_);
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
meshObjects::gravity::New(db().time()); meshObjects::gravity::New(db().time());

View File

@ -114,7 +114,7 @@ void Foam::rotatingTotalPressureFvPatchScalarField::updateCoeffs()
const vectorField Up const vectorField Up
( (
patch().lookupPatchField<volVectorField, vector>(UName()) patch().lookupPatchField<volVectorField>(UName())
+ rotationVelocity + rotationVelocity
); );

View File

@ -166,14 +166,11 @@ void Foam::supersonicFreestreamFvPatchVectorField::updateCoeffs()
return; return;
} }
const fvPatchField<scalar>& pT = const auto& pT = patch().lookupPatchField<volScalarField>(TName_);
patch().lookupPatchField<volScalarField, scalar>(TName_);
const fvPatchField<scalar>& pp = const auto& pp = patch().lookupPatchField<volScalarField>(pName_);
patch().lookupPatchField<volScalarField, scalar>(pName_);
const fvPatchField<scalar>& ppsi = const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_);
patch().lookupPatchField<volScalarField, scalar>(psiName_);
// Need R of the free-stream flow. Assume R is independent of location // Need R of the free-stream flow. Assume R is independent of location
// along patch so use face 0 // along patch so use face 0

View File

@ -40,25 +40,21 @@ void Foam::swirlFanVelocityFvPatchField::calcFanJump()
{ {
const scalar rpm = rpm_->value(this->db().time().timeOutputValue()); const scalar rpm = rpm_->value(this->db().time().timeOutputValue());
const surfaceScalarField& phi = const auto& phi = db().lookupObject<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvPatchField<scalar>& pOwner = const auto& pOwner = patch().lookupPatchField<volScalarField>(pName_);
patch().lookupPatchField<volScalarField, scalar>(pName_);
const label nbrIndex = this->cyclicPatch().neighbPatchID(); const label nbrIndex = this->cyclicPatch().neighbPatchID();
const fvPatch& nbrPatch = patch().boundaryMesh()[nbrIndex]; const fvPatch& nbrPatch = patch().boundaryMesh()[nbrIndex];
const fvPatchField<scalar>& pSlave = const auto& pSlave = nbrPatch.lookupPatchField<volScalarField>(pName_);
nbrPatch.lookupPatchField<volScalarField, scalar>(pName_);
scalarField deltaP(mag(pOwner - pSlave)); scalarField deltaP(mag(pOwner - pSlave));
if (phi.dimensions() == dimMass/dimTime) if (phi.dimensions() == dimMass/dimTime)
{ {
deltaP /= deltaP /= patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
} }
const vector axisHat = const vector axisHat =

View File

@ -168,8 +168,7 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
tmp<vectorField> n = patch().nf(); tmp<vectorField> n = patch().nf();
const surfaceScalarField& phi = const auto& phi = db().lookupObject<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
if (phi.dimensions() == dimVolume/dimTime) if (phi.dimensions() == dimVolume/dimTime)
{ {
@ -178,8 +177,8 @@ void Foam::swirlFlowRateInletVelocityFvPatchVectorField::updateCoeffs()
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phi.dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
// mass flow-rate // mass flow-rate
operator==(tangentialVelocity + n*avgU/rhop); operator==(tangentialVelocity + n*avgU/rhop);

View File

@ -200,17 +200,13 @@ void Foam::syringePressureFvPatchScalarField::updateCoeffs()
scalar t = db().time().value(); scalar t = db().time().value();
scalar deltaT = db().time().deltaTValue(); scalar deltaT = db().time().deltaTValue();
const surfaceScalarField& phi = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
const fvsPatchField<scalar>& phip = if (phip.internalField().dimensions() == dimVolume/dimTime)
patch().patchField<surfaceScalarField, scalar>(phi);
if (phi.dimensions() == dimVolume/dimTime)
{ {
ams_ = ams0_ + deltaT*sum((*this*psi_)*phip); ams_ = ams0_ + deltaT*sum((*this*psi_)*phip);
} }
else if (phi.dimensions() == dimMass/dimTime) else if (phip.internalField().dimensions() == dimMass/dimTime)
{ {
ams_ = ams0_ + deltaT*sum(phip); ams_ = ams0_ + deltaT*sum(phip);
} }

View File

@ -167,8 +167,7 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs
return; return;
} }
const fvsPatchField<scalar>& phip = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
if (internalField().dimensions() == dimPressure) if (internalField().dimensions() == dimPressure)
{ {
@ -176,8 +175,8 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs
{ {
// Variable density and low-speed compressible flow // Variable density and low-speed compressible flow
const fvPatchField<scalar>& rho = const auto& rho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
operator==(p0p - 0.5*rho*(1.0 - pos0(phip))*magSqr(Up)); operator==(p0p - 0.5*rho*(1.0 - pos0(phip))*magSqr(Up));
} }
@ -185,8 +184,8 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs
{ {
// High-speed compressible flow // High-speed compressible flow
const fvPatchField<scalar>& psip = const auto& psip =
patch().lookupPatchField<volScalarField, scalar>(psiName_); patch().lookupPatchField<volScalarField>(psiName_);
if (gamma_ > 1) if (gamma_ > 1)
{ {
@ -238,7 +237,7 @@ void Foam::totalPressureFvPatchScalarField::updateCoeffs()
updateCoeffs updateCoeffs
( (
p0(), p0(),
patch().lookupPatchField<volVectorField, vector>(UName()) patch().lookupPatchField<volVectorField>(UName())
); );
} }

View File

@ -157,14 +157,14 @@ void Foam::totalTemperatureFvPatchScalarField::updateCoeffs()
return; return;
} }
const fvPatchVectorField& Up = const auto& Up =
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField>(UName_);
const fvsPatchField<scalar>& phip = const auto& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField>(phiName_);
const fvPatchField<scalar>& psip = const auto& psip =
patch().lookupPatchField<volScalarField, scalar>(psiName_); patch().lookupPatchField<volScalarField>(psiName_);
scalar gM1ByG = (gamma_ - 1.0)/gamma_; scalar gM1ByG = (gamma_ - 1.0)/gamma_;

View File

@ -133,11 +133,11 @@ updateCoeffs()
return; return;
} }
const fvPatchVectorField& Up = const auto& Up =
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField>(UName_);
const fvsPatchScalarField& phip = const auto& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(this->phiName_); patch().lookupPatchField<surfaceScalarField>(this->phiName_);
this->refValue() = 1.5*sqr(intensity_)*magSqr(Up); this->refValue() = 1.5*sqr(intensity_)*magSqr(Up);
this->valueFraction() = 1.0 - pos0(phip); this->valueFraction() = 1.0 - pos0(phip);

View File

@ -152,7 +152,7 @@ void Foam::uniformInletOutletFvPatchField<Type>::updateCoeffs()
this->refValue() = uniformInletValue_->value(t); this->refValue() = uniformInletValue_->value(t);
const Field<scalar>& phip = const Field<scalar>& phip =
this->patch().template lookupPatchField<surfaceScalarField, scalar> this->patch().template lookupPatchField<surfaceScalarField>
( (
phiName_ phiName_
); );

View File

@ -155,8 +155,7 @@ void Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs
scalar p0 = p0_->value(this->db().time().timeOutputValue()); scalar p0 = p0_->value(this->db().time().timeOutputValue());
const fvsPatchField<scalar>& phip = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
if (internalField().dimensions() == dimPressure) if (internalField().dimensions() == dimPressure)
{ {
@ -164,8 +163,8 @@ void Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs
{ {
// Variable density and low-speed compressible flow // Variable density and low-speed compressible flow
const fvPatchField<scalar>& rho = const auto& rho =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
operator==(p0 - 0.5*rho*(1.0 - pos0(phip))*magSqr(Up)); operator==(p0 - 0.5*rho*(1.0 - pos0(phip))*magSqr(Up));
} }
@ -173,8 +172,8 @@ void Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs
{ {
// High-speed compressible flow // High-speed compressible flow
const fvPatchField<scalar>& psip = const auto& psip =
patch().lookupPatchField<volScalarField, scalar>(psiName_); patch().lookupPatchField<volScalarField>(psiName_);
if (gamma_ > 1) if (gamma_ > 1)
{ {
@ -223,7 +222,7 @@ void Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs
void Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs() void Foam::uniformTotalPressureFvPatchScalarField::updateCoeffs()
{ {
updateCoeffs(patch().lookupPatchField<volVectorField, vector>(UName_)); updateCoeffs(patch().lookupPatchField<volVectorField>(UName_));
} }

View File

@ -137,8 +137,7 @@ void Foam::variableHeightFlowRateFvPatchScalarField::updateCoeffs()
return; return;
} }
const fvsPatchField<scalar>& phip = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
scalarField alphap(this->patchInternalField()); scalarField alphap(this->patchInternalField());

View File

@ -109,8 +109,10 @@ void Foam::variableHeightFlowRateInletVelocityFvPatchVectorField
return; return;
} }
scalarField alphap = scalarField alphap
patch().lookupPatchField<volScalarField, scalar>(alphaName_); (
patch().lookupPatchField<volScalarField>(alphaName_)
);
alphap = max(alphap, scalar(0)); alphap = max(alphap, scalar(0));
alphap = min(alphap, scalar(1)); alphap = min(alphap, scalar(1));

View File

@ -155,8 +155,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
ddtSchemeType ddtScheme(ddtSchemeTypeNames_[ddtSchemeName]); ddtSchemeType ddtScheme(ddtSchemeTypeNames_[ddtSchemeName]);
// Retrieve the flux field from the database // Retrieve the flux field from the database
const surfaceScalarField& phi = const auto& phi = db().lookupObject<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
// Cache the patch face-normal vectors // Cache the patch face-normal vectors
tmp<vectorField> nf(patch().nf()); tmp<vectorField> nf(patch().nf());
@ -166,8 +165,7 @@ void Foam::waveSurfacePressureFvPatchScalarField::updateCoeffs()
if (phi.dimensions() == dimMass/dimTime) if (phi.dimensions() == dimMass/dimTime)
{ {
const scalarField& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
dZetap /= rhop; dZetap /= rhop;
} }

View File

@ -110,22 +110,23 @@ Foam::tmp<Foam::scalarField>
Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const Foam::waveTransmissiveFvPatchField<Type>::advectionSpeed() const
{ {
// Lookup the velocity and compressibility of the patch // Lookup the velocity and compressibility of the patch
const fvPatchField<scalar>& psip = const auto& psip =
this->patch().template this->patch().template lookupPatchField<volScalarField>(psiName_);
lookupPatchField<volScalarField, scalar>(psiName_);
const surfaceScalarField& phi = const auto& phi =
this->db().template lookupObject<surfaceScalarField>(this->phiName_); this->db().template lookupObject<surfaceScalarField>(this->phiName_);
fvsPatchField<scalar> phip = scalarField phip
(
this->patch().template this->patch().template
lookupPatchField<surfaceScalarField, scalar>(this->phiName_); lookupPatchField<surfaceScalarField>(this->phiName_)
);
if (phi.dimensions() == dimMass/dimTime) if (phi.dimensions() == dimMass/dimTime)
{ {
const fvPatchScalarField& rhop = const auto& rhop =
this->patch().template this->patch().template
lookupPatchField<volScalarField, scalar>(this->rhoName_); lookupPatchField<volScalarField>(this->rhoName_);
phip /= rhop; phip /= rhop;
} }

View File

@ -161,15 +161,11 @@ Foam::functionObjects::extractEulerianParticles::phiU() const
{ {
DebugInFunction << endl; DebugInFunction << endl;
const surfaceScalarField& phi const auto& phi = mesh_.lookupObject<surfaceScalarField>(phiName_);
(
mesh_.lookupObject<surfaceScalarField>(phiName_)
);
if (phi.dimensions() == dimMass/dimTime) if (phi.dimensions() == dimMass/dimTime)
{ {
const volScalarField& rho = const auto& rho = mesh_.lookupObject<volScalarField>(rhoName_);
mesh_.lookupObject<volScalarField>(rhoName_);
return phi/fvc::interpolate(rho); return phi/fvc::interpolate(rho);
} }

View File

@ -147,7 +147,7 @@ Foam::functionObjects::momentumError::momentumError
{ {
read(dict); read(dict);
const auto& phi =lookupObject<surfaceScalarField>(phiName_); const auto& phi = lookupObject<surfaceScalarField>(phiName_);
const dimensionSet momDims const dimensionSet momDims
( (

View File

@ -127,8 +127,7 @@ Foam::scalar Foam::PatchFlowRateInjection<CloudType>::flowRate() const
{ {
const polyMesh& mesh = this->owner().mesh(); const polyMesh& mesh = this->owner().mesh();
const surfaceScalarField& phi = const auto& phi = mesh.lookupObject<surfaceScalarField>(phiName_);
mesh.lookupObject<surfaceScalarField>(phiName_);
const scalarField& phip = phi.boundaryField()[patchId_]; const scalarField& phip = phi.boundaryField()[patchId_];
@ -139,8 +138,7 @@ Foam::scalar Foam::PatchFlowRateInjection<CloudType>::flowRate() const
} }
else else
{ {
const volScalarField& rho = const auto& rho = mesh.lookupObject<volScalarField>(rhoName_);
mesh.lookupObject<volScalarField>(rhoName_);
const scalarField& rhop = rho.boundaryField()[patchId_]; const scalarField& rhop = rho.boundaryField()[patchId_];
flowRateIn = max(0.0, -sum(phip/rhop)); flowRateIn = max(0.0, -sum(phip/rhop));

View File

@ -110,7 +110,7 @@ void Foam::adjointFarFieldPressureFvPatchScalarField::updateCoeffs()
// Adjoint flux // Adjoint flux
//const fvsPatchField<scalar>& phiap = //const fvsPatchField<scalar>& phiap =
// patch().lookupPatchField<surfaceScalarField, scalar>("phia"); // patch().lookupPatchField<surfaceScalarField>("phia");
// Primal velocity // Primal velocity
const fvPatchField<vector>& Up = boundaryContrPtr_->Ub(); const fvPatchField<vector>& Up = boundaryContrPtr_->Ub();

View File

@ -101,7 +101,7 @@ void Foam::copiedFixedValueFvPatchScalarField::updateCoeffs()
operator== operator==
( (
patch().lookupPatchField<volScalarField, scalar>(sourceFieldName_) patch().lookupPatchField<volScalarField>(sourceFieldName_)
); );
fixedValueFvPatchScalarField::updateCoeffs(); fixedValueFvPatchScalarField::updateCoeffs();

View File

@ -165,7 +165,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
// lookup all the fields on this patch // lookup all the fields on this patch
const fvPatchScalarField& alpha const fvPatchScalarField& alpha
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
phased.volScalarField::name() phased.volScalarField::name()
) )
@ -173,7 +173,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
const fvPatchScalarField& gs0 const fvPatchScalarField& gs0
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
IOobject::groupName("gs0", phased.name()) IOobject::groupName("gs0", phased.name())
) )
@ -181,7 +181,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
const scalarField nu const scalarField nu
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
IOobject::groupName("nut", phased.name()) IOobject::groupName("nut", phased.name())
) )
@ -189,7 +189,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
const scalarField nuFric const scalarField nuFric
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
IOobject::groupName("nuFric", phased.name()) IOobject::groupName("nuFric", phased.name())
) )
@ -200,7 +200,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
const fvPatchScalarField& Theta const fvPatchScalarField& Theta
( (
db().foundObject<volScalarField>(ThetaName) db().foundObject<volScalarField>(ThetaName)
? patch().lookupPatchField<volScalarField, scalar>(ThetaName) ? patch().lookupPatchField<volScalarField>(ThetaName)
: alpha : alpha
); );

View File

@ -181,7 +181,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
// lookup all the fields on this patch // lookup all the fields on this patch
const fvPatchScalarField& alpha const fvPatchScalarField& alpha
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
phased.volScalarField::name() phased.volScalarField::name()
) )
@ -189,7 +189,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
const fvPatchVectorField& U const fvPatchVectorField& U
( (
patch().lookupPatchField<volVectorField, vector> patch().lookupPatchField<volVectorField>
( (
IOobject::groupName("U", phased.name()) IOobject::groupName("U", phased.name())
) )
@ -197,7 +197,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
const fvPatchScalarField& gs0 const fvPatchScalarField& gs0
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
IOobject::groupName("gs0", phased.name()) IOobject::groupName("gs0", phased.name())
) )
@ -205,7 +205,7 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
const fvPatchScalarField& kappa const fvPatchScalarField& kappa
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
IOobject::groupName("kappa", phased.name()) IOobject::groupName("kappa", phased.name())
) )

View File

@ -163,25 +163,21 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
); );
// lookup all the fields on this patch // lookup all the fields on this patch
const fvPatchScalarField& alpha const auto& alpha =
( patch().lookupPatchField<volScalarField>
patch().lookupPatchField<volScalarField, scalar>
( (
phased.volScalarField::name() phased.volScalarField::name()
) );
);
const fvPatchScalarField& gs0 const auto& gs0 =
( patch().lookupPatchField<volScalarField>
patch().lookupPatchField<volScalarField, scalar>
( (
IOobject::groupName("gs0", phased.name()) IOobject::groupName("gs0", phased.name())
) );
);
const scalarField nu const scalarField nu
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
IOobject::groupName("nut", phased.name()) IOobject::groupName("nut", phased.name())
) )
@ -189,7 +185,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
const scalarField nuFric const scalarField nuFric
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>
( (
IOobject::groupName("nuFric", phased.name()) IOobject::groupName("nuFric", phased.name())
) )
@ -200,7 +196,7 @@ void Foam::JohnsonJacksonParticleSlipFvPatchVectorField::updateCoeffs()
const fvPatchScalarField& Theta const fvPatchScalarField& Theta
( (
db().foundObject<volScalarField>(ThetaName) db().foundObject<volScalarField>(ThetaName)
? patch().lookupPatchField<volScalarField, scalar>(ThetaName) ? patch().lookupPatchField<volScalarField>(ThetaName)
: alpha : alpha
); );

View File

@ -179,37 +179,29 @@ void Foam::JohnsonJacksonParticleThetaFvPatchScalarField::updateCoeffs()
); );
// lookup all the fields on this patch // lookup all the fields on this patch
const fvPatchScalarField& alpha const auto& alpha =
( patch().lookupPatchField<volScalarField>
patch().lookupPatchField<volScalarField, scalar>
( (
phased.volScalarField::name() phased.volScalarField::name()
) );
);
const fvPatchVectorField& U const auto& U =
( patch().lookupPatchField<volVectorField>
patch().lookupPatchField<volVectorField, vector>
( (
IOobject::groupName("U", phased.name()) IOobject::groupName("U", phased.name())
) );
);
const fvPatchScalarField& gs0 const auto& gs0 =
( patch().lookupPatchField<volScalarField>
patch().lookupPatchField<volScalarField, scalar>
( (
IOobject::groupName("gs0", phased.name()) IOobject::groupName("gs0", phased.name())
) );
);
const fvPatchScalarField& kappa const auto& kappa =
( patch().lookupPatchField<volScalarField>
patch().lookupPatchField<volScalarField, scalar>
( (
IOobject::groupName("kappa", phased.name()) IOobject::groupName("kappa", phased.name())
) );
);
const scalarField Theta(patchInternalField()); const scalarField Theta(patchInternalField());

View File

@ -266,14 +266,13 @@ void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::updateCoeffs()
scalarField intFld(patchInternalField()); scalarField intFld(patchInternalField());
const filmPyrolysisRadiativeCoupledMixedFvPatchScalarField& const auto& nbrField =
nbrField =
refCast refCast
< <
const filmPyrolysisRadiativeCoupledMixedFvPatchScalarField const filmPyrolysisRadiativeCoupledMixedFvPatchScalarField
> >
( (
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_) nbrPatch.lookupPatchField<volScalarField>(TnbrName_)
); );
// Swap to obtain full local values of neighbour internal field // Swap to obtain full local values of neighbour internal field
@ -307,7 +306,7 @@ void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::updateCoeffs()
coupledPatchi = patchi; coupledPatchi = patchi;
if (qrName_ != "none") if (qrName_ != "none")
{ {
qr = nbrPatch.lookupPatchField<volScalarField, scalar>(qrName_); qr = nbrPatch.lookupPatchField<volScalarField>(qrName_);
mpp.distribute(qr); mpp.distribute(qr);
} }
} }
@ -316,7 +315,7 @@ void filmPyrolysisRadiativeCoupledMixedFvPatchScalarField::updateCoeffs()
coupledPatchi = nbrPatch.index(); coupledPatchi = nbrPatch.index();
if (qrName_ != "none") if (qrName_ != "none")
{ {
qr = patch().lookupPatchField<volScalarField, scalar>(qrName_); qr = patch().lookupPatchField<volScalarField>(qrName_);
} }
} }
else else

View File

@ -173,15 +173,13 @@ void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
pyrModel.toPrimary(pyrPatchi, phiPyr); pyrModel.toPrimary(pyrPatchi, phiPyr);
const surfaceScalarField& phi = const auto& phi = db().lookupObject<surfaceScalarField>(phiName_);
db().lookupObject<surfaceScalarField>(phiName_);
if (phi.dimensions() == dimVolume/dimTime) if (phi.dimensions() == dimVolume/dimTime)
{} {}
else if (phi.dimensions() == dimMass/dimTime) else if (phi.dimensions() == dimMass/dimTime)
{ {
const fvPatchField<scalar>& rhop = const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
phiPyr /= rhop; phiPyr /= rhop;
} }
else else

View File

@ -114,14 +114,9 @@ void Foam::filmHeightInletVelocityFvPatchVectorField::updateCoeffs()
return; return;
} }
const fvsPatchField<scalar>& phip = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); const auto& rhop = patch().lookupPatchField<volScalarField>(rhoName_);
const auto& deltafp = patch().lookupPatchField<volScalarField>(deltafName_);
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const fvPatchField<scalar>& deltafp =
patch().lookupPatchField<volScalarField, scalar>(deltafName_);
vectorField n(patch().nf()); vectorField n(patch().nf());
const scalarField& magSf = patch().magSf(); const scalarField& magSf = patch().magSf();

View File

@ -319,7 +319,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
{ {
qr = qr =
qrRelaxation_ qrRelaxation_
*patch().lookupPatchField<volScalarField, scalar>(qrName_) *patch().lookupPatchField<volScalarField>(qrName_)
+ (1 - qrRelaxation_)*qrPrevious_; + (1 - qrRelaxation_)*qrPrevious_;
qrPrevious_ = qr; qrPrevious_ = qr;

View File

@ -439,14 +439,12 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
const fvPatch& nbrPatch = const fvPatch& nbrPatch =
refCast<const fvMesh>(nbrMesh).boundary()[nbrPatchI]; refCast<const fvMesh>(nbrMesh).boundary()[nbrPatchI];
const humidityTemperatureCoupledMixedFvPatchScalarField& const auto& nbrField = refCast
nbrField =
refCast
< <
const humidityTemperatureCoupledMixedFvPatchScalarField const humidityTemperatureCoupledMixedFvPatchScalarField
> >
( (
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_) nbrPatch.lookupPatchField<volScalarField>(TnbrName_)
); );
// Swap to obtain full local values of neighbour internal field // Swap to obtain full local values of neighbour internal field
@ -515,24 +513,21 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
const fixedGradientFvPatchField<scalar> const fixedGradientFvPatchField<scalar>
> >
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>(specieName_)
(
specieName_
)
) )
); );
const fvPatchScalarField& pp = const auto& pp =
patch().lookupPatchField<volScalarField, scalar>(pName_); patch().lookupPatchField<volScalarField>(pName_);
const fvPatchVectorField& Up = const auto& Up =
patch().lookupPatchField<volVectorField, vector>(UName_); patch().lookupPatchField<volVectorField>(UName_);
const fvPatchScalarField& rhop = const auto& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
const fvPatchScalarField& mup = const auto& mup =
patch().lookupPatchField<volScalarField, scalar>(muName_); patch().lookupPatchField<volScalarField>(muName_);
const vectorField Ui(Up.patchInternalField()); const vectorField Ui(Up.patchInternalField());
const scalarField Yi(Yp.patchInternalField()); const scalarField Yi(Yp.patchInternalField());
@ -716,13 +711,13 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
scalarField qr(Tp.size(), Zero); scalarField qr(Tp.size(), Zero);
if (qrName_ != "none") if (qrName_ != "none")
{ {
qr = patch().lookupPatchField<volScalarField, scalar>(qrName_); qr = patch().lookupPatchField<volScalarField>(qrName_);
} }
scalarField qrNbr(Tp.size(), Zero); scalarField qrNbr(Tp.size(), Zero);
if (qrNbrName_ != "none") if (qrNbrName_ != "none")
{ {
qrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(qrNbrName_); qrNbr = nbrPatch.lookupPatchField<volScalarField>(qrNbrName_);
mpp.distribute(qrNbr); mpp.distribute(qrNbr);
} }

View File

@ -156,8 +156,7 @@ void Foam::outletMachNumberPressureFvPatchScalarField::updateCoeffs()
const scalarField pb(p.oldTime().boundaryField()[patchi]); const scalarField pb(p.oldTime().boundaryField()[patchi]);
const fvsPatchField<scalar>& phi = const auto& phi = patch().lookupPatchField<surfaceScalarField>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
// Calculate the current mass flow rate // Calculate the current mass flow rate
if (phi.internalField().dimensions() != dimMass/dimTime) if (phi.internalField().dimensions() != dimMass/dimTime)
@ -179,8 +178,7 @@ void Foam::outletMachNumberPressureFvPatchScalarField::updateCoeffs()
const scalarField gamma(thermoPtr->gamma()().boundaryField()[patchi]); const scalarField gamma(thermoPtr->gamma()().boundaryField()[patchi]);
const fvPatchField<scalar>& rho = const auto& rho = patch().lookupPatchField<volScalarField>(rhoName_);
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
const scalarField Mb(mag(Ub)/sqrt(gamma*pb/rho)); const scalarField Mb(mag(Ub)/sqrt(gamma*pb/rho));

View File

@ -132,8 +132,7 @@ Foam::semiPermeableBaffleMassFractionFvPatchScalarField::phiY() const
const label nbrPatchi = samplePolyPatch().index(); const label nbrPatchi = samplePolyPatch().index();
const fvPatch& nbrPatch = patch().boundaryMesh()[nbrPatchi]; const fvPatch& nbrPatch = patch().boundaryMesh()[nbrPatchi];
const fvPatchScalarField& nbrYp = const auto& nbrYp = nbrPatch.lookupPatchField<volScalarField>(YName);
nbrPatch.lookupPatchField<volScalarField, scalar>(YName);
scalarField nbrYc(nbrYp.patchInternalField()); scalarField nbrYc(nbrYp.patchInternalField());
mappedPatchBase::map().distribute(nbrYc); mappedPatchBase::map().distribute(nbrYc);
@ -149,7 +148,7 @@ void Foam::semiPermeableBaffleMassFractionFvPatchScalarField::updateCoeffs()
} }
const scalarField& phip = const scalarField& phip =
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); patch().lookupPatchField<surfaceScalarField>(phiName_);
const turbulenceModel& turbModel = const turbulenceModel& turbModel =
db().lookupObject<turbulenceModel> db().lookupObject<turbulenceModel>

View File

@ -139,7 +139,7 @@ void Foam::semiPermeableBaffleVelocityFvPatchVectorField::updateCoeffs()
typedef semiPermeableBaffleMassFractionFvPatchScalarField YBCType; typedef semiPermeableBaffleMassFractionFvPatchScalarField YBCType;
const scalarField& rhop = const scalarField& rhop =
patch().lookupPatchField<volScalarField, scalar>(rhoName_); patch().lookupPatchField<volScalarField>(rhoName_);
const PtrList<volScalarField>& Y = composition().Y(); const PtrList<volScalarField>& Y = composition().Y();

View File

@ -341,10 +341,7 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::kappa
mesh.lookupObject<solidThermo>(basicThermo::dictName); mesh.lookupObject<solidThermo>(basicThermo::dictName);
const symmTensorField& alphaAni = const symmTensorField& alphaAni =
patch_.lookupPatchField<volSymmTensorField, scalar> patch_.lookupPatchField<volSymmTensorField>(alphaAniName_);
(
alphaAniName_
);
const scalarField& pp = thermo.p().boundaryField()[patchi]; const scalarField& pp = thermo.p().boundaryField()[patchi];
@ -498,10 +495,7 @@ Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::alpha
case mtDirectionalSolidThermo: case mtDirectionalSolidThermo:
{ {
const symmTensorField& alphaAni = const symmTensorField& alphaAni =
patch_.lookupPatchField<volSymmTensorField, scalar> patch_.lookupPatchField<volSymmTensorField>(alphaAniName_);
(
alphaAniName_
);
const vectorField n(patch_.nf()); const vectorField n(patch_.nf());

View File

@ -220,7 +220,7 @@ const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solid() const
const thermalBaffle1DFvPatchScalarField& nbrField = const thermalBaffle1DFvPatchScalarField& nbrField =
refCast<const thermalBaffle1DFvPatchScalarField> refCast<const thermalBaffle1DFvPatchScalarField>
( (
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_) nbrPatch.template lookupPatchField<volScalarField>(TName_)
); );
return nbrField.solid(); return nbrField.solid();
@ -253,7 +253,7 @@ baffleThickness() const
const thermalBaffle1DFvPatchScalarField& nbrField = const thermalBaffle1DFvPatchScalarField& nbrField =
refCast<const thermalBaffle1DFvPatchScalarField> refCast<const thermalBaffle1DFvPatchScalarField>
( (
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_) nbrPatch.template lookupPatchField<volScalarField>(TName_)
); );
tmp<scalarField> tthickness tmp<scalarField> tthickness
@ -284,7 +284,7 @@ tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::qs() const
const thermalBaffle1DFvPatchScalarField& nbrField = const thermalBaffle1DFvPatchScalarField& nbrField =
refCast<const thermalBaffle1DFvPatchScalarField> refCast<const thermalBaffle1DFvPatchScalarField>
( (
nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_) nbrPatch.template lookupPatchField<volScalarField>(TName_)
); );
tmp<scalarField> tqs(new scalarField(nbrField.qs())); tmp<scalarField> tqs(new scalarField(nbrField.qs()));
@ -365,15 +365,14 @@ void thermalBaffle1DFvPatchScalarField<solidType>::updateCoeffs()
const scalarField kappaw(turbModel.kappaEff(patchi)); const scalarField kappaw(turbModel.kappaEff(patchi));
const fvPatchScalarField& Tp = const fvPatchScalarField& Tp =
patch().template lookupPatchField<volScalarField, scalar>(TName_); patch().template lookupPatchField<volScalarField>(TName_);
scalarField qr(Tp.size(), Zero); scalarField qr(Tp.size(), Zero);
if (qrName_ != "none") if (qrName_ != "none")
{ {
qr = patch().template lookupPatchField<volScalarField, scalar> qr = patch().template lookupPatchField<volScalarField>(qrName_);
(qrName_);
qr = qrRelaxation_*qr + (1.0 - qrRelaxation_)*qrPrevious_; qr = qrRelaxation_*qr + (1.0 - qrRelaxation_)*qrPrevious_;
qrPrevious_ = qr; qrPrevious_ = qr;

View File

@ -158,7 +158,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
const label patchi = patch().index(); const label patchi = patch().index();
const compressible::turbulenceModel& turbModel = const auto& turbModel =
db().lookupObject<compressible::turbulenceModel> db().lookupObject<compressible::turbulenceModel>
( (
IOobject::groupName IOobject::groupName
@ -168,8 +168,7 @@ void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
) )
); );
const fvsPatchField<scalar>& phip = const auto& phip = patch().lookupPatchField<surfaceScalarField>(phiName_);
patch().lookupPatchField<surfaceScalarField, scalar>(phiName_);
const scalarField alphap(turbModel.alphaEff(patchi)); const scalarField alphap(turbModel.alphaEff(patchi));

View File

@ -346,10 +346,7 @@ void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs()
const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField
> >
( (
nbrPatch.lookupPatchField<volScalarField, scalar> nbrPatch.lookupPatchField<volScalarField>(TnbrName_)
(
TnbrName_
)
); );
// Swap to obtain full local values of neighbour K*delta // Swap to obtain full local values of neighbour K*delta

View File

@ -373,7 +373,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
const auto& nbrField = refCast const auto& nbrField = refCast
<const turbulentTemperatureRadCoupledMixedFvPatchScalarField> <const turbulentTemperatureRadCoupledMixedFvPatchScalarField>
( (
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_) nbrPatch.lookupPatchField<volScalarField>(TnbrName_)
); );
// Swap to obtain full local values of neighbour K*delta // Swap to obtain full local values of neighbour K*delta
@ -421,7 +421,7 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
scalarField qr(Tp.size(), Zero); scalarField qr(Tp.size(), Zero);
if (qrName_ != "none") if (qrName_ != "none")
{ {
qr = patch().lookupPatchField<volScalarField, scalar>(qrName_); qr = patch().lookupPatchField<volScalarField>(qrName_);
} }
scalarField qrNbr(Tp.size(), Zero); scalarField qrNbr(Tp.size(), Zero);
@ -433,13 +433,11 @@ void turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs()
const label samplePatchi = mpp.samplePolyPatch().index(); const label samplePatchi = mpp.samplePolyPatch().index();
const fvPatch& nbrPatch = const fvPatch& nbrPatch =
refCast<const fvMesh>(nbrMesh).boundary()[samplePatchi]; refCast<const fvMesh>(nbrMesh).boundary()[samplePatchi];
qrNbr = qrNbr = nbrPatch.lookupPatchField<volScalarField>(qrNbrName_);
nbrPatch.lookupPatchField<volScalarField, scalar>(qrNbrName_);
} }
else else
{ {
qrNbr = qrNbr = patch().lookupPatchField<volScalarField>(qrNbrName_);
patch().lookupPatchField<volScalarField, scalar>(qrNbrName_);
} }
distribute(qrNbrName_, qrNbr); distribute(qrNbrName_, qrNbr);
} }
@ -635,7 +633,7 @@ beta() const
nbrField = refCast nbrField = refCast
<const turbulentTemperatureRadCoupledMixedFvPatchScalarField> <const turbulentTemperatureRadCoupledMixedFvPatchScalarField>
( (
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_) nbrPatch.lookupPatchField<volScalarField>(TnbrName_)
); );
// Swap to obtain full local values of neighbour internal field // Swap to obtain full local values of neighbour internal field

View File

@ -133,15 +133,13 @@ void Foam::radiation::MarshakRadiationFvPatchScalarField::updateCoeffs()
UPstream::msgType() = oldTag+1; UPstream::msgType() = oldTag+1;
// Temperature field // Temperature field
const scalarField& Tp = const auto& Tp = patch().lookupPatchField<volScalarField>(TName_);
patch().lookupPatchField<volScalarField, scalar>(TName_);
// Re-calc reference value // Re-calc reference value
refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp); refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp);
// Diffusion coefficient - created by radiation model's ::updateCoeffs() // Diffusion coefficient - created by radiation model's ::updateCoeffs()
const scalarField& gamma = const auto& gamma = patch().lookupPatchField<volScalarField>("gammaRad");
patch().lookupPatchField<volScalarField, scalar>("gammaRad");
const boundaryRadiationProperties& boundaryRadiation = const boundaryRadiationProperties& boundaryRadiation =
boundaryRadiationProperties::New(internalField().mesh()); boundaryRadiationProperties::New(internalField().mesh());

View File

@ -158,7 +158,7 @@ updateCoeffs()
// Diffusion coefficient - created by radiation model's ::updateCoeffs() // Diffusion coefficient - created by radiation model's ::updateCoeffs()
const scalarField& gamma = const scalarField& gamma =
patch().lookupPatchField<volScalarField, scalar>("gammaRad"); patch().lookupPatchField<volScalarField>("gammaRad");
//const scalarField temissivity = emissivity(); //const scalarField temissivity = emissivity();
const boundaryRadiationProperties& boundaryRadiation = const boundaryRadiationProperties& boundaryRadiation =

View File

@ -151,8 +151,7 @@ updateCoeffs()
int oldTag = UPstream::msgType(); int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1; UPstream::msgType() = oldTag+1;
const scalarField& Tp = const auto& Tp = patch().lookupPatchField<volScalarField>(TName_);
patch().lookupPatchField<volScalarField, scalar>(TName_);
const fvDOM& dom = db().lookupObject<fvDOM>("radiationProperties"); const fvDOM& dom = db().lookupObject<fvDOM>("radiationProperties");
@ -224,7 +223,7 @@ updateCoeffs()
if (dom.useSolarLoad()) if (dom.useSolarLoad())
{ {
// Looking for primary heat flux single band // Looking for primary heat flux single band
Ir += patch().lookupPatchField<volScalarField,scalar> Ir += patch().lookupPatchField<volScalarField>
( (
dom.primaryFluxName_ + "_0" dom.primaryFluxName_ + "_0"
); );

View File

@ -173,7 +173,7 @@ greyDiffusiveViewFactorFixedValueFvPatchScalarField::qro(label bandI) const
if (radiation.useSolarLoad()) if (radiation.useSolarLoad())
{ {
tqrt.ref() += patch().lookupPatchField<volScalarField, scalar> tqrt.ref() += patch().lookupPatchField<volScalarField>
( (
radiation.primaryFluxName_ + "_" + name(bandI) radiation.primaryFluxName_ + "_" + name(bandI)
); );

View File

@ -211,7 +211,7 @@ updateCoeffs()
if (dom.useSolarLoad()) if (dom.useSolarLoad())
{ {
// Looking for primary heat flux single band // Looking for primary heat flux single band
Ir += patch().lookupPatchField<volScalarField,scalar> Ir += patch().lookupPatchField<volScalarField>
( (
dom.primaryFluxName_ + "_" + name(lambdaId) dom.primaryFluxName_ + "_" + name(lambdaId)
); );

View File

@ -208,10 +208,7 @@ patchSource() const
const auto& Yp = const auto& Yp =
refCast<const speciesSorptionFvPatchScalarField> refCast<const speciesSorptionFvPatchScalarField>
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>(speciesName_)
(
speciesName_
)
); );
// mass rate [kg/sec/m3] // mass rate [kg/sec/m3]
@ -224,11 +221,8 @@ patchSource() const
if (includeHs_) if (includeHs_)
{ {
const fvPatchField<scalar>& pp = const auto& pp = patch().lookupPatchField<volScalarField>(pName_);
patch().lookupPatchField<volScalarField, scalar>(pName_); const auto& Tp = patch().lookupPatchField<volScalarField>(TName_);
const fvPatchField<scalar>& Tp =
patch().lookupPatchField<volScalarField, scalar>(TName_);
const auto& thermo = db().lookupObject<rhoReactionThermo> const auto& thermo = db().lookupObject<rhoReactionThermo>
( (
@ -270,10 +264,7 @@ void Foam::enthalpySorptionFvPatchScalarField::updateCoeffs()
const auto& Yp = const auto& Yp =
refCast<const speciesSorptionFvPatchScalarField> refCast<const speciesSorptionFvPatchScalarField>
( (
patch().lookupPatchField<volScalarField, scalar> patch().lookupPatchField<volScalarField>(speciesName_)
(
speciesName_
)
); );
switch (enthalpyModel_) switch (enthalpyModel_)

View File

@ -369,8 +369,7 @@ void Foam::speciesSorptionFvPatchScalarField::updateCoeffs()
// mole fraction // mole fraction
tmp<scalarField> tco = calcMoleFractions(); tmp<scalarField> tco = calcMoleFractions();
const fvPatchField<scalar>& pp = const auto& pp = patch().lookupPatchField<volScalarField>(pName_);
patch().lookupPatchField<volScalarField, scalar>(pName_);
cEq = max_*(kl_*tco()*pp/(1 + kl_*tco()*pp)); cEq = max_*(kl_*tco()*pp/(1 + kl_*tco()*pp));
break; break;

View File

@ -113,7 +113,7 @@ Foam::temperatureDependentAlphaContactAngleFvPatchScalarField::theta
{ {
return theta0_->value return theta0_->value
( (
patch().lookupPatchField<volScalarField, scalar>(TName_) patch().lookupPatchField<volScalarField>(TName_)
); );
} }

View File

@ -146,8 +146,7 @@ void Foam::alphaFixedPressureFvPatchScalarField::updateCoeffs()
const uniformDimensionedVectorField& g = const uniformDimensionedVectorField& g =
meshObjects::gravity::New(db().time()); meshObjects::gravity::New(db().time());
const fvPatchField<scalar>& rho = const auto& rho = patch().lookupPatchField<volScalarField>("rho");
patch().lookupPatchField<volScalarField, scalar>("rho");
operator==(p_ - rho*(g.value() & patch().Cf())); operator==(p_ - rho*(g.value() & patch().Cf()));

View File

@ -56,13 +56,13 @@ functions
#{ #{
// Lookup U // Lookup U
Info<< "Looking up field U\n" << endl; Info<< "Looking up field U\n" << endl;
const volVectorField& U = mesh().lookupObject<volVectorField>("U"); const auto& U = mesh().lookupObject<volVectorField>("U");
Info<< "Reading inlet velocity uInfX\n" << endl; Info<< "Reading inlet velocity uInfX\n" << endl;
scalar ULeft = 0.0; scalar ULeft = 0.0;
label leftI = mesh().boundaryMesh().findPatchID("left"); label leftI = mesh().boundaryMesh().findPatchID("left");
const fvPatchVectorField& fvp = U.boundaryField()[leftI]; const auto& fvp = U.boundaryField()[leftI];
if (fvp.size()) if (fvp.size())
{ {
ULeft = fvp[0].x(); ULeft = fvp[0].x();
@ -76,7 +76,7 @@ functions
scalar magCylinder = 0.0; scalar magCylinder = 0.0;
label cylI = mesh().boundaryMesh().findPatchID("cylinder"); label cylI = mesh().boundaryMesh().findPatchID("cylinder");
const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI]; const auto& cylFvp = mesh().C().boundaryField()[cylI];
if (cylFvp.size()) if (cylFvp.size())
{ {
magCylinder = mag(cylFvp[0]); magCylinder = mag(cylFvp[0]);

View File

@ -112,8 +112,7 @@ functions
codeWrite codeWrite
#{ #{
const volScalarField& rho = const auto& rho = mesh().lookupObject<volScalarField>("rho");
mesh().lookupObject<volScalarField>("rho");
Info<< "rho volume = " << rho.weightedAverage(mesh().Vsc()) << endl; Info<< "rho volume = " << rho.weightedAverage(mesh().Vsc()) << endl;
#}; #};

View File

@ -98,7 +98,7 @@ functions
codeWrite codeWrite
#{ #{
const volScalarField& alpha = const auto& alpha =
mesh().lookupObject<volScalarField>("alpha.water"); mesh().lookupObject<volScalarField>("alpha.water");
Info<< "Alpha volume = " << alpha.weightedAverage(mesh().Vsc()) Info<< "Alpha volume = " << alpha.weightedAverage(mesh().Vsc())

View File

@ -60,17 +60,16 @@ totalMass
code code
#{ #{
const volScalarField& alphaGas = const auto& alphaGas =
mesh().lookupObject<volScalarField>("alpha.gas"); mesh().lookupObject<volScalarField>("alpha.gas");
const volScalarField& alphaLiquid = const auto& alphaLiquid =
mesh().lookupObject<volScalarField>("alpha.liquid"); mesh().lookupObject<volScalarField>("alpha.liquid");
const volScalarField& rhoGas = const auto& rhoGas =
mesh().lookupObject<volScalarField>("thermo:rho.gas"); mesh().lookupObject<volScalarField>("thermo:rho.gas");
const volScalarField& rhoLiquid = const auto& rhoLiquid =
mesh().lookupObject<volScalarField>("thermo:rho.liquid"); mesh().lookupObject<volScalarField>("thermo:rho.liquid");
const scalarField& v = mesh().V(); const scalarField& v = mesh().V();
Info<< "coded totalMass output:" << endl Info<< "coded totalMass output:" << endl