diff --git a/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleMultiphaseVoFMixture.C b/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleMultiphaseVoFMixture.C index 524d7f757b..0ff8774785 100644 --- a/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleMultiphaseVoFMixture.C +++ b/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleMultiphaseVoFMixture.C @@ -103,14 +103,14 @@ Foam::tmp Foam::compressibleMultiphaseVoFMixture::nu scalarField mu ( phases_[0].Alpha().boundaryField()[patchi] - *phases_[0].thermo().mu(patchi) + *phases_[0].thermo().mu().boundaryField()[patchi] ); for (label phasei=1; phasei Foam::compressibleTwoPhaseVoFMixture::nu { return ( - alpha1().boundaryField()[patchi]*thermo1_->mu(patchi) - + alpha2().boundaryField()[patchi]*thermo2_->mu(patchi) + alpha1().boundaryField()[patchi]*thermo1_->mu().boundaryField()[patchi] + + alpha2().boundaryField()[patchi]*thermo2_->mu().boundaryField()[patchi] )/rho_.boundaryField()[patchi]; } diff --git a/applications/modules/multiphaseEuler/phaseSystem/phaseModels/ThermoPhaseModel/ThermoPhaseModel.C b/applications/modules/multiphaseEuler/phaseSystem/phaseModels/ThermoPhaseModel/ThermoPhaseModel.C index 01b443d87e..7bbafa3115 100644 --- a/applications/modules/multiphaseEuler/phaseSystem/phaseModels/ThermoPhaseModel/ThermoPhaseModel.C +++ b/applications/modules/multiphaseEuler/phaseSystem/phaseModels/ThermoPhaseModel/ThermoPhaseModel.C @@ -136,7 +136,7 @@ Foam::ThermoPhaseModel::mu const label patchi ) const { - return thermo_->mu(patchi); + return thermo_->mu().boundaryField()[patchi]; } diff --git a/applications/modules/shockFluid/shockFluid.C b/applications/modules/shockFluid/shockFluid.C index 4770fa6d5f..16f320402b 100644 --- a/applications/modules/shockFluid/shockFluid.C +++ b/applications/modules/shockFluid/shockFluid.C @@ -144,7 +144,7 @@ Foam::solvers::shockFluid::shockFluid(fvMesh& mesh) inviscid ( - max(thermo_.mu()().primitiveField()) > 0 + max(thermo_.mu().primitiveField()) > 0 ? false : true ), diff --git a/applications/modules/solidDisplacement/solidDisplacementThermo/solidDisplacementThermo.H b/applications/modules/solidDisplacement/solidDisplacementThermo/solidDisplacementThermo.H index 29f1384e8c..63f1b9b430 100644 --- a/applications/modules/solidDisplacement/solidDisplacementThermo/solidDisplacementThermo.H +++ b/applications/modules/solidDisplacement/solidDisplacementThermo/solidDisplacementThermo.H @@ -103,7 +103,7 @@ public: } - // Access to thermophysical state variables + // Mechanical state //- Youngs modulus [Pa] virtual const volScalarField& E() const; diff --git a/src/thermophysicalModels/basic/basicThermo/BasicThermo.C b/src/thermophysicalModels/basic/basicThermo/BasicThermo.C index 27da417ff2..58716b30ec 100644 --- a/src/thermophysicalModels/basic/basicThermo/BasicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/BasicThermo.C @@ -301,6 +301,36 @@ Foam::BasicThermo::~BasicThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +Foam::tmp +Foam::BasicThermo::W() const +{ + return volScalarFieldProperty + ( + "W", + dimMass/dimMoles, + &MixtureType::thermoMixture, + &MixtureType::thermoMixtureType::W + ); +} + + +template +Foam::tmp +Foam::BasicThermo::W +( + const label patchi +) const +{ + return patchFieldProperty + ( + &MixtureType::thermoMixture, + &MixtureType::thermoMixtureType::W, + patchi + ); +} + + template const Foam::volScalarField& Foam::BasicThermo::Cpv() const @@ -593,33 +623,6 @@ Foam::BasicThermo::Cv } -template -Foam::tmp -Foam::BasicThermo::gamma -( - const scalarField& T, - const label patchi -) const -{ - return patchFieldProperty - ( - &MixtureType::thermoMixture, - &MixtureType::thermoMixtureType::gamma, - patchi, - this->p_.boundaryField()[patchi], - T - ); -} - - -template -Foam::tmp -Foam::BasicThermo::gamma() const -{ - return volScalarField::New("gamma", Cp_/Cv_); -} - - template Foam::tmp Foam::BasicThermo::Cpv @@ -703,36 +706,6 @@ Foam::BasicThermo::THE } -template -Foam::tmp -Foam::BasicThermo::W() const -{ - return volScalarFieldProperty - ( - "W", - dimMass/dimMoles, - &MixtureType::thermoMixture, - &MixtureType::thermoMixtureType::W - ); -} - - -template -Foam::tmp -Foam::BasicThermo::W -( - const label patchi -) const -{ - return patchFieldProperty - ( - &MixtureType::thermoMixture, - &MixtureType::thermoMixtureType::W, - patchi - ); -} - - template bool Foam::BasicThermo::read() { diff --git a/src/thermophysicalModels/basic/basicThermo/BasicThermo.H b/src/thermophysicalModels/basic/basicThermo/BasicThermo.H index 96a598a19e..6cd04a586b 100644 --- a/src/thermophysicalModels/basic/basicThermo/BasicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/BasicThermo.H @@ -209,17 +209,26 @@ public: } - // Access to thermodynamic state variables + // Molecular properties + + //- Molecular weight [kg/kmol] + virtual tmp W() const; + + //- Molecular weight for patch [kg/kmol] + virtual tmp W(const label patchi) const; + + + // Thermodynamic state //- Enthalpy/Internal energy [J/kg] - // Non-const access allowed for transport equations - virtual volScalarField& he() + virtual const volScalarField& he() const { return he_; } //- Enthalpy/Internal energy [J/kg] - virtual const volScalarField& he() const + // Non-const access allowed for transport equations + virtual volScalarField& he() { return he_; } @@ -240,7 +249,7 @@ public: virtual const volScalarField& Cpv() const; - // Fields derived from thermodynamic state variables + // Derived Thermodynamic Properties //- Enthalpy/Internal energy // for given pressure and temperature [J/kg] @@ -324,6 +333,30 @@ public: //- Enthalpy of formation [J/kg] virtual tmp hc() const; + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant volume for patch [J/kg/K] + virtual tmp Cv + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure/volume for patch [J/kg/K] + virtual tmp Cpv + ( + const scalarField& T, + const label patchi + ) const; + + + // Temperature-energy inversion functions + //- Temperature from enthalpy/internal energy virtual tmp THE ( @@ -348,43 +381,6 @@ public: const label patchi ) const; - //- Heat capacity at constant pressure for patch [J/kg/K] - virtual tmp Cp - ( - const scalarField& T, - const label patchi - ) const; - - //- Heat capacity at constant volume for patch [J/kg/K] - virtual tmp Cv - ( - const scalarField& T, - const label patchi - ) const; - - //- Gamma = Cp/Cv [] - virtual tmp gamma() const; - - //- Gamma = Cp/Cv for patch [] - virtual tmp gamma - ( - const scalarField& T, - const label patchi - ) const; - - //- Heat capacity at constant pressure/volume for patch [J/kg/K] - virtual tmp Cpv - ( - const scalarField& T, - const label patchi - ) const; - - //- Molecular weight [kg/kmol] - virtual tmp W() const; - - //- Molecular weight for patch [kg/kmol] - virtual tmp W(const label patchi) const; - //- Read thermophysical properties dictionary using BasicThermoType::read; diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index 6e78628adf..55989aa535 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -319,6 +319,7 @@ void Foam::basicThermo::validate } } + void Foam::basicThermo::validate ( const string& app, @@ -343,6 +344,22 @@ void Foam::basicThermo::validate } +Foam::tmp Foam::basicThermo::gamma() const +{ + return volScalarField::New(phasePropertyName("gamma"), Cp()/Cv()); +} + + +Foam::tmp Foam::basicThermo::gamma +( + const scalarField& T, + const label patchi +) const +{ + return Cp(T, patchi)/Cv(T, patchi); +} + + const Foam::volScalarField& Foam::basicThermo::implementation::T() const { return T_; diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 8e446a4859..f300de296c 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -252,7 +252,42 @@ public: virtual Switch dpdt() const = 0; - // Access to thermodynamic state variables + // Molecular properties + + //- Molecular weight [kg/kmol] + virtual tmp W() const = 0; + + //- Molecular weight for patch [kg/kmol] + virtual tmp W(const label patchi) const = 0; + + + // Thermodynamic state + + //- Temperature [K] + virtual const volScalarField& T() const = 0; + + //- Temperature [K] + // Non-const access allowed for transport equations + virtual volScalarField& T() = 0; + + //- Enthalpy/Internal energy [J/kg] + virtual const volScalarField& he() const = 0; + + //- Enthalpy/Internal energy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& he() = 0; + + //- Heat capacity at constant pressure [J/kg/K] + virtual const volScalarField& Cp() const = 0; + + //- Heat capacity at constant volume [J/kg/K] + virtual const volScalarField& Cv() const = 0; + + //- Heat capacity at constant pressure/volume [J/kg/K] + virtual const volScalarField& Cpv() const = 0; + + + // Derived Thermodynamic Properties //- Density [kg/m^3] virtual tmp rho() const = 0; @@ -260,13 +295,6 @@ public: //- Density for patch [kg/m^3] virtual tmp rho(const label patchi) const = 0; - //- Enthalpy/Internal energy [J/kg] - // Non-const access allowed for transport equations - virtual volScalarField& he() = 0; - - //- Enthalpy/Internal energy [J/kg] - virtual const volScalarField& he() const = 0; - //- Enthalpy/Internal energy // for given pressure and temperature [J/kg] virtual tmp he @@ -349,6 +377,40 @@ public: //- Enthalpy of formation [J/kg] virtual tmp hc() const = 0; + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const label patchi + ) const = 0; + + //- Heat capacity at constant volume for patch [J/kg/K] + virtual tmp Cv + ( + const scalarField& T, + const label patchi + ) const = 0; + + //- Heat capacity at constant pressure/volume for patch [J/kg/K] + virtual tmp Cpv + ( + const scalarField& T, + const label patchi + ) const = 0; + + //- Gamma = Cp/Cv [] + tmp gamma() const; + + //- Gamma = Cp/Cv for patch [] + tmp gamma + ( + const scalarField& T, + const label patchi + ) const; + + + // Temperature-energy inversion functions + //- Temperature from enthalpy/internal energy virtual tmp THE ( @@ -373,51 +435,11 @@ public: const label patchi ) const = 0; - //- Heat capacity at constant pressure [J/kg/K] - virtual const volScalarField& Cp() const = 0; - //- Heat capacity at constant volume [J/kg/K] - virtual const volScalarField& Cv() const = 0; - - //- Heat capacity at constant pressure/volume [J/kg/K] - virtual const volScalarField& Cpv() const = 0; - - - // Access to transport state variables + // Transport state //- Thermal conductivity of mixture [W/m/K] virtual const volScalarField& kappa() const = 0; - - - // Fields derived from thermodynamic state variables - - //- Temperature [K] - virtual const volScalarField& T() const = 0; - - //- Temperature [K] - // Non-const access allowed for transport equations - virtual volScalarField& T() = 0; - - //- Heat capacity at constant pressure for patch [J/kg/K] - virtual tmp Cp - ( - const scalarField& T, - const label patchi - ) const = 0; - - //- Heat capacity at constant volume for patch [J/kg/K] - virtual tmp Cv - ( - const scalarField& T, - const label patchi - ) const = 0; - - //- Heat capacity at constant pressure/volume for patch [J/kg/K] - virtual tmp Cpv - ( - const scalarField& T, - const label patchi - ) const = 0; }; @@ -493,7 +515,7 @@ public: } - // Fields derived from thermodynamic state variables + // Thermodynamic state //- Temperature [K] virtual const volScalarField& T() const; @@ -503,7 +525,7 @@ public: virtual volScalarField& T(); - // Access to transport state variables + // Transport state //- Thermal conductivity of mixture [W/m/K] virtual const volScalarField& kappa() const; diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C index 12519801b4..f7a03f1e9c 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C @@ -108,17 +108,17 @@ Foam::tmp Foam::fluidThermo::nu() const Foam::tmp Foam::fluidThermo::nu(const label patchi) const { - return mu(patchi)/rho(patchi); + return mu().boundaryField()[patchi]/rho(patchi); } -Foam::volScalarField& Foam::fluidThermo::implementation::p() +const Foam::volScalarField& Foam::fluidThermo::implementation::p() const { return p_; } -const Foam::volScalarField& Foam::fluidThermo::implementation::p() const +Foam::volScalarField& Foam::fluidThermo::implementation::p() { return p_; } @@ -130,19 +130,10 @@ const Foam::volScalarField& Foam::fluidThermo::implementation::psi() const } -Foam::tmp Foam::fluidThermo::implementation::mu() const +const Foam::volScalarField& Foam::fluidThermo::implementation::mu() const { return mu_; } -Foam::tmp Foam::fluidThermo::implementation::mu -( - const label patchi -) const -{ - return mu_.boundaryField()[patchi]; -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H index 5b38276f06..d27da6ef15 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H @@ -95,60 +95,44 @@ public: // Member Functions - // Access to thermodynamic state variables + // Thermodynamic state + + //- Pressure [Pa] + virtual const volScalarField& p() const = 0; //- Pressure [Pa] // Non-const access allowed for transport equations virtual volScalarField& p() = 0; - //- Pressure [Pa] - virtual const volScalarField& p() const = 0; - - //- Add the given density correction to the density field. - // Used to update the density field following pressure solution - virtual void correctRho(const volScalarField& deltaRho) = 0; - //- Compressibility [s^2/m^2] virtual const volScalarField& psi() const = 0; - // Fields derived from thermodynamic state variables + // Derived thermodynamic properties //- Rename the thermodynamic density field if stored and return // This is used by solvers which create a separate continuity rho // [kg/m^3] virtual tmp renameRho() = 0; - //- Gamma = Cp/Cv [] - virtual tmp gamma() const = 0; - - //- Gamma = Cp/Cv for patch [] - virtual tmp gamma - ( - const scalarField& T, - const label patchi - ) const = 0; - - //- Molecular weight [kg/kmol] - virtual tmp W() const = 0; - - //- Molecular weight for patch [kg/kmol] - virtual tmp W(const label patchi) const = 0; + //- Add the given density correction to the density field. + // Used to update the density field following pressure solution + virtual void correctRho(const volScalarField& deltaRho) = 0; - // Access to transport state variables + // Transport state //- Dynamic viscosity of mixture [kg/m/s] - virtual tmp mu() const = 0; + virtual const volScalarField& mu() const = 0; - //- Dynamic viscosity of mixture for patch [kg/m/s] - virtual tmp mu(const label patchi) const = 0; + + // Derived transport properties //- Kinematic viscosity of mixture [m^2/s] - virtual tmp nu() const; + tmp nu() const; //- Kinematic viscosity of mixture for patch [m^2/s] - virtual tmp nu(const label patchi) const; + tmp nu(const label patchi) const; }; @@ -193,26 +177,23 @@ public: // Member Functions - // Access to thermodynamic state variables + // Thermodynamic state + + //- Pressure [Pa] + virtual const volScalarField& p() const; //- Pressure [Pa] // Non-const access allowed for transport equations virtual volScalarField& p(); - //- Pressure [Pa] - virtual const volScalarField& p() const; - //- Compressibility [s^2/m^2] virtual const volScalarField& psi() const; - // Access to transport state variables + // Transport state //- Dynamic viscosity of mixture [kg/m/s] - virtual tmp mu() const; - - //- Dynamic viscosity of mixture for patch [kg/m/s] - virtual tmp mu(const label patchi) const; + virtual const volScalarField& mu() const; // Member Operators diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.C b/src/thermophysicalModels/basic/psiThermo/psiThermo.C index b627380d02..baeb88f91c 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.C @@ -71,16 +71,16 @@ Foam::psiThermo::implementation::~implementation() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::psiThermo::correctRho(const Foam::volScalarField& deltaRho) -{} - - Foam::tmp Foam::psiThermo::renameRho() { return rho(); } +void Foam::psiThermo::correctRho(const Foam::volScalarField& deltaRho) +{} + + Foam::tmp Foam::psiThermo::implementation::rho() const { return p()*psi(); diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.H b/src/thermophysicalModels/basic/psiThermo/psiThermo.H index 9331bed254..cf85cfd84a 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.H @@ -108,7 +108,7 @@ public: // Member Functions - // Fields derived from thermodynamic state variables + // Derived thermodynamic properties //- Density [kg/m^3] - uses current value of pressure virtual tmp rho() const = 0; @@ -152,7 +152,7 @@ public: // Member Functions - // Fields derived from thermodynamic state variables + // Derived thermodynamic properties //- Density [kg/m^3] - uses current value of pressure virtual tmp rho() const; diff --git a/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.C b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.C index 63a5f15c55..baa278f4c3 100644 --- a/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.C +++ b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.C @@ -56,8 +56,7 @@ Foam::rhoFluidThermo::~rhoFluidThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp -Foam::rhoFluidThermo::renameRho() +Foam::tmp Foam::rhoFluidThermo::renameRho() { rho().rename(phasePropertyName(Foam::typedName("rho"))); return rho(); diff --git a/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.H b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.H index 37c2683ef5..548923ab02 100644 --- a/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.H +++ b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.H @@ -107,7 +107,7 @@ public: // Member Functions - // Fields derived from thermodynamic state variables + // Derived Thermodynamic Properties //- Rename and return the thermodynamic density field [kg/m^3] // This is used by solvers which create a separate continuity rho diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H index 19daff8606..c12d3831be 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H @@ -67,7 +67,7 @@ public: // Member Functions - // Fields derived from thermodynamic state variables + // Derived thermodynamic properties //- Density [kg/m^3] virtual tmp rho() const = 0; @@ -113,7 +113,7 @@ public: // Member Functions - // Fields derived from thermodynamic state variables + // Derived thermodynamic properties //- Density [kg/m^3] virtual tmp rho() const; diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.C index 1e0afda134..a668a2fa67 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.C @@ -137,16 +137,6 @@ Foam::scalar Foam::MulticomponentThermo::Wi } -template -Foam::scalar Foam::MulticomponentThermo::hfi -( - const label speciei -) const -{ - return this->specieThermo(speciei).Hf(); -} - - template Foam::scalar Foam::MulticomponentThermo::rhoi ( @@ -366,6 +356,16 @@ Foam::MulticomponentThermo::hai } +template +Foam::scalar Foam::MulticomponentThermo::hfi +( + const label speciei +) const +{ + return this->specieThermo(speciei).Hf(); +} + + template Foam::scalar Foam::MulticomponentThermo::kappai ( diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.H index 33cbad4eda..850219e9cf 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.H @@ -94,16 +94,13 @@ public: // Member Functions - // Specie properties + // Specie molecular properties //- Molecular weight [kg/kmol] virtual scalar Wi(const label speciei) const; - //- Enthalpy of formation [J/kg] - virtual scalar hfi(const label speciei) const; - - // Specie thermo properties + // Specie thermodynamic properties //- Density [kg/m^3] virtual scalar rhoi @@ -209,6 +206,9 @@ public: const volScalarField& T ) const; + //- Enthalpy of formation [J/kg] + virtual scalar hfi(const label speciei) const; + // Specie transport properties diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H index 42b91a6893..bf88994716 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H @@ -129,7 +129,7 @@ public: void normaliseY(); - // Specie properties + // Specie molecular properties //- Molecular weight [kg/kmol] virtual scalar Wi(const label speciei) const = 0; @@ -138,7 +138,7 @@ public: virtual scalar hfi(const label speciei) const = 0; - // Specie thermo properties + // Specie thermodynamic properties //- Density [kg/m^3] virtual scalar rhoi diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.H index 1790667160..cfb8eaea19 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.H @@ -91,13 +91,12 @@ public: virtual void correct(); - // Access to thermodynamic state variables. + // Thermodynamic state - //- Unburnt gas enthalpy [J/kg] - // Non-const access allowed for transport equations - virtual volScalarField& heu() + //- Unburnt gas temperature [K] + virtual const volScalarField& Tu() const { - return heu_; + return Tu_; } //- Unburnt gas enthalpy [J/kg] @@ -106,14 +105,15 @@ public: return heu_; } - //- Unburnt gas temperature [K] - virtual const volScalarField& Tu() const + //- Unburnt gas enthalpy [J/kg] + // Non-const access allowed for transport equations + virtual volScalarField& heu() { - return Tu_; + return heu_; } - // Fields derived from thermodynamic state variables + // Derived thermodynamic properties //- Unburnt gas enthalpy for cell-set [J/kg] virtual tmp heu @@ -129,7 +129,6 @@ public: const label patchi ) const; - //- Burnt gas temperature [K] virtual tmp Tb() const; @@ -140,7 +139,7 @@ public: virtual tmp psib() const; - // Access to transport variables + // Derived transport properties //- Dynamic viscosity of unburnt gas [kg/m/s] virtual tmp muu() const; diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C index e40b24e9ff..69d8858c20 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C @@ -161,6 +161,18 @@ Foam::psiuMulticomponentThermo::implementation::~implementation() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::tmp Foam::psiuMulticomponentThermo::rhou() const +{ + return p()*psiu(); +} + + +Foam::tmp Foam::psiuMulticomponentThermo::rhob() const +{ + return p()*psib(); +} + + const Foam::speciesTable& Foam::psiuMulticomponentThermo::implementation::species() const { diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H index ea1aefa366..fd3d57ca26 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H @@ -147,17 +147,20 @@ public: inline const volScalarField& Y(const word& specieName) const; - // Access to thermodynamic state variables. + // Thermodynamic state + + //- Unburnt gas temperature [K] + virtual const volScalarField& Tu() const = 0; + + //- Unburnt gas enthalpy [J/kg] + virtual const volScalarField& heu() const = 0; //- Unburnt gas enthalpy [J/kg] // Non-const access allowed for transport equations virtual volScalarField& heu() = 0; - //- Unburnt gas enthalpy [J/kg] - virtual const volScalarField& heu() const = 0; - - // Fields derived from thermodynamic state variables + // Derived thermodynamic properties //- Unburnt gas enthalpy for cell-set [J/kg] virtual tmp heu @@ -173,30 +176,24 @@ public: const label patchi ) const = 0; - //- Unburnt gas temperature [K] - virtual const volScalarField& Tu() const = 0; - //- Burnt gas temperature [K] virtual tmp Tb() const = 0; - //- Unburnt gas density [kg/m^3] - virtual tmp rhou() const - { - return p()*psiu(); - } - - //- Burnt gas density [kg/m^3] - virtual tmp rhob() const - { - return p()*psib(); - } - //- Unburnt gas compressibility [s^2/m^2] virtual tmp psiu() const = 0; //- Burnt gas compressibility [s^2/m^2] virtual tmp psib() const = 0; + //- Unburnt gas density [kg/m^3] + tmp rhou() const; + + //- Burnt gas density [kg/m^3] + tmp rhob() const; + + + // Derived transport properties + //- Dynamic viscosity of unburnt gas [kg/m/s] virtual tmp muu() const = 0; diff --git a/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.H b/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.H index 4ee025e0e8..df02154c4b 100644 --- a/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/constAnisoSolidThermo/constAnisoSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -160,7 +160,7 @@ public: // Member Functions - // Access to transport state variables + // Transport state //- Return false as the thermal conductivity is anisotropic virtual bool isotropic() const diff --git a/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.C b/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.C index 3aa44f42ab..91fdc4a79e 100644 --- a/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.C +++ b/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.C @@ -92,9 +92,23 @@ Foam::constSolidThermo::~constSolidThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const Foam::volScalarField& Foam::constSolidThermo::Cpv() const +Foam::tmp Foam::constSolidThermo::W() const { - return Cv_; + NotImplemented; + return tmp(nullptr); +} + + +Foam::tmp Foam::constSolidThermo::W(const label patchi) const +{ + NotImplemented; + return tmp(nullptr); +} + + +const Foam::volScalarField& Foam::constSolidThermo::he() const +{ + return e_; } @@ -104,9 +118,21 @@ Foam::volScalarField& Foam::constSolidThermo::he() } -const Foam::volScalarField& Foam::constSolidThermo::he() const +const Foam::volScalarField& Foam::constSolidThermo::Cp() const { - return e_; + return Cv_; +} + + +const Foam::volScalarField& Foam::constSolidThermo::Cv() const +{ + return Cv_; +} + + +const Foam::volScalarField& Foam::constSolidThermo::Cpv() const +{ + return Cv_; } @@ -238,6 +264,36 @@ Foam::tmp Foam::constSolidThermo::hc() const } +Foam::tmp Foam::constSolidThermo::Cp +( + const scalarField& T, + const label patchi +) const +{ + return Cv_.boundaryField()[patchi]; +} + + +Foam::tmp Foam::constSolidThermo::Cv +( + const scalarField& T, + const label patchi +) const +{ + return Cv_.boundaryField()[patchi]; +} + + +Foam::tmp Foam::constSolidThermo::Cpv +( + const scalarField& T, + const label patchi +) const +{ + return Cv_.boundaryField()[patchi]; +} + + Foam::tmp Foam::constSolidThermo::THE ( const volScalarField& h, @@ -274,48 +330,6 @@ Foam::tmp Foam::constSolidThermo::THE } -const Foam::volScalarField& Foam::constSolidThermo::Cp() const -{ - return Cv_; -} - - -const Foam::volScalarField& Foam::constSolidThermo::Cv() const -{ - return Cv_; -} - - -Foam::tmp Foam::constSolidThermo::Cp -( - const scalarField& T, - const label patchi -) const -{ - return Cv_.boundaryField()[patchi]; -} - - -Foam::tmp Foam::constSolidThermo::Cv -( - const scalarField& T, - const label patchi -) const -{ - return Cv_.boundaryField()[patchi]; -} - - -Foam::tmp Foam::constSolidThermo::Cpv -( - const scalarField& T, - const label patchi -) const -{ - return Cv_.boundaryField()[patchi]; -} - - const Foam::volVectorField& Foam::constSolidThermo::Kappa() const { NotImplemented; diff --git a/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.H b/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.H index cd701a358c..785d97ceac 100644 --- a/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.H @@ -206,15 +206,24 @@ public: } - // Access to thermophysical state variables + // Molecular properties + + //- Molecular weight [kg/kmol] + virtual tmp W() const; + + //- Molecular weight for patch [kg/kmol] + virtual tmp W(const label patchi) const; + + + // Thermodynamic state + + //- Enthalpy/Internal energy [J/kg] + virtual const volScalarField& he() const; //- Enthalpy/Internal energy [J/kg] // Non-const access allowed for transport equations virtual volScalarField& he(); - //- Enthalpy/Internal energy [J/kg] - virtual const volScalarField& he() const; - //- Heat capacity at constant pressure [J/kg/K] virtual const volScalarField& Cp() const; @@ -225,20 +234,7 @@ public: virtual const volScalarField& Cpv() const; - // Access to transport state variables - - //- Return true as the thermal conductivity is isotropic - virtual bool isotropic() const - { - return true; - } - - //- Anisotropic thermal conductivity [W/m/K] - // Not implemented - virtual const volVectorField& Kappa() const; - - - // Fields derived from thermodynamic state variables + // Derived thermodynamic properties //- Enthalpy/Internal energy // for given pressure and temperature [J/kg] @@ -322,6 +318,30 @@ public: //- Enthalpy of formation [J/kg] virtual tmp hc() const; + //- Heat capacity at constant pressure for patch [J/kg/K] + virtual tmp Cp + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant volume for patch [J/kg/K] + virtual tmp Cv + ( + const scalarField& T, + const label patchi + ) const; + + //- Heat capacity at constant pressure/volume for patch [J/kg/K] + virtual tmp Cpv + ( + const scalarField& T, + const label patchi + ) const; + + + // Temperature-energy inversion functions + //- Temperature from enthalpy/internal energy virtual tmp THE ( @@ -346,26 +366,18 @@ public: const label patchi ) const; - //- Heat capacity at constant pressure for patch [J/kg/K] - virtual tmp Cp - ( - const scalarField& T, - const label patchi - ) const; - //- Heat capacity at constant volume for patch [J/kg/K] - virtual tmp Cv - ( - const scalarField& T, - const label patchi - ) const; + // Transport state - //- Heat capacity at constant pressure/volume for patch [J/kg/K] - virtual tmp Cpv - ( - const scalarField& T, - const label patchi - ) const; + //- Return true as the thermal conductivity is isotropic + virtual bool isotropic() const + { + return true; + } + + //- Anisotropic thermal conductivity [W/m/K] + // Not implemented + virtual const volVectorField& Kappa() const; //- Update properties