driftFluxFoam: Rationalise phase-fraction handling and implement semi-implicit MULES

This commit is contained in:
Henry
2014-02-24 17:10:20 +00:00
committed by Andrew Heather
parent 35229643ba
commit 177b54ae94
26 changed files with 215 additions and 92 deletions

View File

@ -6,7 +6,7 @@
+ fvm::div(rhoPhi, U) + fvm::div(rhoPhi, U)
+ fvc::div + fvc::div
( (
(alpha/(scalar(1.001) - alpha))*((rhoc*rhod)/rho)*Vdj*Vdj, (alpha1/(scalar(1.001) - alpha1))*((rho2*rho1)/rho)*Vdj*Vdj,
"div(phiVdj,Vdj)" "div(phiVdj,Vdj)"
) )
- fvm::laplacian(muEff, U) - fvm::laplacian(muEff, U)

View File

@ -1,4 +0,0 @@
const dictionary& alphaControls = mesh.solverDict(alpha.name());
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));

View File

@ -2,30 +2,118 @@
word alphaScheme("div(phi,alpha)"); word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)"); word alpharScheme("div(phirb,alpha)");
if (MULESCorr)
{
fvScalarMatrix alpha1Eqn
(
#ifdef LTSSOLVE
fv::localEulerDdtScheme<scalar>(mesh, rDeltaT.name()).fvmDdt(alpha1)
#else
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
#endif
+ fv::gaussConvectionScheme<scalar>
(
mesh,
phi,
upwind<scalar>(mesh, phi)
).fvmDiv(phi, alpha1)
- fv::gaussLaplacianScheme<scalar, scalar>
(
mesh,
linear<scalar>(mesh),
fv::uncorrectedSnGrad<scalar>(mesh)
).fvmLaplacian(fvc::interpolate(mut/rho), alpha1)
);
alpha1Eqn.solve();
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(alpha1) = " << min(alpha1).value()
<< " Max(alpha1) = " << max(alpha1).value()
<< endl;
tmp<surfaceScalarField> tphiAlphaUD(alpha1Eqn.flux());
phiAlpha = tphiAlphaUD();
if (alphaApplyPrevCorr && tphiAlphaCorr0.valid())
{
Info<< "Applying the previous iteration correction flux" << endl;
#ifdef LTSSOLVE
MULES::LTScorrect(alpha1, phiAlpha, tphiAlphaCorr0(), 1, 0);
#else
MULES::correct(alpha1, phiAlpha, tphiAlphaCorr0(), 1, 0);
#endif
phiAlpha += tphiAlphaCorr0();
}
// Cache the upwind-flux
tphiAlphaCorr0 = tphiAlphaUD;
}
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++) for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
{ {
phiAlpha = tmp<surfaceScalarField> tphiAlphaUn
( (
fvc::flux fvc::flux
( (
phi, phi,
alpha, alpha1,
alphaScheme alphaScheme
) )
+ fvc::flux + fvc::flux
( (
phir, phir,
alpha, alpha1,
alpharScheme alpharScheme
) )
); );
MULES::explicitSolve(alpha, phi, phiAlpha, 1, 0); if (MULESCorr)
{
tmp<surfaceScalarField> tphiAlphaCorr(tphiAlphaUn() - phiAlpha);
volScalarField alpha10(alpha1);
#ifdef LTSSOLVE
MULES::LTScorrect(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0);
#else
MULES::correct(alpha1, tphiAlphaUn(), tphiAlphaCorr(), 1, 0);
#endif
// Under-relax the correction for all but the 1st corrector
if (aCorr == 0)
{
phiAlpha += tphiAlphaCorr();
}
else
{
alpha1 = 0.5*alpha1 + 0.5*alpha10;
phiAlpha += 0.5*tphiAlphaCorr();
}
}
else
{
phiAlpha = tphiAlphaUn;
#ifdef LTSSOLVE
MULES::explicitLTSSolve(alpha1, phi, phiAlpha, 1, 0);
#else
MULES::explicitSolve(alpha1, phi, phiAlpha, 1, 0);
#endif
}
} }
if (alphaApplyPrevCorr && MULESCorr)
{
tphiAlphaCorr0 = phiAlpha - tphiAlphaCorr0;
}
alpha2 = 1.0 - alpha1;
Info<< "Phase-1 volume fraction = " Info<< "Phase-1 volume fraction = "
<< alpha.weightedAverage(mesh.Vsc()).value() << alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(alpha) = " << min(alpha).value() << " Min(alpha1) = " << min(alpha1).value()
<< " Max(alpha) = " << max(alpha).value() << " Max(alpha1) = " << max(alpha1).value()
<< endl; << endl;
} }

