139 lines
2.9 KiB
C
139 lines
2.9 KiB
C
|
Info<< "Reading field pd\n" << endl;
|
||
|
volScalarField pd
|
||
|
(
|
||
|
IOobject
|
||
|
(
|
||
|
"pd",
|
||
|
runTime.timeName(),
|
||
|
mesh,
|
||
|
IOobject::MUST_READ,
|
||
|
IOobject::AUTO_WRITE
|
||
|
),
|
||
|
mesh
|
||
|
);
|
||
|
|
||
|
Info<< "Reading field alpha1\n" << endl;
|
||
|
volScalarField alpha1
|
||
|
(
|
||
|
IOobject
|
||
|
(
|
||
|
"alpha1",
|
||
|
runTime.timeName(),
|
||
|
mesh,
|
||
|
IOobject::MUST_READ,
|
||
|
IOobject::AUTO_WRITE
|
||
|
),
|
||
|
mesh
|
||
|
);
|
||
|
|
||
|
Info<< "Reading field U\n" << endl;
|
||
|
volVectorField U
|
||
|
(
|
||
|
IOobject
|
||
|
(
|
||
|
"U",
|
||
|
runTime.timeName(),
|
||
|
mesh,
|
||
|
IOobject::MUST_READ,
|
||
|
IOobject::AUTO_WRITE
|
||
|
),
|
||
|
mesh
|
||
|
);
|
||
|
|
||
|
# include "createPhi.H"
|
||
|
|
||
|
|
||
|
Info<< "Reading transportProperties\n" << endl;
|
||
|
twoPhaseMixture twoPhaseProperties(U, phi, "alpha1");
|
||
|
|
||
|
const dimensionedScalar& rho1 = twoPhaseProperties.rho1();
|
||
|
const dimensionedScalar& rho2 = twoPhaseProperties.rho2();
|
||
|
|
||
|
|
||
|
// Need to store rho for ddt(rho, U)
|
||
|
volScalarField rho
|
||
|
(
|
||
|
IOobject
|
||
|
(
|
||
|
"rho",
|
||
|
runTime.timeName(),
|
||
|
mesh,
|
||
|
IOobject::READ_IF_PRESENT
|
||
|
),
|
||
|
alpha1*rho1 + (scalar(1) - alpha1)*rho2,
|
||
|
alpha1.boundaryField().types()
|
||
|
);
|
||
|
rho.oldTime();
|
||
|
|
||
|
|
||
|
// Mass flux
|
||
|
// Initialisation does not matter because rhoPhi is reset after the
|
||
|
// alpha1 solution before it is used in the U equation.
|
||
|
surfaceScalarField rhoPhi
|
||
|
(
|
||
|
IOobject
|
||
|
(
|
||
|
"rho*phi",
|
||
|
runTime.timeName(),
|
||
|
mesh,
|
||
|
IOobject::NO_READ,
|
||
|
IOobject::NO_WRITE
|
||
|
),
|
||
|
rho1*phi
|
||
|
);
|
||
|
|
||
|
|
||
|
Info<< "Calculating field g.h\n" << endl;
|
||
|
volScalarField gh("gh", g & mesh.C());
|
||
|
surfaceScalarField ghf("gh", g & mesh.Cf());
|
||
|
|
||
|
volScalarField p
|
||
|
(
|
||
|
IOobject
|
||
|
(
|
||
|
"p",
|
||
|
runTime.timeName(),
|
||
|
mesh,
|
||
|
IOobject::NO_READ,
|
||
|
IOobject::AUTO_WRITE
|
||
|
),
|
||
|
pd + rho*gh
|
||
|
);
|
||
|
|
||
|
|
||
|
label pdRefCell = 0;
|
||
|
scalar pdRefValue = 0.0;
|
||
|
setRefCell
|
||
|
(
|
||
|
pd,
|
||
|
mesh.solutionDict().subDict("PIMPLE"),
|
||
|
pdRefCell,
|
||
|
pdRefValue
|
||
|
);
|
||
|
|
||
|
scalar pRefValue = 0.0;
|
||
|
|
||
|
if (pd.needReference())
|
||
|
{
|
||
|
pRefValue = readScalar
|
||
|
(
|
||
|
mesh.solutionDict().subDict("PIMPLE").lookup("pRefValue")
|
||
|
);
|
||
|
|
||
|
p += dimensionedScalar
|
||
|
(
|
||
|
"p",
|
||
|
p.dimensions(),
|
||
|
pRefValue - getRefCellValue(p, pdRefCell)
|
||
|
);
|
||
|
}
|
||
|
|
||
|
// Construct interface from alpha1 distribution
|
||
|
interfaceProperties interface(alpha1, U, twoPhaseProperties);
|
||
|
|
||
|
// Construct incompressible turbulence model
|
||
|
autoPtr<incompressible::turbulenceModel> turbulence
|
||
|
(
|
||
|
incompressible::turbulenceModel::New(U, phi, twoPhaseProperties)
|
||
|
);
|