solvers: Provided public constant access to state fields
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,16 +49,13 @@ Foam::solvers::XiFluid::XiFluid(fvMesh& mesh)
|
||||
autoPtr<fluidThermo>(psiuMulticomponentThermo::New(mesh).ptr())
|
||||
),
|
||||
|
||||
thermo(refCast<psiuMulticomponentThermo>(isothermalFluid::thermo)),
|
||||
thermo_(refCast<psiuMulticomponentThermo>(isothermalFluid::thermo_)),
|
||||
|
||||
composition(thermo.composition()),
|
||||
composition(thermo_.composition()),
|
||||
|
||||
b(composition.Y("b")),
|
||||
b_(composition.Y("b")),
|
||||
|
||||
unstrainedLaminarFlameSpeed
|
||||
(
|
||||
laminarFlameSpeed::New(thermo)
|
||||
),
|
||||
unstrainedLaminarFlameSpeed(laminarFlameSpeed::New(thermo_)),
|
||||
|
||||
Su
|
||||
(
|
||||
@ -76,7 +73,7 @@ Foam::solvers::XiFluid::XiFluid(fvMesh& mesh)
|
||||
SuMin(0.01*Su.average()),
|
||||
SuMax(4*Su.average()),
|
||||
|
||||
Xi
|
||||
Xi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -99,7 +96,7 @@ Foam::solvers::XiFluid::XiFluid(fvMesh& mesh)
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Xi*Su
|
||||
Xi_*Su
|
||||
),
|
||||
|
||||
combustionProperties
|
||||
@ -149,9 +146,13 @@ Foam::solvers::XiFluid::XiFluid(fvMesh& mesh)
|
||||
thermophysicalTransport
|
||||
(
|
||||
momentumTransport(),
|
||||
thermo,
|
||||
thermo_,
|
||||
true
|
||||
)
|
||||
),
|
||||
|
||||
thermo(thermo_),
|
||||
b(b_),
|
||||
Xi(Xi_)
|
||||
{
|
||||
thermo.validate(type(), "ha", "ea");
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,7 +101,7 @@ protected:
|
||||
|
||||
// Thermophysical properties
|
||||
|
||||
psiuMulticomponentThermo& thermo;
|
||||
psiuMulticomponentThermo& thermo_;
|
||||
|
||||
|
||||
// Composition
|
||||
@ -111,7 +111,7 @@ protected:
|
||||
|
||||
//- Reference to the combustion regress variable
|
||||
// obtained from the combustion mixture
|
||||
volScalarField& b;
|
||||
volScalarField& b_;
|
||||
|
||||
//- Set of fields used for the multivariate convection scheme
|
||||
multivariateSurfaceInterpolationScheme<scalar>::fieldTable fields;
|
||||
@ -132,7 +132,7 @@ protected:
|
||||
dimensionedScalar SuMax;
|
||||
|
||||
//- Flame wrinkling coefficient field
|
||||
volScalarField Xi;
|
||||
volScalarField Xi_;
|
||||
|
||||
//- Turbulent flame-speed field
|
||||
volScalarField St;
|
||||
@ -214,6 +214,17 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
//- Reference to the fluid thermophysical properties
|
||||
const psiuMulticomponentThermo& thermo;
|
||||
|
||||
//- Reference to the combustion regress variable
|
||||
// obtained from the combustion mixture
|
||||
const volScalarField& b;
|
||||
|
||||
//- Flame wrinkling coefficient field
|
||||
const volScalarField& Xi;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("XiFluid");
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -161,6 +161,9 @@ void Foam::solvers::XiFluid::bSolve
|
||||
const fv::convectionScheme<scalar>& mvConvection
|
||||
)
|
||||
{
|
||||
volScalarField& b(b_);
|
||||
volScalarField& Xi(Xi_);
|
||||
|
||||
// progress variable
|
||||
// ~~~~~~~~~~~~~~~~~
|
||||
const volScalarField c("c", scalar(1) - b);
|
||||
@ -480,7 +483,7 @@ void Foam::solvers::XiFluid::EauSolve
|
||||
const fv::convectionScheme<scalar>& mvConvection
|
||||
)
|
||||
{
|
||||
volScalarField& heau = thermo.heu();
|
||||
volScalarField& heau = thermo_.heu();
|
||||
|
||||
const volScalarField::Internal rhoByRhou(rho()/thermo.rhou()());
|
||||
|
||||
@ -522,7 +525,7 @@ void Foam::solvers::XiFluid::EaSolve
|
||||
const fv::convectionScheme<scalar>& mvConvection
|
||||
)
|
||||
{
|
||||
volScalarField& hea = thermo.he();
|
||||
volScalarField& hea = thermo_.he();
|
||||
|
||||
fvScalarMatrix EaEqn
|
||||
(
|
||||
@ -581,10 +584,10 @@ void Foam::solvers::XiFluid::thermophysicalPredictor()
|
||||
|
||||
if (!ign.ignited())
|
||||
{
|
||||
thermo.heu() == thermo.he();
|
||||
thermo_.heu() == thermo.he();
|
||||
}
|
||||
|
||||
thermo.correct();
|
||||
thermo_.correct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -31,7 +31,7 @@ License
|
||||
|
||||
void Foam::solvers::fluid::thermophysicalPredictor()
|
||||
{
|
||||
volScalarField& he = thermo.he();
|
||||
volScalarField& he = thermo_.he();
|
||||
|
||||
fvScalarMatrix EEqn
|
||||
(
|
||||
@ -60,7 +60,7 @@ void Foam::solvers::fluid::thermophysicalPredictor()
|
||||
|
||||
fvConstraints().constrain(he);
|
||||
|
||||
thermo.correct();
|
||||
thermo_.correct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -38,6 +38,10 @@ License
|
||||
|
||||
void Foam::solvers::incompressibleFluid::correctPressure()
|
||||
{
|
||||
volScalarField& p(p_);
|
||||
volVectorField& U(U_);
|
||||
surfaceScalarField& phi(phi_);
|
||||
|
||||
fvVectorMatrix& UEqn = tUEqn.ref();
|
||||
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
|
||||
@ -60,7 +60,7 @@ Foam::solvers::incompressibleFluid::incompressibleFluid(fvMesh& mesh)
|
||||
:
|
||||
fluidSolver(mesh),
|
||||
|
||||
p
|
||||
p_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -73,9 +73,9 @@ Foam::solvers::incompressibleFluid::incompressibleFluid(fvMesh& mesh)
|
||||
mesh
|
||||
),
|
||||
|
||||
pressureReference(p, pimple.dict()),
|
||||
pressureReference(p_, pimple.dict()),
|
||||
|
||||
U
|
||||
U_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -88,7 +88,7 @@ Foam::solvers::incompressibleFluid::incompressibleFluid(fvMesh& mesh)
|
||||
mesh
|
||||
),
|
||||
|
||||
phi
|
||||
phi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -98,7 +98,7 @@ Foam::solvers::incompressibleFluid::incompressibleFluid(fvMesh& mesh)
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(U) & mesh.Sf()
|
||||
linearInterpolate(U_) & mesh.Sf()
|
||||
),
|
||||
|
||||
viscosity(viscosityModel::New(mesh)),
|
||||
@ -107,13 +107,17 @@ Foam::solvers::incompressibleFluid::incompressibleFluid(fvMesh& mesh)
|
||||
(
|
||||
incompressible::momentumTransportModel::New
|
||||
(
|
||||
U,
|
||||
phi,
|
||||
U_,
|
||||
phi_,
|
||||
viscosity
|
||||
)
|
||||
),
|
||||
|
||||
MRF(mesh)
|
||||
MRF(mesh),
|
||||
|
||||
p(p_),
|
||||
U(U_),
|
||||
phi(phi_)
|
||||
{
|
||||
mesh.schemes().setFluxRequired(p.name());
|
||||
|
||||
@ -124,7 +128,7 @@ Foam::solvers::incompressibleFluid::incompressibleFluid(fvMesh& mesh)
|
||||
Info<< "Constructing face momentum Uf" << endl;
|
||||
|
||||
// Ensure the U BCs are up-to-date before constructing Uf
|
||||
U.correctBoundaryConditions();
|
||||
U_.correctBoundaryConditions();
|
||||
|
||||
Uf = new surfaceVectorField
|
||||
(
|
||||
|
||||
@ -81,7 +81,7 @@ protected:
|
||||
// Pressure
|
||||
|
||||
//- Pressure field
|
||||
volScalarField p;
|
||||
volScalarField p_;
|
||||
|
||||
//- Pressure reference
|
||||
Foam::pressureReference pressureReference;
|
||||
@ -90,10 +90,10 @@ protected:
|
||||
// Kinematic properties
|
||||
|
||||
//- Velocity field
|
||||
volVectorField U;
|
||||
volVectorField U_;
|
||||
|
||||
//- Mass-flux field
|
||||
surfaceScalarField phi;
|
||||
surfaceScalarField phi_;
|
||||
|
||||
|
||||
// Momentum transport
|
||||
@ -143,6 +143,18 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Public Data
|
||||
|
||||
//- Reference to the pressure field
|
||||
const volScalarField& p;
|
||||
|
||||
//- Reference to the velocity field
|
||||
const volVectorField& U;
|
||||
|
||||
//- Reference to the mass-flux field
|
||||
const surfaceScalarField& phi;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("incompressibleFluid");
|
||||
|
||||
|
||||
@ -31,6 +31,8 @@ License
|
||||
|
||||
void Foam::solvers::incompressibleFluid::momentumPredictor()
|
||||
{
|
||||
volVectorField& U(U_);
|
||||
|
||||
tUEqn =
|
||||
(
|
||||
fvm::ddt(U) + fvm::div(phi, U)
|
||||
|
||||
@ -45,13 +45,13 @@ void Foam::solvers::incompressibleFluid::moveMesh()
|
||||
{
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf();
|
||||
phi_ = mesh.Sf() & Uf();
|
||||
|
||||
correctUphiBCs(U, phi, true);
|
||||
correctUphiBCs(U_, phi_, true);
|
||||
|
||||
fv::correctPhi
|
||||
(
|
||||
phi,
|
||||
phi_,
|
||||
U,
|
||||
p,
|
||||
autoPtr<volScalarField>(),
|
||||
@ -61,7 +61,7 @@ void Foam::solvers::incompressibleFluid::moveMesh()
|
||||
);
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
fvc::makeRelative(phi_, U);
|
||||
}
|
||||
|
||||
meshCourantNo();
|
||||
|
||||
@ -40,6 +40,11 @@ License
|
||||
|
||||
void Foam::solvers::isothermalFluid::correctBuoyantPressure()
|
||||
{
|
||||
volScalarField& rho(rho_);
|
||||
volScalarField& p(p_);
|
||||
volVectorField& U(U_);
|
||||
surfaceScalarField& phi(phi_);
|
||||
|
||||
// Local references to the buoyancy parameters
|
||||
const volScalarField& gh = buoyancy->gh;
|
||||
const surfaceScalarField& ghf = buoyancy->ghf;
|
||||
@ -220,7 +225,7 @@ void Foam::solvers::isothermalFluid::correctBuoyantPressure()
|
||||
const bool constrained = fvConstraints().constrain(p);
|
||||
|
||||
// Thermodynamic density update
|
||||
thermo.correctRho(psi*p - psip0);
|
||||
thermo_.correctRho(psi*p - psip0);
|
||||
|
||||
if (constrained)
|
||||
{
|
||||
|
||||
@ -30,6 +30,8 @@ License
|
||||
|
||||
void Foam::solvers::isothermalFluid::correctDensity()
|
||||
{
|
||||
volScalarField& rho(rho_);
|
||||
|
||||
fvScalarMatrix rhoEqn
|
||||
(
|
||||
fvm::ddt(rho) + fvc::div(phi)
|
||||
|
||||
@ -41,6 +41,11 @@ License
|
||||
|
||||
void Foam::solvers::isothermalFluid::correctPressure()
|
||||
{
|
||||
volScalarField& rho(rho_);
|
||||
volScalarField& p(p_);
|
||||
volVectorField& U(U_);
|
||||
surfaceScalarField& phi(phi_);
|
||||
|
||||
const volScalarField& psi = thermo.psi();
|
||||
rho = thermo.rho();
|
||||
rho.relax();
|
||||
@ -199,7 +204,7 @@ void Foam::solvers::isothermalFluid::correctPressure()
|
||||
const bool constrained = fvConstraints().constrain(p);
|
||||
|
||||
// Thermodynamic density update
|
||||
thermo.correctRho(psi*p - psip0);
|
||||
thermo_.correctRho(psi*p - psip0);
|
||||
|
||||
if (constrained)
|
||||
{
|
||||
|
||||
@ -95,12 +95,12 @@ Foam::solvers::isothermalFluid::isothermalFluid
|
||||
:
|
||||
fluidSolver(mesh),
|
||||
|
||||
thermo_(thermoPtr),
|
||||
thermo(thermo_()),
|
||||
thermoPtr_(thermoPtr),
|
||||
thermo_(thermoPtr_()),
|
||||
|
||||
p(thermo.p()),
|
||||
p_(thermo_.p()),
|
||||
|
||||
rho
|
||||
rho_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -110,7 +110,7 @@ Foam::solvers::isothermalFluid::isothermalFluid
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo.renameRho()
|
||||
thermo_.renameRho()
|
||||
),
|
||||
|
||||
dpdt
|
||||
@ -122,22 +122,22 @@ Foam::solvers::isothermalFluid::isothermalFluid
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar(p.dimensions()/dimTime, 0)
|
||||
dimensionedScalar(p_.dimensions()/dimTime, 0)
|
||||
),
|
||||
|
||||
buoyancy(buoyancy::New(mesh)),
|
||||
|
||||
p_rgh(buoyancy.valid() ? buoyancy->p_rgh : p),
|
||||
p_rgh(buoyancy.valid() ? buoyancy->p_rgh : p_),
|
||||
|
||||
pressureReference
|
||||
(
|
||||
p,
|
||||
p_,
|
||||
p_rgh,
|
||||
pimple.dict(),
|
||||
thermo.incompressible()
|
||||
thermo_.incompressible()
|
||||
),
|
||||
|
||||
U
|
||||
U_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -150,7 +150,7 @@ Foam::solvers::isothermalFluid::isothermalFluid
|
||||
mesh
|
||||
),
|
||||
|
||||
phi
|
||||
phi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -160,25 +160,31 @@ Foam::solvers::isothermalFluid::isothermalFluid
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rho*U) & mesh.Sf()
|
||||
linearInterpolate(rho_*U_) & mesh.Sf()
|
||||
),
|
||||
|
||||
K("K", 0.5*magSqr(U)),
|
||||
K("K", 0.5*magSqr(U_)),
|
||||
|
||||
momentumTransport
|
||||
(
|
||||
compressible::momentumTransportModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
rho_,
|
||||
U_,
|
||||
phi_,
|
||||
thermo_
|
||||
)
|
||||
),
|
||||
|
||||
initialMass(fvc::domainIntegrate(rho)),
|
||||
initialMass(fvc::domainIntegrate(rho_)),
|
||||
|
||||
MRF(mesh)
|
||||
MRF(mesh),
|
||||
|
||||
thermo(thermo_),
|
||||
p(p_),
|
||||
rho(rho_),
|
||||
U(U_),
|
||||
phi(phi_)
|
||||
{
|
||||
// Read the controls
|
||||
readControls();
|
||||
@ -191,13 +197,13 @@ Foam::solvers::isothermalFluid::isothermalFluid
|
||||
hydrostaticInitialisation
|
||||
(
|
||||
p_rgh,
|
||||
p,
|
||||
rho,
|
||||
p_,
|
||||
rho_,
|
||||
U,
|
||||
buoyancy->gh,
|
||||
buoyancy->ghf,
|
||||
buoyancy->pRef,
|
||||
thermo,
|
||||
thermo_,
|
||||
pimple.dict()
|
||||
);
|
||||
|
||||
@ -222,7 +228,7 @@ Foam::solvers::isothermalFluid::isothermalFluid
|
||||
Info<< "Constructing face momentum rhoUf" << endl;
|
||||
|
||||
// Ensure the U BCs are up-to-date before constructing Uf
|
||||
U.correctBoundaryConditions();
|
||||
U_.correctBoundaryConditions();
|
||||
|
||||
rhoUf = new surfaceVectorField
|
||||
(
|
||||
@ -327,7 +333,7 @@ void Foam::solvers::isothermalFluid::preSolve()
|
||||
|
||||
void Foam::solvers::isothermalFluid::thermophysicalPredictor()
|
||||
{
|
||||
thermo.correct();
|
||||
thermo_.correct();
|
||||
}
|
||||
|
||||
|
||||
@ -364,7 +370,7 @@ void Foam::solvers::isothermalFluid::postSolve()
|
||||
|
||||
if (!mesh.schemes().steady())
|
||||
{
|
||||
rho = thermo.rho();
|
||||
rho_ = thermo.rho();
|
||||
|
||||
// Correct rhoUf with the updated density if the mesh is moving
|
||||
fvc::correctRhoUf(rhoUf, rho, U, phi, MRF);
|
||||
|
||||
@ -82,16 +82,16 @@ protected:
|
||||
// Thermophysical properties
|
||||
|
||||
//- Pointer to the fluid thermophysical properties
|
||||
autoPtr<fluidThermo> thermo_;
|
||||
autoPtr<fluidThermo> thermoPtr_;
|
||||
|
||||
//- Reference to the fluid thermophysical properties
|
||||
fluidThermo& thermo;
|
||||
fluidThermo& thermo_;
|
||||
|
||||
//- Reference to the pressure field
|
||||
volScalarField& p;
|
||||
volScalarField& p_;
|
||||
|
||||
//- The continuity density field
|
||||
volScalarField rho;
|
||||
volScalarField rho_;
|
||||
|
||||
//- Rate of change of the pressure
|
||||
// Used in the enthalpy equation
|
||||
@ -118,10 +118,10 @@ protected:
|
||||
// Kinematic properties
|
||||
|
||||
//- Velocity field
|
||||
volVectorField U;
|
||||
volVectorField U_;
|
||||
|
||||
//- Mass-flux field
|
||||
surfaceScalarField phi;
|
||||
surfaceScalarField phi_;
|
||||
|
||||
//- Kinetic energy field
|
||||
// Used in the energy equation
|
||||
@ -213,6 +213,24 @@ protected:
|
||||
|
||||
public:
|
||||
|
||||
// Public Data
|
||||
|
||||
//- Reference to the fluid thermophysical properties
|
||||
const fluidThermo& thermo;
|
||||
|
||||
//- Reference to the pressure field
|
||||
const volScalarField& p;
|
||||
|
||||
//- Reference to the continuity density field
|
||||
const volScalarField& rho;
|
||||
|
||||
//- Velocity field
|
||||
const volVectorField& U;
|
||||
|
||||
//- Mass-flux field
|
||||
const surfaceScalarField& phi;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("isothermalFluid");
|
||||
|
||||
|
||||
@ -31,6 +31,8 @@ License
|
||||
|
||||
void Foam::solvers::isothermalFluid::momentumPredictor()
|
||||
{
|
||||
volVectorField& U(U_);
|
||||
|
||||
tUEqn =
|
||||
(
|
||||
fvm::ddt(rho, U) + fvm::div(phi, U)
|
||||
|
||||
@ -54,13 +54,13 @@ void Foam::solvers::isothermalFluid::moveMesh()
|
||||
{
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi = mesh.Sf() & rhoUf();
|
||||
phi_ = mesh.Sf() & rhoUf();
|
||||
|
||||
correctUphiBCs(rho, U, phi, true);
|
||||
correctUphiBCs(rho, U_, phi_, true);
|
||||
|
||||
fv::correctPhi
|
||||
(
|
||||
phi,
|
||||
phi_,
|
||||
buoyancy.valid() ? p_rgh : p,
|
||||
thermo.psi(),
|
||||
autoPtr<volScalarField>(),
|
||||
@ -69,7 +69,7 @@ void Foam::solvers::isothermalFluid::moveMesh()
|
||||
);
|
||||
|
||||
// Make the fluxes relative to the mesh-motion
|
||||
fvc::makeRelative(phi, rho, U);
|
||||
fvc::makeRelative(phi_, rho, U);
|
||||
}
|
||||
|
||||
meshCourantNo();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,22 +49,25 @@ Foam::solvers::multicomponentFluid::multicomponentFluid(fvMesh& mesh)
|
||||
autoPtr<fluidThermo>(fluidMulticomponentThermo::New(mesh).ptr())
|
||||
),
|
||||
|
||||
thermo(refCast<fluidMulticomponentThermo>(isothermalFluid::thermo)),
|
||||
thermo_(refCast<fluidMulticomponentThermo>(isothermalFluid::thermo_)),
|
||||
|
||||
composition(thermo.composition()),
|
||||
composition(thermo_.composition()),
|
||||
|
||||
Y(composition.Y()),
|
||||
Y_(composition.Y()),
|
||||
|
||||
reaction(combustionModel::New(thermo, momentumTransport())),
|
||||
reaction(combustionModel::New(thermo_, momentumTransport())),
|
||||
|
||||
thermophysicalTransport
|
||||
(
|
||||
fluidMulticomponentThermophysicalTransportModel::New
|
||||
(
|
||||
momentumTransport(),
|
||||
thermo
|
||||
thermo_
|
||||
)
|
||||
)
|
||||
),
|
||||
|
||||
thermo(thermo_),
|
||||
Y(Y_)
|
||||
{
|
||||
thermo.validate(type(), "h", "e");
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -81,13 +81,13 @@ protected:
|
||||
|
||||
// Thermophysical properties
|
||||
|
||||
fluidMulticomponentThermo& thermo;
|
||||
fluidMulticomponentThermo& thermo_;
|
||||
|
||||
|
||||
// Composition
|
||||
|
||||
basicSpecieMixture& composition;
|
||||
PtrList<volScalarField>& Y;
|
||||
PtrList<volScalarField>& Y_;
|
||||
|
||||
|
||||
// Reactions
|
||||
@ -112,6 +112,15 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
// Public Data
|
||||
|
||||
//- Reference to the fluid thermophysical properties
|
||||
const fluidMulticomponentThermo& thermo;
|
||||
|
||||
//- Reference to the composition
|
||||
const PtrList<volScalarField>& Y;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("multicomponentFluid");
|
||||
|
||||
|
||||
@ -108,7 +108,7 @@ void Foam::solvers::multicomponentFluid::setRDeltaT()
|
||||
{
|
||||
if (composition.solve(i))
|
||||
{
|
||||
volScalarField& Yi = Y[i];
|
||||
volScalarField& Yi = Y_[i];
|
||||
|
||||
if (Yref.found(Yi.name()))
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -47,7 +47,7 @@ void Foam::solvers::multicomponentFluid::thermophysicalPredictor()
|
||||
{
|
||||
if (composition.solve(i))
|
||||
{
|
||||
volScalarField& Yi = Y[i];
|
||||
volScalarField& Yi = Y_[i];
|
||||
|
||||
fvScalarMatrix YiEqn
|
||||
(
|
||||
@ -72,7 +72,7 @@ void Foam::solvers::multicomponentFluid::thermophysicalPredictor()
|
||||
composition.normalise();
|
||||
|
||||
|
||||
volScalarField& he = thermo.he();
|
||||
volScalarField& he = thermo_.he();
|
||||
|
||||
fvScalarMatrix EEqn
|
||||
(
|
||||
@ -102,7 +102,7 @@ void Foam::solvers::multicomponentFluid::thermophysicalPredictor()
|
||||
|
||||
fvConstraints().constrain(he);
|
||||
|
||||
thermo.correct();
|
||||
thermo_.correct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -31,6 +31,8 @@ License
|
||||
|
||||
void Foam::solvers::shockFluid::correctDensity()
|
||||
{
|
||||
volScalarField& rho(rho_);
|
||||
|
||||
fvScalarMatrix rhoEqn
|
||||
(
|
||||
fvm::ddt(rho) + fvc::div(phi)
|
||||
|
||||
@ -124,7 +124,7 @@ void Foam::solvers::shockFluid::fluxPredictor()
|
||||
aphiv_pos = surfaceScalarField::New("aphiv_pos", phiv_pos - aSf());
|
||||
aphiv_neg = surfaceScalarField::New("aphiv_neg", phiv_neg + aSf());
|
||||
|
||||
phi = aphiv_pos()*rho_pos() + aphiv_neg()*rho_neg();
|
||||
phi_ = aphiv_pos()*rho_pos() + aphiv_neg()*rho_neg();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -31,6 +31,8 @@ License
|
||||
|
||||
void Foam::solvers::shockFluid::momentumPredictor()
|
||||
{
|
||||
volVectorField& U(U_);
|
||||
|
||||
const surfaceVectorField phiUp
|
||||
(
|
||||
(aphiv_pos()*rhoU_pos() + aphiv_neg()*rhoU_neg())
|
||||
|
||||
@ -30,9 +30,9 @@ License
|
||||
void Foam::solvers::shockFluid::pressureCorrector()
|
||||
{
|
||||
const volScalarField& psi = thermo.psi();
|
||||
p.ref() = rho()/psi();
|
||||
p.correctBoundaryConditions();
|
||||
rho.boundaryFieldRef() == psi.boundaryField()*p.boundaryField();
|
||||
p_.ref() = rho()/psi();
|
||||
p_.correctBoundaryConditions();
|
||||
rho_.boundaryFieldRef() == psi.boundaryField()*p.boundaryField();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -94,13 +94,13 @@ Foam::solvers::shockFluid::shockFluid(fvMesh& mesh)
|
||||
:
|
||||
fluidSolver(mesh),
|
||||
|
||||
thermo_(psiThermo::New(mesh)),
|
||||
thermoPtr_(psiThermo::New(mesh)),
|
||||
|
||||
thermo(thermo_()),
|
||||
thermo_(thermoPtr_()),
|
||||
|
||||
p(thermo.p()),
|
||||
p_(thermo_.p()),
|
||||
|
||||
rho
|
||||
rho_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -110,10 +110,10 @@ Foam::solvers::shockFluid::shockFluid(fvMesh& mesh)
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
thermo.renameRho()
|
||||
thermo_.renameRho()
|
||||
),
|
||||
|
||||
U
|
||||
U_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -126,7 +126,7 @@ Foam::solvers::shockFluid::shockFluid(fvMesh& mesh)
|
||||
mesh
|
||||
),
|
||||
|
||||
phi
|
||||
phi_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -136,14 +136,14 @@ Foam::solvers::shockFluid::shockFluid(fvMesh& mesh)
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
linearInterpolate(rho*U) & mesh.Sf()
|
||||
linearInterpolate(rho_*U_) & mesh.Sf()
|
||||
),
|
||||
|
||||
K("K", 0.5*magSqr(U)),
|
||||
K("K", 0.5*magSqr(U_)),
|
||||
|
||||
inviscid
|
||||
(
|
||||
max(thermo.mu()().primitiveField()) > 0
|
||||
max(thermo_.mu()().primitiveField()) > 0
|
||||
? false
|
||||
: true
|
||||
),
|
||||
@ -154,10 +154,10 @@ Foam::solvers::shockFluid::shockFluid(fvMesh& mesh)
|
||||
? autoPtr<compressibleMomentumTransportModel>(nullptr)
|
||||
: compressible::momentumTransportModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
phi,
|
||||
thermo
|
||||
rho_,
|
||||
U_,
|
||||
phi_,
|
||||
thermo_
|
||||
)
|
||||
),
|
||||
|
||||
@ -168,14 +168,20 @@ Foam::solvers::shockFluid::shockFluid(fvMesh& mesh)
|
||||
: fluidThermoThermophysicalTransportModel::New
|
||||
(
|
||||
momentumTransport(),
|
||||
thermo
|
||||
thermo_
|
||||
)
|
||||
),
|
||||
|
||||
fluxScheme
|
||||
(
|
||||
mesh.schemes().dict().lookupOrDefault<word>("fluxScheme", "Kurganov")
|
||||
)
|
||||
),
|
||||
|
||||
thermo(thermo_),
|
||||
p(p_),
|
||||
rho(rho_),
|
||||
U(U_),
|
||||
phi(phi_)
|
||||
{
|
||||
// Read the controls
|
||||
readControls();
|
||||
|
||||
@ -78,25 +78,25 @@ protected:
|
||||
// Thermophysical properties
|
||||
|
||||
//- Pointer to the fluid thermophysical properties
|
||||
autoPtr<psiThermo> thermo_;
|
||||
autoPtr<psiThermo> thermoPtr_;
|
||||
|
||||
//- Reference to the fluid thermophysical properties
|
||||
psiThermo& thermo;
|
||||
psiThermo& thermo_;
|
||||
|
||||
//- Reference to the pressure field
|
||||
volScalarField& p;
|
||||
volScalarField& p_;
|
||||
|
||||
//- The continuity density field
|
||||
volScalarField rho;
|
||||
volScalarField rho_;
|
||||
|
||||
|
||||
// Kinematic properties
|
||||
|
||||
//- Velocity field
|
||||
volVectorField U;
|
||||
volVectorField U_;
|
||||
|
||||
//- Mass-flux field
|
||||
surfaceScalarField phi;
|
||||
surfaceScalarField phi_;
|
||||
|
||||
//- Kinetic energy field
|
||||
// Used in the energy equation
|
||||
@ -201,6 +201,24 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
// Public Data
|
||||
|
||||
//- Reference to the fluid thermophysical properties
|
||||
const psiThermo& thermo;
|
||||
|
||||
//- Reference to the pressure field
|
||||
const volScalarField& p;
|
||||
|
||||
//- Reference to the continuity density field
|
||||
const volScalarField& rho;
|
||||
|
||||
//- Reference to the velocity field
|
||||
const volVectorField& U;
|
||||
|
||||
//- Reference to the mass-flux field
|
||||
const surfaceScalarField& phi;
|
||||
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("shockFluid");
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ License
|
||||
|
||||
void Foam::solvers::shockFluid::thermophysicalPredictor()
|
||||
{
|
||||
volScalarField& e = thermo.he();
|
||||
volScalarField& e = thermo_.he();
|
||||
|
||||
const surfaceScalarField e_pos(interpolate(e, pos, thermo.T().name()));
|
||||
const surfaceScalarField e_neg(interpolate(e, neg, thermo.T().name()));
|
||||
@ -78,7 +78,7 @@ void Foam::solvers::shockFluid::thermophysicalPredictor()
|
||||
|
||||
fvConstraints().constrain(e);
|
||||
|
||||
thermo.correct();
|
||||
thermo_.correct();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user