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

@ -56,13 +56,13 @@ functions
#{
// Lookup U
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;
scalar ULeft = 0.0;
label leftI = mesh().boundaryMesh().findPatchID("left");
const fvPatchVectorField& fvp = U.boundaryField()[leftI];
const auto& fvp = U.boundaryField()[leftI];
if (fvp.size())
{
ULeft = fvp[0].x();
@ -76,7 +76,7 @@ functions
scalar magCylinder = 0.0;
label cylI = mesh().boundaryMesh().findPatchID("cylinder");
const fvPatchVectorField& cylFvp = mesh().C().boundaryField()[cylI];
const auto& cylFvp = mesh().C().boundaryField()[cylI];
if (cylFvp.size())
{
magCylinder = mag(cylFvp[0]);

View File

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

View File

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

View File

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