This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/engine/sonicTurbDyMEngineFoam/createFields.H

133 lines
2.7 KiB
C
Raw Normal View History

scalar totalVolume = sum(mesh.V()).value();
Info<< "Reading thermophysical properties\n" << endl;
2010-09-22 18:13:13 +00:00
autoPtr<basicPsiThermo> pThermo
(
2010-09-22 18:13:13 +00:00
basicPsiThermo::New(mesh)
);
2010-09-22 18:13:13 +00:00
basicPsiThermo& thermo = pThermo();
// Make density field with zero gradient boundary conditions to handle
// attach-detach cases. HJ, 20/Mar/2011
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo.rho(),
zeroGradientFvPatchScalarField::typeName
);
rho.oldTime();
2010-09-22 18:13:13 +00:00
volScalarField& p = thermo.p();
p.oldTime();
2010-09-22 18:13:13 +00:00
const volScalarField& psi = thermo.psi();
const volScalarField& T = thermo.T();
volScalarField& h = thermo.h();
Info<< "\nReading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "compressibleCreatePhi.H"
Info<< "Creating turbulence model\n" << endl;
2010-09-22 18:13:13 +00:00
autoPtr<compressible::turbulenceModel> turbulence
(
2010-09-22 18:13:13 +00:00
compressible::turbulenceModel::New
(
rho,
U,
phi,
2010-09-22 18:13:13 +00:00
thermo
)
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt
(
IOobject
(
"DpDt",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
);
volScalarField dpdt = fvc::ddt(p);
volScalarField rUA
(
IOobject
(
"rUA",
runTime.timeName(),
mesh
),
mesh,
dimensionedScalar("rUA", dimensionSet(-1, 3, 1, 0, 0, 0, 0), 1),
zeroGradientFvPatchScalarField::typeName
);
volVectorField H
(
IOobject
(
"H",
runTime.timeName(),
mesh
),
mesh,
dimensionedVector("H", U.dimensions()/rUA.dimensions(), vector::zero),
zeroGradientFvPatchVectorField::typeName
);
volScalarField divPhi
(
IOobject
(
"divPhi",
runTime.timeName(),
mesh
),
fvc::div(phi)
);
surfaceScalarField meshFlux
(
IOobject
(
"meshFlux",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::interpolate(rho) * fvc::meshPhi(U)
);
mesh.schemesDict().setFluxRequired(p.name());