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/steadyUniversalFoam/createThermo.H

51 lines
1.3 KiB
C++

Info<< "Reading thermophysical properties\n" << endl;
volScalarField* pPtr = nullptr;
volScalarField* hPtr = nullptr;
const volScalarField* TPtr = nullptr;
volScalarField* psisPtr = nullptr;
basicThermo* thermoPtr = nullptr;
Switch compressible;
{
dictionary pimple = mesh.solutionDict().subDict("PIMPLE");
compressible = Switch(pimple.lookup("compressible"));
if (compressible)
{
thermoPtr =
(
basicPsiThermo::New(mesh)
).ptr();
pPtr = &(thermoPtr->p());
hPtr = &(thermoPtr->h());
TPtr = &(thermoPtr->T());
psisPtr = new volScalarField
(
"psi",
thermoPtr->psi()/thermoPtr->Cp()*thermoPtr->Cv()
);
}
else
{
thermoPtr =
(
basicRhoThermo::New(mesh)
).ptr();
pPtr = &(thermoPtr->p());
hPtr = &(thermoPtr->h());
TPtr = &(thermoPtr->T());
psisPtr = const_cast<volScalarField*>(&(thermoPtr->psi()));
}
}
basicThermo& thermo = *thermoPtr;
volScalarField& p = *pPtr;
volScalarField& h = *hPtr;
const volScalarField& T = *TPtr;
volScalarField& psis = *psisPtr;