VoF Solvers: Relocate the correction, sub-cycling and compressions controls from PIMPLE to the alpha1 sub-dict

MULES: Add support for explicit correction
interPhaseChangeFoam: Add option for explicit MULES or as correction to an upwind solution
Deprecate implicit form of MULES
This commit is contained in:
Henry
2013-05-03 15:46:29 +01:00
parent 24e36ddf3f
commit d13c9810e8
24 changed files with 635 additions and 157 deletions

View File

@ -1,7 +1,5 @@
{
label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles")));
#include "alphaControls.H"
surfaceScalarField phic(mag(phi/mesh.magSf()));
phic = min(interface.cAlpha()*phic, max(phic));

View File

@ -1,17 +1,5 @@
#include "readTimeControls.H"
label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles")));
if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1)
{
FatalErrorIn(args.executable())
<< "Sub-cycling alpha is only allowed for PISO, "
"i.e. when the number of outer-correctors = 1"
<< exit(FatalError);
}
bool correctPhi =
pimple.dict().lookupOrDefault<Switch>("correctPhi", true);

View File

@ -56,7 +56,7 @@ int main(int argc, char *argv[])
pimpleControl pimple(mesh);
#include "readControls.H"
#include "readTimeControls.H"
#include "initContinuityErrs.H"
#include "createFields.H"
#include "CourantNo.H"
@ -68,7 +68,7 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readControls.H"
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"

View File

@ -85,8 +85,8 @@
if (pimple.finalNonOrthogonalIter())
{
//p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
//p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh;
dgdt =
(
@ -102,7 +102,7 @@
}
}
p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
// p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin);
// Update densities from change in p_rgh
rho1 += psi1*(p_rgh - p_rgh_0);

View File

@ -1,13 +0,0 @@
#include "readTimeControls.H"
label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles")));
if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1)
{
FatalErrorIn(args.executable())
<< "Sub-cycling alpha is only allowed for PISO operation, "
"i.e. when the number of outer-correctors = 1"
<< exit(FatalError);
}

View File

@ -1,4 +1,2 @@
#include "readTimeControls.H"
int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr")));
int nAlphaSubCycles(readInt(pimple.dict().lookup("nAlphaSubCycles")));
#include "alphaControls.H"

View File

@ -1,5 +1,4 @@
label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles")));
#include "alphaControls.H"
if (nAlphaSubCycles > 1)
{

View File

@ -130,10 +130,7 @@
<< ", " << gMax(1/rDeltaT.internalField()) << endl;
}
label nAlphaSubCycles
(
readLabel(pimpleDict.lookup("nAlphaSubCycles"))
);
#include "alphaControls.H"
rSubDeltaT = rDeltaT*nAlphaSubCycles;
}

View File

