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:
@ -35,7 +35,7 @@ void Foam::solvers::VoFSolver::moveMesh()
|
||||
{
|
||||
if
|
||||
(
|
||||
correctPhi
|
||||
(correctPhi || mesh.topoChanged())
|
||||
&& divergent()
|
||||
&& !divU.valid()
|
||||
)
|
||||
@ -65,34 +65,31 @@ void Foam::solvers::VoFSolver::moveMesh()
|
||||
|
||||
correctUphiBCs(U_, phi, true);
|
||||
|
||||
if (correctPhi)
|
||||
if (divU.valid())
|
||||
{
|
||||
if (divU.valid())
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
divU(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
geometricZeroField(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
divU(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p_rgh,
|
||||
surfaceScalarField("rAUf", fvc::interpolate(rAU())),
|
||||
geometricZeroField(),
|
||||
pressureReference(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
|
||||
@ -48,19 +48,16 @@ void Foam::solvers::incompressibleFluid::moveMesh()
|
||||
|
||||
correctUphiBCs(U, phi, true);
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
geometricZeroField(),
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
}
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
U,
|
||||
p,
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
geometricZeroField(),
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
@ -57,19 +57,16 @@ void Foam::solvers::isothermalFluid::moveMesh()
|
||||
|
||||
correctUphiBCs(rho, U, phi, true);
|
||||
|
||||
if (correctPhi)
|
||||
{
|
||||
CorrectPhi
|
||||
(
|
||||
phi,
|
||||
buoyancy.valid() ? p_rgh : p,
|
||||
rho,
|
||||
thermo.psi(),
|
||||
dimensionedScalar("rAUf", dimTime, 1),
|
||||
divrhoU(),
|
||||
pimple
|
||||
);
|
||||
}
|
||||
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);
|
||||
|
||||
@ -37,7 +37,11 @@ void Foam::solvers::multiphaseEuler::moveMesh()
|
||||
&& (pimple.firstIter() || pimple.moveMeshOuterCorrectors())
|
||||
)
|
||||
{
|
||||
if (correctPhi && !divU.valid())
|
||||
if
|
||||
(
|
||||
(correctPhi || mesh.topoChanged())
|
||||
&& !divU.valid()
|
||||
)
|
||||
{
|
||||
// Construct and register divU for mapping
|
||||
divU = new volScalarField
|
||||
@ -53,20 +57,22 @@ void Foam::solvers::multiphaseEuler::moveMesh()
|
||||
// Move the mesh
|
||||
mesh_.move();
|
||||
|
||||
if (mesh.changing() || mesh.topoChanged())
|
||||
if (mesh.changing())
|
||||
{
|
||||
buoyancy.moveMesh();
|
||||
|
||||
fluid.meshUpdate();
|
||||
if (correctPhi || mesh.topoChanged())
|
||||
{
|
||||
fluid.meshUpdate();
|
||||
|
||||
fluid.correctPhi
|
||||
(
|
||||
p_rgh,
|
||||
divU,
|
||||
correctPhi,
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
fluid.correctPhi
|
||||
(
|
||||
p_rgh,
|
||||
divU,
|
||||
pressureReference,
|
||||
pimple
|
||||
);
|
||||
}
|
||||
|
||||
meshCourantNo();
|
||||
}
|
||||
|
||||
@ -727,7 +727,6 @@ void Foam::phaseSystem::correctPhi
|
||||
(
|
||||
const volScalarField& p_rgh,
|
||||
const tmp<volScalarField>& divU,
|
||||
const bool correctPhi,
|
||||
const pressureReference& pressureReference,
|
||||
nonOrthogonalSolutionControl& pimple
|
||||
)
|
||||
@ -760,42 +759,37 @@ void Foam::phaseSystem::correctPhi
|
||||
// Correct fixed-flux BCs to be consistent with the velocity BCs
|
||||
correctBoundaryFlux();
|
||||
|
||||
phi_ = Zero;
|
||||
PtrList<surfaceScalarField> alphafs(phaseModels_.size());
|
||||
forAll(movingPhases(), movingPhasei)
|
||||
{
|
||||
phi_ = Zero;
|
||||
PtrList<surfaceScalarField> alphafs(phaseModels_.size());
|
||||
forAll(movingPhases(), movingPhasei)
|
||||
{
|
||||
phaseModel& phase = movingPhases()[movingPhasei];
|
||||
const label phasei = phase.index();
|
||||
const volScalarField& alpha = phase;
|
||||
phaseModel& phase = movingPhases()[movingPhasei];
|
||||
const label phasei = phase.index();
|
||||
const volScalarField& alpha = phase;
|
||||
|
||||
alphafs.set(phasei, fvc::interpolate(alpha).ptr());
|
||||
alphafs.set(phasei, fvc::interpolate(alpha).ptr());
|
||||
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi_ += alphafs[phasei]*(mesh_.Sf() & phase.UfRef());
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
setMixturePhi(alphafs, phi_);
|
||||
// Calculate absolute flux
|
||||
// from the mapped surface velocity
|
||||
phi_ += alphafs[phasei]*(mesh_.Sf() & phase.UfRef());
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
setMixturePhi(alphafs, phi_);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -657,7 +657,6 @@ public:
|
||||
(
|
||||
const volScalarField& p_rgh,
|
||||
const tmp<volScalarField>& divU,
|
||||
const bool correctPhi,
|
||||
const pressureReference& pressureReference,
|
||||
nonOrthogonalSolutionControl& pimple
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user