mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
settlingFoam -> driftFluxFoam
Changed Alpha -> alpha Solve alpha using MULES Added fvOptions
This commit is contained in:
3
applications/solvers/multiphase/driftFluxFoam/Make/files
Normal file
3
applications/solvers/multiphase/driftFluxFoam/Make/files
Normal file
@ -0,0 +1,3 @@
|
||||
driftFluxFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/driftFluxFoam
|
||||
11
applications/solvers/multiphase/driftFluxFoam/Make/options
Normal file
11
applications/solvers/multiphase/driftFluxFoam/Make/options
Normal file
@ -0,0 +1,11 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/fvOptions/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling \
|
||||
-lfvOptions
|
||||
@ -3,18 +3,22 @@
|
||||
fvVectorMatrix UEqn
|
||||
(
|
||||
fvm::ddt(rho, U)
|
||||
+ fvm::div(phi, U)
|
||||
+ fvm::div(rhoPhi, U)
|
||||
+ fvc::div
|
||||
(
|
||||
(Alpha/(scalar(1.001) - Alpha))*(sqr(rhoc)/rho)*Vdj*Vdj,
|
||||
(alpha/(scalar(1.001) - alpha))*((rhoc*rhod)/rho)*Vdj*Vdj,
|
||||
"div(phiVdj,Vdj)"
|
||||
)
|
||||
- fvm::laplacian(muEff, U, "laplacian(muEff,U)")
|
||||
- (fvc::grad(U) & fvc::grad(muEff))
|
||||
- fvm::laplacian(muEff, U)
|
||||
- fvc::div(muEff*dev2(T(fvc::grad(U))))
|
||||
==
|
||||
fvOptions(rho, U)
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
fvOptions.constrain(UEqn);
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
@ -29,4 +33,6 @@
|
||||
)*mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
const dictionary& alphaControls = mesh.solverDict(alpha.name());
|
||||
|
||||
label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr")));
|
||||
label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles")));
|
||||
31
applications/solvers/multiphase/driftFluxFoam/alphaEqn.H
Normal file
31
applications/solvers/multiphase/driftFluxFoam/alphaEqn.H
Normal file
@ -0,0 +1,31 @@
|
||||
{
|
||||
word alphaScheme("div(phi,alpha)");
|
||||
word alpharScheme("div(phirb,alpha)");
|
||||
|
||||
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
|
||||
{
|
||||
phiAlpha =
|
||||
(
|
||||
fvc::flux
|
||||
(
|
||||
phi,
|
||||
alpha,
|
||||
alphaScheme
|
||||
)
|
||||
+ fvc::flux
|
||||
(
|
||||
phir,
|
||||
alpha,
|
||||
alpharScheme
|
||||
)
|
||||
);
|
||||
|
||||
MULES::explicitSolve(alpha, phi, phiAlpha, 1, 0);
|
||||
}
|
||||
|
||||
Info<< "Phase-1 volume fraction = "
|
||||
<< alpha.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(alpha) = " << min(alpha).value()
|
||||
<< " Max(alpha) = " << max(alpha).value()
|
||||
<< endl;
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
{
|
||||
surfaceScalarField phiAlpha
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiAlpha",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", phi.dimensions(), 0)
|
||||
);
|
||||
|
||||
surfaceScalarField phir
|
||||
(
|
||||
rhoc*(mesh.Sf() & fvc::interpolate(Vdj/rho))
|
||||
);
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||
surfaceScalarField phiAlphaSum
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiAlphaSum",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", phi.dimensions(), 0)
|
||||
);
|
||||
|
||||
for
|
||||
(
|
||||
subCycle<volScalarField> alphaSubCycle(alpha, nAlphaSubCycles);
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
#include "alphaEqn.H"
|
||||
phiAlphaSum += (runTime.deltaT()/totalDeltaT)*phiAlpha;
|
||||
}
|
||||
|
||||
phiAlpha = phiAlphaSum;
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "alphaEqn.H"
|
||||
}
|
||||
|
||||
// Apply the diffusion term separately to allow implicit solution
|
||||
// and boundedness of the explicit advection
|
||||
{
|
||||
fvScalarMatrix alphaEqn
|
||||
(
|
||||
fvm::ddt(alpha) - fvc::ddt(alpha)
|
||||
- fvm::laplacian(mut/rho, alpha)
|
||||
);
|
||||
|
||||
alphaEqn.solve();
|
||||
|
||||
phiAlpha += alphaEqn.flux();
|
||||
}
|
||||
|
||||
Info<< "Phase-1 volume fraction = "
|
||||
<< alpha.weightedAverage(mesh.Vsc()).value()
|
||||
<< " Min(alpha) = " << min(alpha).value()
|
||||
<< " Max(alpha) = " << max(alpha).value()
|
||||
<< endl;
|
||||
|
||||
rhoPhi = phiAlpha*(rhod - rhoc) + phi*rhoc;
|
||||
rho == alpha*rhod + (scalar(1) - alpha)*rhoc;
|
||||
}
|
||||
@ -8,7 +8,7 @@ if (VdjModel == "general")
|
||||
}
|
||||
else if (VdjModel == "simple")
|
||||
{
|
||||
Vdj = V0*pow(10.0, -a*alpha);
|
||||
Vdj = V0*pow(10.0, -a*max(alpha, scalar(0)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -12,12 +12,12 @@
|
||||
mesh
|
||||
);
|
||||
|
||||
Info<< "Reading field Alpha\n" << endl;
|
||||
volScalarField Alpha
|
||||
Info<< "Reading field alpha\n" << endl;
|
||||
volScalarField alpha
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Alpha",
|
||||
"alpha",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
@ -40,6 +40,8 @@
|
||||
mesh
|
||||
);
|
||||
|
||||
#include "createPhi.H"
|
||||
|
||||
|
||||
Info<< "Reading transportProperties\n" << endl;
|
||||
|
||||
@ -100,25 +102,24 @@
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
rhoc/(scalar(1) + (rhoc/rhod - 1.0)*Alpha)
|
||||
alpha*rhod + (scalar(1) - alpha)*rhoc
|
||||
);
|
||||
rho.oldTime();
|
||||
|
||||
volScalarField alpha
|
||||
// Mass flux
|
||||
surfaceScalarField rhoPhi
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"alpha",
|
||||
"rhoPhi",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
rho*Alpha/rhod
|
||||
fvc::interpolate(rho)*phi
|
||||
);
|
||||
|
||||
#include "compressibleCreatePhi.H"
|
||||
|
||||
|
||||
Info<< "Calculating field mul\n" << endl;
|
||||
volScalarField mul
|
||||
(
|
||||
@ -135,7 +136,7 @@
|
||||
(
|
||||
plasticViscosityCoeff,
|
||||
plasticViscosityExponent,
|
||||
Alpha
|
||||
alpha
|
||||
)
|
||||
);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -22,15 +22,20 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
settlingFoam
|
||||
driftFluxFoam
|
||||
|
||||
Description
|
||||
Solver for 2 incompressible fluids for simulating the settling of the
|
||||
dispersed phase.
|
||||
Solver for 2 incompressible fluids using the mixture approach with the
|
||||
drift-flux approximation for relative motion of the phases.
|
||||
|
||||
Used for simulating the settling of the dispersed phase and other similar
|
||||
separation problems.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "CMULES.H"
|
||||
#include "subCycle.H"
|
||||
#include "nearWallDist.H"
|
||||
#include "wallFvPatch.H"
|
||||
#include "bound.H"
|
||||
@ -38,6 +43,7 @@ Description
|
||||
#include "plasticViscosity.H"
|
||||
#include "yieldStress.H"
|
||||
#include "pimpleControl.H"
|
||||
#include "fvIOoptionList.H"
|
||||
#include "fixedFluxPressureFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -50,6 +56,7 @@ int main(int argc, char *argv[])
|
||||
#include "createMesh.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "createFields.H"
|
||||
#include "createFvOptions.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
pimpleControl pimple(mesh);
|
||||
@ -61,26 +68,24 @@ int main(int argc, char *argv[])
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readTimeControls.H"
|
||||
#include "compressibleCourantNo.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "rhoEqn.H"
|
||||
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
while (pimple.loop())
|
||||
{
|
||||
#include "alphaControls.H"
|
||||
|
||||
#include "calcVdj.H"
|
||||
#include "alphaEqnSubCycle.H"
|
||||
#include "correctViscosity.H"
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
#include "alphaEqn.H"
|
||||
|
||||
#include "correctViscosity.H"
|
||||
|
||||
// --- Pressure corrector loop
|
||||
while (pimple.correct())
|
||||
{
|
||||
@ -10,10 +10,10 @@ if (turbulence)
|
||||
dimensionedScalar epsilon0("epsilon0", epsilon.dimensions(), 0);
|
||||
dimensionedScalar epsilonMin("epsilonMin", epsilon.dimensions(), SMALL);
|
||||
|
||||
volScalarField divU(fvc::div(phi/fvc::interpolate(rho)));
|
||||
volScalarField divU(fvc::div(rhoPhi/fvc::interpolate(rho)));
|
||||
|
||||
tmp<volTensorField> tgradU = fvc::grad(U);
|
||||
volScalarField G(2*mut*(tgradU() && dev(symm(tgradU()))));
|
||||
volScalarField G(mut*(tgradU() && dev(twoSymm(tgradU()))));
|
||||
tgradU.clear();
|
||||
|
||||
volScalarField Gcoef
|
||||
@ -27,7 +27,7 @@ if (turbulence)
|
||||
fvScalarMatrix epsEqn
|
||||
(
|
||||
fvm::ddt(rho, epsilon)
|
||||
+ fvm::div(phi, epsilon)
|
||||
+ fvm::div(rhoPhi, epsilon)
|
||||
- fvm::laplacian
|
||||
(
|
||||
mut/sigmaEps + muc, epsilon,
|
||||
@ -51,7 +51,7 @@ if (turbulence)
|
||||
fvScalarMatrix kEqn
|
||||
(
|
||||
fvm::ddt(rho, k)
|
||||
+ fvm::div(phi, k)
|
||||
+ fvm::div(rhoPhi, k)
|
||||
- fvm::laplacian
|
||||
(
|
||||
mut/sigmak + muc, k,
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
volScalarField rAU("rAU", 1.0/UEqn.A());
|
||||
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
|
||||
volVectorField HbyA("HbyA", U);
|
||||
HbyA = rAU*UEqn.H();
|
||||
@ -8,15 +8,17 @@
|
||||
surfaceScalarField phiHbyA
|
||||
(
|
||||
"phiHbyA",
|
||||
(
|
||||
(fvc::interpolate(rho*HbyA) & mesh.Sf())
|
||||
+ rhorAUf*fvc::ddtCorr(rho, U, phi)
|
||||
)
|
||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi)
|
||||
);
|
||||
adjustPhi(phiHbyA, U, p_rgh);
|
||||
fvOptions.makeRelative(phiHbyA);
|
||||
|
||||
surfaceScalarField phig
|
||||
(
|
||||
- ghf*fvc::snGrad(rho)*rhorAUf*mesh.magSf()
|
||||
(
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rAUf*mesh.magSf()
|
||||
);
|
||||
|
||||
phiHbyA += phig;
|
||||
@ -27,16 +29,15 @@
|
||||
p_rgh.boundaryField(),
|
||||
(
|
||||
phiHbyA.boundaryField()
|
||||
- (mesh.Sf().boundaryField() & U.boundaryField())
|
||||
*rho.boundaryField()
|
||||
)/(mesh.magSf().boundaryField()*rhorAUf.boundaryField())
|
||||
- fvOptions.relative(mesh.Sf().boundaryField() & U.boundaryField())
|
||||
)/(mesh.magSf().boundaryField()*rAUf.boundaryField())
|
||||
);
|
||||
|
||||
while (pimple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
fvm::laplacian(rhorAUf, p_rgh) == fvc::ddt(rho) + fvc::div(phiHbyA)
|
||||
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
|
||||
);
|
||||
|
||||
p_rghEqn.setReference(pRefCell, getRefCellValue(p_rgh, pRefCell));
|
||||
@ -47,11 +48,16 @@
|
||||
{
|
||||
phi = phiHbyA - p_rghEqn.flux();
|
||||
|
||||
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rhorAUf);
|
||||
p_rgh.relax();
|
||||
|
||||
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
|
||||
U.correctBoundaryConditions();
|
||||
fvOptions.correct(U);
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
p == p_rgh + rho*gh;
|
||||
|
||||
if (p_rgh.needReference())
|
||||
@ -64,7 +70,4 @@
|
||||
);
|
||||
p_rgh = p - rho*gh;
|
||||
}
|
||||
|
||||
#include "rhoEqn.H"
|
||||
#include "compressibleContinuityErrs.H"
|
||||
}
|
||||
@ -2,14 +2,18 @@ volScalarField plasticViscosity
|
||||
(
|
||||
const dimensionedScalar& plasticViscosityCoeff,
|
||||
const dimensionedScalar& plasticViscosityExponent,
|
||||
const volScalarField& alpha
|
||||
const volScalarField& Alpha
|
||||
)
|
||||
{
|
||||
tmp<volScalarField> tfld
|
||||
(
|
||||
plasticViscosityCoeff*
|
||||
(
|
||||
pow(10.0, plasticViscosityExponent*alpha + SMALL) - scalar(1)
|
||||
pow
|
||||
(
|
||||
10.0,
|
||||
plasticViscosityExponent*Alpha + SMALL
|
||||
) - scalar(1)
|
||||
)
|
||||
);
|
||||
|
||||
@ -10,8 +10,16 @@ volScalarField yieldStress
|
||||
(
|
||||
yieldStressCoeff*
|
||||
(
|
||||
pow(10.0, yieldStressExponent*(alpha + yieldStressOffset))
|
||||
- pow(10.0, yieldStressExponent*yieldStressOffset)
|
||||
pow
|
||||
(
|
||||
10.0,
|
||||
yieldStressExponent*(max(alpha, scalar(0)) + yieldStressOffset)
|
||||
)
|
||||
- pow
|
||||
(
|
||||
10.0,
|
||||
yieldStressExponent*yieldStressOffset
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
settlingFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/settlingFoam
|
||||
@ -1,5 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfiniteVolume
|
||||
@ -1,34 +0,0 @@
|
||||
{
|
||||
surfaceScalarField phiAlpha
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"phiAlpha",
|
||||
runTime.timeName(),
|
||||
mesh
|
||||
),
|
||||
phi + rhoc*(mesh.Sf() & fvc::interpolate(Vdj))
|
||||
);
|
||||
|
||||
fvScalarMatrix AlphaEqn
|
||||
(
|
||||
fvm::ddt(rho, Alpha)
|
||||
+ fvm::div(phiAlpha, Alpha)
|
||||
- fvm::laplacian(mut, Alpha)
|
||||
);
|
||||
|
||||
AlphaEqn.relax();
|
||||
AlphaEqn.solve();
|
||||
|
||||
Info<< "Solid phase fraction = "
|
||||
<< Alpha.weightedAverage(mesh.V()).value()
|
||||
<< " Min(Alpha) = " << min(Alpha).value()
|
||||
<< " Max(Alpha) = " << max(Alpha).value()
|
||||
<< endl;
|
||||
|
||||
Alpha.min(1.0);
|
||||
Alpha.max(0.0);
|
||||
|
||||
rho == rhoc/(scalar(1) + (rhoc/rhod - 1.0)*Alpha);
|
||||
alpha == rho*Alpha/rhod;
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
scalar sumLocalContErr =
|
||||
runTime.deltaTValue()*
|
||||
mag
|
||||
(
|
||||
fvc::ddt(rho)
|
||||
+ fvc::div(phi)
|
||||
)().weightedAverage(rho*mesh.V()).value();
|
||||
|
||||
scalar globalContErr =
|
||||
runTime.deltaTValue()*
|
||||
(
|
||||
fvc::ddt(rho)
|
||||
+ fvc::div(phi)
|
||||
)().weightedAverage(rho*mesh.V()).value();
|
||||
|
||||
cumulativeContErr += globalContErr;
|
||||
|
||||
Info<< "time step continuity errors : sum local = " << sumLocalContErr
|
||||
<< ", global = " << globalContErr
|
||||
<< ", cumulative = " << cumulativeContErr
|
||||
<< endl;
|
||||
Reference in New Issue
Block a user