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::New(mesh)
); );
psiThermo& thermo = pThermo(); psiThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho volScalarField rho
( (
@ -20,7 +21,6 @@
); );
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
volScalarField& e = thermo.he();
const volScalarField& psi = thermo.psi(); const volScalarField& psi = thermo.psi();
Info<< "Reading field U\n" << endl; 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::New(mesh)
); );
rhoThermo& thermo = pThermo(); rhoThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho volScalarField rho
( (
@ -20,7 +21,6 @@
); );
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
volScalarField& e = thermo.he();
Info<< "Reading field U\n" << endl; Info<< "Reading field U\n" << endl;
volVectorField U 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 // Pressure-velocity SIMPLE corrector
{ {
#include "UEqn.H" #include "UEqn.H"
#include "eEqn.H" #include "EEqn.H"
#include "pEqn.H" #include "pEqn.H"
} }

View File

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

View File

@ -61,7 +61,7 @@ int main(int argc, char *argv[])
// Velocity-pressure-enthalpy SIMPLEC corrector // Velocity-pressure-enthalpy SIMPLEC corrector
{ {
#include "UEqn.H" #include "UEqn.H"
#include "eEqn.H" #include "EEqn.H"
#include "pEqn.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::New(mesh)
); );
psiThermo& thermo = pThermo(); psiThermo& thermo = pThermo();
thermo.validate(args.executable(), "e");
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
volScalarField& e = thermo.he(); 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); volScalarField Dp("Dp", rho*rAU);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) // Non-orthogonal pressure corrector loop
while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
@ -28,7 +29,7 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
pEqn.solve(); pEqn.solve();
if (nonOrth == nNonOrthCorr) if (pimple.finalNonOrthogonalIter())
{ {
phi = pEqn.flux(); 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 "psiThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "motionSolver.H" #include "motionSolver.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,6 +46,8 @@ int main(int argc, char *argv[])
#include "createFields.H" #include "createFields.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -62,19 +65,23 @@ int main(int argc, char *argv[])
#include "rhoEqn.H" #include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UEqn.H" #include "UEqn.H"
#include "EEqn.H"
#include "eEqn.H" // --- Pressure corrector loop
while (pimple.correct())
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{ {
#include "pEqn.H" #include "pEqn.H"
} }
if (pimple.turbCorr())
{
turbulence->correct(); turbulence->correct();
}
}
rho = thermo.rho(); rho = thermo.rho();

View File

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

View File

@ -31,6 +31,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,6 +45,8 @@ int main(int argc, char *argv[])
#include "createFields.H" #include "createFields.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
@ -52,11 +55,14 @@ int main(int argc, char *argv[])
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readPISOControls.H" #include "readTimeControls.H"
#include "compressibleCourantNo.H" #include "compressibleCourantNo.H"
#include "rhoEqn.H" #include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
fvVectorMatrix UEqn fvVectorMatrix UEqn
( (
fvm::ddt(rho, U) fvm::ddt(rho, U)
@ -66,10 +72,8 @@ int main(int argc, char *argv[])
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p));
// --- Pressure corrector loop
// --- PISO loop while (pimple.correct())
for (int corr=0; corr<nCorr; corr++)
{ {
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
U = rAU*UEqn.H(); U = rAU*UEqn.H();
@ -104,6 +108,7 @@ int main(int argc, char *argv[])
U -= rAU*fvc::grad(p); U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }
}
rho = rhoO + psi*p; 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()) while (pimple.loop())
{ {
#include "UEqn.H" #include "UEqn.H"
#include "hEqn.H" #include "EEqn.H"
// --- Pressure corrector loop // --- Pressure corrector loop
while (pimple.correct()) while (pimple.correct())

View File

@ -5,6 +5,7 @@
rhoThermo::New(mesh) rhoThermo::New(mesh)
); );
rhoThermo& thermo = pThermo(); rhoThermo& thermo = pThermo();
thermo.validate(args.executable(), "h", "e");
volScalarField rho volScalarField rho
( (
@ -20,7 +21,6 @@
); );
volScalarField& p = thermo.p(); volScalarField& p = thermo.p();
volScalarField& h = thermo.he();
const volScalarField& psi = thermo.psi(); 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 // Pressure-velocity SIMPLE corrector
{ {
#include "UEqn.H" #include "UEqn.H"
#include "hEqn.H" #include "EEqn.H"
#include "pEqn.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,4 +1,3 @@
buoyantSimpleRadiationFoam.C buoyantSimpleRadiationFoam.C
EXE = $(FOAM_APPBIN)/buoyantSimpleRadiationFoam EXE = $(FOAM_APPBIN)/buoyantSimpleRadiationFoam

View File

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

View File

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

View File

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

View File

@ -884,6 +884,7 @@ DebugSwitches
wallHeatTransfer 0; wallHeatTransfer 0;
wallLayerCells 0; wallLayerCells 0;
wallModel 0; wallModel 0;
warnUnboundedGauss 1;
waveTransmissive 0; waveTransmissive 0;
wedge 0; wedge 0;
weighted 0; weighted 0;

View File

@ -345,6 +345,7 @@ convectionSchemes = finiteVolume/convectionSchemes
$(convectionSchemes)/convectionScheme/convectionSchemes.C $(convectionSchemes)/convectionScheme/convectionSchemes.C
$(convectionSchemes)/gaussConvectionScheme/gaussConvectionSchemes.C $(convectionSchemes)/gaussConvectionScheme/gaussConvectionSchemes.C
$(convectionSchemes)/multivariateGaussConvectionScheme/multivariateGaussConvectionSchemes.C $(convectionSchemes)/multivariateGaussConvectionScheme/multivariateGaussConvectionSchemes.C
$(convectionSchemes)/boundedConvectionScheme/boundedConvectionSchemes.C
laplacianSchemes = finiteVolume/laplacianSchemes laplacianSchemes = finiteVolume/laplacianSchemes
$(laplacianSchemes)/laplacianScheme/laplacianSchemes.C $(laplacianSchemes)/laplacianScheme/laplacianSchemes.C

View File

@ -0,0 +1,103 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "boundedConvectionScheme.H"
#include "fvcSurfaceIntegrate.H"
#include "fvMatrices.H"
#include "fvmSup.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
boundedConvectionScheme<Type>::interpolate
(
const surfaceScalarField& phi,
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
return scheme_().interpolate(phi, vf);
}
template<class Type>
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
boundedConvectionScheme<Type>::flux
(
const surfaceScalarField& faceFlux,
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
return scheme_().flux(faceFlux, vf);
}
template<class Type>
tmp<fvMatrix<Type> >
boundedConvectionScheme<Type>::fvmDiv
(
const surfaceScalarField& faceFlux,
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
return
scheme_().fvmDiv(faceFlux, vf)
- fvm::Sp(fvc::surfaceIntegrate(faceFlux), vf);
}
template<class Type>
tmp<GeometricField<Type, fvPatchField, volMesh> >
boundedConvectionScheme<Type>::fvcDiv
(
const surfaceScalarField& faceFlux,
const GeometricField<Type, fvPatchField, volMesh>& vf
) const
{
return
scheme_().fvcDiv(faceFlux, vf)
- fvc::surfaceIntegrate(faceFlux)*vf;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,150 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
Class
Foam::fv::boundedConvectionScheme
Description
Bounded form of the selected convection scheme.
Boundedness is achieved by subtracting div(phi)*vf or Sp(div(phi), vf)
which is non-conservative if div(phi) != 0 but conservative otherwise.
Can be used for convection of bounded scalar properties in steady-state
solvers to improve stability if insufficient convergence of the pressure
equation causes temporary divergence of the flux field.
SourceFiles
boundedConvectionScheme.C
\*---------------------------------------------------------------------------*/
#ifndef boundedConvectionScheme_H
#define boundedConvectionScheme_H
#include "convectionScheme.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace fv
{
/*---------------------------------------------------------------------------*\
Class boundedConvectionScheme Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class boundedConvectionScheme
:
public fv::convectionScheme<Type>
{
// Private data
tmp<fv::convectionScheme<Type> > scheme_;
// Private Member Functions
//- Disallow default bitwise copy construct
boundedConvectionScheme(const boundedConvectionScheme&);
//- Disallow default bitwise assignment
void operator=(const boundedConvectionScheme&);
public:
//- Runtime type information
TypeName("bounded");
// Constructors
//- Construct from flux and Istream
boundedConvectionScheme
(
const fvMesh& mesh,
const surfaceScalarField& faceFlux,
Istream& is
)
:
convectionScheme<Type>(mesh, faceFlux),
scheme_
(
fv::convectionScheme<Type>::New(mesh, faceFlux, is)
)
{}
// Member Functions
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > interpolate
(
const surfaceScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
) const;
tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > flux
(
const surfaceScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
) const;
tmp<fvMatrix<Type> > fvmDiv
(
const surfaceScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
) const;
tmp<GeometricField<Type, fvPatchField, volMesh> > fvcDiv
(
const surfaceScalarField&,
const GeometricField<Type, fvPatchField, volMesh>&
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fv
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "boundedConvectionScheme.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,39 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#include "boundedConvectionScheme.H"
#include "fvMesh.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
makeFvConvectionScheme(boundedConvectionScheme)
}
}
// ************************************************************************* //

View File

@ -47,6 +47,10 @@ namespace Foam
namespace fv namespace fv
{ {
//- Temporary debug switch to provide warning about backward-compatibility
// issue with setting div schemes for steady-state
extern int warnUnboundedGauss;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class gaussConvectionScheme Declaration Class gaussConvectionScheme Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -103,7 +107,29 @@ public:
( (
surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is) surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is)
) )
{} {
is.rewind();
word bounded(is);
if
(
warnUnboundedGauss
&& word(mesh.ddtScheme("default")) == "steadyState"
&& bounded != "bounded"
)
{
fileNameList controlDictFiles(findEtcFiles("controlDict"));
IOWarningIn("gaussConvectionScheme", is)
<< "Unbounded 'Gauss' div scheme used in "
"steady-state solver, use 'bounded Gauss' "
"to ensure boundedness.\n"
<< " To remove this warning switch off "
<< "'boundedGauss' in "
<< controlDictFiles[controlDictFiles.size()-1]
<< endl;
}
}
// Member Functions // Member Functions

View File

@ -32,6 +32,11 @@ namespace Foam
{ {
namespace fv namespace fv
{ {
int warnUnboundedGauss
(
Foam::debug::debugSwitch("warnUnboundedGauss", true)
);
makeFvConvectionScheme(gaussConvectionScheme) makeFvConvectionScheme(gaussConvectionScheme)
} }
} }

View File

@ -164,6 +164,89 @@ Foam::basicThermo::~basicThermo()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::basicThermo::validate
(
const word& app,
const word& a
) const
{
if (!(he().name() == a))
{
FatalErrorIn(app)
<< "Supported energy type is " << a
<< ", thermodynamics package provides " << he().name()
<< exit(FatalError);
}
}
void Foam::basicThermo::validate
(
const word& app,
const word& a,
const word& b
) const
{
if (!(he().name() == a || he().name() == b))
{
FatalErrorIn(app)
<< "Supported energy types are " << a << " and " << b
<< ", thermodynamics package provides " << he().name()
<< exit(FatalError);
}
}
void Foam::basicThermo::validate
(
const word& app,
const word& a,
const word& b,
const word& c
) const
{
if
(
!(
he().name() == a
|| he().name() == b
|| he().name() == c
)
)
{
FatalErrorIn(app)
<< "Supported energy types are " << a << ", " << b << " and " << c
<< ", thermodynamics package provides " << he().name()
<< exit(FatalError);
}
}
void Foam::basicThermo::validate
(
const word& app,
const word& a,
const word& b,
const word& c,
const word& d
) const
{
if
(
!(
he().name() == a
|| he().name() == b
|| he().name() == c
|| he().name() == d
)
)
{
FatalErrorIn(app)
<< "Supported energy types are " << a << ", " << b
<< ", " << c << " and " << d
<< ", thermodynamics package provides " << he().name()
<< exit(FatalError);
}
}
Foam::volScalarField& Foam::basicThermo::p() Foam::volScalarField& Foam::basicThermo::p()
{ {
return p_; return p_;

View File

@ -111,6 +111,45 @@ public:
// Member functions // Member functions
//- Check that the thermodynamics package is consistent
// with energy forms supported by the application
void validate
(
const word& app,
const word&
) const;
//- Check that the thermodynamics package is consistent
// with energy forms supported by the application
void validate
(
const word& app,
const word&,
const word&
) const;
//- Check that the thermodynamics package is consistent
// with energy forms supported by the application
void validate
(
const word& app,
const word&,
const word&,
const word&
) const;
//- Check that the thermodynamics package is consistent
// with energy forms supported by the application
void validate
(
const word& app,
const word&,
const word&,
const word&,
const word&
) const;
//- Update properties //- Update properties
virtual void correct() = 0; virtual void correct() = 0;

View File

@ -142,6 +142,24 @@ makeBasicMixture
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeBasicMixture
(
pureMixture,
constTransport,
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
makeBasicMixture
(
pureMixture,
sutherlandTransport,
sensibleInternalEnergy,
eConstThermo,
perfectGas
);
makeBasicMixture makeBasicMixture
( (
pureMixture, pureMixture,

View File

@ -84,27 +84,27 @@ makeThermo
/* * * * * * * * * * * * * * Internal-energy-based * * * * * * * * * * * * * */ /* * * * * * * * * * * * * * Internal-energy-based * * * * * * * * * * * * * */
// makeThermo makeThermo
// ( (
// psiThermo, psiThermo,
// hePsiThermo, hePsiThermo,
// pureMixture, pureMixture,
// constTransport, constTransport,
// sensibleInternalEnergy, sensibleInternalEnergy,
// eConstThermo, eConstThermo,
// perfectGas perfectGas
// ); );
// makeThermo makeThermo
// ( (
// psiThermo, psiThermo,
// hePsiThermo, hePsiThermo,
// pureMixture, pureMixture,
// sutherlandTransport, sutherlandTransport,
// sensibleInternalEnergy, sensibleInternalEnergy,
// eConstThermo, eConstThermo,
// perfectGas perfectGas
// ); );
makeThermo makeThermo
( (

View File

@ -292,7 +292,7 @@ void kEpsilon::correct()
( (
fvm::ddt(rho_, epsilon_) fvm::ddt(rho_, epsilon_)
+ fvm::div(phi_, epsilon_) + fvm::div(phi_, epsilon_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), epsilon_) //***HGW - fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), epsilon_)
- fvm::laplacian(DepsilonEff(), epsilon_) - fvm::laplacian(DepsilonEff(), epsilon_)
== ==
C1_*G*epsilon_/k_ C1_*G*epsilon_/k_
@ -314,7 +314,7 @@ void kEpsilon::correct()
( (
fvm::ddt(rho_, k_) fvm::ddt(rho_, k_)
+ fvm::div(phi_, k_) + fvm::div(phi_, k_)
- fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), k_) //***HGW - fvm::Sp(fvc::ddt(rho_) + fvc::div(phi_), k_)
- fvm::laplacian(DkEff(), k_) - fvm::laplacian(DkEff(), k_)
== ==
G G

View File

@ -26,6 +26,7 @@ FoamFile
empty empty
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 400; nFaces 400;
startFace 101; startFace 101;
} }

View File

@ -32,12 +32,14 @@ FoamFile
bottom bottom
{ {
type symmetryPlane; type symmetryPlane;
inGroups 1(symmetryPlane);
nFaces 25; nFaces 25;
startFace 10415; startFace 10415;
} }
top top
{ {
type symmetryPlane; type symmetryPlane;
inGroups 1(symmetryPlane);
nFaces 125; nFaces 125;
startFace 10440; startFace 10440;
} }
@ -50,6 +52,7 @@ FoamFile
defaultFaces defaultFaces
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 10500; nFaces 10500;
startFace 10675; startFace 10675;
} }

View File

@ -17,7 +17,7 @@ FoamFile
solvers solvers
{ {
p "p.*"
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;
@ -25,14 +25,14 @@ solvers
relTol 0; relTol 0;
} }
"(U|e)" "(U|e).*"
{ {
$p; $p;
tolerance 1e-05; tolerance 1e-05;
relTol 0; relTol 0;
} }
rho "rho.*"
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
@ -41,9 +41,10 @@ solvers
} }
} }
PISO PIMPLE
{ {
nCorrectors 2; nOuterCorrectors 2;
nCorrectors 1;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }

View File

@ -26,6 +26,7 @@ FoamFile
empty empty
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 4000; nFaces 4000;
startFace 1001; startFace 1001;
} }

