ENH: pimpleFoam, rhoPimpleFoam, interDyMFoam: Rationalized mesh-motion support

Added support for mesh-motion update within PIMPLE loop in pimpleFoam and rhoPimpleFoam.
This commit is contained in:
Henry Weller
2017-11-30 13:07:42 +00:00
committed by Andrew Heather
parent 889791060c
commit e50af751a4
37 changed files with 240 additions and 325 deletions

View File

@ -1,5 +1,3 @@
InfoInFunction << "consistent" << endl;
if (!pimple.SIMPLErho())
{
rho = thermo.rho();

View File

@ -1,10 +0,0 @@
#include "readTimeControls.H"
bool correctPhi = pimple.dict().lookupOrDefault<Switch>
(
"correctPhi",
!isA<staticFvMesh>(mesh)
);
bool checkMeshCourantNo =
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);

View File

@ -57,12 +57,11 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createControl.H"
#include "createDyMControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createRhoUfIfPresent.H"
#include "createTimeControls.H"
turbulence->validate();
@ -78,81 +77,81 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readControls.H"
#include "readDyMControls.H"
// 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
autoPtr<volScalarField> divrhoU;
if (correctPhi)
{
// 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
autoPtr<volScalarField> divrhoU;
if (correctPhi)
{
divrhoU.reset
divrhoU.reset
(
new volScalarField
(
new volScalarField
(
"divrhoU",
fvc::div(fvc::absolute(phi, rho, U))
)
);
}
if (LTS)
{
#include "setRDeltaT.H"
}
else
{
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
}
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU.reset(new volVectorField("rhoU", rho*U));
}
// Do any mesh changes
mesh.update();
#include "updateRhoUf.H"
if (mesh.changing())
{
MRF.update();
if (correctPhi)
{
// Calculate absolute flux from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
#include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
if (checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
}
"divrhoU",
fvc::div(fvc::absolute(phi, rho, U))
)
);
}
if (pimple.nCorrPIMPLE() <= 1)
if (LTS)
{
#include "rhoEqn.H"
#include "setRDeltaT.H"
}
else
{
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
}
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
if (pimple.firstIter() || moveMeshOuterCorrectors)
{
// Store momentum to set rhoUf for introduced faces.
autoPtr<volVectorField> rhoU;
if (rhoUf.valid())
{
rhoU.reset(new volVectorField("rhoU", rho*U));
}
// Do any mesh changes
mesh.update();
if (mesh.changing())
{
MRF.update();
if (correctPhi)
{
// Calculate absolute flux
// from the mapped surface velocity
phi = mesh.Sf() & rhoUf();
#include "correctPhi.H"
// Make the fluxes relative to the mesh-motion
fvc::makeRelative(phi, rho, U);
}
if (checkMeshCourantNo)
{
#include "meshCourantNo.H"
}
}
}
if (pimple.nCorrPIMPLE() <= 1)
{
#include "rhoEqn.H"
}
#include "UEqn.H"
#include "EEqn.H"

View File

@ -50,8 +50,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createDynamicFvMesh.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createDyMControls.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createRhoUf.H"
@ -67,7 +66,7 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readControls.H"
#include "readDyMControls.H"
{
// Store divrhoU from the previous mesh so that it can be mapped