- when constructing dimensioned fields that are to be zero-initialized, it is preferrable to use a form such as dimensionedScalar(dims, Zero) dimensionedVector(dims, Zero) rather than dimensionedScalar("0", dims, 0) dimensionedVector("zero", dims, vector::zero) This reduces clutter and also avoids any suggestion that the name of the dimensioned quantity has any influence on the field's name. An even shorter version is possible. Eg, dimensionedScalar(dims) but reduces the clarity of meaning. - NB: UniformDimensionedField is an exception to these style changes since it does use the name of the dimensioned type (instead of the regIOobject).
86 lines
1.5 KiB
C
86 lines
1.5 KiB
C
#include "readGravitationalAcceleration.H"
|
|
#include "readhRef.H"
|
|
|
|
Info<< "Creating twoPhaseSystem\n" << endl;
|
|
|
|
twoPhaseSystem fluid(mesh, g);
|
|
|
|
phaseModel& phase1 = fluid.phase1();
|
|
phaseModel& phase2 = fluid.phase2();
|
|
|
|
volScalarField& alpha1 = phase1;
|
|
volVectorField& U1 = phase1.U();
|
|
volVectorField& U2 = phase2.U();
|
|
|
|
volScalarField& p = phase1.thermo().p();
|
|
|
|
dimensionedScalar pMin
|
|
(
|
|
"pMin",
|
|
dimPressure,
|
|
fluid
|
|
);
|
|
|
|
#include "gh.H"
|
|
|
|
Info<< "Reading field p_rgh\n" << endl;
|
|
volScalarField p_rgh
|
|
(
|
|
IOobject
|
|
(
|
|
"p_rgh",
|
|
runTime.timeName(),
|
|
mesh,
|
|
IOobject::MUST_READ,
|
|
IOobject::AUTO_WRITE
|
|
),
|
|
mesh
|
|
);
|
|
|
|
volVectorField U
|
|
(
|
|
IOobject
|
|
(
|
|
"U",
|
|
runTime.timeName(),
|
|
mesh,
|
|
IOobject::NO_READ,
|
|
IOobject::AUTO_WRITE
|
|
),
|
|
fluid.U()
|
|
);
|
|
|
|
label pRefCell = 0;
|
|
scalar pRefValue = 0.0;
|
|
setRefCell
|
|
(
|
|
p,
|
|
p_rgh,
|
|
pimple.dict(),
|
|
pRefCell,
|
|
pRefValue
|
|
);
|
|
mesh.setFluxRequired(p_rgh.name());
|
|
mesh.setFluxRequired(alpha1.name());
|
|
|
|
Info<< "Creating field dpdt\n" << endl;
|
|
volScalarField dpdt
|
|
(
|
|
IOobject
|
|
(
|
|
"dpdt",
|
|
runTime.timeName(),
|
|
mesh
|
|
),
|
|
mesh,
|
|
dimensionedScalar(p.dimensions()/dimTime, Zero)
|
|
);
|
|
|
|
|
|
Info<< "Creating field kinetic energy K\n" << endl;
|
|
volScalarField K1(IOobject::groupName("K", phase1.name()), 0.5*magSqr(U1));
|
|
volScalarField K2(IOobject::groupName("K", phase2.name()), 0.5*magSqr(U2));
|
|
|
|
#include "createMRF.H"
|
|
#include "createFvOptions.H"
|