solvers: Cache rAU and/or divU fields for CorrectPhi if mesh.topoChanging()

This commit is contained in:
Henry Weller
2023-04-01 09:56:52 +01:00
parent 07478d25c0
commit de174c2b82
6 changed files with 42 additions and 40 deletions

View File

@ -102,7 +102,7 @@ Foam::solvers::compressibleMultiphaseVoF::compressibleMultiphaseVoF
// Read the controls
readControls();
if (correctPhi)
if (correctPhi || mesh.topoChanging())
{
rAU = new volScalarField
(

View File

@ -119,7 +119,7 @@ Foam::solvers::compressibleVoF::compressibleVoF(fvMesh& mesh)
// Read the controls
readControls();
if (correctPhi)
if (correctPhi || mesh.topoChanging())
{
rAU = new volScalarField
(

View File

@ -102,26 +102,29 @@ Foam::solvers::incompressibleMultiphaseVoF::incompressibleMultiphaseVoF
// Read the controls
readControls();
if (correctPhi || mesh.topoChanging())
{
rAU = new volScalarField
(
IOobject
(
"rAU",
runTime.name(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar(dimTime/dimDensity, 1)
);
}
if (!runTime.restart() || !divergent())
{
correctUphiBCs(U_, phi, true);
if (correctPhi)
{
rAU = new volScalarField
(
IOobject
(
"rAU",
runTime.name(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar(dimTime/dimDensity, 1)
);
correctUphiBCs(U_, phi, true);
CorrectPhi
(
phi,
@ -135,8 +138,6 @@ Foam::solvers::incompressibleMultiphaseVoF::incompressibleMultiphaseVoF
}
else
{
correctUphiBCs(U_, phi, true);
CorrectPhi
(
phi,

View File

@ -87,26 +87,29 @@ Foam::solvers::incompressibleVoF::incompressibleVoF(fvMesh& mesh)
// Read the controls
readControls();
if (correctPhi || mesh.topoChanging())
{
rAU = new volScalarField
(
IOobject
(
"rAU",
runTime.name(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar(dimTime/dimDensity, 1)
);
}
if (!runTime.restart() || !divergent())
{
correctUphiBCs(U_, phi, true);
if (correctPhi)
{
rAU = new volScalarField
(
IOobject
(
"rAU",
runTime.name(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar(dimTime/dimDensity, 1)
);
correctUphiBCs(U_, phi, true);
CorrectPhi
(
phi,
@ -120,8 +123,6 @@ Foam::solvers::incompressibleVoF::incompressibleVoF(fvMesh& mesh)
}
else
{
correctUphiBCs(U_, phi, true);
CorrectPhi
(
phi,

View File

@ -298,7 +298,7 @@ void Foam::solvers::isothermalFluid::preSolve()
// Store divrhoU 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)
if (correctPhi || mesh.topoChanging())
{
divrhoU = new volScalarField
(

View File

@ -215,7 +215,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)
if (correctPhi || mesh.topoChanging())
{
// Construct and register divU for mapping
divU = new volScalarField