Files
OpenFOAM-12/applications/solvers/modules/compressibleVoF/alphaSuSp.H
Henry Weller 29b82422d7 applications/solvers/modules: Reorganised to match the structure of tutorials/modules
Given that the number of solid solver modules is currently 1 and unlikely to
exceed 3 it is not very useful to maintain solid and fluid sub-directories and
easier to see the correspondence between the solver modules and tutorial cases
without.
2022-11-16 23:28:59 +00:00

52 lines
1018 B
C++

tmp<volScalarField::Internal> Sp
(
volScalarField::Internal::New
(
"Sp",
mesh,
dimensionedScalar(dgdt.dimensions(), 0)
)
);
tmp<volScalarField::Internal> Su
(
volScalarField::Internal::New
(
"Su",
mesh,
dimensionedScalar(dgdt.dimensions(), 0)
)
);
if (fvModels().addsSupToField(alpha1.name()))
{
// Phase change alpha1 source
const fvScalarMatrix alphaSup(fvModels().source(alpha1));
Su = alphaSup.Su();
Sp = alphaSup.Sp();
}
volScalarField::Internal& SpRef = Sp.ref();
volScalarField::Internal& SuRef = Su.ref();
forAll(dgdt, celli)
{
if (dgdt[celli] > 0.0)
{
SpRef[celli] -= dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
SuRef[celli] += dgdt[celli]/max(1.0 - alpha1[celli], 1e-4);
}
else if (dgdt[celli] < 0.0)
{
SpRef[celli] += dgdt[celli]/max(alpha1[celli], 1e-4);
}
}
tmp<volScalarField> divU
(
mesh.moving()
? fvc::div(phiCN() + mesh.phi())
: fvc::div(phiCN())
);