Skip to content
Snippets Groups Projects
Commit f609ccd7 authored by Henry's avatar Henry Committed by Andrew Heather
Browse files

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

parent d2e9a0d1
No related merge requests found
Showing
with 77 additions and 15 deletions
{ {
solve fvScalarMatrix EEqn
( (
fvm::ddt(rho, e) + fvm::div(phi, e) fvm::ddt(rho, e) + fvm::div(phi, e)
+ fvc::ddt(rho, K) + fvc::div(phi, K) + fvc::ddt(rho, K) + fvc::div(phi, K)
+ fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)") + fvc::div(fvc::absolute(phi/fvc::interpolate(rho), U), p, "div(phiv,p)")
- fvm::laplacian(turbulence->alphaEff(), e) - fvm::laplacian(turbulence->alphaEff(), e)
==
fvOptions(rho, e)
); );
EEqn.relax();
fvOptions.constrain(EEqn);
EEqn.solve();
fvOptions.correct(e);
thermo.correct(); thermo.correct();
} }
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -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)/finiteVolume/lnInclude
EXE_LIBS = \ EXE_LIBS = \
...@@ -9,5 +13,7 @@ EXE_LIBS = \ ...@@ -9,5 +13,7 @@ EXE_LIBS = \
-lcompressibleTurbulenceModel \ -lcompressibleTurbulenceModel \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lfiniteVolume \ -lmeshTools \
-lmeshTools -lsampling \
-lfvOptions \
-lfiniteVolume
...@@ -3,7 +3,18 @@ fvVectorMatrix UEqn ...@@ -3,7 +3,18 @@ fvVectorMatrix UEqn
fvm::ddt(rho, U) fvm::ddt(rho, U)
+ fvm::div(phi, U) + fvm::div(phi, U)
+ turbulence->divDevRhoReff(U) + turbulence->divDevRhoReff(U)
==
fvOptions(rho, U)
); );
solve(UEqn == -fvc::grad(p)); UEqn.relax();
K = 0.5*magSqr(U);
fvOptions.constrain(UEqn);
if (pimple.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
fvOptions.correct(U);
K = 0.5*magSqr(U);
}
...@@ -16,6 +16,8 @@ surfaceScalarField phid ...@@ -16,6 +16,8 @@ surfaceScalarField phid
) )
); );
fvOptions.makeRelative(fvc::interpolate(psi), phid);
// Non-orthogonal pressure corrector loop // Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
...@@ -24,8 +26,12 @@ while (pimple.correctNonOrthogonal()) ...@@ -24,8 +26,12 @@ while (pimple.correctNonOrthogonal())
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rhorAUf, p) - fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
); );
fvOptions.constrain(pEqn);
pEqn.solve(); pEqn.solve();
if (pimple.finalNonOrthogonalIter()) if (pimple.finalNonOrthogonalIter())
...@@ -39,4 +45,5 @@ while (pimple.correctNonOrthogonal()) ...@@ -39,4 +45,5 @@ while (pimple.correctNonOrthogonal())
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
EXE_INC = \ EXE_INC = \
-I.. \ -I.. \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -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)/finiteVolume/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lfluidThermophysicalModels \ -lfluidThermophysicalModels \
...@@ -12,6 +15,8 @@ EXE_LIBS = \ ...@@ -12,6 +15,8 @@ EXE_LIBS = \
-lcompressibleTurbulenceModel \ -lcompressibleTurbulenceModel \
-lcompressibleRASModels \ -lcompressibleRASModels \
-lcompressibleLESModels \ -lcompressibleLESModels \
-lmeshTools \
-lsampling \
-lfvOptions \
-lfiniteVolume \ -lfiniteVolume \
-ldynamicMesh \ -ldynamicMesh
-lmeshTools
...@@ -19,6 +19,7 @@ surfaceScalarField phid ...@@ -19,6 +19,7 @@ surfaceScalarField phid
); );
fvc::makeRelative(phid, psi, U); fvc::makeRelative(phid, psi, U);
fvOptions.makeRelative(fvc::interpolate(psi), phid);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
...@@ -27,8 +28,12 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) ...@@ -27,8 +28,12 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rhorAUf, p) - fvm::laplacian(rhorAUf, p)
==
fvOptions(psi, p, rho.name())
); );
fvOptions.constrain(pEqn);
pEqn.solve(); pEqn.solve();
phi = pEqn.flux(); phi = pEqn.flux();
...@@ -38,6 +43,8 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) ...@@ -38,6 +43,8 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
U = HbyA - rAU*fvc::grad(p); U = HbyA - rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U);
K = 0.5*magSqr(U);
{ {
rhoUf = fvc::interpolate(rho*U); rhoUf = fvc::interpolate(rho*U);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -35,6 +35,7 @@ Description ...@@ -35,6 +35,7 @@ Description
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "motionSolver.H" #include "motionSolver.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "fvIOoptionList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -44,6 +45,7 @@ int main(int argc, char *argv[]) ...@@ -44,6 +45,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H"
#include "createRhoUf.H" #include "createRhoUf.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -34,6 +34,7 @@ Description ...@@ -34,6 +34,7 @@ Description
#include "psiThermo.H" #include "psiThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "pimpleControl.H" #include "pimpleControl.H"
#include "fvIOoptionList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
...@@ -43,6 +44,7 @@ int main(int argc, char *argv[]) ...@@ -43,6 +44,7 @@ int main(int argc, char *argv[])
#include "createTime.H" #include "createTime.H"
#include "createMesh.H" #include "createMesh.H"
#include "createFields.H" #include "createFields.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
pimpleControl pimple(mesh); pimpleControl pimple(mesh);
......
{ {
# include "rhoEqn.H" solve(fvm::ddt(rho) + fvc::div(phi));
} }
{ {
scalar sumLocalContErr = scalar sumLocalContErr =
......
...@@ -58,7 +58,7 @@ int main(int argc, char *argv[]) ...@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
#include "readTimeControls.H" #include "readTimeControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "rhoEqn.H" solve(fvm::ddt(rho) + fvc::div(phi));
// --- Pressure-velocity PIMPLE corrector loop // --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop()) while (pimple.loop())
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
...@@ -30,7 +30,19 @@ Description ...@@ -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);
} }
// ************************************************************************* // // ************************************************************************* //
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment