mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: use simpler lookupPatchField form
This commit is contained in:
@ -165,14 +165,10 @@ void Foam::smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
|
||||
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_);
|
||||
const fvPatchVectorField& pU =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const auto& pmu = patch().lookupPatchField<volScalarField>(muName_);
|
||||
const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_);
|
||||
const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_);
|
||||
const auto& pU = patch().lookupPatchField<volVectorField>(UName_);
|
||||
|
||||
// Prandtl number reading consistent with rhoCentralFoam
|
||||
const dictionary& thermophysicalProperties =
|
||||
|
||||
@ -155,12 +155,9 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
|
||||
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_);
|
||||
const auto& pmu = patch().lookupPatchField<volScalarField>(muName_);
|
||||
const auto& prho = patch().lookupPatchField<volScalarField>(rhoName_);
|
||||
const auto& ppsi = patch().lookupPatchField<volScalarField>(psiName_);
|
||||
|
||||
Field<scalar> C1
|
||||
(
|
||||
@ -187,8 +184,8 @@ void Foam::maxwellSlipUFvPatchVectorField::updateCoeffs()
|
||||
|
||||
if (curvature_)
|
||||
{
|
||||
const fvPatchTensorField& ptauMC =
|
||||
patch().lookupPatchField<volTensorField, tensor>(tauMCName_);
|
||||
const auto& ptauMC =
|
||||
patch().lookupPatchField<volTensorField>(tauMCName_);
|
||||
vectorField n(patch().nf());
|
||||
|
||||
refValue() -= C1/prho*transform(I - n*n, (n & ptauMC));
|
||||
|
||||
@ -104,11 +104,8 @@ void Foam::fixedRhoFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvPatchField<scalar>& psip =
|
||||
patch().lookupPatchField<volScalarField, scalar>(psiName_);
|
||||
|
||||
const fvPatchField<scalar>& pp =
|
||||
patch().lookupPatchField<volScalarField, scalar>(pName_);
|
||||
const auto& psip = patch().lookupPatchField<volScalarField>(psiName_);
|
||||
const auto& pp = patch().lookupPatchField<volScalarField>(pName_);
|
||||
|
||||
operator==(psip*pp);
|
||||
|
||||
|
||||
@ -88,26 +88,29 @@ kappa
|
||||
|
||||
case mtLookup:
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(kappaName_))
|
||||
{
|
||||
return patch().lookupPatchField<volScalarField, scalar>
|
||||
(
|
||||
kappaName_
|
||||
);
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<volScalarField>(kappaName_);
|
||||
|
||||
if (ptr)
|
||||
{
|
||||
return patch().patchField(*ptr);
|
||||
}
|
||||
}
|
||||
else if (mesh.foundObject<volSymmTensorField>(kappaName_))
|
||||
{
|
||||
const symmTensorField& KWall =
|
||||
patch().lookupPatchField<volSymmTensorField, scalar>
|
||||
(
|
||||
kappaName_
|
||||
);
|
||||
const auto* ptr =
|
||||
mesh.cfindObject<volSymmTensorField>(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
|
||||
<< "Did not find field " << kappaName_
|
||||
@ -117,9 +120,6 @@ kappa
|
||||
<< " or volSymmTensorField."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -131,10 +131,8 @@ kappa
|
||||
mesh.lookupObject<phaseSystem>("phaseProperties")
|
||||
);
|
||||
|
||||
tmp<scalarField> kappaEff
|
||||
(
|
||||
new scalarField(patch().size(), 0.0)
|
||||
);
|
||||
auto tkappaEff = tmp<scalarField>::New(patch().size(), Zero);
|
||||
auto& kappaEff = tkappaEff.ref();
|
||||
|
||||
forAll(fluid.phases(), phasei)
|
||||
{
|
||||
@ -142,10 +140,10 @@ kappa
|
||||
|
||||
const fvPatchScalarField& alpha = phase.boundaryField()[patchi];
|
||||
|
||||
kappaEff.ref() += alpha*phase.kappaEff(patchi)();
|
||||
kappaEff += alpha*phase.kappaEff(patchi)();
|
||||
}
|
||||
|
||||
return kappaEff;
|
||||
return tkappaEff;
|
||||
|
||||
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;
|
||||
|
||||
const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField&
|
||||
nbrField = refCast
|
||||
<const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField>
|
||||
(
|
||||
nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_)
|
||||
);
|
||||
const auto& nbrField =
|
||||
refCast
|
||||
<
|
||||
const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
|
||||
>(nbrPatch.lookupPatchField<volScalarField>(TnbrName_));
|
||||
|
||||
// Swap to obtain full local values of neighbour internal field
|
||||
scalarField TcNbr(nbrField.patchInternalField());
|
||||
@ -330,13 +329,13 @@ updateCoeffs()
|
||||
scalarField qr(Tp.size(), 0.0);
|
||||
if (qrName_ != "none")
|
||||
{
|
||||
qr = patch().lookupPatchField<volScalarField, scalar>(qrName_);
|
||||
qr = patch().lookupPatchField<volScalarField>(qrName_);
|
||||
}
|
||||
|
||||
scalarField qrNbr(Tp.size(), 0.0);
|
||||
if (qrNbrName_ != "none")
|
||||
{
|
||||
qrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(qrNbrName_);
|
||||
qrNbr = nbrPatch.lookupPatchField<volScalarField>(qrNbrName_);
|
||||
mpp.distribute(qrNbr);
|
||||
}
|
||||
|
||||
|
||||
@ -89,17 +89,10 @@ void Foam::adjointOutletPressureFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>("phi");
|
||||
|
||||
const fvsPatchField<scalar>& phiap =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>("phia");
|
||||
|
||||
const fvPatchField<vector>& Up =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
|
||||
const fvPatchField<vector>& Uap =
|
||||
patch().lookupPatchField<volVectorField, vector>("Ua");
|
||||
const auto& phip = patch().lookupPatchField<surfaceScalarField>("phi");
|
||||
const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia");
|
||||
const auto& Up = patch().lookupPatchField<volVectorField>("U");
|
||||
const auto& Uap = patch().lookupPatchField<volVectorField>("Ua");
|
||||
|
||||
operator==((phiap/patch().magSf() - 1.0)*phip/patch().magSf() + (Up & Uap));
|
||||
|
||||
|
||||
@ -90,11 +90,8 @@ void Foam::adjointOutletVelocityFvPatchVectorField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const fvsPatchField<scalar>& phiap =
|
||||
patch().lookupPatchField<surfaceScalarField, scalar>("phia");
|
||||
|
||||
const fvPatchField<vector>& Up =
|
||||
patch().lookupPatchField<volVectorField, vector>("U");
|
||||
const auto& phiap = patch().lookupPatchField<surfaceScalarField>("phia");
|
||||
const auto& Up = patch().lookupPatchField<volVectorField>("U");
|
||||
|
||||
scalarField Un(mag(patch().nf() & Up));
|
||||
vectorField UtHat((Up - patch().nf()*Un)/(Un + SMALL));
|
||||
|
||||
@ -152,14 +152,9 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
db().lookupObject<IOdictionary>("thermalProperties");
|
||||
|
||||
|
||||
const fvPatchField<scalar>& rho =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const fvPatchField<scalar>& rhoE =
|
||||
patch().lookupPatchField<volScalarField, scalar>("E");
|
||||
|
||||
const fvPatchField<scalar>& nu =
|
||||
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||
const auto& rho = patch().lookupPatchField<volScalarField>("rho");
|
||||
const auto& rhoE = patch().lookupPatchField<volScalarField>("E");
|
||||
const auto& nu = patch().lookupPatchField<volScalarField>("nu");
|
||||
|
||||
scalarField E(rhoE/rho);
|
||||
scalarField mu(E/(2.0*(1.0 + nu)));
|
||||
@ -176,8 +171,7 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
|
||||
vectorField n(patch().nf());
|
||||
|
||||
const fvPatchField<symmTensor>& sigmaD =
|
||||
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
|
||||
const auto& sigmaD = patch().lookupPatchField<volSymmTensorField>("sigmaD");
|
||||
|
||||
gradient() =
|
||||
(
|
||||
@ -187,11 +181,10 @@ void tractionDisplacementFvPatchVectorField::updateCoeffs()
|
||||
|
||||
if (thermalProperties.get<bool>("thermalStress"))
|
||||
{
|
||||
const fvPatchField<scalar>& threeKalpha=
|
||||
patch().lookupPatchField<volScalarField, scalar>("threeKalpha");
|
||||
const auto& threeKalpha =
|
||||
patch().lookupPatchField<volScalarField>("threeKalpha");
|
||||
|
||||
const fvPatchField<scalar>& T =
|
||||
patch().lookupPatchField<volScalarField, scalar>("T");
|
||||
const auto& T = patch().lookupPatchField<volScalarField>("T");
|
||||
|
||||
gradient() += n*threeKalpha*T/twoMuLambda;
|
||||
}
|
||||
|
||||
@ -152,14 +152,9 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
|
||||
"mechanicalProperties"
|
||||
);
|
||||
|
||||
const fvPatchField<scalar>& rho =
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
|
||||
const fvPatchField<scalar>& rhoE =
|
||||
patch().lookupPatchField<volScalarField, scalar>("E");
|
||||
|
||||
const fvPatchField<scalar>& nu =
|
||||
patch().lookupPatchField<volScalarField, scalar>("nu");
|
||||
const auto& rho = patch().lookupPatchField<volScalarField>("rho");
|
||||
const auto& rhoE = patch().lookupPatchField<volScalarField>("E");
|
||||
const auto& nu = patch().lookupPatchField<volScalarField>("nu");
|
||||
|
||||
scalarField E(rhoE/rho);
|
||||
scalarField mu(E/(2.0*(1.0 + nu)));
|
||||
@ -172,11 +167,8 @@ void tractionDisplacementCorrectionFvPatchVectorField::updateCoeffs()
|
||||
|
||||
vectorField n(patch().nf());
|
||||
|
||||
const fvPatchField<symmTensor>& sigmaD =
|
||||
patch().lookupPatchField<volSymmTensorField, symmTensor>("sigmaD");
|
||||
|
||||
const fvPatchField<tensor>& sigmaExp =
|
||||
patch().lookupPatchField<volTensorField, tensor>("sigmaExp");
|
||||
const auto& sigmaD = patch().lookupPatchField<volSymmTensorField>("sigmaD");
|
||||
const auto& sigmaExp = patch().lookupPatchField<volTensorField>("sigmaExp");
|
||||
|
||||
gradient() =
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user