View File

@ -17,7 +17,7 @@ FoamFile
solvers solvers
{ {
"(p|U|e)" "(p|U|e).*"
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;
@ -25,7 +25,7 @@ solvers
relTol 0; relTol 0;
} }
rho "rho.*"
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
@ -34,9 +34,10 @@ solvers
} }
} }
PISO PIMPLE
{ {
nCorrectors 2; nOuterCorrectors 2;
nCorrectors 1;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }

View File

@ -32,6 +32,7 @@ FoamFile
SYMP3 SYMP3
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 80000; nFaces 80000;
startFace 80170; startFace 80170;
} }

View File

@ -17,12 +17,12 @@ FoamFile
solvers solvers
{ {
rho "rho.*"
{ {
solver diagonal; solver diagonal;
} }
p "p.*"
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;
@ -30,21 +30,22 @@ solvers
relTol 0; relTol 0;
} }
"(U|e)" "(U|e).*"
{ {
$p; $p;
tolerance 1e-9; tolerance 1e-9;
} }
"(k|epsilon)" "(k|epsilon).*"
{ {
$p; $p;
tolerance 1e-10; tolerance 1e-10;
} }
} }
PISO PIMPLE
{ {
nOuterCorrectors 1;
nCorrectors 2; nCorrectors 2;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }

View File

@ -50,6 +50,7 @@ FoamFile
defaultFaces defaultFaces
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 13272; nFaces 13272;
startFace 13463; startFace 13463;
} }

