fvOptions: Rationalise the rhoEqn.H so that all compressible solvers support mass-sources correctly

This commit is contained in:
Henry 2014-05-01 16:11:03 +01:00 committed by Andrew Heather
parent d2e9a0d156
commit f609ccd76f
11 changed files with 77 additions and 15 deletions

View File

@ -1,11 +1,21 @@
{
solve
fvScalarMatrix EEqn
(
fvm::ddt(rho, e) + fvm::div(phi, e)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
+ fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)")
- fvm::laplacian(turbulence->alphaEff(), e)
==
fvOptions(rho, e)
);
EEqn.relax();
fvOptions.constrain(EEqn);
EEqn.solve();
fvOptions.correct(e);
thermo.correct();
}

View File

@ -1,6 +1,10 @@
EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
@ -9,5 +13,7 @@ EXE_LIBS = \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \
-lmeshTools
-lmeshTools \
-lsampling \
-lfvOptions \
-lfiniteVolume

View File

@ -3,7 +3,18 @@ fvVectorMatrix UEqn
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
==
fvOptions(rho, U)
);
solve(UEqn == -fvc::grad(p));
K = 0.5*magSqr(U);
UEqn.relax();
fvOptions.constrain(UEqn);
if (pimple.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
fvOptions.correct(U);
K = 0.5*magSqr(U);
}

View File

@ -16,6 +16,8 @@ surfaceScalarField phid
)
);
fvOptions.makeRelative(fvc::interpolate(psi), phid);
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{
@ -24,8 +26,12 @@ while (pimple.correctNonOrthogonal())
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
fvOptions.constrain(pEqn);
pEqn.solve();
if (pimple.finalNonOrthogonalIter())
@ -39,4 +45,5 @@ while (pimple.correctNonOrthogonal())
U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);

View File

@ -1,10 +1,13 @@
EXE_INC = \
-I.. \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/dynamicMesh/lnInclude
EXE_LIBS = \
-lfluidThermophysicalModels \
@ -12,6 +15,8 @@ EXE_LIBS = \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lmeshTools \
-lsampling \
-lfvOptions \
-lfiniteVolume \
-ldynamicMesh \
-lmeshTools
-ldynamicMesh

View File

@ -19,6 +19,7 @@ surfaceScalarField phid
);
fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
@ -27,8 +28,12 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
);
fvOptions.constrain(pEqn);
pEqn.solve();
phi = pEqn.flux();
@ -38,6 +43,8 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);
{
rhoUf = fvc::interpolate(rho*U);

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -35,6 +35,7 @@ Description
#include "turbulenceModel.H"
#include "motionSolver.H"
#include "pimpleControl.H"
#include "fvIOoptionList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,6 +45,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "createRhoUf.H"
#include "initContinuityErrs.H"

View File

@ -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
@ -34,6 +34,7 @@ Description
#include "psiThermo.H"
#include "turbulenceModel.H"
#include "pimpleControl.H"
#include "fvIOoptionList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,6 +44,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);

View File

@ -1,5 +1,5 @@
{
# include "rhoEqn.H"
solve(fvm::ddt(rho) + fvc::div(phi));
}
{
scalar sumLocalContErr =

View File

@ -58,7 +58,7 @@ int main(int argc, char *argv[])
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "rhoEqn.H"
solve(fvm::ddt(rho) + fvc::div(phi));
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -30,7 +30,19 @@ Description
\*---------------------------------------------------------------------------*/
{
solve(fvm::ddt(rho) + fvc::div(phi));
fvScalarMatrix rhoEqn
(
fvm::ddt(rho)
+ fvc::div(phi)
==
fvOptions(rho)
);
fvOptions.constrain(rhoEqn);
rhoEqn.solve();
fvOptions.correct(rho);
}
// ************************************************************************* //