View File

@ -13,7 +13,7 @@
surfaceScalarField phir surfaceScalarField phir
( (
rhoc*(mesh.Sf() & fvc::interpolate(Vdj/rho)) rho2*(mesh.Sf() & fvc::interpolate(Vdj/rho))
); );
if (nAlphaSubCycles > 1) if (nAlphaSubCycles > 1)
@ -33,7 +33,7 @@
for for
( (
subCycle<volScalarField> alphaSubCycle(alpha, nAlphaSubCycles); subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
!(++alphaSubCycle).end(); !(++alphaSubCycle).end();
) )
{ {
@ -50,24 +50,26 @@
// Apply the diffusion term separately to allow implicit solution // Apply the diffusion term separately to allow implicit solution
// and boundedness of the explicit advection // and boundedness of the explicit advection
if (!MULESCorr)
{ {
fvScalarMatrix alphaEqn fvScalarMatrix alpha1Eqn
( (
fvm::ddt(alpha) - fvc::ddt(alpha) fvm::ddt(alpha1) - fvc::ddt(alpha1)
- fvm::laplacian(mut/rho, alpha) - fvm::laplacian(mut/rho, alpha1)
); );
alphaEqn.solve(); alpha1Eqn.solve(mesh.solver("alpha1Diffusion"));
phiAlpha += alphaEqn.flux(); phiAlpha += alpha1Eqn.flux();
} alpha2 = 1.0 - alpha1;
Info<< "Phase-1 volume fraction = " Info<< "Phase-1 volume fraction = "
<< alpha.weightedAverage(mesh.Vsc()).value() << alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(alpha) = " << min(alpha).value() << " Min(alpha1) = " << min(alpha1).value()
<< " Max(alpha) = " << max(alpha).value() << " Max(alpha1) = " << max(alpha1).value()
<< endl; << endl;
}
rhoPhi = phiAlpha*(rhod - rhoc) + phi*rhoc; rhoPhi = phiAlpha*(rho1 - rho2) + phi*rho2;
rho == alpha*rhod + (scalar(1) - alpha)*rhoc; rho == alpha1*rho1 + alpha2*rho2;
} }

View File

@ -2,13 +2,13 @@ if (VdjModel == "general")
{ {
Vdj = V0* Vdj = V0*
( (
exp(-a*max(alpha - alphaMin, scalar(0))) exp(-a*max(alpha1 - alphaMin, scalar(0)))
- exp(-a1*max(alpha - alphaMin, scalar(0))) - exp(-a1*max(alpha1 - alphaMin, scalar(0)))
); );
} }
else if (VdjModel == "simple") else if (VdjModel == "simple")
{ {
Vdj = V0*pow(10.0, -a*max(alpha, scalar(0))); Vdj = V0*pow(10.0, -a*max(alpha1, scalar(0)));
} }
else else
{ {

View File

@ -4,7 +4,7 @@
( (
plasticViscosityCoeff, plasticViscosityCoeff,
plasticViscosityExponent, plasticViscosityExponent,
alpha alpha1
); );
if (BinghamPlastic) if (BinghamPlastic)
@ -14,7 +14,7 @@
yieldStressCoeff, yieldStressCoeff,
yieldStressExponent, yieldStressExponent,
yieldStressOffset, yieldStressOffset,
alpha alpha1
); );
mul = mul =

View File

