Thermodynamics: Changed all eEqn to EEqn and reformulated to conserve E in sonic solvers

To support these changes the need for "Sp" corrections on div-terms has been
eliminated by introducing a "bounded" convection scheme which subtracts the Sp
term from the selected scheme.  The equivalent will be needed for the ddt term.

A warning message is generated for steady-state solvers in which the "bounded"
scheme is not selected for the convection terms.
This commit is contained in:
Henry
2012-09-19 12:49:07 +01:00
parent b1fb071823
commit dbe48b482c
62 changed files with 775 additions and 264 deletions

View File

@ -0,0 +1,19 @@
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::div(phi, he)
+ (
he.name() == "e"
? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho))
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
)
- fvm::laplacian(turbulence->alphaEff(), he)
);
EEqn.relax();
EEqn.solve();
thermo.correct();
}

View File

@ -5,6 +5,7 @@
psiThermo::New(mesh)
);
psiThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho
(
@ -20,7 +21,6 @@
);
volScalarField& p = thermo.p();
volScalarField& e = thermo.he();
const volScalarField& psi = thermo.psi();
Info<< "Reading field U\n" << endl;

View File

@ -1,18 +0,0 @@
{
// Kinetic + pressure energy
volScalarField Ekp("Ekp", 0.5*magSqr(U) + p/rho);
fvScalarMatrix eEqn
(
fvm::div(phi, e)
- fvm::Sp(fvc::div(phi), e)
- fvm::laplacian(turbulence->alphaEff(), e)
==
fvc::div(phi)*Ekp - fvc::div(phi, Ekp)
);
eEqn.relax();
eEqn.solve();
thermo.correct();
}

View File

@ -0,0 +1,21 @@
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::div(phi, he)
+ (
he.name() == "e"
? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho))
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
)
- fvm::laplacian(turbulence->alphaEff(), he)
);
pZones.addEnergySource(thermo, rho, EEqn);
EEqn.relax();
EEqn.solve();
thermo.correct();
}

View File

@ -5,6 +5,7 @@
rhoThermo::New(mesh)
);
rhoThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho
(
@ -20,7 +21,6 @@
);
volScalarField& p = thermo.p();
volScalarField& e = thermo.he();
Info<< "Reading field U\n" << endl;
volVectorField U

View File

@ -1,20 +0,0 @@
{
// Kinetic + pressure energy
volScalarField Ekp("Ekp", 0.5*magSqr(U) + p/rho);
fvScalarMatrix eEqn
(
fvm::div(phi, e)
- fvm::Sp(fvc::div(phi), e)
- fvm::laplacian(turbulence->alphaEff(), e)
==
fvc::div(phi)*Ekp - fvc::div(phi, Ekp)
);
pZones.addEnergySource(thermo, rho, eEqn);
eEqn.relax();
eEqn.solve();
thermo.correct();
}

View File

@ -63,7 +63,7 @@ int main(int argc, char *argv[])
// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "eEqn.H"
#include "EEqn.H"
#include "pEqn.H"
}

View File

@ -59,7 +59,7 @@ int main(int argc, char *argv[])
// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "eEqn.H"
#include "EEqn.H"
#include "pEqn.H"
}

View File

@ -61,7 +61,7 @@ int main(int argc, char *argv[])
// Velocity-pressure-enthalpy SIMPLEC corrector
{
#include "UEqn.H"
#include "eEqn.H"
#include "EEqn.H"
#include "pEqn.H"
}

View File

@ -0,0 +1,10 @@
{
solve
(
fvm::ddt(rho, e) + fvm::div(phi, e)
+ fvc::ddt(rho, K) + fvc::div(phi, volScalarField("Ekp", K + p/rho))
- fvm::laplacian(turbulence->alphaEff(), e)
);
thermo.correct();
}

View File

@ -5,6 +5,7 @@
psiThermo::New(mesh)
);
psiThermo& thermo = pThermo();
thermo.validate(args.executable(), "e");
volScalarField& p = thermo.p();
volScalarField& e = thermo.he();

View File

@ -1,12 +0,0 @@
{
solve
(
fvm::ddt(rho, e)
+ fvm::div(phi, e)
- fvm::laplacian(turbulence->alphaEff(), e)
==
- (fvc::ddt(rho, K) + fvc::div(phi, volScalarField("Ekp", K + p/rho)))
);
thermo.correct();
}

View File

@ -17,7 +17,8 @@ surfaceScalarField phid
volScalarField Dp("Dp", rho*rAU);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
// Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -28,7 +29,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (pimple.finalNonOrthogonalIter())
{
phi = pEqn.flux();
}

View File

@ -0,0 +1,11 @@
{
solve
(
fvm::ddt(rho, e) + fvm::div(phi, e)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
+ fvc::div(phi/fvc::interpolate(rho) + mesh.phi(), p, "div(phiv,p)")
- fvm::laplacian(turbulence->alphaEff(), e)
);
thermo.correct();
}

View File

@ -1,12 +0,0 @@
{
solve
(
fvm::ddt(rho, e)
+ fvm::div(phi, e)
- fvm::laplacian(turbulence->alphaEff(), e)
==
- p*fvc::div(phi/fvc::interpolate(rho) + mesh.phi())
);
thermo.correct();
}

View File

@ -34,6 +34,7 @@ Description
#include "psiThermo.H"
#include "turbulenceModel.H"
#include "motionSolver.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,6 +46,8 @@ int main(int argc, char *argv[])
#include "createFields.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
@ -62,19 +65,23 @@ int main(int argc, char *argv[])
#include "rhoEqn.H"
#include "UEqn.H"
#include "eEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "pEqn.H"
}
#include "UEqn.H"
#include "EEqn.H"
turbulence->correct();
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
turbulence->correct();
}
}
rho = thermo.rho();

