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 label phasei = phase.index();
HbyAs.set
const volVectorField H
(
phasei,
constrainHbyA
constrainH
(
rAUs[phasei]
*(
UEqns[phasei].H()
+ byDt
(
max(phase.residualAlpha() - alpha, scalar(0))
*phase.rho()
)
*phase.U()().oldTime()
),
UEqns[phasei].H()
+ byDt
(
max(phase.residualAlpha() - alpha, scalar(0))
*phase.rho()
)
*phase.U()().oldTime(),
rAUs[phasei],
phase.U(),
p_rgh
)
);
HbyAs.set(phasei, rAUs[phasei]*H);
phiHbyAs.set
(
phasei,
new surfaceScalarField
(
IOobject::groupName("phiHbyA", phase.name()),
rAUfs[phasei]
*(
fvc::flux(HbyAs[phasei]/rAUs[phasei])
+ ddtCorrs[phasei]
)
rAUfs[phasei]*(fvc::flux(H) + ddtCorrs[phasei])
- alpharAUfs[phasei]*phigFs[phasei]
- rAUfs[phasei]*Fs[phasei]
)

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
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
(
const tmp<surfaceScalarField>& tphiHbyA,

View File

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