@ -12,12 +12,12 @@
mesh mesh
); );
Info<< "Reading field alpha\n" << endl; Info<< "Reading field alpha1\n" << endl;
volScalarField alpha volScalarField alpha1
( (
IOobject IOobject
( (
"alpha", "alpha1",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
@ -26,6 +26,8 @@
mesh mesh
); );
volScalarField alpha2("alpha2", scalar(1) - alpha1);
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U volVectorField U
( (
@ -58,9 +60,8 @@
); );
dimensionedScalar rhoc(transportProperties.lookup("rhoc")); dimensionedScalar rho1(transportProperties.lookup("rho1"));
dimensionedScalar rho2(transportProperties.lookup("rho2"));
dimensionedScalar rhod(transportProperties.lookup("rhod"));
dimensionedScalar muc(transportProperties.lookup("muc")); dimensionedScalar muc(transportProperties.lookup("muc"));
dimensionedScalar muMax(transportProperties.lookup("muMax")); dimensionedScalar muMax(transportProperties.lookup("muMax"));
@ -102,7 +103,7 @@
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
alpha*rhod + (scalar(1) - alpha)*rhoc alpha1*rho1 + alpha2*rho2
); );
rho.oldTime(); rho.oldTime();
@ -136,7 +137,7 @@
( (
plasticViscosityCoeff, plasticViscosityCoeff,
plasticViscosityExponent, plasticViscosityExponent,
alpha alpha1
) )
); );
@ -382,3 +383,6 @@
); );
p_rgh = p - rho*gh; p_rgh = p - rho*gh;
} }
tmp<surfaceScalarField> tphiAlphaCorr0;

View File

@ -45,6 +45,8 @@ Description
#include "pimpleControl.H" #include "pimpleControl.H"
#include "fvIOoptionList.H" #include "fvIOoptionList.H"
#include "fixedFluxPressureFvPatchScalarField.H" #include "fixedFluxPressureFvPatchScalarField.H"
#include "gaussLaplacianScheme.H"
#include "uncorrectedSnGrad.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
const scalar kappa_ = kappa.value(); const scalar kappa_ = kappa.value();
const scalar E_ = E.value(); const scalar E_ = E.value();
const scalar muc_ = muc.value(); const scalar muc_ = muc.value();
const scalar nuc_ = muc_/rhoc.value(); const scalar nuc_ = muc_/rho2.value();
const fvPatchList& patches = mesh.boundary(); const fvPatchList& patches = mesh.boundary();

View File

