From dbe48b482ceecdb2ac88dbb42af3678c5247059c Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 19 Sep 2012 12:49:07 +0100 Subject: [PATCH] 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. --- .../solvers/compressible/rhoSimpleFoam/EEqn.H | 19 +++ .../compressible/rhoSimpleFoam/createFields.H | 2 +- .../solvers/compressible/rhoSimpleFoam/eEqn.H | 18 --- .../rhoPorousMRFSimpleFoam/EEqn.H | 21 +++ .../rhoPorousMRFSimpleFoam/createFields.H | 2 +- .../rhoPorousMRFSimpleFoam/eEqn.H | 20 --- .../rhoPorousMRFSimpleFoam.C | 2 +- .../rhoSimpleFoam/rhoSimpleFoam.C | 2 +- .../rhoSimplecFoam/rhoSimplecFoam.C | 2 +- .../solvers/compressible/sonicFoam/EEqn.H | 10 ++ .../compressible/sonicFoam/createFields.H | 1 + .../solvers/compressible/sonicFoam/eEqn.H | 12 -- .../solvers/compressible/sonicFoam/pEqn.H | 5 +- .../sonicFoam/sonicDyMFoam/EEqn.H | 11 ++ .../sonicFoam/sonicDyMFoam/eEqn.H | 12 -- .../sonicFoam/sonicDyMFoam/sonicDyMFoam.C | 29 ++-- .../compressible/sonicFoam/sonicFoam.C | 27 +++- .../sonicLiquidFoam/sonicLiquidFoam.C | 81 +++++----- .../heatTransfer/buoyantPimpleFoam/EEqn.H | 20 +++ .../buoyantPimpleFoam/buoyantPimpleFoam.C | 2 +- .../buoyantPimpleFoam/createFields.H | 2 +- .../heatTransfer/buoyantPimpleFoam/hEqn.H | 16 -- .../heatTransfer/buoyantSimpleFoam/Allwmake | 8 + .../heatTransfer/buoyantSimpleFoam/EEqn.H | 19 +++ .../buoyantSimpleFoam/buoyantSimpleFoam.C | 2 +- .../buoyantSimpleRadiationFoam/EEqn.H | 22 +++ .../buoyantSimpleRadiationFoam/Make/files | 1 - .../buoyantSimpleRadiationFoam/Make/options | 2 +- .../buoyantSimpleRadiationFoam.C | 2 +- .../buoyantSimpleFoam/createFields.H | 2 +- .../heatTransfer/buoyantSimpleFoam/hEqn.H | 15 -- .../buoyantSimpleRadiationFoam/hEqn.H | 19 --- etc/controlDict | 1 + src/finiteVolume/Make/files | 1 + .../boundedConvectionScheme.C | 103 ++++++++++++ .../boundedConvectionScheme.H | 150 ++++++++++++++++++ .../boundedConvectionSchemes.C | 39 +++++ .../gaussConvectionScheme.H | 28 +++- .../gaussConvectionSchemes.C | 5 + .../basic/basicThermo/basicThermo.C | 83 ++++++++++ .../basic/basicThermo/basicThermo.H | 39 +++++ .../mixtures/basicMixture/basicMixtures.C | 18 +++ .../psiThermo/hePsiThermo/hePsiThermos.C | 40 ++--- .../compressible/RAS/kEpsilon/kEpsilon.C | 4 +- .../shockTube/constant/polyMesh/boundary | 1 + .../forwardStep/constant/polyMesh/boundary | 3 + .../laminar/forwardStep/system/fvSolution | 11 +- .../shockTube/constant/polyMesh/boundary | 1 + .../laminar/shockTube/system/fvSolution | 9 +- .../nacaAirfoil/constant/polyMesh/boundary | 1 + .../ras/nacaAirfoil/system/fvSolution | 13 +- .../ras/prism/constant/polyMesh/boundary | 1 + .../sonicFoam/ras/prism/system/fvSolution | 13 +- .../constant/polyMesh/boundary | 3 + .../decompressionTank/system/fvSolution | 11 +- .../hotRoom/constant/thermophysicalProperties | 3 +- .../hotRoom/system/fvSchemes | 10 +- .../hotRoom/system/fvSolution | 4 +- .../buoyantSimpleFoam/hotRoom/constant/g | 3 +- .../hotRoom/constant/thermophysicalProperties | 2 +- .../hotRoom/system/fvSchemes | 20 +-- .../hotRoom/system/fvSolution | 11 +- 62 files changed, 775 insertions(+), 264 deletions(-) create mode 100644 applications/solvers/compressible/rhoSimpleFoam/EEqn.H delete mode 100644 applications/solvers/compressible/rhoSimpleFoam/eEqn.H create mode 100644 applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H delete mode 100644 applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/eEqn.H create mode 100644 applications/solvers/compressible/sonicFoam/EEqn.H delete mode 100644 applications/solvers/compressible/sonicFoam/eEqn.H create mode 100644 applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H delete mode 100644 applications/solvers/compressible/sonicFoam/sonicDyMFoam/eEqn.H create mode 100644 applications/solvers/heatTransfer/buoyantPimpleFoam/EEqn.H delete mode 100644 applications/solvers/heatTransfer/buoyantPimpleFoam/hEqn.H create mode 100755 applications/solvers/heatTransfer/buoyantSimpleFoam/Allwmake create mode 100644 applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H create mode 100644 applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/EEqn.H rename applications/solvers/heatTransfer/{ => buoyantSimpleFoam}/buoyantSimpleRadiationFoam/Make/files (98%) rename applications/solvers/heatTransfer/{ => buoyantSimpleFoam}/buoyantSimpleRadiationFoam/Make/options (94%) rename applications/solvers/heatTransfer/{ => buoyantSimpleFoam}/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C (98%) delete mode 100644 applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H delete mode 100644 applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H create mode 100644 src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.C create mode 100644 src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.H create mode 100644 src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionSchemes.C diff --git a/applications/solvers/compressible/rhoSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/EEqn.H new file mode 100644 index 0000000000..e4c79b40cc --- /dev/null +++ b/applications/solvers/compressible/rhoSimpleFoam/EEqn.H @@ -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(); +} diff --git a/applications/solvers/compressible/rhoSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/createFields.H index d8fdff55ae..dea35b7657 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/createFields.H @@ -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; diff --git a/applications/solvers/compressible/rhoSimpleFoam/eEqn.H b/applications/solvers/compressible/rhoSimpleFoam/eEqn.H deleted file mode 100644 index a1ea771573..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/eEqn.H +++ /dev/null @@ -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(); -} diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H new file mode 100644 index 0000000000..ff467c0382 --- /dev/null +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/EEqn.H @@ -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(); +} diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createFields.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createFields.H index 96bdb2a122..4fff74d224 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createFields.H +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/createFields.H @@ -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 diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/eEqn.H b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/eEqn.H deleted file mode 100644 index 5d0f174623..0000000000 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/eEqn.H +++ /dev/null @@ -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(); -} diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C index 22a58da1cc..3898295b91 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoPorousMRFSimpleFoam/rhoPorousMRFSimpleFoam.C @@ -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" } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C index 0eee9129b5..312196583e 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimpleFoam.C @@ -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" } diff --git a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C index 561c5e2dc9..f707570f60 100644 --- a/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C +++ b/applications/solvers/compressible/rhoSimpleFoam/rhoSimplecFoam/rhoSimplecFoam.C @@ -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" } diff --git a/applications/solvers/compressible/sonicFoam/EEqn.H b/applications/solvers/compressible/sonicFoam/EEqn.H new file mode 100644 index 0000000000..15979381a9 --- /dev/null +++ b/applications/solvers/compressible/sonicFoam/EEqn.H @@ -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(); +} diff --git a/applications/solvers/compressible/sonicFoam/createFields.H b/applications/solvers/compressible/sonicFoam/createFields.H index 3c39d3e7aa..c3421369e7 100644 --- a/applications/solvers/compressible/sonicFoam/createFields.H +++ b/applications/solvers/compressible/sonicFoam/createFields.H @@ -5,6 +5,7 @@ psiThermo::New(mesh) ); psiThermo& thermo = pThermo(); + thermo.validate(args.executable(), "e"); volScalarField& p = thermo.p(); volScalarField& e = thermo.he(); diff --git a/applications/solvers/compressible/sonicFoam/eEqn.H b/applications/solvers/compressible/sonicFoam/eEqn.H deleted file mode 100644 index cfd908ded8..0000000000 --- a/applications/solvers/compressible/sonicFoam/eEqn.H +++ /dev/null @@ -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(); -} diff --git a/applications/solvers/compressible/sonicFoam/pEqn.H b/applications/solvers/compressible/sonicFoam/pEqn.H index 99ca26fce3..4d700b3a41 100644 --- a/applications/solvers/compressible/sonicFoam/pEqn.H +++ b/applications/solvers/compressible/sonicFoam/pEqn.H @@ -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(); } diff --git a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H new file mode 100644 index 0000000000..994c2862b8 --- /dev/null +++ b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/EEqn.H @@ -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(); +} diff --git a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/eEqn.H b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/eEqn.H deleted file mode 100644 index 0c17353ec4..0000000000 --- a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/eEqn.H +++ /dev/null @@ -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(); -} diff --git a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/sonicDyMFoam.C b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/sonicDyMFoam.C index 163baa5b69..2f7ac9962a 100644 --- a/applications/solvers/compressible/sonicFoam/sonicDyMFoam/sonicDyMFoam.C +++ b/applications/solvers/compressible/sonicFoam/sonicDyMFoam/sonicDyMFoam.C @@ -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; corrcorrect(); + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } rho = thermo.rho(); diff --git a/applications/solvers/compressible/sonicFoam/sonicFoam.C b/applications/solvers/compressible/sonicFoam/sonicFoam.C index 954404b6a4..71d032d422 100644 --- a/applications/solvers/compressible/sonicFoam/sonicFoam.C +++ b/applications/solvers/compressible/sonicFoam/sonicFoam.C @@ -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; corrcorrect(); + // --- Pressure corrector loop + while (pimple.correct()) + { + #include "pEqn.H" + } + + if (pimple.turbCorr()) + { + turbulence->correct(); + } + } rho = thermo.rho(); diff --git a/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/sonicLiquidFoam.C b/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/sonicLiquidFoam.C index 19a530a6aa..1ac1ae4ae3 100644 --- a/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/sonicLiquidFoam.C +++ b/applications/solvers/compressible/sonicFoam/sonicLiquidFoam/sonicLiquidFoam.C @@ -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; corralphaEff(), he) + ); + + EEqn.relax(); + EEqn.solve(); + + thermo.correct(); +} diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C index 07ec2300c0..dfa88b59a9 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/buoyantPimpleFoam.C @@ -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()) diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H index f2edc4cdba..f6b183e3fc 100644 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantPimpleFoam/createFields.H @@ -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(); diff --git a/applications/solvers/heatTransfer/buoyantPimpleFoam/hEqn.H b/applications/solvers/heatTransfer/buoyantPimpleFoam/hEqn.H deleted file mode 100644 index b1d9e4e8b0..0000000000 --- a/applications/solvers/heatTransfer/buoyantPimpleFoam/hEqn.H +++ /dev/null @@ -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(); -} diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/Allwmake b/applications/solvers/heatTransfer/buoyantSimpleFoam/Allwmake new file mode 100755 index 0000000000..0fe8e8f4ad --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/Allwmake @@ -0,0 +1,8 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # run from this directory +set -x + +wmake +wmake buoyantSimpleRadiationFoam + +# ----------------------------------------------------------------- end-of-file diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H new file mode 100644 index 0000000000..e4c79b40cc --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/EEqn.H @@ -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(); +} diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C index 2a355a21de..4a9387c188 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleFoam.C @@ -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" } diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/EEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/EEqn.H new file mode 100644 index 0000000000..0d1f41d0c3 --- /dev/null +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/EEqn.H @@ -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(); +} diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/files b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/files similarity index 98% rename from applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/files rename to applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/files index 79ebcd90aa..a8347c5525 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/files +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/files @@ -1,4 +1,3 @@ buoyantSimpleRadiationFoam.C EXE = $(FOAM_APPBIN)/buoyantSimpleRadiationFoam - diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/options similarity index 94% rename from applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options rename to applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/options index f2ebc095ff..f26046adb2 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/Make/options +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/Make/options @@ -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 \ diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C similarity index 98% rename from applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C rename to applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C index 07718aa41d..d02853591e 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/buoyantSimpleRadiationFoam/buoyantSimpleRadiationFoam.C @@ -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" } diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H index d2fff48837..bb7a65cb1d 100644 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H +++ b/applications/solvers/heatTransfer/buoyantSimpleFoam/createFields.H @@ -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; diff --git a/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H b/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H deleted file mode 100644 index 24ed135c08..0000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleFoam/hEqn.H +++ /dev/null @@ -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(); -} diff --git a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H b/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H deleted file mode 100644 index 2c422a5cab..0000000000 --- a/applications/solvers/heatTransfer/buoyantSimpleRadiationFoam/hEqn.H +++ /dev/null @@ -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(); -} diff --git a/etc/controlDict b/etc/controlDict index 04ec43aca0..816febf3ec 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -884,6 +884,7 @@ DebugSwitches wallHeatTransfer 0; wallLayerCells 0; wallModel 0; + warnUnboundedGauss 1; waveTransmissive 0; wedge 0; weighted 0; diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index 22988f3216..17abbc6363 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -345,6 +345,7 @@ convectionSchemes = finiteVolume/convectionSchemes $(convectionSchemes)/convectionScheme/convectionSchemes.C $(convectionSchemes)/gaussConvectionScheme/gaussConvectionSchemes.C $(convectionSchemes)/multivariateGaussConvectionScheme/multivariateGaussConvectionSchemes.C +$(convectionSchemes)/boundedConvectionScheme/boundedConvectionSchemes.C laplacianSchemes = finiteVolume/laplacianSchemes $(laplacianSchemes)/laplacianScheme/laplacianSchemes.C diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.C b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.C new file mode 100644 index 0000000000..1e5c911763 --- /dev/null +++ b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "boundedConvectionScheme.H" +#include "fvcSurfaceIntegrate.H" +#include "fvMatrices.H" +#include "fvmSup.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace fv +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template +tmp > +boundedConvectionScheme::interpolate +( + const surfaceScalarField& phi, + const GeometricField& vf +) const +{ + return scheme_().interpolate(phi, vf); +} + + +template +tmp > +boundedConvectionScheme::flux +( + const surfaceScalarField& faceFlux, + const GeometricField& vf +) const +{ + return scheme_().flux(faceFlux, vf); +} + + +template +tmp > +boundedConvectionScheme::fvmDiv +( + const surfaceScalarField& faceFlux, + const GeometricField& vf +) const +{ + return + scheme_().fvmDiv(faceFlux, vf) + - fvm::Sp(fvc::surfaceIntegrate(faceFlux), vf); +} + + +template +tmp > +boundedConvectionScheme::fvcDiv +( + const surfaceScalarField& faceFlux, + const GeometricField& vf +) const +{ + return + scheme_().fvcDiv(faceFlux, vf) + - fvc::surfaceIntegrate(faceFlux)*vf; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.H b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.H new file mode 100644 index 0000000000..9426104d33 --- /dev/null +++ b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionScheme.H @@ -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 . + +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 boundedConvectionScheme +: + public fv::convectionScheme +{ + // Private data + + tmp > 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(mesh, faceFlux), + scheme_ + ( + fv::convectionScheme::New(mesh, faceFlux, is) + ) + {} + + + // Member Functions + + tmp > interpolate + ( + const surfaceScalarField&, + const GeometricField& + ) const; + + tmp > flux + ( + const surfaceScalarField&, + const GeometricField& + ) const; + + tmp > fvmDiv + ( + const surfaceScalarField&, + const GeometricField& + ) const; + + tmp > fvcDiv + ( + const surfaceScalarField&, + const GeometricField& + ) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "boundedConvectionScheme.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionSchemes.C b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionSchemes.C new file mode 100644 index 0000000000..33385d4ecf --- /dev/null +++ b/src/finiteVolume/finiteVolume/convectionSchemes/boundedConvectionScheme/boundedConvectionSchemes.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "boundedConvectionScheme.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + makeFvConvectionScheme(boundedConvectionScheme) +} +} + +// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H index 1b27e361a9..3b03227909 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H +++ b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionScheme.H @@ -47,6 +47,10 @@ namespace Foam 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 \*---------------------------------------------------------------------------*/ @@ -103,7 +107,29 @@ public: ( surfaceInterpolationScheme::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 diff --git a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionSchemes.C b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionSchemes.C index 55a5e6049d..eca87c0698 100644 --- a/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionSchemes.C +++ b/src/finiteVolume/finiteVolume/convectionSchemes/gaussConvectionScheme/gaussConvectionSchemes.C @@ -32,6 +32,11 @@ namespace Foam { namespace fv { + int warnUnboundedGauss + ( + Foam::debug::debugSwitch("warnUnboundedGauss", true) + ); + makeFvConvectionScheme(gaussConvectionScheme) } } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index a2ad3c88f7..13d6f0462c 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -164,6 +164,89 @@ Foam::basicThermo::~basicThermo() // * * * * * * * * * * * * * * * 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() { return p_; diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index c9559d4ef0..d25c9c1ef4 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -111,6 +111,45 @@ public: // 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 virtual void correct() = 0; diff --git a/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C b/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C index c439348fc0..af89aec73a 100644 --- a/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C +++ b/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixtures.C @@ -142,6 +142,24 @@ makeBasicMixture // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +makeBasicMixture +( + pureMixture, + constTransport, + sensibleInternalEnergy, + eConstThermo, + perfectGas +); + +makeBasicMixture +( + pureMixture, + sutherlandTransport, + sensibleInternalEnergy, + eConstThermo, + perfectGas +); + makeBasicMixture ( pureMixture, diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo/hePsiThermos.C b/src/thermophysicalModels/basic/psiThermo/hePsiThermo/hePsiThermos.C index 56baf3fa0b..b5a48fc315 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo/hePsiThermos.C +++ b/src/thermophysicalModels/basic/psiThermo/hePsiThermo/hePsiThermos.C @@ -84,27 +84,27 @@ makeThermo /* * * * * * * * * * * * * * Internal-energy-based * * * * * * * * * * * * * */ -// makeThermo -// ( -// psiThermo, -// hePsiThermo, -// pureMixture, -// constTransport, -// sensibleInternalEnergy, -// eConstThermo, -// perfectGas -// ); +makeThermo +( + psiThermo, + hePsiThermo, + pureMixture, + constTransport, + sensibleInternalEnergy, + eConstThermo, + perfectGas +); -// makeThermo -// ( -// psiThermo, -// hePsiThermo, -// pureMixture, -// sutherlandTransport, -// sensibleInternalEnergy, -// eConstThermo, -// perfectGas -// ); +makeThermo +( + psiThermo, + hePsiThermo, + pureMixture, + sutherlandTransport, + sensibleInternalEnergy, + eConstThermo, + perfectGas +); makeThermo ( diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C index ee80730baa..9d186eb039 100644 --- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C +++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.C @@ -292,7 +292,7 @@ void kEpsilon::correct() ( fvm::ddt(rho_, 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_) == C1_*G*epsilon_/k_ @@ -314,7 +314,7 @@ void kEpsilon::correct() ( fvm::ddt(rho_, 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_) == G diff --git a/tutorials/compressible/rhoCentralFoam/shockTube/constant/polyMesh/boundary b/tutorials/compressible/rhoCentralFoam/shockTube/constant/polyMesh/boundary index a38765097f..ef087376e6 100644 --- a/tutorials/compressible/rhoCentralFoam/shockTube/constant/polyMesh/boundary +++ b/tutorials/compressible/rhoCentralFoam/shockTube/constant/polyMesh/boundary @@ -26,6 +26,7 @@ FoamFile empty { type empty; + inGroups 1(empty); nFaces 400; startFace 101; } diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/polyMesh/boundary b/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/polyMesh/boundary index 2abc731c97..53cce9211b 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/polyMesh/boundary +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/constant/polyMesh/boundary @@ -32,12 +32,14 @@ FoamFile bottom { type symmetryPlane; + inGroups 1(symmetryPlane); nFaces 25; startFace 10415; } top { type symmetryPlane; + inGroups 1(symmetryPlane); nFaces 125; startFace 10440; } @@ -50,6 +52,7 @@ FoamFile defaultFaces { type empty; + inGroups 1(empty); nFaces 10500; startFace 10675; } diff --git a/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSolution b/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSolution index 45bb949628..e07aa4bafc 100644 --- a/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSolution +++ b/tutorials/compressible/sonicFoam/laminar/forwardStep/system/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - p + "p.*" { solver PBiCG; preconditioner DILU; @@ -25,14 +25,14 @@ solvers relTol 0; } - "(U|e)" + "(U|e).*" { $p; tolerance 1e-05; relTol 0; } - rho + "rho.*" { solver PCG; preconditioner DIC; @@ -41,9 +41,10 @@ solvers } } -PISO +PIMPLE { - nCorrectors 2; + nOuterCorrectors 2; + nCorrectors 1; nNonOrthogonalCorrectors 0; } diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/constant/polyMesh/boundary b/tutorials/compressible/sonicFoam/laminar/shockTube/constant/polyMesh/boundary index e4b48d35f4..7fc4ff3fe5 100644 --- a/tutorials/compressible/sonicFoam/laminar/shockTube/constant/polyMesh/boundary +++ b/tutorials/compressible/sonicFoam/laminar/shockTube/constant/polyMesh/boundary @@ -26,6 +26,7 @@ FoamFile empty { type empty; + inGroups 1(empty); nFaces 4000; startFace 1001; } diff --git a/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSolution b/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSolution index b894099c4c..9ed6e1a982 100644 --- a/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSolution +++ b/tutorials/compressible/sonicFoam/laminar/shockTube/system/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - "(p|U|e)" + "(p|U|e).*" { solver PBiCG; preconditioner DILU; @@ -25,7 +25,7 @@ solvers relTol 0; } - rho + "rho.*" { solver PCG; preconditioner DIC; @@ -34,9 +34,10 @@ solvers } } -PISO +PIMPLE { - nCorrectors 2; + nOuterCorrectors 2; + nCorrectors 1; nNonOrthogonalCorrectors 0; } diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/polyMesh/boundary b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/polyMesh/boundary index 59a99aa3f0..b6f0d11024 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/polyMesh/boundary +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/constant/polyMesh/boundary @@ -32,6 +32,7 @@ FoamFile SYMP3 { type empty; + inGroups 1(empty); nFaces 80000; startFace 80170; } diff --git a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution index 530a5bbd34..afc24d24a2 100644 --- a/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution +++ b/tutorials/compressible/sonicFoam/ras/nacaAirfoil/system/fvSolution @@ -17,12 +17,12 @@ FoamFile solvers { - rho + "rho.*" { solver diagonal; } - p + "p.*" { solver PBiCG; preconditioner DILU; @@ -30,22 +30,23 @@ solvers relTol 0; } - "(U|e)" + "(U|e).*" { $p; tolerance 1e-9; } - "(k|epsilon)" + "(k|epsilon).*" { $p; tolerance 1e-10; } } -PISO +PIMPLE { - nCorrectors 2; + nOuterCorrectors 1; + nCorrectors 2; nNonOrthogonalCorrectors 0; } diff --git a/tutorials/compressible/sonicFoam/ras/prism/constant/polyMesh/boundary b/tutorials/compressible/sonicFoam/ras/prism/constant/polyMesh/boundary index 635f185a35..0b093a1e0f 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/constant/polyMesh/boundary +++ b/tutorials/compressible/sonicFoam/ras/prism/constant/polyMesh/boundary @@ -50,6 +50,7 @@ FoamFile defaultFaces { type empty; + inGroups 1(empty); nFaces 13272; startFace 13463; } diff --git a/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution b/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution index 3f46bc0a25..56886cc6e1 100644 --- a/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution +++ b/tutorials/compressible/sonicFoam/ras/prism/system/fvSolution @@ -17,12 +17,12 @@ FoamFile solvers { - rho + "rho.*" { solver diagonal; } - p + "p.*" { solver PBiCG; preconditioner DILU; @@ -30,22 +30,23 @@ solvers relTol 0; } - "(U|e|R)" + "(U|e|R).*" { $p; tolerance 1e-05; } - "(k|epsilon)" + "(k|epsilon).*" { $p; tolerance 1e-08; } } -PISO +PIMPLE { - nCorrectors 2; + nOuterCorrectors 2; + nCorrectors 1; nNonOrthogonalCorrectors 0; } diff --git a/tutorials/compressible/sonicLiquidFoam/decompressionTank/constant/polyMesh/boundary b/tutorials/compressible/sonicLiquidFoam/decompressionTank/constant/polyMesh/boundary index add55d69d6..b1ca7310c6 100644 --- a/tutorials/compressible/sonicLiquidFoam/decompressionTank/constant/polyMesh/boundary +++ b/tutorials/compressible/sonicLiquidFoam/decompressionTank/constant/polyMesh/boundary @@ -26,6 +26,7 @@ FoamFile axis { type symmetryPlane; + inGroups 1(symmetryPlane); nFaces 120; startFace 7500; } @@ -38,12 +39,14 @@ FoamFile back { type empty; + inGroups 1(empty); nFaces 3725; startFace 7625; } front { type empty; + inGroups 1(empty); nFaces 3725; startFace 11350; } diff --git a/tutorials/compressible/sonicLiquidFoam/decompressionTank/system/fvSolution b/tutorials/compressible/sonicLiquidFoam/decompressionTank/system/fvSolution index f63bb3a65b..5f012bcea7 100644 --- a/tutorials/compressible/sonicLiquidFoam/decompressionTank/system/fvSolution +++ b/tutorials/compressible/sonicLiquidFoam/decompressionTank/system/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - p + "p.*" { solver PBiCG; preconditioner DILU; @@ -25,14 +25,14 @@ solvers relTol 0; } - U + "U.*" { $p; tolerance 1e-05; relTol 0; } - rho + "rho.*" { solver PCG; preconditioner DIC; @@ -41,9 +41,10 @@ solvers } } -PISO +PIMPLE { - nCorrectors 2; + nOuterCorrectors 2; + nCorrectors 1; nNonOrthogonalCorrectors 0; } diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/constant/thermophysicalProperties index 05bbb78407..410aa5f42a 100644 --- a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/constant/thermophysicalProperties +++ b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/constant/thermophysicalProperties @@ -15,7 +15,8 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType heRhoThermo,sensibleEnthalpy>>>>; +thermoType heRhoThermo,sensibleEnthalpy>>>>; +//thermoType heRhoThermo,sensibleInternalEnergy>>>>; pRef 100000; diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/system/fvSchemes index a6897b72d5..9ca38f0376 100644 --- a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/system/fvSchemes @@ -30,23 +30,19 @@ divSchemes default none; div(phi,U) Gauss upwind; div(phi,h) Gauss upwind; + div(phi,e) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,R) Gauss upwind; div(phi,K) Gauss linear; + div(phi,Ekp) Gauss linear; div(R) Gauss linear; div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes { - default none; - 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; + default Gauss linear corrected; } interpolationSchemes diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/system/fvSolution b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/system/fvSolution index 42d96d946f..7127fdc8c6 100644 --- a/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/system/fvSolution +++ b/tutorials/heatTransfer/buoyantPimpleFoam/hotRoom/system/fvSolution @@ -39,7 +39,7 @@ solvers relTol 0; } - "(U|h|k|epsilon|R)" + "(U|h|e|k|epsilon|R)" { solver PBiCG; preconditioner DILU; @@ -47,7 +47,7 @@ solvers relTol 0.1; } - "(U|h|k|epsilon|R)Final" + "(U|h|e|k|epsilon|R)Final" { $U; relTol 0; diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/g b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/g index e0ac2653b5..037e3b47f3 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/g +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/g @@ -16,7 +16,6 @@ FoamFile // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 1 -2 0 0 0 0]; -value ( 0 -9.81 0 ); - +value (0 -9.81 0); // ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/thermophysicalProperties index 521cf3b421..885c152f4f 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/thermophysicalProperties +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/constant/thermophysicalProperties @@ -15,7 +15,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -thermoType hePsiThermo,sensibleEnthalpy>>>>; +thermoType hePsiThermo,sensibleEnthalpy>>>>; pRef 100000; diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSchemes b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSchemes index 991a5277f6..62bdbb235b 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSchemes +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSchemes @@ -28,25 +28,17 @@ gradSchemes divSchemes { default none; - div(phi,U) Gauss upwind; - div(phi,h) Gauss upwind; - div(phi,K) Gauss upwind; - div(phi,k) Gauss upwind; - div(phi,epsilon) Gauss upwind; - div(phi,R) Gauss upwind; - div(R) Gauss linear; + div(phi,U) bounded Gauss upwind; + div(phi,h) bounded Gauss upwind; + div(phi,K) bounded Gauss upwind; + div(phi,k) bounded Gauss upwind; + div(phi,epsilon) bounded Gauss upwind; div((muEff*dev2(T(grad(U))))) Gauss linear; } laplacianSchemes { - default none; - 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; + default Gauss linear uncorrected; } interpolationSchemes diff --git a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSolution b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSolution index c80f4db413..f7365e5f6d 100644 --- a/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSolution +++ b/tutorials/heatTransfer/buoyantSimpleFoam/hotRoom/system/fvSolution @@ -21,15 +21,15 @@ solvers { solver PCG; preconditioner DIC; - tolerance 1e-08; + tolerance 1e-8; relTol 0.01; } - "(U|h|k|epsilon|R)" + "(U|h|e|k|epsilon|R)" { solver PBiCG; preconditioner DILU; - tolerance 1e-05; + tolerance 1e-6; relTol 0.1; } } @@ -45,6 +45,7 @@ SIMPLE p_rgh 1e-2; U 1e-3; h 1e-3; + e 1e-3; // possibly check turbulence fields "(k|epsilon|omega)" 1e-3; @@ -60,8 +61,8 @@ relaxationFactors } equations { - U 0.2; - h 0.2; + U 0.3; + "(h|e)" 0.3; "(k|epsilon|R)" 0.5; } }