mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
pisoFoam: Added MRF and fvOptions support
This commit is contained in:
@ -8,7 +8,6 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/fvOptions/lnInclude \
|
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||||
-I$(LIB_SRC)/sampling/lnInclude
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lturbulenceModels \
|
-lturbulenceModels \
|
||||||
-lincompressibleTurbulenceModels \
|
-lincompressibleTurbulenceModels \
|
||||||
|
|||||||
@ -30,7 +30,7 @@ Description
|
|||||||
|
|
||||||
Sub-models include:
|
Sub-models include:
|
||||||
- turbulence modelling, i.e. laminar, RAS or LES
|
- turbulence modelling, i.e. laminar, RAS or LES
|
||||||
- run-time selectable finite volume options, e.g. MRF, explicit porosity
|
- run-time selectable MRF and finite volume options, e.g. explicit porosity
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|||||||
@ -4,11 +4,15 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/transportModels \
|
-I$(LIB_SRC)/transportModels \
|
||||||
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
-I$(LIB_SRC)/transportModels/incompressible/singlePhaseTransportModel \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
|
-I$(LIB_SRC)/fvOptions/lnInclude \
|
||||||
|
-I$(LIB_SRC)/sampling/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lturbulenceModels \
|
-lturbulenceModels \
|
||||||
-lincompressibleTurbulenceModels \
|
-lincompressibleTurbulenceModels \
|
||||||
-lincompressibleTransportModels \
|
-lincompressibleTransportModels \
|
||||||
-lfiniteVolume \
|
-lfiniteVolume \
|
||||||
-lmeshTools
|
-lmeshTools \
|
||||||
|
-lfvOptions \
|
||||||
|
-lsampling
|
||||||
|
|||||||
23
applications/solvers/incompressible/pisoFoam/UEqn.H
Normal file
23
applications/solvers/incompressible/pisoFoam/UEqn.H
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// Solve the Momentum equation
|
||||||
|
|
||||||
|
MRF.correctBoundaryVelocity(U);
|
||||||
|
|
||||||
|
fvVectorMatrix UEqn
|
||||||
|
(
|
||||||
|
fvm::ddt(U) + fvm::div(phi, U)
|
||||||
|
+ MRF.DDt(U)
|
||||||
|
+ turbulence->divDevReff(U)
|
||||||
|
==
|
||||||
|
fvOptions(U)
|
||||||
|
);
|
||||||
|
|
||||||
|
UEqn.relax();
|
||||||
|
|
||||||
|
fvOptions.constrain(UEqn);
|
||||||
|
|
||||||
|
if (piso.momentumPredictor())
|
||||||
|
{
|
||||||
|
solve(UEqn == -fvc::grad(p));
|
||||||
|
|
||||||
|
fvOptions.correct(U);
|
||||||
|
}
|
||||||
40
applications/solvers/incompressible/pisoFoam/pEqn.H
Normal file
40
applications/solvers/incompressible/pisoFoam/pEqn.H
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
volScalarField rAU(1.0/UEqn.A());
|
||||||
|
|
||||||
|
volVectorField HbyA("HbyA", U);
|
||||||
|
HbyA = rAU*UEqn.H();
|
||||||
|
surfaceScalarField phiHbyA
|
||||||
|
(
|
||||||
|
"phiHbyA",
|
||||||
|
(fvc::interpolate(HbyA) & mesh.Sf())
|
||||||
|
+ fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
|
||||||
|
);
|
||||||
|
|
||||||
|
MRF.makeRelative(phiHbyA);
|
||||||
|
|
||||||
|
adjustPhi(phiHbyA, U, p);
|
||||||
|
|
||||||
|
// Non-orthogonal pressure corrector loop
|
||||||
|
while (piso.correctNonOrthogonal())
|
||||||
|
{
|
||||||
|
// Pressure corrector
|
||||||
|
|
||||||
|
fvScalarMatrix pEqn
|
||||||
|
(
|
||||||
|
fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
|
||||||
|
);
|
||||||
|
|
||||||
|
pEqn.setReference(pRefCell, pRefValue);
|
||||||
|
|
||||||
|
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
|
||||||
|
|
||||||
|
if (piso.finalNonOrthogonalIter())
|
||||||
|
{
|
||||||
|
phi = phiHbyA - pEqn.flux();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "continuityErrs.H"
|
||||||
|
|
||||||
|
U = HbyA - rAU*fvc::grad(p);
|
||||||
|
U.correctBoundaryConditions();
|
||||||
|
fvOptions.correct(U);
|
||||||
@ -27,7 +27,9 @@ Application
|
|||||||
Description
|
Description
|
||||||
Transient solver for incompressible flow.
|
Transient solver for incompressible flow.
|
||||||
|
|
||||||
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
|
Sub-models include:
|
||||||
|
- turbulence modelling, i.e. laminar, RAS or LES
|
||||||
|
- run-time selectable MRF and finite volume options, e.g. explicit porosity
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -35,6 +37,7 @@ Description
|
|||||||
#include "singlePhaseTransportModel.H"
|
#include "singlePhaseTransportModel.H"
|
||||||
#include "turbulentTransportModel.H"
|
#include "turbulentTransportModel.H"
|
||||||
#include "pisoControl.H"
|
#include "pisoControl.H"
|
||||||
|
#include "fvIOoptionList.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -47,6 +50,8 @@ int main(int argc, char *argv[])
|
|||||||
pisoControl piso(mesh);
|
pisoControl piso(mesh);
|
||||||
|
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
|
#include "createMRF.H"
|
||||||
|
#include "createFvOptions.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -61,61 +66,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
// Pressure-velocity PISO corrector
|
// Pressure-velocity PISO corrector
|
||||||
{
|
{
|
||||||
// Momentum predictor
|
#include "UEqn.H"
|
||||||
fvVectorMatrix UEqn
|
|
||||||
(
|
|
||||||
fvm::ddt(U)
|
|
||||||
+ fvm::div(phi, U)
|
|
||||||
+ turbulence->divDevReff(U)
|
|
||||||
);
|
|
||||||
|
|
||||||
UEqn.relax();
|
|
||||||
|
|
||||||
if (piso.momentumPredictor())
|
|
||||||
{
|
|
||||||
solve(UEqn == -fvc::grad(p));
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- PISO loop
|
// --- PISO loop
|
||||||
while (piso.correct())
|
while (piso.correct())
|
||||||
{
|
{
|
||||||
volScalarField rAU(1.0/UEqn.A());
|
#include "pEqn.H"
|
||||||
|
|
||||||
volVectorField HbyA("HbyA", U);
|
|
||||||
HbyA = rAU*UEqn.H();
|
|
||||||
surfaceScalarField phiHbyA
|
|
||||||
(
|
|
||||||
"phiHbyA",
|
|
||||||
(fvc::interpolate(HbyA) & mesh.Sf())
|
|
||||||
+ fvc::interpolate(rAU)*fvc::ddtCorr(U, phi)
|
|
||||||
);
|
|
||||||
|
|
||||||
adjustPhi(phiHbyA, U, p);
|
|
||||||
|
|
||||||
// Non-orthogonal pressure corrector loop
|
|
||||||
while (piso.correctNonOrthogonal())
|
|
||||||
{
|
|
||||||
// Pressure corrector
|
|
||||||
|
|
||||||
fvScalarMatrix pEqn
|
|
||||||
(
|
|
||||||
fvm::laplacian(rAU, p) == fvc::div(phiHbyA)
|
|
||||||
);
|
|
||||||
|
|
||||||
pEqn.setReference(pRefCell, pRefValue);
|
|
||||||
|
|
||||||
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
|
|
||||||
|
|
||||||
if (piso.finalNonOrthogonalIter())
|
|
||||||
{
|
|
||||||
phi = phiHbyA - pEqn.flux();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "continuityErrs.H"
|
|
||||||
|
|
||||||
U = HbyA - rAU*fvc::grad(p);
|
|
||||||
U.correctBoundaryConditions();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user