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/compressible/dbnsFoam/createFields.H

83 lines
1.6 KiB
C

Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicPsiThermo> thermo
(
basicPsiThermo::New(mesh)
);
// Primitive variables
volScalarField& h = thermo->h();
volScalarField& p = thermo->p();
const volScalarField& T = thermo->T();
Info<< "Reading field rho\n" << endl;
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo->rho()
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
// Conservative variables
volVectorField rhoU
(
IOobject
(
"rhoU",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*U
);
volScalarField rhoE
(
IOobject
(
"rhoE",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
rho*(h + 0.5*magSqr(U)) - p
);
// Create numeric flux
// numericFlux<roeFlux, BarthJespersenLimiter> dbnsFlux
numericFlux<rusanovFlux, BarthJespersenLimiter> dbnsFlux
(
p,
U,
T,
thermo()
);
// Create mass flux alias for easier coupling with other code components
const surfaceScalarField& phi = dbnsFlux.rhoFlux();