solvers/modules: Updated correctPhi logic so that it is not required following topology change

Now fluxes are updated from the mapped fields following mesh topology change
with or without implicit continuity correction enabled by the optional
correctPhi switch.
This commit is contained in:
Henry Weller
2022-11-20 20:22:59 +00:00
parent 691866d782
commit 084097bab9
7 changed files with 68 additions and 56 deletions

View File

@ -45,7 +45,7 @@ bool Foam::solvers::compressibleVoF::moveMesh()
// Move the mesh
mesh.move();
if (mesh.changing())
if (correctPhi || mesh.topoChanged())
{
buoyancy.moveMesh();
@ -59,16 +59,19 @@ bool Foam::solvers::compressibleVoF::moveMesh()
correctUphiBCs(U, phi, true);
CorrectPhi
(
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
divU(),
pressureReference,
pimple
);
if (correctPhi)
{
CorrectPhi
(
phi,
U,
p_rgh,
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
divU(),
pressureReference,
pimple
);
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -39,7 +39,7 @@ bool Foam::solvers::incompressibleFluid::moveMesh()
{
MRF.update();
if (correctPhi)
if (correctPhi || mesh.topoChanged())
{
// Calculate absolute flux
// from the mapped surface velocity
@ -47,16 +47,19 @@ bool Foam::solvers::incompressibleFluid::moveMesh()
correctUphiBCs(U, phi, true);
CorrectPhi
(
phi,
U,
p,
dimensionedScalar("rAUf", dimTime, 1),
geometricZeroField(),
pressureReference,
pimple
);
if (correctPhi)
{
CorrectPhi
(
phi,
U,
p,
dimensionedScalar("rAUf", dimTime, 1),
geometricZeroField(),
pressureReference,
pimple
);
}
// Make the flux relative to the mesh motion
fvc::makeRelative(phi, U);

View File

@ -44,7 +44,7 @@ bool Foam::solvers::isothermalFluid::moveMesh()
MRF.update();
if (correctPhi)
if (correctPhi || mesh.topoChanged())
{
// Calculate absolute flux
// from the mapped surface velocity
@ -52,16 +52,19 @@ bool Foam::solvers::isothermalFluid::moveMesh()
correctUphiBCs(rho, U, phi, true);
CorrectPhi
(
phi,
buoyancy.valid() ? p_rgh : p,
rho,
thermo.psi(),
dimensionedScalar("rAUf", dimTime, 1),
divrhoU(),
pimple
);
if (correctPhi)
{
CorrectPhi
(
phi,
buoyancy.valid() ? p_rgh : p,
rho,
thermo.psi(),
dimensionedScalar("rAUf", dimTime, 1),
divrhoU(),
pimple
);
}
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);

View File

@ -53,22 +53,20 @@ bool Foam::solvers::multiphaseEuler::moveMesh()
// Move the mesh
mesh.move();
if (mesh.changing())
if (mesh.changing() || mesh.topoChanged())
{
buoyancy.moveMesh();
fluid.meshUpdate();
if (correctPhi)
{
fluid.correctPhi
(
p_rgh,
divU,
pressureReference,
pimple
);
}
fluid.correctPhi
(
p_rgh,
divU,
correctPhi,
pressureReference,
pimple
);
meshCourantNo();

View File

@ -207,7 +207,7 @@ void Foam::solvers::multiphaseEuler::preSolve()
// Store divU from the previous mesh so that it can be
// mapped and used in correctPhi to ensure the corrected phi
// has the same divergence
if (correctPhi && mesh.topoChanged())
if (correctPhi)
{
// Construct and register divU for mapping
divU = new volScalarField

View File

@ -710,6 +710,7 @@ void Foam::phaseSystem::correctPhi
(
const volScalarField& p_rgh,
const tmp<volScalarField>& divU,
const bool correctPhi,
const pressureReference& pressureReference,
nonOrthogonalSolutionControl& pimple
)
@ -758,17 +759,20 @@ void Foam::phaseSystem::correctPhi
phi_ += alphafs[phasei]*(mesh_.Sf() & phase.Uf());
}
CorrectPhi
(
phi_,
movingPhases()[0].U(),
p_rgh,
// surfaceScalarField("rAUf", fvc::interpolate(rAU())),
dimensionedScalar(dimTime/dimDensity, 1),
divU(),
pressureReference,
pimple
);
if (correctPhi)
{
CorrectPhi
(
phi_,
movingPhases()[0].U(),
p_rgh,
// surfaceScalarField("rAUf", fvc::interpolate(rAU())),
dimensionedScalar(dimTime/dimDensity, 1),
divU(),
pressureReference,
pimple
);
}
// Make the flux relative to the mesh motion
fvc::makeRelative(phi_, movingPhases()[0].U());

View File

@ -651,6 +651,7 @@ public:
(
const volScalarField& p_rgh,
const tmp<volScalarField>& divU,
const bool correctPhi,
const pressureReference& pressureReference,
nonOrthogonalSolutionControl& pimple
);