multiphaseEuler::cellPressureCorrector: Use constrainH rather than constrainHbyA

This commit is contained in:
Henry Weller
2023-04-01 17:22:14 +01:00
parent bcddcc89f6
commit f6a730f0ac
3 changed files with 69 additions and 20 deletions

View File

@ -168,37 +168,32 @@ void Foam::solvers::multiphaseEuler::cellPressureCorrector()
const volScalarField& alpha = phase; const volScalarField& alpha = phase;
const label phasei = phase.index(); const label phasei = phase.index();
HbyAs.set const volVectorField H
( (
phasei, constrainH
constrainHbyA
( (
rAUs[phasei] UEqns[phasei].H()
*( + byDt
UEqns[phasei].H() (
+ byDt max(phase.residualAlpha() - alpha, scalar(0))
( *phase.rho()
max(phase.residualAlpha() - alpha, scalar(0)) )
*phase.rho() *phase.U()().oldTime(),
) rAUs[phasei],
*phase.U()().oldTime()
),
phase.U(), phase.U(),
p_rgh p_rgh
) )
); );
HbyAs.set(phasei, rAUs[phasei]*H);
phiHbyAs.set phiHbyAs.set
( (
phasei, phasei,
new surfaceScalarField new surfaceScalarField
( (
IOobject::groupName("phiHbyA", phase.name()), IOobject::groupName("phiHbyA", phase.name()),
rAUfs[phasei] rAUfs[phasei]*(fvc::flux(H) + ddtCorrs[phasei])
*(
fvc::flux(HbyAs[phasei]/rAUs[phasei])
+ ddtCorrs[phasei]
)
- alpharAUfs[phasei]*phigFs[phasei] - alpharAUfs[phasei]*phigFs[phasei]
- rAUfs[phasei]*Fs[phasei] - rAUfs[phasei]*Fs[phasei]
) )

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -75,6 +75,52 @@ Foam::tmp<Foam::volVectorField> Foam::constrainHbyA
} }
Foam::tmp<Foam::volVectorField> Foam::constrainH
(
const tmp<volVectorField>& tH,
const volScalarField& rA,
const volVectorField& U,
const volScalarField& p
)
{
tmp<volVectorField> tHNew;
if (tH.isTmp())
{
tHNew = tH;
tHNew.ref().rename(IOobject::groupName("H", U.group()));
}
else
{
tHNew = volVectorField::New
(
IOobject::groupName("H", U.group()),
tH
);
}
volVectorField& H = tHNew.ref();
volVectorField::Boundary& Hbf = H.boundaryFieldRef();
forAll(U.boundaryField(), patchi)
{
if
(
!U.boundaryField()[patchi].assignable()
&& !isA<fixedFluxExtrapolatedPressureFvPatchScalarField>
(
p.boundaryField()[patchi]
)
)
{
Hbf[patchi] = U.boundaryField()[patchi]/rA.boundaryField()[patchi];
}
}
return tHNew;
}
Foam::tmp<Foam::surfaceScalarField> Foam::constrainPhiHbyA Foam::tmp<Foam::surfaceScalarField> Foam::constrainPhiHbyA
( (
const tmp<surfaceScalarField>& tphiHbyA, const tmp<surfaceScalarField>& tphiHbyA,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -51,6 +51,14 @@ tmp<volVectorField> constrainHbyA
const volScalarField& p const volScalarField& p
); );
tmp<volVectorField> constrainH
(
const tmp<volVectorField>& tH,
const volScalarField& rA,
const volVectorField& U,
const volScalarField& p
);
tmp<surfaceScalarField> constrainPhiHbyA tmp<surfaceScalarField> constrainPhiHbyA
( (
const tmp<surfaceScalarField>& tphiHbyA, const tmp<surfaceScalarField>& tphiHbyA,