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:
@ -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]);
|
||||
|
||||
@ -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;
|
||||
#};
|
||||
|
||||
@ -98,7 +98,7 @@ functions
|
||||
codeWrite
|
||||
#{
|
||||
|
||||
const volScalarField& alpha =
|
||||
const auto& alpha =
|
||||
mesh().lookupObject<volScalarField>("alpha.water");
|
||||
|
||||
Info<< "Alpha volume = " << alpha.weightedAverage(mesh().Vsc())
|
||||
|
||||
@ -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
|
||||
|
||||
Reference in New Issue
Block a user