From f9971f80d72a5318cdc81120a925ab9817b3ec62 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 19 Oct 2018 10:31:42 +0100 Subject: [PATCH] thermophysicalModels::equationOfState: Completed departure functions for all except adiabaticPerfectFluid Changed liquid thermo from sensibleEnthalpy to sensibleInternalEnergy in tutorials. It is generally more convergent and stable to solve for internal energy if the fluid is incompressible or weakly compressible. --- .../specie/equationOfState/Boussinesq/BoussinesqI.H | 6 ++---- .../adiabaticPerfectFluid/adiabaticPerfectFluidI.H | 2 ++ .../specie/equationOfState/icoPolynomial/icoPolynomialI.H | 6 ++---- .../incompressiblePerfectGas/incompressiblePerfectGasI.H | 4 ++-- .../specie/equationOfState/linear/linearI.H | 6 ++++-- .../specie/equationOfState/perfectFluid/perfectFluidI.H | 5 ++++- .../templates/materials/water/thermophysicalProperties | 2 +- .../heatExchanger/constant/air/thermophysicalProperties | 2 +- .../heatExchanger/constant/porous/thermophysicalProperties | 2 +- .../chtMultiRegionFoam/heatExchanger/system/air/fvSchemes | 1 + .../chtMultiRegionFoam/heatExchanger/system/air/fvSolution | 1 + .../heatExchanger/system/porous/fvSchemes | 2 +- .../filter/constant/thermophysicalProperties | 4 +--- .../lagrangian/reactingParcelFoam/filter/system/fvSchemes | 2 +- .../lagrangian/reactingParcelFoam/filter/system/fvSolution | 6 +++--- .../parcelInBox/constant/thermophysicalProperties | 4 +--- .../reactingParcelFoam/parcelInBox/system/fvSchemes | 5 +++-- .../reactingParcelFoam/parcelInBox/system/fvSolution | 6 ++++-- .../verticalChannel/constant/thermophysicalProperties | 4 +--- .../reactingParcelFoam/verticalChannel/system/fvSchemes | 2 +- .../reactingParcelFoam/verticalChannel/system/fvSolution | 4 ++-- .../verticalChannelLTS/constant/thermophysicalProperties | 5 +---- .../reactingParcelFoam/verticalChannelLTS/system/fvSchemes | 2 +- .../reactingParcelFoam/verticalChannelLTS/system/fvSolution | 4 ++-- 24 files changed, 43 insertions(+), 44 deletions(-) diff --git a/src/thermophysicalModels/specie/equationOfState/Boussinesq/BoussinesqI.H b/src/thermophysicalModels/specie/equationOfState/Boussinesq/BoussinesqI.H index 296590a33b..74e3a581b3 100644 --- a/src/thermophysicalModels/specie/equationOfState/Boussinesq/BoussinesqI.H +++ b/src/thermophysicalModels/specie/equationOfState/Boussinesq/BoussinesqI.H @@ -96,9 +96,7 @@ inline Foam::scalar Foam::Boussinesq::rho template inline Foam::scalar Foam::Boussinesq::H(scalar p, scalar T) const { - const scalar rho = this->rho(p, T); - - return (p/rho)*(1 - rho0_*beta_*T/rho); + return p/this->rho(p, T); } @@ -163,7 +161,7 @@ inline Foam::scalar Foam::Boussinesq::CpMCv scalar T ) const { - return this->R(); + return 0; } diff --git a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H index b970418bf3..8c838244fa 100644 --- a/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H +++ b/src/thermophysicalModels/specie/equationOfState/adiabaticPerfectFluid/adiabaticPerfectFluidI.H @@ -107,6 +107,7 @@ inline Foam::scalar Foam::adiabaticPerfectFluid::H scalar T ) const { + // ***HGW This needs to be added, it is not 0 return 0; } @@ -129,6 +130,7 @@ inline Foam::scalar Foam::adiabaticPerfectFluid::E scalar T ) const { + // ***HGW This needs to be added, it is H - p/rho return 0; } diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H index 6c925219cb..73cc4d525e 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomialI.H @@ -95,9 +95,7 @@ inline Foam::scalar Foam::icoPolynomial::H scalar T ) const { - const scalar rho = this->rho(p, T); - - return (p/rho)*(1 + (T/rho)*rhoCoeffs_.derivative(T)); + return p/this->rho(p, T); } @@ -174,7 +172,7 @@ inline Foam::scalar Foam::icoPolynomial::CpMCv scalar T ) const { - return -(p/sqr(rhoCoeffs_.value(T)))*rhoCoeffs_.derivative(T); + return 0; } diff --git a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H index 6d738a4d6b..bf63745ede 100644 --- a/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H +++ b/src/thermophysicalModels/specie/equationOfState/incompressiblePerfectGas/incompressiblePerfectGasI.H @@ -96,7 +96,7 @@ inline Foam::scalar Foam::incompressiblePerfectGas::H scalar T ) const { - return 0; + return p/this->rho(p, T); } @@ -173,7 +173,7 @@ inline Foam::scalar Foam::incompressiblePerfectGas::CpMCv scalar T ) const { - return this->R(); + return 0; } diff --git a/src/thermophysicalModels/specie/equationOfState/linear/linearI.H b/src/thermophysicalModels/specie/equationOfState/linear/linearI.H index f81ff99c3c..6ec30b4793 100644 --- a/src/thermophysicalModels/specie/equationOfState/linear/linearI.H +++ b/src/thermophysicalModels/specie/equationOfState/linear/linearI.H @@ -87,7 +87,7 @@ inline Foam::scalar Foam::linear::rho(scalar p, scalar T) const template inline Foam::scalar Foam::linear::H(scalar p, scalar T) const { - return 0; + return log(rho(p, T))/psi_; } @@ -101,7 +101,9 @@ inline Foam::scalar Foam::linear::Cp(scalar p, scalar T) const template inline Foam::scalar Foam::linear::E(scalar p, scalar T) const { - return 0; + const scalar rho = this->rho(p, T); + + return log(rho)/psi_ - p/rho; } diff --git a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H index b05343df32..c543363185 100644 --- a/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H +++ b/src/thermophysicalModels/specie/equationOfState/perfectFluid/perfectFluidI.H @@ -146,7 +146,10 @@ inline Foam::scalar Foam::perfectFluid::Z(scalar p, scalar T) const template inline Foam::scalar Foam::perfectFluid::CpMCv(scalar p, scalar T) const { - return 0; + const scalar R = this->R(); + const scalar rho = this->rho(p, T); + + return R*sqr(p/(rho*R*T)); } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/water/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/water/thermophysicalProperties index 16714a8084..8c62b69610 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/water/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/coolingSphere/templates/materials/water/thermophysicalProperties @@ -22,7 +22,7 @@ thermoType thermo hConst; equationOfState perfectFluid; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/air/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/air/thermophysicalProperties index 7d8b81b7f5..4914bd20ca 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/air/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/air/thermophysicalProperties @@ -23,7 +23,7 @@ thermoType thermo hPolynomial; equationOfState icoPolynomial; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } mixture diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/porous/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/porous/thermophysicalProperties index b0e32ca07f..6f3b110bed 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/porous/thermophysicalProperties +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/constant/porous/thermophysicalProperties @@ -22,7 +22,7 @@ thermoType thermo hPolynomial; equationOfState icoPolynomial; specie specie; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; } diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/air/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/air/fvSchemes index c627d4361b..7421cfba41 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/air/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/air/fvSchemes @@ -33,6 +33,7 @@ divSchemes div(phi,h) bounded Gauss upwind; div(phi,e) bounded Gauss upwind; div(phi,K) bounded Gauss upwind; + div(phiv,p) Gauss upwind; div(phi,k) bounded Gauss upwind; div(phi,epsilon) bounded Gauss upwind; div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/air/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/air/fvSolution index 733dc87303..c3c9c93d0e 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/air/fvSolution +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/air/fvSolution @@ -47,6 +47,7 @@ relaxationFactors "rho.*" 1; "p_rgh.*" 0.7; } + equations { "U.*" 0.3; diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/porous/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/porous/fvSchemes index 3b7bfc8ccf..10e4ad2fda 100644 --- a/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/porous/fvSchemes +++ b/tutorials/heatTransfer/chtMultiRegionFoam/heatExchanger/system/porous/fvSchemes @@ -30,7 +30,7 @@ divSchemes div(phi,U) bounded Gauss upwind; div(phi,h) bounded Gauss upwind; div(phi,e) bounded Gauss upwind; - div(phi,Ekp) bounded Gauss upwind; + div(phiv,p) Gauss upwind; div(phi,K) bounded Gauss upwind; div(phi,k) bounded Gauss upwind; div(phi,epsilon) bounded Gauss upwind; diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/thermophysicalProperties b/tutorials/lagrangian/reactingParcelFoam/filter/constant/thermophysicalProperties index 4eca0dca50..0429272faf 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/thermophysicalProperties +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/thermophysicalProperties @@ -21,13 +21,11 @@ thermoType mixture reactingMixture; transport polynomial; thermo hPolynomial; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; equationOfState icoPolynomial; specie specie; } -dpdt no; - chemistryReader foamChemistryReader; foamChemistryFile "$FOAM_CASE/constant/reactions"; diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/system/fvSchemes b/tutorials/lagrangian/reactingParcelFoam/filter/system/fvSchemes index 335a8fa5bb..23f46ba36e 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/system/fvSchemes +++ b/tutorials/lagrangian/reactingParcelFoam/filter/system/fvSchemes @@ -32,7 +32,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phi,K) Gauss linear; - div(phi,h) Gauss upwind; + div(phiv,p) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(U) Gauss linear; diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/system/fvSolution b/tutorials/lagrangian/reactingParcelFoam/filter/system/fvSolution index c46a7cebc3..e26a0ef31c 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/system/fvSolution +++ b/tutorials/lagrangian/reactingParcelFoam/filter/system/fvSolution @@ -70,13 +70,13 @@ solvers relTol 0; } - h + e { $Yi; relTol 0.1; } - hFinal + eFinal { $Yi; } @@ -95,7 +95,7 @@ relaxationFactors { equations { - ".*Final" 1; + ".*" 1; } } diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/thermophysicalProperties b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/thermophysicalProperties index 872ed99768..b9e4606eee 100644 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/thermophysicalProperties +++ b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/thermophysicalProperties @@ -21,13 +21,11 @@ thermoType mixture reactingMixture; transport polynomial; thermo hPolynomial; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; equationOfState icoPolynomial; specie specie; } -dpdt no; - chemistryReader foamChemistryReader; foamChemistryFile "$FOAM_CASE/constant/reactions"; diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/system/fvSchemes b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/system/fvSchemes index 98f11fde7b..69c230b9d6 100644 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/system/fvSchemes +++ b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/system/fvSchemes @@ -23,16 +23,17 @@ ddtSchemes gradSchemes { default Gauss linear; - grad(p) Gauss linear; } divSchemes { default none; + div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phi,K) Gauss upwind; - div(phi,h) Gauss upwind; + div(phiv,p) Gauss upwind; + div(phi,e) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,omega) Gauss upwind; diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/system/fvSolution b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/system/fvSolution index b5991d4dc1..44d19d06be 100644 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/system/fvSolution +++ b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/system/fvSolution @@ -70,12 +70,14 @@ solvers tolerance 1e-6; relTol 0; } - h + + e { $Yi; relTol 0.1; } - hFinal + + eFinal { $Yi; } diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/thermophysicalProperties b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/thermophysicalProperties index 872ed99768..b9e4606eee 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/thermophysicalProperties +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/thermophysicalProperties @@ -21,13 +21,11 @@ thermoType mixture reactingMixture; transport polynomial; thermo hPolynomial; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; equationOfState icoPolynomial; specie specie; } -dpdt no; - chemistryReader foamChemistryReader; foamChemistryFile "$FOAM_CASE/constant/reactions"; diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvSchemes b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvSchemes index 5e8121df2f..96134e427d 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvSchemes +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvSchemes @@ -31,7 +31,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phi,K) Gauss upwind; - div(phi,h) Gauss upwind; + div(phiv,p) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,omega) Gauss upwind; diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvSolution b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvSolution index ad0b4e607f..fcaf591adf 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvSolution +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/system/fvSolution @@ -66,13 +66,13 @@ solvers relTol 0; } - h + e { $Yi; relTol 0.1; } - hFinal + eFinal { $Yi; } diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/constant/thermophysicalProperties b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/constant/thermophysicalProperties index c107b9907c..b9e4606eee 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/constant/thermophysicalProperties +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/constant/thermophysicalProperties @@ -21,7 +21,7 @@ thermoType mixture reactingMixture; transport polynomial; thermo hPolynomial; - energy sensibleEnthalpy; + energy sensibleInternalEnergy; equationOfState icoPolynomial; specie specie; } @@ -42,8 +42,5 @@ liquids solids {} -// de-activate the pressure-work term when running local time-stepping -dpdt no; - // ************************************************************************* // diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/fvSchemes b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/fvSchemes index 3a195f560d..93d76ef423 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/fvSchemes +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/fvSchemes @@ -31,7 +31,7 @@ divSchemes div(phi,U) Gauss upwind; div(phid,p) Gauss upwind; div(phi,K) Gauss upwind; - div(phi,h) Gauss upwind; + div(phiv,p) Gauss upwind; div(phi,k) Gauss upwind; div(phi,epsilon) Gauss upwind; div(phi,omega) Gauss upwind; diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/fvSolution b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/fvSolution index 2df0ec37c8..0dca24ccce 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/fvSolution +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannelLTS/system/fvSolution @@ -17,7 +17,7 @@ FoamFile solvers { - "(rho|.*Final)" + "rho.*" { solver PCG; preconditioner DIC; @@ -46,7 +46,7 @@ solvers $p_rgh; } - "(U|Yi|h|k|omega|.*Final)" + "(U|Yi|h|e|k|omega).*" { solver smoothSolver; smoother GaussSeidel;