ENH: interCondensingEvaporatingFoam - updated for postProcess utility; tidying

This commit is contained in:
Andrew Heather
2016-12-16 13:33:19 +00:00
parent bd86b155aa
commit 267903077b
3 changed files with 147 additions and 144 deletions

View File

@ -1,6 +1,7 @@
interPhaseChangePath = $(FOAM_SOLVERS)/multiphase/interPhaseChangeFoam interPhaseChangePath = $(FOAM_SOLVERS)/multiphase/interPhaseChangeFoam
EXE_INC = \ EXE_INC = \
-I. \
-ItemperaturePhaseChangeTwoPhaseMixtures/lnInclude \ -ItemperaturePhaseChangeTwoPhaseMixtures/lnInclude \
-I$(interPhaseChangePath) \ -I$(interPhaseChangePath) \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \

View File

@ -1,6 +1,6 @@
Info<< "Reading field p_rgh\n" << endl; Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh volScalarField p_rgh
( (
IOobject IOobject
( (
"p_rgh", "p_rgh",
@ -10,11 +10,11 @@
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh mesh
); );
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U volVectorField U
( (
IOobject IOobject
( (
"U", "U",
@ -24,36 +24,32 @@
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh mesh
); );
#include "createPhi.H" #include "createPhi.H"
// Creating e based thermo // Creating e based thermo
autoPtr<twoPhaseMixtureEThermo> thermo; autoPtr<twoPhaseMixtureEThermo> thermo;
thermo.set(new twoPhaseMixtureEThermo(U, phi)); thermo.set(new twoPhaseMixtureEThermo(U, phi));
// Create mixture and // Create mixture and
Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl; Info<< "Creating temperaturePhaseChangeTwoPhaseMixture\n" << endl;
autoPtr<temperaturePhaseChangeTwoPhaseMixture> mixture = autoPtr<temperaturePhaseChangeTwoPhaseMixture> mixture =
temperaturePhaseChangeTwoPhaseMixture::New(thermo(), mesh); temperaturePhaseChangeTwoPhaseMixture::New(thermo(), mesh);
volScalarField& T = thermo->T(); // Correct e from T and alpha
volScalarField& e = thermo->he(); //thermo->correct();
e.oldTime();
// Correct e from T and alpha volScalarField& alpha1(thermo->alpha1());
//thermo->correct(); volScalarField& alpha2(thermo->alpha2());
volScalarField& alpha1(thermo->alpha1()); const dimensionedScalar& rho1 = thermo->rho1();
volScalarField& alpha2(thermo->alpha2()); const dimensionedScalar& rho2 = thermo->rho2();
const dimensionedScalar& rho1 = thermo->rho1(); // Need to store rho for ddt(rho, U)
const dimensionedScalar& rho2 = thermo->rho2(); volScalarField rho
(
// Need to store rho for ddt(rho, U)
volScalarField rho
(
IOobject IOobject
( (
"rho", "rho",
@ -64,43 +60,42 @@
), ),
alpha1*rho1 + alpha2*rho2, alpha1*rho1 + alpha2*rho2,
alpha1.boundaryField().types() alpha1.boundaryField().types()
); );
rho.oldTime(); rho.oldTime();
// Construct interface from alpha1 distribution // Construct interface from alpha1 distribution
interfaceProperties interface interfaceProperties interface
( (
alpha1, alpha1,
U, U,
thermo->transportPropertiesDict() thermo->transportPropertiesDict()
); );
// Construct incompressible turbulence model // Construct incompressible turbulence model
autoPtr<incompressible::turbulenceModel> turbulence autoPtr<incompressible::turbulenceModel> turbulence
( (
incompressible::turbulenceModel::New(U, phi, thermo()) incompressible::turbulenceModel::New(U, phi, thermo())
); );
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"
Info<< "Calculating field g.h\n" << endl; volScalarField& p = thermo->p();
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", g & mesh.Cf());
volScalarField& p = thermo->p(); label pRefCell = 0;
scalar pRefValue = 0.0;
label pRefCell = 0; setRefCell
scalar pRefValue = 0.0; (
setRefCell
(
p, p,
p_rgh, p_rgh,
pimple.dict(), pimple.dict(),
pRefCell, pRefCell,
pRefValue pRefValue
); );
if (p_rgh.needReference()) if (p_rgh.needReference())
{ {
p += dimensionedScalar p += dimensionedScalar
( (
"p", "p",
@ -108,13 +103,16 @@
pRefValue - getRefCellValue(p, pRefCell) pRefValue - getRefCellValue(p, pRefCell)
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }
// Turbulent Prandtl number mesh.setFluxRequired(p_rgh.name());
dimensionedScalar Prt("Prt", dimless, thermo->transportPropertiesDict()); mesh.setFluxRequired(alpha1.name());
volScalarField kappaEff // Turbulent Prandtl number
( dimensionedScalar Prt("Prt", dimless, thermo->transportPropertiesDict());
volScalarField kappaEff
(
IOobject IOobject
( (
"kappaEff", "kappaEff",
@ -124,14 +122,14 @@
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
thermo->kappa() thermo->kappa()
); );
Info<< "Creating field kinetic energy K\n" << endl; Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U)); volScalarField K("K", 0.5*magSqr(U));
Info<< "Creating field pDivU\n" << endl; Info<< "Creating field pDivU\n" << endl;
volScalarField pDivU volScalarField pDivU
( (
IOobject IOobject
( (
"pDivU", "pDivU",
@ -140,4 +138,5 @@
), ),
mesh, mesh,
dimensionedScalar("pDivU", p.dimensions()/dimTime, 0) dimensionedScalar("pDivU", p.dimensions()/dimTime, 0)
); );

View File

@ -56,19 +56,22 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "postProcess.H"
#include "setRootCase.H" #include "setRootCase.H"
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createControl.H"
pimpleControl pimple(mesh);
#include "readGravitationalAcceleration.H"
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H" #include "createFvOptions.H"
#include "createTimeControls.H" #include "createTimeControls.H"
#include "CourantNo.H" #include "CourantNo.H"
#include "setInitialDeltaT.H" #include "setInitialDeltaT.H"
volScalarField& T = thermo->T();
volScalarField& e = thermo->he();
e.oldTime();
turbulence->validate(); turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //