solvers::*:moveMesh: rationalised the application of correctPhi

Flux correction is now applied if either the topology changed or the mesh is
moving and correctPhi is true.  This strategy allows moving mesh cases without
topology change to be run without any change to the fluxes which is appropriate
for solid-body motion of the entire domain or a rotating sub-domain with NCC.
This commit is contained in:
Henry Weller
2023-03-25 15:36:09 +00:00
parent 92dacbfcf0
commit 7b4002fec2
6 changed files with 89 additions and 99 deletions

View File

@ -35,7 +35,7 @@ void Foam::solvers::VoFSolver::moveMesh()
{ {
if if
( (
correctPhi (correctPhi || mesh.topoChanged())
&& divergent() && divergent()
&& !divU.valid() && !divU.valid()
) )
@ -65,8 +65,6 @@ void Foam::solvers::VoFSolver::moveMesh()
correctUphiBCs(U_, phi, true); correctUphiBCs(U_, phi, true);
if (correctPhi)
{
if (divU.valid()) if (divU.valid())
{ {
CorrectPhi CorrectPhi
@ -93,7 +91,6 @@ void Foam::solvers::VoFSolver::moveMesh()
pimple pimple
); );
} }
}
// Make the fluxes relative to the mesh motion // Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U); fvc::makeRelative(phi, U);

View File

@ -48,8 +48,6 @@ void Foam::solvers::incompressibleFluid::moveMesh()
correctUphiBCs(U, phi, true); correctUphiBCs(U, phi, true);
if (correctPhi)
{
CorrectPhi CorrectPhi
( (
phi, phi,
@ -60,7 +58,6 @@ void Foam::solvers::incompressibleFluid::moveMesh()
pressureReference, pressureReference,
pimple pimple
); );
}
// Make the flux relative to the mesh motion // Make the flux relative to the mesh motion
fvc::makeRelative(phi, U); fvc::makeRelative(phi, U);

View File

@ -57,8 +57,6 @@ void Foam::solvers::isothermalFluid::moveMesh()
correctUphiBCs(rho, U, phi, true); correctUphiBCs(rho, U, phi, true);
if (correctPhi)
{
CorrectPhi CorrectPhi
( (
phi, phi,
@ -69,7 +67,6 @@ void Foam::solvers::isothermalFluid::moveMesh()
divrhoU(), divrhoU(),
pimple pimple
); );
}
// Make the fluxes relative to the mesh-motion // Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U); fvc::makeRelative(phi, rho, U);

View File

@ -37,7 +37,11 @@ void Foam::solvers::multiphaseEuler::moveMesh()
&& (pimple.firstIter() || pimple.moveMeshOuterCorrectors()) && (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
) )
{ {
if (correctPhi && !divU.valid()) if
(
(correctPhi || mesh.topoChanged())
&& !divU.valid()
)
{ {
// Construct and register divU for mapping // Construct and register divU for mapping
divU = new volScalarField divU = new volScalarField
@ -53,20 +57,22 @@ void Foam::solvers::multiphaseEuler::moveMesh()
// Move the mesh // Move the mesh
mesh_.move(); mesh_.move();
if (mesh.changing() || mesh.topoChanged()) if (mesh.changing())
{ {
buoyancy.moveMesh(); buoyancy.moveMesh();
if (correctPhi || mesh.topoChanged())
{
fluid.meshUpdate(); fluid.meshUpdate();
fluid.correctPhi fluid.correctPhi
( (
p_rgh, p_rgh,
divU, divU,
correctPhi,
pressureReference, pressureReference,
pimple pimple
); );
}
meshCourantNo(); meshCourantNo();
} }

View File

@ -727,7 +727,6 @@ void Foam::phaseSystem::correctPhi
( (
const volScalarField& p_rgh, const volScalarField& p_rgh,
const tmp<volScalarField>& divU, const tmp<volScalarField>& divU,
const bool correctPhi,
const pressureReference& pressureReference, const pressureReference& pressureReference,
nonOrthogonalSolutionControl& pimple nonOrthogonalSolutionControl& pimple
) )
@ -760,7 +759,6 @@ void Foam::phaseSystem::correctPhi
// Correct fixed-flux BCs to be consistent with the velocity BCs // Correct fixed-flux BCs to be consistent with the velocity BCs
correctBoundaryFlux(); correctBoundaryFlux();
{
phi_ = Zero; phi_ = Zero;
PtrList<surfaceScalarField> alphafs(phaseModels_.size()); PtrList<surfaceScalarField> alphafs(phaseModels_.size());
forAll(movingPhases(), movingPhasei) forAll(movingPhases(), movingPhasei)
@ -776,8 +774,6 @@ void Foam::phaseSystem::correctPhi
phi_ += alphafs[phasei]*(mesh_.Sf() & phase.UfRef()); phi_ += alphafs[phasei]*(mesh_.Sf() & phase.UfRef());
} }
if (correctPhi)
{
CorrectPhi CorrectPhi
( (
phi_, phi_,
@ -789,13 +785,11 @@ void Foam::phaseSystem::correctPhi
pressureReference, pressureReference,
pimple pimple
); );
}
// Make the flux relative to the mesh motion // Make the flux relative to the mesh motion
fvc::makeRelative(phi_, movingPhases()[0].U()); fvc::makeRelative(phi_, movingPhases()[0].U());
setMixturePhi(alphafs, phi_); setMixturePhi(alphafs, phi_);
}
} }

View File

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