@ -3,7 +3,7 @@ volScalarField yieldStress
const dimensionedScalar& yieldStressCoeff, const dimensionedScalar& yieldStressCoeff,
const dimensionedScalar& yieldStressExponent, const dimensionedScalar& yieldStressExponent,
const dimensionedScalar& yieldStressOffset, const dimensionedScalar& yieldStressOffset,
const volScalarField& alpha const volScalarField& alpha1
) )
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
@ -13,7 +13,7 @@ volScalarField yieldStress
pow pow
( (
10.0, 10.0,
yieldStressExponent*(max(alpha, scalar(0)) + yieldStressOffset) yieldStressExponent*(max(alpha1, scalar(0)) + yieldStressOffset)
) )
- pow - pow
( (

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object alpha; object alpha1;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,9 +31,8 @@ yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0;
muMax muMax [ 1 -1 -1 0 0 0 0 ] 10.0; muMax muMax [ 1 -1 -1 0 0 0 0 ] 10.0;
rhoc rhoc [ 1 -3 0 0 0 0 0 ] 996; rho1 rho1 [ 1 -3 0 0 0 0 0 ] 1996;
rho2 rho2 [ 1 -3 0 0 0 0 0 ] 996;
rhod rhod [ 1 -3 0 0 0 0 0 ] 1996;
VdjModel simple; VdjModel simple;

View File

@ -47,7 +47,7 @@ runTimeModifiable yes;
adjustTimeStep on; adjustTimeStep on;
maxCo 1; maxCo 5;
maxDeltaT 1; maxDeltaT 1;

View File

@ -32,7 +32,7 @@ divSchemes
div(rhoPhi,U) Gauss linearUpwind grad(U); div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phiVdj,Vdj) Gauss linear; div(phiVdj,Vdj) Gauss linear;
div(phi,alpha) Gauss vanLeer; div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss vanLeer; div(phirb,alpha) Gauss linear;
div(rhoPhi,k) Gauss limitedLinear 1; div(rhoPhi,k) Gauss limitedLinear 1;
div(rhoPhi,epsilon) Gauss limitedLinear 1; div(rhoPhi,epsilon) Gauss limitedLinear 1;
@ -58,7 +58,7 @@ fluxRequired
{ {
default no; default no;
p_rgh; p_rgh;
alpha; alpha1;
} }

View File

@ -17,10 +17,14 @@ FoamFile
solvers solvers
{ {
"alpha.*" "alpha1.*"
{ {
nAlphaCorr 1; nAlphaCorr 2;
nAlphaSubCycles 4; nAlphaSubCycles 1;
MULESCorr yes;
nLimiterIter 3;
alphaApplyPrevCorr yes;
solver smoothSolver; solver smoothSolver;
smoother symGaussSeidel; smoother symGaussSeidel;
@ -29,6 +33,15 @@ solvers
minIter 1; minIter 1;
} }
alpha1Diffusion
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
minIter 1;
}
p_rgh p_rgh
{ {
solver GAMG; solver GAMG;
@ -49,7 +62,8 @@ solvers
"(U|k|epsilon)" "(U|k|epsilon)"
{ {
solver smoothSolver; solver PBiCG;
preconditioner DILU;
smoother symGaussSeidel; smoother symGaussSeidel;
tolerance 1e-7; tolerance 1e-7;
relTol 0.1; relTol 0.1;
@ -65,20 +79,16 @@ solvers
PIMPLE PIMPLE
{ {
nCorrectors 2; momentumPredictor no;
nCorrectors 3;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }
relaxationFactors relaxationFactors
{ {
fields
{
}
equations equations
{ {
"U.*" 1; ".*" 1;
"k.*" 1;
"epsilon.*" 1;
} }
} }

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object alpha; object alpha1;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,9 +31,8 @@ yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0;
muMax muMax [ 1 -1 -1 0 0 0 0 ] 10.0; muMax muMax [ 1 -1 -1 0 0 0 0 ] 10.0;
rhoc rhoc [ 1 -3 0 0 0 0 0 ] 996; rho1 rho1 [ 1 -3 0 0 0 0 0 ] 1996;
rho2 rho2 [ 1 -3 0 0 0 0 0 ] 996;
rhod rhod [ 1 -3 0 0 0 0 0 ] 1996;
VdjModel simple; VdjModel simple;

View File

@ -47,8 +47,7 @@ runTimeModifiable yes;
adjustTimeStep yes; adjustTimeStep yes;
maxCo 0.5; maxCo 1;
maxAlphaCo 0.5;
maxDeltaT 0.05; maxDeltaT 0.05;

View File

@ -32,7 +32,7 @@ divSchemes
div(rhoPhi,U) Gauss linearUpwind grad(U); div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phiVdj,Vdj) Gauss linear; div(phiVdj,Vdj) Gauss linear;
div(phi,alpha) Gauss vanLeer; div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss vanLeer; div(phirb,alpha) Gauss linear;
div(rhoPhi,k) Gauss limitedLinear 1; div(rhoPhi,k) Gauss limitedLinear 1;
div(rhoPhi,epsilon) Gauss limitedLinear 1; div(rhoPhi,epsilon) Gauss limitedLinear 1;
@ -57,8 +57,8 @@ snGradSchemes
fluxRequired fluxRequired
{ {
default no; default no;
p_rgh ; p_rgh;
alpha ; alpha1;
} }

View File

@ -17,15 +17,29 @@ FoamFile
solvers solvers
{ {
"alpha.*" "alpha1.*"
{ {
nAlphaCorr 1; nAlphaCorr 2;
nAlphaSubCycles 3; nAlphaSubCycles 1;
MULESCorr yes;
nLimiterIter 3;
alphaApplyPrevCorr yes;
solver smoothSolver; solver smoothSolver;
smoother symGaussSeidel; smoother symGaussSeidel;
tolerance 1e-6; tolerance 1e-6;
relTol 0; relTol 0;
minIter 1;
}
alpha1Diffusion
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
minIter 1;
} }
"rho.*" "rho.*"
@ -71,7 +85,7 @@ solvers
PIMPLE PIMPLE
{ {
momentumPredictor yes; momentumPredictor no;
nCorrectors 3; nCorrectors 3;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;

View File

@ -136,8 +136,8 @@ boundaryField
OUTL15 OUTL15
{ {
type inletOutlet; type pressureInletOutletVelocity;
inletValue uniform (0 0 0); value uniform (0 0 0);
} }
} }

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object alpha; object alpha1;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -31,9 +31,8 @@ yieldStressOffset yieldStressOffset [ 0 0 0 0 0 0 0 ] 0;
muMax muMax [ 1 -1 -1 0 0 0 0 ] 10.0; muMax muMax [ 1 -1 -1 0 0 0 0 ] 10.0;
rhoc rhoc [ 1 -3 0 0 0 0 0 ] 1000; rho1 rho1 [ 1 -3 0 0 0 0 0 ] 1042;
rho2 rho2 [ 1 -3 0 0 0 0 0 ] 1000;
rhod rhod [ 1 -3 0 0 0 0 0 ] 1042;
VdjModel simple; VdjModel simple;

View File

@ -25,7 +25,7 @@ stopAt endTime;
endTime 8000; endTime 8000;
deltaT 0.1; deltaT 0.5;
writeControl runTime; writeControl runTime;
@ -33,11 +33,11 @@ writeInterval 50;
purgeWrite 0; purgeWrite 0;
writeFormat ascii; writeFormat binary;
writePrecision 6; writePrecision 6;
writeCompression compressed; writeCompression uncompressed;
timeFormat general; timeFormat general;

View File

@ -32,7 +32,7 @@ divSchemes
div(rhoPhi,U) Gauss linearUpwind grad(U); div(rhoPhi,U) Gauss linearUpwind grad(U);
div(phiVdj,Vdj) Gauss linear; div(phiVdj,Vdj) Gauss linear;
div(phi,alpha) Gauss vanLeer; div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss vanLeer; div(phirb,alpha) Gauss linear;
div(rhoPhi,k) Gauss limitedLinear 1; div(rhoPhi,k) Gauss limitedLinear 1;
div(rhoPhi,epsilon) Gauss limitedLinear 1; div(rhoPhi,epsilon) Gauss limitedLinear 1;
@ -58,7 +58,7 @@ fluxRequired
{ {
default no; default no;
p_rgh; p_rgh;
alpha; alpha1;
} }

View File

@ -17,10 +17,14 @@ FoamFile
solvers solvers
{ {
"alpha.*" "alpha1.*"
{ {
nAlphaCorr 1; nAlphaCorr 2;
nAlphaSubCycles 4; nAlphaSubCycles 1;
MULESCorr yes;
nLimiterIter 3;
alphaApplyPrevCorr yes;
solver smoothSolver; solver smoothSolver;
smoother symGaussSeidel; smoother symGaussSeidel;
@ -29,6 +33,15 @@ solvers
minIter 1; minIter 1;
} }
alpha1Diffusion
{
solver PCG;
preconditioner DIC;
tolerance 1e-6;
relTol 0;
minIter 1;
}
p_rgh p_rgh
{ {
solver GAMG; solver GAMG;
@ -65,15 +78,13 @@ solvers
PIMPLE PIMPLE
{ {
nCorrectors 2; momentumPredictor no;
nCorrectors 3;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }
relaxationFactors relaxationFactors
{ {
fields
{
}
equations equations
{ {
".*" 1; ".*" 1;