View File

@ -17,12 +17,12 @@ FoamFile
solvers solvers
{ {
rho "rho.*"
{ {
solver diagonal; solver diagonal;
} }
p "p.*"
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;
@ -30,22 +30,23 @@ solvers
relTol 0; relTol 0;
} }
"(U|e|R)" "(U|e|R).*"
{ {
$p; $p;
tolerance 1e-05; tolerance 1e-05;
} }
"(k|epsilon)" "(k|epsilon).*"
{ {
$p; $p;
tolerance 1e-08; tolerance 1e-08;
} }
} }
PISO PIMPLE
{ {
nCorrectors 2; nOuterCorrectors 2;
nCorrectors 1;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }

View File

@ -26,6 +26,7 @@ FoamFile
axis axis
{ {
type symmetryPlane; type symmetryPlane;
inGroups 1(symmetryPlane);
nFaces 120; nFaces 120;
startFace 7500; startFace 7500;
} }
@ -38,12 +39,14 @@ FoamFile
back back
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 3725; nFaces 3725;
startFace 7625; startFace 7625;
} }
front front
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 3725; nFaces 3725;
startFace 11350; startFace 11350;
} }

View File

@ -17,7 +17,7 @@ FoamFile
solvers solvers
{ {
p "p.*"
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;
@ -25,14 +25,14 @@ solvers
relTol 0; relTol 0;
} }
U "U.*"
{ {
$p; $p;
tolerance 1e-05; tolerance 1e-05;
relTol 0; relTol 0;
} }
rho "rho.*"
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
@ -41,9 +41,10 @@ solvers
} }
} }
PISO PIMPLE
{ {
nCorrectors 2; nOuterCorrectors 2;
nCorrectors 1;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }

View File

@ -16,6 +16,7 @@ FoamFile
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
thermoType heRhoThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>,sensibleEnthalpy>>>>; thermoType heRhoThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>,sensibleEnthalpy>>>>;
//thermoType heRhoThermo<pureMixture<constTransport<specieThermo<hConstThermo<perfectGas>,sensibleInternalEnergy>>>>;
pRef 100000; pRef 100000;

View File

@ -30,23 +30,19 @@ divSchemes
default none; default none;
div(phi,U) Gauss upwind; div(phi,U) Gauss upwind;
div(phi,h) Gauss upwind; div(phi,h) Gauss upwind;
div(phi,e) Gauss upwind;
div(phi,k) Gauss upwind; div(phi,k) Gauss upwind;
div(phi,epsilon) Gauss upwind; div(phi,epsilon) Gauss upwind;
div(phi,R) Gauss upwind; div(phi,R) Gauss upwind;
div(phi,K) Gauss linear; div(phi,K) Gauss linear;
div(phi,Ekp) Gauss linear;
div(R) Gauss linear; div(R) Gauss linear;
div((muEff*dev2(T(grad(U))))) Gauss linear; div((muEff*dev2(T(grad(U))))) Gauss linear;
} }
laplacianSchemes laplacianSchemes
{ {
default none; default Gauss linear corrected;
laplacian(muEff,U) Gauss linear corrected;
laplacian(Dp,p_rgh) Gauss linear corrected;
laplacian(alphaEff,h) Gauss linear corrected;
laplacian(DkEff,k) Gauss linear corrected;
laplacian(DepsilonEff,epsilon) Gauss linear corrected;
laplacian(DREff,R) Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes

View File

@ -39,7 +39,7 @@ solvers
relTol 0; relTol 0;
} }
"(U|h|k|epsilon|R)" "(U|h|e|k|epsilon|R)"
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;
@ -47,7 +47,7 @@ solvers
relTol 0.1; relTol 0.1;
} }
"(U|h|k|epsilon|R)Final" "(U|h|e|k|epsilon|R)Final"
{ {
$U; $U;
relTol 0; relTol 0;

View File

@ -18,5 +18,4 @@ FoamFile
dimensions [0 1 -2 0 0 0 0]; dimensions [0 1 -2 0 0 0 0];
value (0 -9.81 0); value (0 -9.81 0);
// ************************************************************************* // // ************************************************************************* //

View File

@ -28,25 +28,17 @@ gradSchemes
divSchemes divSchemes
{ {
default none; default none;
div(phi,U) Gauss upwind; div(phi,U) bounded Gauss upwind;
div(phi,h) Gauss upwind; div(phi,h) bounded Gauss upwind;
div(phi,K) Gauss upwind; div(phi,K) bounded Gauss upwind;
div(phi,k) Gauss upwind; div(phi,k) bounded Gauss upwind;
div(phi,epsilon) Gauss upwind; div(phi,epsilon) bounded Gauss upwind;
div(phi,R) Gauss upwind;
div(R) Gauss linear;
div((muEff*dev2(T(grad(U))))) Gauss linear; div((muEff*dev2(T(grad(U))))) Gauss linear;
} }
laplacianSchemes laplacianSchemes
{ {
default none; default Gauss linear uncorrected;
laplacian(muEff,U) Gauss linear uncorrected;
laplacian(Dp,p_rgh) Gauss linear uncorrected;
laplacian(alphaEff,h) Gauss linear uncorrected;
laplacian(DkEff,k) Gauss linear uncorrected;
laplacian(DepsilonEff,epsilon) Gauss linear uncorrected;
laplacian(DREff,R) Gauss linear uncorrected;
} }
interpolationSchemes interpolationSchemes

View File

@ -21,15 +21,15 @@ solvers
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
tolerance 1e-08; tolerance 1e-8;
relTol 0.01; relTol 0.01;
} }
"(U|h|k|epsilon|R)" "(U|h|e|k|epsilon|R)"
{ {
solver PBiCG; solver PBiCG;
preconditioner DILU; preconditioner DILU;
tolerance 1e-05; tolerance 1e-6;
relTol 0.1; relTol 0.1;
} }
} }
@ -45,6 +45,7 @@ SIMPLE
p_rgh 1e-2; p_rgh 1e-2;
U 1e-3; U 1e-3;
h 1e-3; h 1e-3;
e 1e-3;
// possibly check turbulence fields // possibly check turbulence fields
"(k|epsilon|omega)" 1e-3; "(k|epsilon|omega)" 1e-3;
@ -60,8 +61,8 @@ relaxationFactors
} }
equations equations
{ {
U 0.2; U 0.3;
h 0.2; "(h|e)" 0.3;
"(k|epsilon|R)" 0.5; "(k|epsilon|R)" 0.5;
} }
} }