View File

@ -33,6 +33,7 @@ Description
#include "fvCFD.H"
#include "psiThermo.H"
#include "turbulenceModel.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,6 +45,8 @@ int main(int argc, char *argv[])
#include "createFields.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
@ -52,20 +55,28 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readPISOControls.H"
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "rhoEqn.H"
#include "UEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "eEqn.H"
#include "pEqn.H"
}
#include "UEqn.H"
#include "EEqn.H"
turbulence->correct();
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
turbulence->correct();
}
}
rho = thermo.rho();

View File

@ -31,6 +31,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,6 +45,8 @@ int main(int argc, char *argv[])
#include "createFields.H"
#include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
@ -52,57 +55,59 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readPISOControls.H"
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "rhoEqn.H"
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
- fvm::laplacian(mu, U)
);
solve(UEqn == -fvc::grad(p));
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
volScalarField rAU(1.0/UEqn.A());
U = rAU*UEqn.H();
surfaceScalarField phid
fvVectorMatrix UEqn
(
"phid",
psi
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
)
fvm::ddt(rho, U)
+ fvm::div(phi, U)
- fvm::laplacian(mu, U)
);
phi = (rhoO/psi)*phid;
volScalarField Dp("Dp", rho*rAU);
solve(UEqn == -fvc::grad(p));
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
);
// --- Pressure corrector loop
while (pimple.correct())
{
volScalarField rAU(1.0/UEqn.A());
U = rAU*UEqn.H();
pEqn.solve();
surfaceScalarField phid
(
"phid",
psi
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rAU, rho, U, phi)
)
);
phi += pEqn.flux();
phi = (rhoO/psi)*phid;
volScalarField Dp("Dp", rho*rAU);
#include "compressibleContinuityErrs.H"
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
+ fvm::div(phid, p)
- fvm::laplacian(Dp, p)
);
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
pEqn.solve();
phi += pEqn.flux();
#include "compressibleContinuityErrs.H"
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
}
}
rho = rhoO + psi*p;

View File

@ -0,0 +1,20 @@
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::ddt(rho, he) + fvm::div(phi, he)
+ fvc::ddt(rho, K) + fvc::div(phi, K)
+ (
he.name() == "e"
? fvc::div(phi, volScalarField("Ep", p/rho))
: -dpdt
)
- fvm::laplacian(turbulence->alphaEff(), he)
);
EEqn.relax();
EEqn.solve();
thermo.correct();
}

View File

@ -75,7 +75,7 @@ int main(int argc, char *argv[])
while (pimple.loop())
{
#include "UEqn.H"
#include "hEqn.H"
#include "EEqn.H"
// --- Pressure corrector loop
while (pimple.correct())

View File

@ -5,6 +5,7 @@
rhoThermo::New(mesh)
);
rhoThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho
(
@ -20,7 +21,6 @@
);
volScalarField& p = thermo.p();
volScalarField& h = thermo.he();
const volScalarField& psi = thermo.psi();

View File

@ -1,16 +0,0 @@
{
fvScalarMatrix hEqn
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
dpdt
- (fvc::ddt(rho, K) + fvc::div(phi, K))
);
hEqn.relax();
hEqn.solve();
thermo.correct();
}

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake
wmake buoyantSimpleRadiationFoam
# ----------------------------------------------------------------- end-of-file

View File

@ -0,0 +1,19 @@
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::div(phi, he)
+ (
he.name() == "e"
? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho))
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
)
- fvm::laplacian(turbulence->alphaEff(), he)
);
EEqn.relax();
EEqn.solve();
thermo.correct();
}

View File

@ -59,7 +59,7 @@ int main(int argc, char *argv[])
// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "hEqn.H"
#include "EEqn.H"
#include "pEqn.H"
}

View File

@ -0,0 +1,22 @@
{
volScalarField& he = thermo.he();
fvScalarMatrix EEqn
(
fvm::div(phi, he)
+ (
he.name() == "e"
? fvc::div(phi, volScalarField("Ekp", 0.5*magSqr(U) + p/rho))
: fvc::div(phi, volScalarField("K", 0.5*magSqr(U)))
)
- fvm::laplacian(turbulence->alphaEff(), he)
==
radiation->Sh(thermo)
);
EEqn.relax();
EEqn.solve();
thermo.correct();
radiation->correct();
}

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I../buoyantSimpleFoam \
-I.. \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/radiationModels/lnInclude \
-I$(LIB_SRC)/turbulenceModels \

View File

@ -62,7 +62,7 @@ int main(int argc, char *argv[])
// Pressure-velocity SIMPLE corrector
{
#include "UEqn.H"
#include "hEqn.H"
#include "EEqn.H"
#include "pEqn.H"
}

View File

@ -5,6 +5,7 @@
psiThermo::New(mesh)
);
psiThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho
(
@ -20,7 +21,6 @@
);
volScalarField& p = thermo.p();
volScalarField& h = thermo.he();
const volScalarField& psi = thermo.psi();
Info<< "Reading field U\n" << endl;

View File

@ -1,15 +0,0 @@
{
fvScalarMatrix hEqn
(
fvm::div(phi, h)
- fvm::Sp(fvc::div(phi), h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
- fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")
);
hEqn.relax();
hEqn.solve();
thermo.correct();
}

View File

@ -1,19 +0,0 @@
{
fvScalarMatrix hEqn
(
fvm::div(phi, h)
- fvm::Sp(fvc::div(phi), h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
- fvc::div(phi, 0.5*magSqr(U), "div(phi,K)")
+ radiation->Sh(thermo)
);
hEqn.relax();
hEqn.solve();
thermo.correct();
radiation->correct();
}