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 // Read the controls
readControls(); readControls();
if (correctPhi) if (correctPhi || mesh.topoChanging())
{ {
rAU = new volScalarField rAU = new volScalarField
( (

View File

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

View File

@ -102,9 +102,7 @@ Foam::solvers::incompressibleMultiphaseVoF::incompressibleMultiphaseVoF
// Read the controls // Read the controls
readControls(); readControls();
if (!runTime.restart() || !divergent()) if (correctPhi || mesh.topoChanging())
{
if (correctPhi)
{ {
rAU = new volScalarField rAU = new volScalarField
( (
@ -119,9 +117,14 @@ Foam::solvers::incompressibleMultiphaseVoF::incompressibleMultiphaseVoF
mesh, mesh,
dimensionedScalar(dimTime/dimDensity, 1) dimensionedScalar(dimTime/dimDensity, 1)
); );
}
if (!runTime.restart() || !divergent())
{
correctUphiBCs(U_, phi, true); correctUphiBCs(U_, phi, true);
if (correctPhi)
{
CorrectPhi CorrectPhi
( (
phi, phi,
@ -135,8 +138,6 @@ Foam::solvers::incompressibleMultiphaseVoF::incompressibleMultiphaseVoF
} }
else else
{ {
correctUphiBCs(U_, phi, true);
CorrectPhi CorrectPhi
( (
phi, phi,

View File

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

View File

@ -298,7 +298,7 @@ void Foam::solvers::isothermalFluid::preSolve()
// Store divrhoU from the previous mesh so that it can be mapped // Store divrhoU from the previous mesh so that it can be mapped
// and used in correctPhi to ensure the corrected phi has the // and used in correctPhi to ensure the corrected phi has the
// same divergence // same divergence
if (correctPhi) if (correctPhi || mesh.topoChanging())
{ {
divrhoU = new volScalarField 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 // Store divU from the previous mesh so that it can be
// mapped and used in correctPhi to ensure the corrected phi // mapped and used in correctPhi to ensure the corrected phi
// has the same divergence // has the same divergence
if (correctPhi) if (correctPhi || mesh.topoChanging())
{ {
// Construct and register divU for mapping // Construct and register divU for mapping
divU = new volScalarField divU = new volScalarField