mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
Merged all multiphase developments in OpenFOAM-1.7.x
This commit is contained in:
8
applications/solvers/multiphase/compressibleInterFoam/Allwclean
Executable file
8
applications/solvers/multiphase/compressibleInterFoam/Allwclean
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wclean
|
||||
wclean compressibleInterDyMFoam
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
8
applications/solvers/multiphase/compressibleInterFoam/Allwmake
Executable file
8
applications/solvers/multiphase/compressibleInterFoam/Allwmake
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake
|
||||
wmake compressibleInterDyMFoam
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -6,7 +6,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-linterfaceProperties \
|
||||
-ltwoPhaseInterfaceProperties \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleTurbulenceModel \
|
||||
-lincompressibleRASModels \
|
||||
|
||||
@ -24,10 +24,10 @@
|
||||
==
|
||||
fvc::reconstruct
|
||||
(
|
||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||
+ (
|
||||
(
|
||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||
- fvc::snGrad(p)
|
||||
- ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
)
|
||||
);
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
compressibleInterDyMFoam.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/compressibleInterDyMFoam
|
||||
@ -0,0 +1,21 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/incompressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-ltwoPhaseInterfaceProperties \
|
||||
-lincompressibleTransportModels \
|
||||
-lincompressibleTurbulenceModel \
|
||||
-lincompressibleRASModels \
|
||||
-lincompressibleLESModels \
|
||||
-lfiniteVolume \
|
||||
-ldynamicMesh \
|
||||
-lmeshTools \
|
||||
-ldynamicFvMesh
|
||||
@ -0,0 +1,45 @@
|
||||
{
|
||||
label nAlphaCorr
|
||||
(
|
||||
readLabel(piso.lookup("nAlphaCorr"))
|
||||
);
|
||||
|
||||
label nAlphaSubCycles
|
||||
(
|
||||
readLabel(piso.lookup("nAlphaSubCycles"))
|
||||
);
|
||||
|
||||
surfaceScalarField phic = mag(phi/mesh.magSf());
|
||||
phic = min(interface.cAlpha()*phic, max(phic));
|
||||
|
||||
fvc::makeAbsolute(phi, U);
|
||||
volScalarField divU = fvc::div(phi);
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
if (nAlphaSubCycles > 1)
|
||||
{
|
||||
dimensionedScalar totalDeltaT = runTime.deltaT();
|
||||
surfaceScalarField rhoPhiSum = 0.0*rhoPhi;
|
||||
|
||||
for
|
||||
(
|
||||
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
|
||||
!(++alphaSubCycle).end();
|
||||
)
|
||||
{
|
||||
#include "alphaEqns.H"
|
||||
rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi;
|
||||
}
|
||||
|
||||
rhoPhi = rhoPhiSum;
|
||||
}
|
||||
else
|
||||
{
|
||||
#include "alphaEqns.H"
|
||||
}
|
||||
|
||||
if (oCorr == 0)
|
||||
{
|
||||
interface.correct();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,146 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Application
|
||||
compressibleInterDyMFoam
|
||||
|
||||
Description
|
||||
Solver for 2 compressible, isothermal immiscible fluids using a VOF
|
||||
(volume of fluid) phase-fraction based interface capturing approach,
|
||||
with optional mesh motion and mesh topology changes including adaptive
|
||||
re-meshing.
|
||||
|
||||
The momentum and other fluid properties are of the "mixture" and a single
|
||||
momentum equation is solved.
|
||||
|
||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "dynamicFvMesh.H"
|
||||
#include "MULES.H"
|
||||
#include "subCycle.H"
|
||||
#include "interfaceProperties.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createDynamicFvMesh.H"
|
||||
#include "readGravitationalAcceleration.H"
|
||||
#include "readControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "createPcorrTypes.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readControls.H"
|
||||
#include "CourantNo.H"
|
||||
|
||||
// Make the fluxes absolute
|
||||
fvc::makeAbsolute(phi, U);
|
||||
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
{
|
||||
// Store divU from the previous mesh for the correctPhi
|
||||
volScalarField divU = fvc::div(phi);
|
||||
|
||||
scalar timeBeforeMeshUpdate = runTime.elapsedCpuTime();
|
||||
|
||||
// Do any mesh changes
|
||||
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)
|
||||
{
|
||||
#include "correctPhi.H"
|
||||
}
|
||||
}
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
|
||||
if (mesh.changing() && checkMeshCourantNo)
|
||||
{
|
||||
#include "meshCourantNo.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
// --- Outer-corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
#include "alphaEqnsSubCycle.H"
|
||||
|
||||
solve(fvm::ddt(rho) + fvc::div(rhoPhi));
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
}
|
||||
|
||||
rho = alpha1*rho1 + alpha2*rho2;
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = "
|
||||
<< runTime.elapsedCpuTime()
|
||||
<< " s\n\n" << endl;
|
||||
}
|
||||
|
||||
Info<< "End\n" << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,61 @@
|
||||
{
|
||||
if (mesh.changing())
|
||||
{
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchi].initEvaluate();
|
||||
}
|
||||
}
|
||||
|
||||
forAll(U.boundaryField(), patchi)
|
||||
{
|
||||
if (U.boundaryField()[patchi].fixesValue())
|
||||
{
|
||||
U.boundaryField()[patchi].evaluate();
|
||||
|
||||
phi.boundaryField()[patchi] =
|
||||
U.boundaryField()[patchi] & mesh.Sf().boundaryField()[patchi];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
volScalarField pcorr
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pcorr",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("pcorr", p.dimensions(), 0.0),
|
||||
pcorrTypes
|
||||
);
|
||||
|
||||
dimensionedScalar rAUf("(1|A(U))", dimTime/rho.dimensions(), 1.0);
|
||||
|
||||
adjustPhi(phi, U, pcorr);
|
||||
|
||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(rAUf, pcorr) == fvc::div(phi) - divU
|
||||
);
|
||||
|
||||
pcorrEqn.solve();
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pcorrEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
wordList pcorrTypes
|
||||
(
|
||||
p_rgh.boundaryField().size(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
||||
for (label i=0; i<p_rgh.boundaryField().size(); i++)
|
||||
{
|
||||
if (p_rgh.boundaryField()[i].fixesValue())
|
||||
{
|
||||
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
{
|
||||
volScalarField rUA = 1.0/UEqn.A();
|
||||
surfaceScalarField rUAf = fvc::interpolate(rUA);
|
||||
|
||||
tmp<fvScalarMatrix> p_rghEqnComp;
|
||||
|
||||
if (transonic)
|
||||
{
|
||||
p_rghEqnComp =
|
||||
(
|
||||
fvm::ddt(p_rgh)
|
||||
+ fvm::div(phi, p_rgh)
|
||||
- fvm::Sp(fvc::div(phi), p_rgh)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
p_rghEqnComp =
|
||||
(
|
||||
fvm::ddt(p_rgh)
|
||||
+ fvc::div(phi, p_rgh)
|
||||
- fvc::Sp(fvc::div(phi), p_rgh)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
U = rUA*UEqn.H();
|
||||
|
||||
surfaceScalarField phiU
|
||||
(
|
||||
"phiU",
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
);
|
||||
|
||||
phi = phiU +
|
||||
(
|
||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rUAf*mesh.magSf();
|
||||
|
||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix p_rghEqnIncomp
|
||||
(
|
||||
fvc::div(phi)
|
||||
- fvm::laplacian(rUAf, p_rgh)
|
||||
);
|
||||
|
||||
solve
|
||||
(
|
||||
(
|
||||
max(alpha1, scalar(0))*(psi1/rho1)
|
||||
+ max(alpha2, scalar(0))*(psi2/rho2)
|
||||
)
|
||||
*p_rghEqnComp()
|
||||
+ p_rghEqnIncomp,
|
||||
mesh.solver
|
||||
(
|
||||
p_rgh.select
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
dgdt =
|
||||
(pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1))
|
||||
*(p_rghEqnComp & p_rgh);
|
||||
phi += p_rghEqnIncomp.flux();
|
||||
}
|
||||
}
|
||||
|
||||
U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
p = max
|
||||
(
|
||||
(p_rgh + gh*(alpha1*rho10 + alpha2*rho20))
|
||||
/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
|
||||
pMin
|
||||
);
|
||||
|
||||
rho1 = rho10 + psi1*p;
|
||||
rho2 = rho20 + psi2*p;
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
|
||||
|
||||
// Make the fluxes relative to the mesh motion
|
||||
fvc::makeRelative(phi, U);
|
||||
}
|
||||
@ -0,0 +1,32 @@
|
||||
#include "readPISOControls.H"
|
||||
#include "readTimeControls.H"
|
||||
|
||||
label nAlphaCorr
|
||||
(
|
||||
readLabel(piso.lookup("nAlphaCorr"))
|
||||
);
|
||||
|
||||
label nAlphaSubCycles
|
||||
(
|
||||
readLabel(piso.lookup("nAlphaSubCycles"))
|
||||
);
|
||||
|
||||
if (nAlphaSubCycles > 1 && nOuterCorr != 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 = true;
|
||||
if (piso.found("correctPhi"))
|
||||
{
|
||||
correctPhi = Switch(piso.lookup("correctPhi"));
|
||||
}
|
||||
|
||||
bool checkMeshCourantNo = false;
|
||||
if (piso.found("checkMeshCourantNo"))
|
||||
{
|
||||
checkMeshCourantNo = Switch(piso.lookup("checkMeshCourantNo"));
|
||||
}
|
||||
@ -1,9 +1,9 @@
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
Info<< "Reading field p_rgh\n" << endl;
|
||||
volScalarField p_rgh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
"p_rgh",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
@ -83,6 +83,28 @@
|
||||
|
||||
dimensionedScalar pMin(twoPhaseProperties.lookup("pMin"));
|
||||
|
||||
Info<< "Calculating field g.h\n" << endl;
|
||||
volScalarField gh("gh", g & mesh.C());
|
||||
surfaceScalarField ghf("ghf", g & mesh.Cf());
|
||||
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
max
|
||||
(
|
||||
(p_rgh + gh*(alpha1*rho10 + alpha2*rho20))
|
||||
/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
|
||||
pMin
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField rho1 = rho10 + psi1*p;
|
||||
volScalarField rho2 = rho20 + psi2*p;
|
||||
|
||||
|
||||
@ -2,17 +2,25 @@
|
||||
volScalarField rUA = 1.0/UEqn.A();
|
||||
surfaceScalarField rUAf = fvc::interpolate(rUA);
|
||||
|
||||
tmp<fvScalarMatrix> pEqnComp;
|
||||
tmp<fvScalarMatrix> p_rghEqnComp;
|
||||
|
||||
if (transonic)
|
||||
{
|
||||
pEqnComp =
|
||||
(fvm::ddt(p) + fvm::div(phi, p) - fvm::Sp(fvc::div(phi), p));
|
||||
p_rghEqnComp =
|
||||
(
|
||||
fvm::ddt(p_rgh)
|
||||
+ fvm::div(phi, p_rgh)
|
||||
- fvm::Sp(fvc::div(phi), p_rgh)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqnComp =
|
||||
(fvm::ddt(p) + fvc::div(phi, p) - fvc::Sp(fvc::div(phi), p));
|
||||
p_rghEqnComp =
|
||||
(
|
||||
fvm::ddt(p_rgh)
|
||||
+ fvc::div(phi, p_rgh)
|
||||
- fvc::Sp(fvc::div(phi), p_rgh)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -21,22 +29,22 @@
|
||||
surfaceScalarField phiU
|
||||
(
|
||||
"phiU",
|
||||
(fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
);
|
||||
|
||||
phi = phiU +
|
||||
(
|
||||
fvc::interpolate(interface.sigmaK())
|
||||
*fvc::snGrad(alpha1)*mesh.magSf()
|
||||
+ fvc::interpolate(rho)*(g & mesh.Sf())
|
||||
)*rUAf;
|
||||
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
|
||||
- ghf*fvc::snGrad(rho)
|
||||
)*rUAf*mesh.magSf();
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pEqnIncomp
|
||||
fvScalarMatrix p_rghEqnIncomp
|
||||
(
|
||||
fvc::div(phi)
|
||||
- fvm::laplacian(rUAf, p)
|
||||
- fvm::laplacian(rUAf, p_rgh)
|
||||
);
|
||||
|
||||
solve
|
||||
@ -45,27 +53,41 @@
|
||||
max(alpha1, scalar(0))*(psi1/rho1)
|
||||
+ max(alpha2, scalar(0))*(psi2/rho2)
|
||||
)
|
||||
*pEqnComp()
|
||||
+ pEqnIncomp
|
||||
*p_rghEqnComp()
|
||||
+ p_rghEqnIncomp,
|
||||
mesh.solver
|
||||
(
|
||||
p_rgh.select
|
||||
(
|
||||
oCorr == nOuterCorr-1
|
||||
&& corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
dgdt =
|
||||
(pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1))
|
||||
*(pEqnComp & p);
|
||||
phi += pEqnIncomp.flux();
|
||||
*(p_rghEqnComp & p_rgh);
|
||||
phi += p_rghEqnIncomp.flux();
|
||||
}
|
||||
}
|
||||
|
||||
U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
|
||||
U.correctBoundaryConditions();
|
||||
|
||||
p.max(pMin);
|
||||
p = max
|
||||
(
|
||||
(p_rgh + gh*(alpha1*rho10 + alpha2*rho20))
|
||||
/(1.0 - gh*(alpha1*psi1 + alpha2*psi2)),
|
||||
pMin
|
||||
);
|
||||
|
||||
rho1 = rho10 + psi1*p;
|
||||
rho2 = rho20 + psi2*p;
|
||||
|
||||
Info<< "max(U) " << max(mag(U)).value() << endl;
|
||||
Info<< "min(p) " << min(p).value() << endl;
|
||||
Info<< "min(p_rgh) " << min(p_rgh).value() << endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user