@ -1,5 +1,4 @@
label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles")));
#include "alphaControls.H"
if (nAlphaSubCycles > 1)
{

View File

@ -1,6 +1,4 @@
const dictionary& pimpleDict = pimple.dict();
label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles")));
#include "alphaControls.H"
if (nAlphaSubCycles > 1)
{

View File

@ -4,9 +4,41 @@
surfaceScalarField phir("phir", phic*interface.nHatf());
for (int gCorr=0; gCorr<nAlphaCorr; gCorr++)
Pair<tmp<volScalarField> > vDotAlphal =
twoPhaseProperties->vDotAlphal();
const volScalarField& vDotcAlphal = vDotAlphal[0]();
const volScalarField& vDotvAlphal = vDotAlphal[1]();
const volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal);
tmp<surfaceScalarField> tphiAlpha;
if (MULESCorr)
{
surfaceScalarField phiAlpha
fvScalarMatrix alpha1Eqn
(
fvm::ddt(alpha1)
+ fvm::div(phi, alpha1, "UD") - fvm::Sp(divU, alpha1)
==
fvm::Sp(vDotvmcAlphal, alpha1)
+ vDotcAlphal
);
alpha1Eqn.solve();
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(alpha1) = " << min(alpha1).value()
<< " Max(alpha1) = " << max(alpha1).value()
<< endl;
tphiAlpha = alpha1Eqn.flux();
}
volScalarField alpha10("alpha10", alpha1);
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
{
tmp<surfaceScalarField> tphiAlphaCorr
(
fvc::flux
(
@ -22,66 +54,52 @@
)
);
Pair<tmp<volScalarField> > vDotAlphal =
twoPhaseProperties->vDotAlphal();
const volScalarField& vDotcAlphal = vDotAlphal[0]();
const volScalarField& vDotvAlphal = vDotAlphal[1]();
if (MULESCorr)
{
tphiAlphaCorr() -= tphiAlpha();
volScalarField Sp
(
IOobject
volScalarField alpha100("alpha100", alpha10);
alpha10 = alpha1;
MULES::correct
(
"Sp",
runTime.timeName(),
mesh
),
vDotvAlphal - vDotcAlphal
);
geometricOneField(),
alpha1,
tphiAlphaCorr(),
vDotvmcAlphal,
(
divU*(alpha10 - alpha100)
- vDotvmcAlphal*alpha10
)(),
1,
0
);
volScalarField Su
(
IOobject
tphiAlpha() += tphiAlphaCorr();
}
else
{
MULES::explicitSolve
(
"Su",
runTime.timeName(),
mesh
),
// Divergence term is handled explicitly to be
// consistent with the explicit transport solution
divU*alpha1
+ vDotcAlphal
);
geometricOneField(),
alpha1,
phi,
tphiAlphaCorr(),
vDotvmcAlphal,
(divU*alpha1 + vDotcAlphal)(),
1,
0
);
//MULES::explicitSolve
//(
// geometricOneField(),
// alpha1,
// phi,
// phiAlpha,
// Sp,
// Su,
// 1,
// 0
//);
MULES::implicitSolve
(
geometricOneField(),
alpha1,
phi,
phiAlpha,
Sp,
Su,
1,
0
);
tphiAlpha = tphiAlphaCorr;
}
alpha2 = 1.0 - alpha1;
rhoPhi +=
(runTime.deltaT()/totalDeltaT)
*(phiAlpha*(rho1 - rho2) + phi*rho2);
}
rhoPhi = tphiAlpha()*(rho1 - rho2) + phi*rho2;
Info<< "Liquid phase volume fraction = "
<< alpha1.weightedAverage(mesh.V()).value()
<< " Min(alpha1) = " << min(alpha1).value()

View File

@ -11,21 +11,18 @@ surfaceScalarField rhoPhi
);
{
const dictionary& pimpleDict = pimple.dict();
label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles")));
#include "alphaControls.H"
surfaceScalarField phic(mag(phi/mesh.magSf()));
phic = min(interface.cAlpha()*phic, max(phic));
volScalarField divU(fvc::div(phi));
dimensionedScalar totalDeltaT = runTime.deltaT();
if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField rhoPhiSum("rhoPhiSum", rhoPhi);
for
(
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
@ -33,7 +30,10 @@ surfaceScalarField rhoPhi
)
{
#include "alphaEqn.H"
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
}
rhoPhi = rhoPhiSum;
}
else
{

View File

@ -41,7 +41,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "IMULES.H"
#include "MULES.H"
#include "subCycle.H"
#include "interfaceProperties.H"
#include "phaseChangeTwoPhaseMixture.H"

View File

@ -812,9 +812,8 @@ void Foam::multiphaseSystem::solve()
const Time& runTime = mesh_.time();
const dictionary& pimpleDict = mesh_.solutionDict().subDict("PIMPLE");
label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles")));
const dictionary& alphaControls = mesh_.solverDict(phases_.first().name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
if (nAlphaSubCycles > 1)
{

View File

@ -249,15 +249,12 @@ void Foam::multiphaseMixture::solve()
const Time& runTime = mesh_.time();
const dictionary& pimpleDict = mesh_.solutionDict().subDict("PIMPLE");
label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles")));
scalar cAlpha(readScalar(pimpleDict.lookup("cAlpha")));
volScalarField& alpha = phases_.first();
const dictionary& alphaControls = mesh_.solverDict(alpha.name());
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
scalar cAlpha(readScalar(alphaControls.lookup("cAlpha")));
if (nAlphaSubCycles > 1)
{
surfaceScalarField rhoPhiSum(0.0*rhoPhi_);

View File

@ -1,5 +1,4 @@
label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles")));
#include "alphaControls.H"
if (nAlphaSubCycles > 1)
{

View File

@ -1,5 +1,4 @@
#include "readTimeControls.H"
#include "alphaControls.H"
int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr")));
int nAlphaSubCycles(readInt(pimple.dict().lookup("nAlphaSubCycles")));
Switch correctAlpha(pimple.dict().lookup("correctAlpha"));