mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
VoF solvers: phase-fraction equation and move mesh motion into PIMPLE loop
This commit is contained in:
@ -70,7 +70,7 @@
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho*phi",
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
|
||||
@ -83,14 +83,14 @@ Foam::multiphaseMixtureThermo::multiphaseMixtureThermo
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho*phi",
|
||||
"rhoPhi",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("rho*phi", dimMass/dimTime, 0.0)
|
||||
dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0)
|
||||
),
|
||||
|
||||
alphas_
|
||||
|
||||
@ -77,19 +77,26 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "setrDeltaT.H"
|
||||
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#define LTSSOLVE
|
||||
#include "alphaEqnSubCycle.H"
|
||||
#undef LTSSOLVE
|
||||
|
||||
interface.correct();
|
||||
|
||||
turbulence->correct();
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
if (pimple.firstIter() || alphaOuterCorrectors)
|
||||
{
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#define LTSSOLVE
|
||||
#include "alphaEqnSubCycle.H"
|
||||
#undef LTSSOLVE
|
||||
|
||||
interface.correct();
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -81,15 +81,22 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
#include "zonePhaseVolumes.H"
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
if (pimple.firstIter() || alphaOuterCorrectors)
|
||||
{
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
#include "zonePhaseVolumes.H"
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
EXE_INC = \
|
||||
EXE_INC = -ggdb3 \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
|
||||
@ -6,9 +6,7 @@
|
||||
phic = min(interface.cAlpha()*phic, max(phic));
|
||||
surfaceScalarField phir(phic*interface.nHatf());
|
||||
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
if (MULESCorr)
|
||||
if (pimple.firstIter() && MULESCorr)
|
||||
{
|
||||
fvScalarMatrix alpha1Eqn
|
||||
(
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#include "alphaControls.H"
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||
|
||||
@ -62,13 +62,14 @@
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho*phi",
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
rho1*phi
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimTime, 0)
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -77,46 +77,56 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = g & mesh.C();
|
||||
ghf = g & mesh.Cf();
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
interface.correct();
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = g & mesh.C();
|
||||
ghf = g & mesh.Cf();
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "correctPhi.H"
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
interface.correct();
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
|
||||
if (pimple.firstIter() || alphaOuterCorrectors)
|
||||
{
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -1,6 +1,16 @@
|
||||
#include "readTimeControls.H"
|
||||
#include "readTimeControls.H"
|
||||
|
||||
bool correctPhi =
|
||||
pimple.dict().lookupOrDefault<Switch>("correctPhi", true);
|
||||
bool checkMeshCourantNo =
|
||||
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false);
|
||||
bool correctPhi
|
||||
(
|
||||
pimple.dict().lookupOrDefault<Switch>("correctPhi", true)
|
||||
);
|
||||
|
||||
bool checkMeshCourantNo
|
||||
(
|
||||
pimple.dict().lookupOrDefault<Switch>("checkMeshCourantNo", false)
|
||||
);
|
||||
|
||||
bool moveMeshOuterCorrectors
|
||||
(
|
||||
pimple.dict().lookupOrDefault<Switch>("moveMeshOuterCorrectors", false)
|
||||
);
|
||||
|
||||
@ -80,14 +80,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
if (pimple.firstIter() || alphaOuterCorrectors)
|
||||
{
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho*phi",
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
|
||||
@ -74,16 +74,23 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
threePhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnsSubCycle.H"
|
||||
interface.correct();
|
||||
|
||||
#define twoPhaseProperties threePhaseProperties
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
if (pimple.firstIter() || alphaOuterCorrectors)
|
||||
{
|
||||
threePhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnsSubCycle.H"
|
||||
interface.correct();
|
||||
|
||||
#define twoPhaseProperties threePhaseProperties
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -83,14 +83,21 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
tmp<surfaceScalarField> tphiAlpha;
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
if (pimple.firstIter() || alphaOuterCorrectors)
|
||||
{
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -1,18 +1,4 @@
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimTime, 0)
|
||||
);
|
||||
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
surfaceScalarField phic(mag(phi/mesh.magSf()));
|
||||
phic = min(interface.cAlpha()*phic, max(phic));
|
||||
|
||||
|
||||
@ -86,44 +86,64 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = g & mesh.C();
|
||||
ghf = g & mesh.Cf();
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "../interFoam/interDyMFoam/correctPhi.H"
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
|
||||
twoPhaseProperties->correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
if (pimple.firstIter() || moveMeshOuterCorrectors)
|
||||
{
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
mesh.update();
|
||||
|
||||
if (mesh.changing())
|
||||
{
|
||||
Info<< "Execution time for mesh.update() = "
|
||||
<< runTime.elapsedCpuTime() - timeBeforeMeshUpdate
|
||||
<< " s" << endl;
|
||||
|
||||
gh = g & mesh.C();
|
||||
ghf = g & mesh.Cf();
|
||||
}
|
||||
|
||||
if (mesh.changing() && correctPhi)
|
||||
{
|
||||
// Calculate absolute flux from the mapped surface velocity
|
||||
phi = mesh.Sf() & Uf;
|
||||
|
||||
#include "../interFoam/interDyMFoam/correctPhi.H"
|
||||
|
||||
// Make the flux relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
}
|
||||
|
||||
#include "alphaControls.H"
|
||||
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimTime, 0)
|
||||
);
|
||||
|
||||
if (pimple.firstIter() || alphaOuterCorrectors)
|
||||
{
|
||||
twoPhaseProperties->correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -83,14 +83,31 @@ int main(int argc, char *argv[])
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
twoPhaseProperties->correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", dimMass/dimTime, 0)
|
||||
);
|
||||
|
||||
if (pimple.firstIter() || alphaOuterCorrectors)
|
||||
{
|
||||
twoPhaseProperties->correct();
|
||||
|
||||
#include "alphaEqnSubCycle.H"
|
||||
interface.correct();
|
||||
}
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
|
||||
@ -87,14 +87,14 @@ Foam::multiphaseMixture::multiphaseMixture
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho*phi",
|
||||
"rhoPhi",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("rho*phi", dimMass/dimTime, 0.0)
|
||||
dimensionedScalar("rhoPhi", dimMass/dimTime, 0.0)
|
||||
),
|
||||
|
||||
alphas_
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rho*phi",
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
|
||||
Reference in New Issue
Block a user