Simplification of the pimple IB solver: mesh update and flux correction

This commit is contained in:
Hrvoje Jasak 2018-10-11 16:47:58 +01:00
parent b8b7ba6eee
commit f9c325021f
3 changed files with 53 additions and 25 deletions

View file

@ -0,0 +1,45 @@
{
// Make the fluxes absolute (using the ddt(U) scheme)
fvc::makeAbsolute(phi, U);
// Motion inside PIMPLE loop: simple IB update
bool meshChanged = mesh.update();
# include "updateIbPatchFields.H"
# include "updateIbMasks.H"
# include "volContinuity.H"
if (runTime.outputTime())
{
volScalarField divMeshPhi
(
"divMeshPhi",
-fvc::div(mesh.phi())
);
divMeshPhi.internalField() +=
(1.0 - mesh.V0()/mesh.V())/runTime.deltaT().value();
divMeshPhi = mag(divMeshPhi);
divMeshPhi.write();
U.write();
mesh.phi().write();
}
// Fluxes will be corrected to absolute velocity
// HJ, 6/Feb/2009
# include "correctPhi.H"
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
if (checkMeshCourantNo)
{
# include "immersedBoundaryCourantNo.H"
}
// Correct velocity boundary conditions after mesh motion, with relative
// fluxes
U.correctBoundaryConditions();
}

View file

@ -1,5 +1,6 @@
{
volScalarField pcorr("pcorr", p);
pcorr *= 0;
// Initialise flux with interpolated velocity
phi = fvc::interpolate(U) & mesh.Sf();
@ -8,11 +9,13 @@
mesh.schemesDict().setFluxRequired(pcorr.name());
dimensionedScalar rUAf("(1|A(U))", dimTime, 1.0);
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pcorrEqn
(
fvm::laplacian(1/aU, pcorr) == fvc::div(phi)
fvm::laplacian(rUAf, pcorr) == fvc::div(phi)
);
pcorrEqn.setReference(pRefCell, pRefValue);
@ -26,6 +29,6 @@
// Fluxes are corrected to absolute velocity and further corrected
// later. HJ, 6/Feb/2009
}
# include "continuityErrs.H"
}

View file

@ -72,34 +72,14 @@ int main(int argc, char *argv[])
while (runTime.run())
{
# include "readControls.H"
# include "CourantNo.H"
# include "immersedBoundaryCourantNo.H"
# include "setDeltaT.H"
// Make the fluxes absolute
fvc::makeAbsolute(phi, U);
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
bool meshChanged = mesh.update();
reduce(meshChanged, orOp<bool>());
# include "updateIbPatchFields.H"
# include "updateIbMasks.H"
# include "volContinuity.H"
if (checkMeshCourantNo)
{
# include "meshCourantNo.H"
}
// Fluxes will be corrected to absolute velocity
// HJ, 6/Feb/2009
# include "correctPhi.H"
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
# include "correctMeshMotion.H"
// --- PIMPLE loop
while (pimple.loop())