From 4c2fae3d06102fce2e068039b79d123900b5a975 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Tue, 5 May 2020 20:33:45 +0100 Subject: [PATCH] thermophysicalModels: Added new tabulated equation of state, thermo and transport models using the new nonUniformTable to interpolate between the values vs temperature provided. All properties (density, heat capacity, viscosity and thermal conductivite) are considered functions of temperature only and the equation of state is thus incompressible. Built-in mixing rules corresponding to those in the other thermo and transport models are not efficient or practical for tabulated data and so these models are currently only instantiated for the pure specie/mixture rhoThermo package but a general external mixing method will be added in the future. To handle reactions the Jacobian function dKcdTbyKc has been rewritten to use the Gstd and S functions directly removing the need for the miss-named dGdT function and hence removing the bugs in the implementation of that function for some of the thermo models. Additionally the Hc() function has been renamed Hf() (heat of formation) which is more commonly used terminology and consistent with the internals of the thermo models. --- .../twoPhaseMixtureThermo.H | 4 +- .../multiphaseMixtureThermo.H | 2 +- .../TwoResistanceHeatTransferPhaseSystem.C | 4 +- .../solidDisplacementThermo.H | 4 +- .../thermophysical/chemkinToFoam/Make/options | 2 - .../COxidationDiffusionLimitedRate.C | 4 +- .../COxidationHurtMitchell.C | 4 +- .../COxidationIntrinsicRate.C | 4 +- .../COxidationKineticDiffusionLimitedRate.C | 4 +- .../COxidationMurphyShaddix.C | 4 +- .../CompositionModel/CompositionModel.C | 4 +- .../basic/basicThermo/basicThermo.H | 4 +- .../basic/heThermo/heThermo.C | 4 +- .../basic/heThermo/heThermo.H | 4 +- .../basic/rhoThermo/rhoThermos.C | 2 + .../StandardChemistryModel.C | 4 +- .../mixtures/SpecieMixture/SpecieMixture.C | 4 +- .../mixtures/SpecieMixture/SpecieMixture.H | 4 +- .../basicSpecieMixture/basicSpecieMixture.H | 4 +- src/thermophysicalModels/specie/Make/files | 20 ++ .../icoPolynomial/icoPolynomial.H | 13 +- .../icoTabulated/icoTabulated.C | 72 +++++++ .../icoTabulated/icoTabulated.H | 203 ++++++++++++++++++ .../icoTabulated/icoTabulatedI.H | 179 +++++++++++++++ .../specie/include/forTabulated.H | 61 ++++++ .../specie/thermo/eConst/eConstThermo.H | 7 +- .../specie/thermo/eConst/eConstThermoI.H | 17 +- .../specie/thermo/hConst/hConstThermo.H | 7 +- .../specie/thermo/hConst/hConstThermoI.H | 17 +- .../thermo/hPolynomial/hPolynomialThermo.H | 9 +- .../thermo/hPolynomial/hPolynomialThermoI.H | 22 +- .../specie/thermo/hPower/hPowerThermo.H | 9 +- .../specie/thermo/hPower/hPowerThermoI.H | 21 +- .../thermo/hTabulated/hTabulatedThermo.C | 76 +++++++ .../thermo/hTabulated/hTabulatedThermo.H | 196 +++++++++++++++++ .../thermo/hTabulated/hTabulatedThermoI.H | 129 +++++++++++ .../specie/thermo/janaf/janafThermo.H | 9 +- .../specie/thermo/janaf/janafThermoI.H | 18 +- .../specie/thermo/thermo/thermo.H | 8 +- .../specie/thermo/thermo/thermoI.H | 12 +- .../APIdiffCoefThermophysicalFunction.C | 2 +- .../APIdiffCoefThermophysicalFunction.H | 2 +- .../NSRDS0/NSRDS0ThermophysicalFunction.C | 2 +- .../NSRDS0/NSRDS0ThermophysicalFunction.H | 2 +- .../NSRDS1/NSRDS1ThermophysicalFunction.C | 2 +- .../NSRDS1/NSRDS1ThermophysicalFunction.H | 2 +- .../NSRDS14/NSRDS14ThermophysicalFunction.C | 2 +- .../NSRDS14/NSRDS14ThermophysicalFunction.H | 2 +- .../NSRDS2/NSRDS2ThermophysicalFunction.C | 2 +- .../NSRDS2/NSRDS2ThermophysicalFunction.H | 2 +- .../NSRDS3/NSRDS3ThermophysicalFunction.C | 2 +- .../NSRDS3/NSRDS3ThermophysicalFunction.H | 2 +- .../NSRDS4/NSRDS4ThermophysicalFunction.C | 2 +- .../NSRDS4/NSRDS4ThermophysicalFunction.H | 2 +- .../NSRDS5/NSRDS5ThermophysicalFunction.C | 2 +- .../NSRDS5/NSRDS5ThermophysicalFunction.H | 2 +- .../NSRDS6/NSRDS6ThermophysicalFunction.C | 2 +- .../NSRDS6/NSRDS6ThermophysicalFunction.H | 2 +- .../NSRDS7/NSRDS7ThermophysicalFunction.C | 2 +- .../NSRDS7/NSRDS7ThermophysicalFunction.H | 2 +- .../constant/constantThermophysicalFunction.C | 2 +- .../constant/constantThermophysicalFunction.H | 2 +- ...tedNonUniformTableThermophysicalFunction.C | 137 ++++++++++++ ...tedNonUniformTableThermophysicalFunction.H | 122 +++++++++++ .../nonUniformTableThermophysicalFunction.C | 48 +++-- .../nonUniformTableThermophysicalFunction.H | 19 +- .../nonUniformTableThermophysicalFunctionI.H | 59 +++++ .../none/noneThermophysicalFunction.C | 2 +- .../none/noneThermophysicalFunction.H | 2 +- .../table/tableThermophysicalFunction.C | 2 +- .../table/tableThermophysicalFunction.H | 0 .../thermophysicalFunction.C | 2 +- .../thermophysicalFunction.H | 2 +- .../transport/tabulated/tabulatedTransport.C | 76 +++++++ .../transport/tabulated/tabulatedTransport.H | 185 ++++++++++++++++ .../transport/tabulated/tabulatedTransportI.H | 114 ++++++++++ .../thermophysicalProperties/Make/files | 19 -- .../liquidProperties/liquidProperties.H | 6 +- .../liquidProperties/liquidPropertiesI.H | 4 +- .../thermophysicalProperties.H | 6 +- .../thermophysicalPropertiesSelector.H | 6 +- .../thermophysicalPropertiesSelectorI.H | 6 +- 82 files changed, 1794 insertions(+), 242 deletions(-) create mode 100644 src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.C create mode 100644 src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.H create mode 100644 src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulatedI.H create mode 100644 src/thermophysicalModels/specie/include/forTabulated.H create mode 100644 src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermo.C create mode 100644 src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermo.H create mode 100644 src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermoI.H rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.H (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/constant/constantThermophysicalFunction.C (96%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/constant/constantThermophysicalFunction.H (97%) create mode 100644 src/thermophysicalModels/specie/thermophysicalFunctions/integratedNonUniformTable/integratedNonUniformTableThermophysicalFunction.C create mode 100644 src/thermophysicalModels/specie/thermophysicalFunctions/integratedNonUniformTable/integratedNonUniformTableThermophysicalFunction.H rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C (84%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H (86%) create mode 100644 src/thermophysicalModels/specie/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunctionI.H rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/none/noneThermophysicalFunction.C (96%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/none/noneThermophysicalFunction.H (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/table/tableThermophysicalFunction.C (97%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/table/tableThermophysicalFunction.H (100%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C (98%) rename src/thermophysicalModels/{thermophysicalProperties => specie}/thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.H (98%) create mode 100644 src/thermophysicalModels/specie/transport/tabulated/tabulatedTransport.C create mode 100644 src/thermophysicalModels/specie/transport/tabulated/tabulatedTransport.H create mode 100644 src/thermophysicalModels/specie/transport/tabulated/tabulatedTransportI.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H index ce55186207..8cea136277 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H +++ b/applications/solvers/multiphase/compressibleInterFoam/twoPhaseMixtureThermo/twoPhaseMixtureThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -189,7 +189,7 @@ public: const label patchi ) const; - //- Chemical enthalpy [J/kg] + //- Enthalpy of formation [J/kg] virtual tmp hc() const; //- Temperature from enthalpy/internal energy for cell-set diff --git a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H index 4907738d12..3f8b44e89e 100644 --- a/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H +++ b/applications/solvers/multiphase/compressibleMultiphaseInterFoam/multiphaseMixtureThermo/multiphaseMixtureThermo.H @@ -311,7 +311,7 @@ public: const label patchi ) const; - //- Chemical enthalpy [J/kg] + //- Enthalpy of formation [J/kg] virtual tmp hc() const; //- Temperature from enthalpy/internal energy for cell-set diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C index 8095f689de..107b01d50a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C @@ -198,7 +198,7 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHef dimensionedScalar ( dimEnergy/dimMass, - composition1.Hc(composition1.species()[member]) + composition1.Hf(composition1.species()[member]) ); } volScalarField hefi2(hef2), hci2(hc2); @@ -217,7 +217,7 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHef dimensionedScalar ( dimEnergy/dimMass, - composition2.Hc(composition2.species()[member]) + composition2.Hf(composition2.species()[member]) ); } diff --git a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementThermo/solidDisplacementThermo.H b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementThermo/solidDisplacementThermo.H index 7deb5979da..f6ecc73a8a 100644 --- a/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementThermo/solidDisplacementThermo.H +++ b/applications/solvers/stressAnalysis/solidDisplacementFoam/solidDisplacementThermo/solidDisplacementThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -217,7 +217,7 @@ public: const labelList& cells ) const; - //- Chemical enthalpy [J/kg] + //- Enthalpy of formation [J/kg] virtual tmp hc() const; //- Temperature from enthalpy/internal energy for cell-set diff --git a/applications/utilities/thermophysical/chemkinToFoam/Make/options b/applications/utilities/thermophysical/chemkinToFoam/Make/options index f46ca72707..caa12b322a 100644 --- a/applications/utilities/thermophysical/chemkinToFoam/Make/options +++ b/applications/utilities/thermophysical/chemkinToFoam/Make/options @@ -4,6 +4,4 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude EXE_LIBS = \ - -lreactionThermophysicalModels \ - -lfluidThermophysicalModels \ -lchemistryModel diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C index 68febbe879..08faacf284 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::COxidationDiffusionLimitedRate::COxidationDiffusionLimitedRate const scalar WCO2 = owner.thermo().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_); + HcCO2_ = owner.thermo().carrier().Hf(CO2GlobalId_); if (Sb_ < 0) { diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C index f8f262878f..b462aec1b7 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::COxidationHurtMitchell::COxidationHurtMitchell const scalar WCO2 = owner.thermo().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_); + HcCO2_ = owner.thermo().carrier().Hf(CO2GlobalId_); const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_]; const scalar YSolidTot = owner.composition().YMixture0()[idSolid]; diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C index a658b88995..d1b98a7377 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -62,7 +62,7 @@ Foam::COxidationIntrinsicRate::COxidationIntrinsicRate const scalar WCO2 = owner.thermo().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_); + HcCO2_ = owner.thermo().carrier().Hf(CO2GlobalId_); if (Sb_ < 0) { diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C index 2df69bdc81..92820a94ea 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ COxidationKineticDiffusionLimitedRate const scalar WCO2 = owner.thermo().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_); + HcCO2_ = owner.thermo().carrier().Hf(CO2GlobalId_); const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_]; const scalar YSolidTot = owner.composition().YMixture0()[idSolid]; diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C index 11af694f19..ecf669dc42 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,7 @@ Foam::COxidationMurphyShaddix::COxidationMurphyShaddix const scalar WCO2 = owner.thermo().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.thermo().carrier().Hc(CO2GlobalId_); + HcCO2_ = owner.thermo().carrier().Hf(CO2GlobalId_); const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_]; const scalar YSolidTot = owner.composition().YMixture0()[idSolid]; diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C index 2bff059a64..23d520638b 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -400,7 +400,7 @@ Foam::scalar Foam::CompositionModel::Hc forAll(Y, i) { label cid = props.carrierIds()[i]; - HcMixture += Y[i]*thermo_.carrier().Hc(cid); + HcMixture += Y[i]*thermo_.carrier().Hf(cid); } break; } diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index eabb84ca22..6cefc3d827 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -329,7 +329,7 @@ public: const label patchi ) const = 0; - //- Chemical enthalpy [J/kg] + //- Enthalpy of formation [J/kg] virtual tmp hc() const = 0; //- Temperature from enthalpy/internal energy for cell-set diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index ccaccf7ace..b798853b31 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -379,7 +379,7 @@ Foam::heThermo::hc() const dimEnergy/dimMass, &MixtureType::cellMixture, &MixtureType::patchFaceMixture, - &MixtureType::thermoType::Hc + &MixtureType::thermoType::Hf ); } diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index 14838f9636..9942f9c4e2 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/heThermo/heThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -233,7 +233,7 @@ public: const labelList& cells ) const; - //- Chemical enthalpy [J/kg] + //- Enthalpy of formation [J/kg] virtual tmp hc() const; //- Temperature from enthalpy/internal energy for cell-set diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C index fe0f25d4bf..ea0391785f 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C @@ -30,6 +30,7 @@ License #include "forGases.H" #include "forLiquids.H" #include "forPolynomials.H" +#include "forTabulated.H" #include "makeThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,6 +40,7 @@ namespace Foam forGases(makeThermos, rhoThermo, heRhoThermo, pureMixture); forLiquids(makeThermos, rhoThermo, heRhoThermo, pureMixture); forPolynomials(makeThermos, rhoThermo, heRhoThermo, pureMixture); + forTabulated(makeThermos, rhoThermo, heRhoThermo, pureMixture); } // ************************************************************************* // diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C index 1c96f6bef0..a7942dc17e 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/StandardChemistryModel/StandardChemistryModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -368,7 +368,7 @@ Foam::StandardChemistryModel::Qdot() const { forAll(Qdot, celli) { - const scalar hi = specieThermo_[i].Hc(); + const scalar hi = specieThermo_[i].Hf(); Qdot[celli] -= hi*RR_[i][celli]; } } diff --git a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.C index 345f4e6040..2407602924 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.C @@ -135,9 +135,9 @@ Foam::scalar Foam::SpecieMixture::Wi(const label speciei) const template -Foam::scalar Foam::SpecieMixture::Hc(const label speciei) const +Foam::scalar Foam::SpecieMixture::Hf(const label speciei) const { - return this->getLocalThermo(speciei).Hc(); + return this->getLocalThermo(speciei).Hf(); } diff --git a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H index c1eb572d6a..abe68fd3dd 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H @@ -109,8 +109,8 @@ public: //- Molecular weight of the given specie [kg/kmol] virtual scalar Wi(const label speciei) const; - //- Chemical enthalpy [J/kg] - virtual scalar Hc(const label speciei) const; + //- Enthalpy of formation [J/kg] + virtual scalar Hf(const label speciei) const; // Per specie thermo properties diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H index 1cbb2ddfde..882da89b0a 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H @@ -85,8 +85,8 @@ public: //- Molecular weight of the given specie [kg/kmol] virtual scalar Wi(const label speciei) const = 0; - //- Chemical enthalpy [J/kg] - virtual scalar Hc(const label speciei) const = 0; + //- Enthalpy of formation [J/kg] + virtual scalar Hf(const label speciei) const = 0; // Per specie thermo properties diff --git a/src/thermophysicalModels/specie/Make/files b/src/thermophysicalModels/specie/Make/files index ac3eefa55e..e3c602a6f3 100644 --- a/src/thermophysicalModels/specie/Make/files +++ b/src/thermophysicalModels/specie/Make/files @@ -2,4 +2,24 @@ atomicWeights/atomicWeights.C specie/specie.C reaction/specieCoeffs/specieCoeffs.C +thermophysicalFunctions/thermophysicalFunction/thermophysicalFunction.C + +thermophysicalFunctions/none/noneThermophysicalFunction.C +thermophysicalFunctions/constant/constantThermophysicalFunction.C +thermophysicalFunctions/table/tableThermophysicalFunction.C +thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C +thermophysicalFunctions/integratedNonUniformTable/integratedNonUniformTableThermophysicalFunction.C +thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.C + +NSRDS = thermophysicalFunctions/NSRDS +$(NSRDS)/NSRDS0/NSRDS0ThermophysicalFunction.C +$(NSRDS)/NSRDS1/NSRDS1ThermophysicalFunction.C +$(NSRDS)/NSRDS2/NSRDS2ThermophysicalFunction.C +$(NSRDS)/NSRDS3/NSRDS3ThermophysicalFunction.C +$(NSRDS)/NSRDS4/NSRDS4ThermophysicalFunction.C +$(NSRDS)/NSRDS5/NSRDS5ThermophysicalFunction.C +$(NSRDS)/NSRDS6/NSRDS6ThermophysicalFunction.C +$(NSRDS)/NSRDS7/NSRDS7ThermophysicalFunction.C +$(NSRDS)/NSRDS14/NSRDS14ThermophysicalFunction.C + LIB = $(FOAM_LIBBIN)/libspecie diff --git a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H index e910e1ea84..200f0fe321 100644 --- a/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H +++ b/src/thermophysicalModels/specie/equationOfState/icoPolynomial/icoPolynomial.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -238,17 +238,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define makeIcoPolynomial(PolySize) \ - \ -defineTemplateTypeNameAndDebugWithName \ -( \ - icoPolynomial, \ - "icoPolynomial<"#PolySize">", \ - 0 \ -); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #include "icoPolynomialI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.C b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.C new file mode 100644 index 0000000000..6fab490b83 --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "icoTabulated.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +icoTabulated::icoTabulated(const dictionary& dict) +: + Specie(dict), + rho_("rho", dict.subDict("equationOfState")) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void icoTabulated::write(Ostream& os) const +{ + Specie::write(os); + + dictionary dict("equationOfState"); + dict.add("rho", rho_.values()); + + os << indent << dict.dictName() << dict; +} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template +Ostream& operator<<(Ostream& os, const icoTabulated& ip) +{ + ip.write(os); + return os; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.H b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.H new file mode 100644 index 0000000000..39a9a7f726 --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulated.H @@ -0,0 +1,203 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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::icoTabulated + +Description + Incompressible of equation of state using non-uniform tabulated + density vs temperature. + +Usage + \table + Property | Description + rho | Density vs temperature table + \endtable + + Example of the specification of the equation of state: + \verbatim + equationOfState + { + rho + ( + (200 1010) + (350 1000) + (400 980) + ); + } + \endverbatim + +SourceFiles + icoTabulatedI.H + icoTabulated.C + +See also + Foam::thermophysicalFunctions::nonUniformTable + +\*---------------------------------------------------------------------------*/ + +#ifndef icoTabulated_H +#define icoTabulated_H + +#include "nonUniformTableThermophysicalFunction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +template +class icoTabulated; + +template +Ostream& operator<< +( + Ostream&, + const icoTabulated& +); + + +/*---------------------------------------------------------------------------*\ + Class icoTabulated Declaration +\*---------------------------------------------------------------------------*/ + +template +class icoTabulated +: + public Specie +{ + typedef thermophysicalFunctions::nonUniformTable nonUniformTable; + + + // Private Data + + //- Density table [kg/m^3] + nonUniformTable rho_; + + +public: + + // Constructors + + //- Construct from components + inline icoTabulated + ( + const Specie& sp, + const nonUniformTable& rho + ); + + //- Construct from dictionary + icoTabulated(const dictionary& dict); + + //- Construct as named copy + inline icoTabulated(const word& name, const icoTabulated&); + + //- Construct and return a clone + inline autoPtr clone() const; + + // Selector from dictionary + inline static autoPtr New(const dictionary& dict); + + + // Member Functions + + //- Return the instantiated type name + static word typeName() + { + return "icoTabulated<" + word(Specie::typeName_()) + '>'; + } + + + // Fundamental properties + + //- Is the equation of state is incompressible i.e. rho != f(p) + static const bool incompressible = true; + + //- Is the equation of state is isochoric i.e. rho = const + static const bool isochoric = false; + + //- Return density [kg/m^3] + inline scalar rho(scalar p, scalar T) const; + + //- Return enthalpy departure [J/kg] + inline scalar H(const scalar p, const scalar T) const; + + //- Return Cp departure [J/(kg K] + inline scalar Cp(scalar p, scalar T) const; + + //- Return internal energy departure [J/kg] + inline scalar E(const scalar p, const scalar T) const; + + //- Return Cv departure [J/(kg K] + inline scalar Cv(scalar p, scalar T) const; + + //- Return entropy [J/kg/K] + inline scalar S(const scalar p, const scalar T) const; + + //- Return compressibility [s^2/m^2] + inline scalar psi(scalar p, scalar T) const; + + //- Return compression factor [] + inline scalar Z(scalar p, scalar T) const; + + //- Return (Cp - Cv) [J/(kg K] + inline scalar CpMCv(scalar p, scalar T) const; + + + // IO + + //- Write to Ostream + void write(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const icoTabulated& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "icoTabulatedI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "icoTabulated.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulatedI.H b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulatedI.H new file mode 100644 index 0000000000..cf16be053e --- /dev/null +++ b/src/thermophysicalModels/specie/equationOfState/icoTabulated/icoTabulatedI.H @@ -0,0 +1,179 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "icoTabulated.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +inline Foam::icoTabulated::icoTabulated +( + const Specie& sp, + const nonUniformTable& rho +) +: + Specie(sp), + rho_(rho) +{} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::icoTabulated::icoTabulated +( + const word& name, + const icoTabulated& ip +) +: + Specie(name, ip), + rho_(ip.rho_) +{} + + +template +inline Foam::autoPtr> +Foam::icoTabulated::clone() const +{ + return autoPtr> + ( + new icoTabulated(*this) + ); +} + + +template +inline Foam::autoPtr> +Foam::icoTabulated::New(const dictionary& dict) +{ + return autoPtr> + ( + new icoTabulated(dict) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::icoTabulated::rho +( + scalar p, + scalar T +) const +{ + return rho_.f(p, T); +} + + +template +inline Foam::scalar Foam::icoTabulated::H +( + scalar p, + scalar T +) const +{ + return p/this->rho(p, T); +} + + +template +inline Foam::scalar Foam::icoTabulated::Cp +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::E +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::Cv +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::S +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::psi +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::Z +( + scalar p, + scalar T +) const +{ + return 0; +} + + +template +inline Foam::scalar Foam::icoTabulated::CpMCv +( + scalar p, + scalar T +) const +{ + return 0; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/include/forTabulated.H b/src/thermophysicalModels/specie/include/forTabulated.H new file mode 100644 index 0000000000..58fe52fd82 --- /dev/null +++ b/src/thermophysicalModels/specie/include/forTabulated.H @@ -0,0 +1,61 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef forTabulated_H +#define forTabulated_H + +#include "specie.H" + +#include "icoTabulated.H" + +#include "hTabulatedThermo.H" + +#include "sensibleEnthalpy.H" +#include "sensibleInternalEnergy.H" + +#include "tabulatedTransport.H" + +#include "thermo.H" + +#include "forThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define forTabulatedEqns(Mu, He, Cp, Macro, Args...) \ + forThermo(Mu, He, Cp, icoTabulated, specie, Macro, Args); + +#define forTabulatedEnergiesAndThermos(Mu, Macro, Args...) \ + forTabulatedEqns(Mu, sensibleEnthalpy, hTabulatedThermo, Macro, Args); \ + forTabulatedEqns(Mu, sensibleInternalEnergy, hTabulatedThermo, Macro, Args); + +#define forTabulatedTransport(Macro, Args...) \ + forTabulatedEnergiesAndThermos(tabulatedTransport, Macro, Args); + +#define forTabulated(Macro, Args...) \ + forTabulatedTransport(Macro, Args) + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H index 26450fcdb4..9ddcb20798 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermo.H @@ -152,8 +152,8 @@ public: //- Absolute internal energy [J/kg] inline scalar Ea(const scalar p, const scalar T) const; - //- Chemical enthalpy [J/kg] - inline scalar Hc() const; + //- Enthalpy of formation [J/kg] + inline scalar Hf() const; //- Entropy [J/kg/K] inline scalar S(const scalar p, const scalar T) const; @@ -166,9 +166,6 @@ public: // Derivative term used for Jacobian - //- Derivative of Gibbs free energy w.r.t. temperature - inline scalar dGdT(const scalar p, const scalar T) const; - //- Temperature derivative of heat capacity at constant pressure inline scalar dCpdT(const scalar p, const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H index 308cc8d7bd..5694c32473 100644 --- a/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/eConst/eConstThermoI.H @@ -117,7 +117,7 @@ inline Foam::scalar Foam::eConstThermo::Es template -inline Foam::scalar Foam::eConstThermo::Hc() const +inline Foam::scalar Foam::eConstThermo::Hf() const { return Hf_; } @@ -130,7 +130,7 @@ inline Foam::scalar Foam::eConstThermo::Ea const scalar T ) const { - return Es(p, T) + Hc(); + return Es(p, T) + Hf(); } @@ -152,22 +152,11 @@ inline Foam::scalar Foam::eConstThermo::Gstd ) const { return - Cv_*(T - Tref_) + Esref_ + Hc() + Pstd/EquationOfState::rho(Pstd, T) + Cv_*(T - Tref_) + Esref_ + Hf() + Pstd/EquationOfState::rho(Pstd, T) - Cp(Pstd, T)*T*log(T/Tstd); } -template -inline Foam::scalar Foam::eConstThermo::dGdT -( - const scalar p, - const scalar T -) const -{ - return 0; -} - - template inline Foam::scalar Foam::eConstThermo::dCpdT ( diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H index 8eded2ec7c..bafc04a76e 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermo.H @@ -152,8 +152,8 @@ public: //- Sensible enthalpy [J/kg] inline scalar Hs(const scalar p, const scalar T) const; - //- Chemical enthalpy [J/kg] - inline scalar Hc() const; + //- Enthalpy of formation [J/kg] + inline scalar Hf() const; //- Entropy [J/kg/K] inline scalar S(const scalar p, const scalar T) const; @@ -166,9 +166,6 @@ public: // Derivative term used for Jacobian - //- Derivative of Gibbs free energy w.r.t. temperature - inline scalar dGdT(const scalar p, const scalar T) const; - //- Temperature derivative of heat capacity at constant pressure inline scalar dCpdT(const scalar p, const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H index a2c53d7927..ff2383d79a 100644 --- a/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hConst/hConstThermoI.H @@ -117,7 +117,7 @@ inline Foam::scalar Foam::hConstThermo::Hs template -inline Foam::scalar Foam::hConstThermo::Hc() const +inline Foam::scalar Foam::hConstThermo::Hf() const { return Hf_; } @@ -130,7 +130,7 @@ inline Foam::scalar Foam::hConstThermo::Ha const scalar T ) const { - return Hs(p, T) + Hc(); + return Hs(p, T) + Hf(); } @@ -151,18 +151,7 @@ inline Foam::scalar Foam::hConstThermo::Gstd const scalar T ) const { - return Cp_*(T - Tref_) + Hsref_ + Hc() - Cp_*T*log(T/Tstd); -} - - -template -inline Foam::scalar Foam::hConstThermo::dGdT -( - const scalar p, - const scalar T -) const -{ - return 0; + return Cp_*(T - Tref_) + Hsref_ + Hf() - Cp_*T*log(T/Tstd); } diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H index 40497fe790..1b93f10e4a 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -190,8 +190,8 @@ public: //- Sensible enthalpy [J/kg] inline scalar Hs(const scalar p, const scalar T) const; - //- Chemical enthalpy [J/kg] - inline scalar Hc() const; + //- Enthalpy of formation [J/kg] + inline scalar Hf() const; //- Entropy [J/kg/K] inline scalar S(const scalar p, const scalar T) const; @@ -204,9 +204,6 @@ public: // Derivative term used for Jacobian - //- Derivative of Gibbs free energy w.r.t. temperature - inline scalar dGdT(const scalar p, const scalar T) const; - //- Temperature derivative of heat capacity at constant pressure inline scalar dCpdT(const scalar p, const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H index 9f531359f8..16e16a64ad 100644 --- a/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hPolynomial/hPolynomialThermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -106,12 +106,12 @@ inline Foam::scalar Foam::hPolynomialThermo::Hs const scalar T ) const { - return Ha(p, T) - Hc(); + return Ha(p, T) - Hf(); } template -inline Foam::scalar Foam::hPolynomialThermo::Hc() +inline Foam::scalar Foam::hPolynomialThermo::Hf() const { return Hf_; @@ -139,22 +139,6 @@ inline Foam::scalar Foam::hPolynomialThermo::Gstd } -template -inline Foam::scalar Foam::hPolynomialThermo::dGdT -( - const scalar p, - const scalar T -) const -{ - return - ( - hCoeffs_.derivative(T) - - T*sCoeffs_.derivative(T) - - sCoeffs_.value(T) - ); -} - - template inline Foam::scalar Foam::hPolynomialThermo::dCpdT ( diff --git a/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H index 83f83bfb7d..3a7566e7e8 100644 --- a/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H +++ b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -162,8 +162,8 @@ public: //- Sensible enthalpy [J/kg] inline scalar Hs(const scalar p, const scalar T) const; - //- Chemical enthalpy [J/kg] - inline scalar Hc() const; + //- Enthalpy of formation [J/kg] + inline scalar Hf() const; //- Entropy [J/kg/K] inline scalar S(const scalar p, const scalar T) const; @@ -176,9 +176,6 @@ public: // Derivative term used for Jacobian - //- Derivative of Gibbs free energy w.r.t. temperature - inline scalar dGdT(const scalar p, const scalar T) const; - //- Temperature derivative of heat capacity at constant pressure inline scalar dCpdT(const scalar p, const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/hPower/hPowerThermoI.H b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermoI.H index 408e60964e..3463fa05e7 100644 --- a/src/thermophysicalModels/specie/thermo/hPower/hPowerThermoI.H +++ b/src/thermophysicalModels/specie/thermo/hPower/hPowerThermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -131,7 +131,7 @@ inline Foam::scalar Foam::hPowerThermo::Ha const scalar T ) const { - return Hs(p, T) + Hc(); + return Hs(p, T) + Hf(); } @@ -149,7 +149,7 @@ inline Foam::scalar Foam::hPowerThermo::Hs template -inline Foam::scalar Foam::hPowerThermo::Hc() const +inline Foam::scalar Foam::hPowerThermo::Hf() const { return Hf_; } @@ -176,24 +176,11 @@ inline Foam::scalar Foam::hPowerThermo::Gstd { return c0_*(pow(T, n0_ + 1) - pow(Tstd, n0_ + 1))/(pow(Tref_, n0_)*(n0_ + 1)) - + Hc() + + Hf() - c0_*(pow(T, n0_) - pow(Tstd, n0_))*T/(pow(Tref_, n0_)*n0_); } -template -inline Foam::scalar Foam::hPowerThermo::dGdT -( - const scalar p, - const scalar T -) const -{ - // To be implemented - NotImplemented; - return 0; -} - - template inline Foam::scalar Foam::hPowerThermo::dCpdT ( diff --git a/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermo.C b/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermo.C new file mode 100644 index 0000000000..f589f459e5 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermo.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "hTabulatedThermo.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::hTabulatedThermo::hTabulatedThermo +( + const dictionary& dict +) +: + EquationOfState(dict), + Hf_(dict.subDict("thermodynamics").lookup("Hf")), + Sf_(dict.subDict("thermodynamics").lookup("Sf")), + Cp_("Cp", dict.subDict("thermodynamics")) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::hTabulatedThermo::write +( + Ostream& os +) const +{ + EquationOfState::write(os); + + dictionary dict("thermodynamics"); + dict.add("Hf", Hf_); + dict.add("Sf", Sf_); + dict.add("Cp", Cp_.values()); + os << indent << dict.dictName() << dict; +} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const hTabulatedThermo& pt +) +{ + pt.write(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermo.H b/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermo.H new file mode 100644 index 0000000000..ebc2c66f39 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermo.H @@ -0,0 +1,196 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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::hTabulatedThermo + +Description + Enthalpy based thermodynamics package using non-uniform tabulated data for + heat capacity vs temperature. + +Usage + + \table + Property | Description + Hf | Heat of formation + Sf | Standard entropy + Cp | Specific heat at constant pressure vs temperature table + \endtable + + Example of the specification of the thermodynamic properties: + \verbatim + thermodynamics + { + Hf 0; + Sf 0; + Cp + ( + (200 1005) + (350 1010) + (400 1020) + ); + } + \endverbatim + +SourceFiles + hTabulatedThermoI.H + hTabulatedThermo.C + +See also + Foam::thermophysicalFunctions::nonUniformTable + +\*---------------------------------------------------------------------------*/ + +#ifndef hTabulatedThermo_H +#define hTabulatedThermo_H + +#include "integratedNonUniformTableThermophysicalFunction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of friend functions and operators + +template +class hTabulatedThermo; + +template +Ostream& operator<< +( + Ostream&, + const hTabulatedThermo& +); + + +/*---------------------------------------------------------------------------*\ + Class hTabulatedThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class hTabulatedThermo +: + public EquationOfState +{ + typedef thermophysicalFunctions::integratedNonUniformTable + integratedNonUniformTable; + + + // Private Data + + //- Heat of formation + scalar Hf_; + + //- Standard entropy + scalar Sf_; + + //- Specific heat at constant pressure table [J/kg/K] + integratedNonUniformTable Cp_; + + +public: + + // Constructors + + //- Construct from dictionary + hTabulatedThermo(const dictionary& dict); + + //- Construct as a named copy + inline hTabulatedThermo(const word&, const hTabulatedThermo&); + + + // Member Functions + + //- Return the instantiated type name + static word typeName() + { + return "hTabulated<" + EquationOfState::typeName() + '>'; + } + + //- Limit the temperature to be in the range Tlow_ to Thigh_ + inline scalar limit(const scalar) const; + + + // Fundamental properties + + //- Heat capacity at constant pressure [J/kg/K] + inline scalar Cp(const scalar p, const scalar T) const; + + //- Absolute enthalpy [J/kg] + inline scalar Ha(const scalar p, const scalar T) const; + + //- Sensible enthalpy [J/kg] + inline scalar Hs(const scalar p, const scalar T) const; + + //- Enthalpy of formation [J/kg] + inline scalar Hf() const; + + //- Entropy [J/kg/K] + inline scalar S(const scalar p, const scalar T) const; + + //- Gibbs free energy of the mixture in the standard state [J/kg] + inline scalar Gstd(const scalar T) const; + + #include "HtoEthermo.H" + + + // Derivative term used for Jacobian + + //- Temperature derivative of heat capacity at constant pressure + inline scalar dCpdT(const scalar p, const scalar T) const; + + + // I-O + + //- Write to Ostream + void write(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const hTabulatedThermo& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "hTabulatedThermoI.H" + +#ifdef NoRepository + #include "hTabulatedThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermoI.H b/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermoI.H new file mode 100644 index 0000000000..9f80f02964 --- /dev/null +++ b/src/thermophysicalModels/specie/thermo/hTabulated/hTabulatedThermoI.H @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "hTabulatedThermo.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +inline Foam::hTabulatedThermo::hTabulatedThermo +( + const word& name, + const hTabulatedThermo& pt +) +: + EquationOfState(name, pt), + Hf_(pt.Hf_), + Sf_(pt.Sf_), + Cp_(pt.Cp_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline Foam::scalar Foam::hTabulatedThermo::limit +( + const scalar T +) const +{ + return T; +} + + +template +inline Foam::scalar Foam::hTabulatedThermo::Cp +( + const scalar p, + const scalar T +) const +{ + return Cp_.f(p, T) + EquationOfState::Cp(p, T); +} + + +template +inline Foam::scalar Foam::hTabulatedThermo::Ha +( + const scalar p, + const scalar T +) const +{ + return Hs(p, T) + Hf_; +} + + +template +inline Foam::scalar Foam::hTabulatedThermo::Hs +( + const scalar p, + const scalar T +) const +{ + return Cp_.intfdT(p, T) + EquationOfState::H(p, T); +} + + +template +inline Foam::scalar Foam::hTabulatedThermo::Hf() +const +{ + return Hf_; +} + + +template +inline Foam::scalar Foam::hTabulatedThermo::S +( + const scalar p, + const scalar T +) const +{ + return Cp_.intfByTdT(p, T) + EquationOfState::S(p, T) + Sf_; +} + + +template +inline Foam::scalar Foam::hTabulatedThermo::Gstd +( + const scalar T +) const +{ + return Cp_.intfdT(Pstd, T) + Hf_ - (Cp_.intfByTdT(Pstd, T) + Sf_)*T; +} + + +template +inline Foam::scalar Foam::hTabulatedThermo::dCpdT +( + const scalar p, + const scalar T +) const +{ + return Cp_.dfdT(p, T); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H index 7d9fdb9e2b..4796166580 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -180,8 +180,8 @@ public: //- Sensible enthalpy [J/kg] inline scalar Hs(const scalar p, const scalar T) const; - //- Chemical enthalpy [J/kg] - inline scalar Hc() const; + //- Enthalpy of formation [J/kg] + inline scalar Hf() const; //- Entropy [J/kg/K] inline scalar S(const scalar p, const scalar T) const; @@ -194,9 +194,6 @@ public: // Derivative term used for Jacobian - //- Derivative of Gibbs free energy w.r.t. temperature - inline scalar dGdT(const scalar p, const scalar T) const; - //- Temperature derivative of heat capacity at constant pressure inline scalar dCpdT(const scalar p, const scalar T) const; diff --git a/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H b/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H index bb91b95c10..e83828b154 100644 --- a/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H +++ b/src/thermophysicalModels/specie/thermo/janaf/janafThermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -203,12 +203,12 @@ inline Foam::scalar Foam::janafThermo::Hs const scalar T ) const { - return Ha(p, T) - Hc(); + return Ha(p, T) - Hf(); } template -inline Foam::scalar Foam::janafThermo::Hc() const +inline Foam::scalar Foam::janafThermo::Hf() const { const coeffArray& a = lowCpCoeffs_; return @@ -256,18 +256,6 @@ inline Foam::scalar Foam::janafThermo::Gstd } -template -inline Foam::scalar Foam::janafThermo::dGdT -( - const scalar p, - const scalar T -) const -{ - const coeffArray& a = coeffs(T); - return -((a[0] + a[5]/T)/T + a[1]/2 + T*(a[2]/3 + T*(a[3]/4 + T*a[4]/5))); -} - - template inline Foam::scalar Foam::janafThermo::dCpdT ( diff --git a/src/thermophysicalModels/specie/thermo/thermo/thermo.H b/src/thermophysicalModels/specie/thermo/thermo/thermo.H index 0738dd76a7..ecc7152b8b 100644 --- a/src/thermophysicalModels/specie/thermo/thermo/thermo.H +++ b/src/thermophysicalModels/specie/thermo/thermo/thermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -158,8 +158,8 @@ public: // Sensible enthalpy [J/kg] // inline scalar Hs(const scalar p, const scalar T) const; - // Chemical enthalpy [J/kg] - // inline scalar Hc() const; + // Enthalpy of formation [J/kg] + // inline scalar Hf() const; // Absolute enthalpy [J/kg] // inline scalar Ha(const scalar p, const scalar T) const; @@ -210,7 +210,7 @@ public: //- Sensible enthalpy [J/kmol] inline scalar hs(const scalar p, const scalar T) const; - //- Chemical enthalpy [J/kmol] + //- Enthalpy of formation [J/kmol] inline scalar hc() const; //- Entropy [J/kmol/K] diff --git a/src/thermophysicalModels/specie/thermo/thermo/thermoI.H b/src/thermophysicalModels/specie/thermo/thermo/thermoI.H index ccf3aa99e0..d014e36d4a 100644 --- a/src/thermophysicalModels/specie/thermo/thermo/thermoI.H +++ b/src/thermophysicalModels/specie/thermo/thermo/thermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -218,7 +218,7 @@ template class Type> inline Foam::scalar Foam::species::thermo::hc() const { - return this->Hc()*this->W(); + return this->Hf()*this->W(); } @@ -461,15 +461,17 @@ Foam::species::thermo::dKcdTbyKc const scalar T ) const { - const scalar nm = this->Y()/this->W(); + const scalar dKcdTbyKc = + (this->S(Pstd, T) + this->Gstd(T)/T)*this->Y()/(RR*T); + const scalar nm = this->Y()/this->W(); if (equal(nm, small)) { - return -this->dGdT(Pstd, T)*this->Y()/RR; + return dKcdTbyKc; } else { - return -(nm/T + this->dGdT(Pstd, T)*this->Y()/RR); + return dKcdTbyKc - nm/T; } } diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.C index f8dab5ec7d..fcc0a10866 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.H index e6252d1c61..bafb04063c 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/APIfunctions/APIdiffCoef/APIdiffCoefThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.C index 7855ee54a4..e9d9fc4795 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.H index 86eea03dcd..d822df6054 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS0/NSRDS0ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.C index e865c7b197..c091ed4539 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.H index 8bae49af25..919406daa5 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS1/NSRDS1ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.C index a568abc688..ef0e7f3241 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.H index bc4ff5b398..d62262df4b 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS14/NSRDS14ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.C index c176e7d46b..90577cb78b 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.H index ff3537e1ba..b628d6be97 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS2/NSRDS2ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.C index 3d1af698aa..51e09ed54f 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.H index 658b6512ea..d38fe63707 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS3/NSRDS3ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.C index d2a45babdd..c74890dc9c 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.H index a593141d9a..2225747c09 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS4/NSRDS4ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.C index dbc5e58d36..9ccf73dc81 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.H index 64f56c0993..a8722d28b1 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS5/NSRDS5ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.C index 605f7a4dbd..4f8224227f 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.H index 00d9bd6eac..6adcb1537e 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS6/NSRDS6ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.C similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.C index 4d203142ce..fb934a6d06 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.H similarity index 98% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.H index 2b3f03261a..f6282396ef 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/NSRDS/NSRDS7/NSRDS7ThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/constant/constantThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/constant/constantThermophysicalFunction.C similarity index 96% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/constant/constantThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/constant/constantThermophysicalFunction.C index 50d4302c2d..a9200d4863 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/constant/constantThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/constant/constantThermophysicalFunction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/constant/constantThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/constant/constantThermophysicalFunction.H similarity index 97% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/constant/constantThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/constant/constantThermophysicalFunction.H index 5b3b71f377..a27e78511d 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/constant/constantThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/constant/constantThermophysicalFunction.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2020 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/specie/thermophysicalFunctions/integratedNonUniformTable/integratedNonUniformTableThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/integratedNonUniformTable/integratedNonUniformTableThermophysicalFunction.C new file mode 100644 index 0000000000..947657077e --- /dev/null +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/integratedNonUniformTable/integratedNonUniformTableThermophysicalFunction.C @@ -0,0 +1,137 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2020 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 "integratedNonUniformTableThermophysicalFunction.H" +#include "specie.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace thermophysicalFunctions +{ + defineTypeNameAndDebug(integratedNonUniformTable, 0); + + addToRunTimeSelectionTable + ( + thermophysicalFunction, + integratedNonUniformTable, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::thermophysicalFunctions::integratedNonUniformTable:: +integratedNonUniformTable +( + const word& name, + const dictionary& dict +) +: + nonUniformTable(name, dict), + intf_(values().size()), + intfByT_(values().size()) +{ + intf_[0] = 0; + intfByT_[0] = 0; + + for(label i = 0; i. + +Class + Foam::thermophysicalFunctions::integratedNonUniformTable + +Description + Non-uniform tabulated property function that linearly interpolates between + the values. + + To speed-up the search of the non-uniform table a uniform jump-table is + created on construction which is used for fast indirect addressing into + the table. + +Usage + \integratedNonUniformTable + Property | Description + values | List of (temperature property) value pairs + \endintegratedNonUniformTable + + Example for the density of water between 280 and 350K + \verbatim + rho + { + type integratedNonUniformTable; + + values + ( + (280 999.87) + (300 995.1) + (350 973.7) + ); + } + \endverbatim + +\*---------------------------------------------------------------------------*/ + +#ifndef integratedNonUniformTableThermophysicalFunction_H +#define integratedNonUniformTableThermophysicalFunction_H + +#include "nonUniformTableThermophysicalFunction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace thermophysicalFunctions +{ + +/*---------------------------------------------------------------------------*\ + Class integratedNonUniformTable Declaration +\*---------------------------------------------------------------------------*/ + +class integratedNonUniformTable +: + public nonUniformTable +{ + // Private member data + + List intf_; + + List intfByT_; + + +public: + + //- Runtime type information + TypeName("integratedNonUniformTable"); + + + // Constructors + + //- Construct from entry name and dictionary + integratedNonUniformTable(const word& name, const dictionary& dict); + + //- Construct from dictionary + integratedNonUniformTable(const dictionary& dict); + + + // Member Functions + + //- Integrate the function and return the result + scalar intfdT(scalar p, scalar T) const; + + //- Integrate the function divided by T and return the result + scalar intfByTdT(scalar p, scalar T) const; + + //- Write the function coefficients + void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace thermophysicalFunctions +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C b/src/thermophysicalModels/specie/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C similarity index 84% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C rename to src/thermophysicalModels/specie/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C index 591e592132..9e5f3588f4 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.C @@ -54,22 +54,23 @@ const char* const Foam::Tuple2::typeName Foam::thermophysicalFunctions::nonUniformTable::nonUniformTable ( + const word& name, const dictionary& dict ) : - dictName_(dict.name()), + name_(name), Tlow_(great), Thigh_(-great), - values_(dict.lookup("values")), + values_(dict.lookup(name)), deltaT_(great) { if (values_.size() < 2) { - FatalErrorInFunction + FatalIOErrorInFunction(dict) << "Table " << nl - << " " << dictName_ << nl + << " " << name_ << nl << " has less than 2 entries." - << exit(FatalError); + << exit(FatalIOError); } else { @@ -101,6 +102,15 @@ Foam::thermophysicalFunctions::nonUniformTable::nonUniformTable } +Foam::thermophysicalFunctions::nonUniformTable::nonUniformTable +( + const dictionary& dict +) +: + nonUniformTable("values", dict) +{} + + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::scalar Foam::thermophysicalFunctions::nonUniformTable::f @@ -109,19 +119,7 @@ Foam::scalar Foam::thermophysicalFunctions::nonUniformTable::f scalar T ) const { - if (T < Tlow_ || T > Thigh_) - { - FatalErrorInFunction - << "Temperature " << T << " out of range " - << Tlow_ << " to " << Thigh_ << nl - << " of nonUniformTable " << dictName_ - << exit(FatalError); - } - - const scalar nd = (T - Tlow_)/deltaT_; - const label j = nd; - const label i = jumpTable_[j]; - + const label i = index(p, T); const scalar Ti = values_[i].first(); const scalar lambda = (T - Ti)/(values_[i + 1].first() - Ti); @@ -131,6 +129,20 @@ Foam::scalar Foam::thermophysicalFunctions::nonUniformTable::f } +Foam::scalar Foam::thermophysicalFunctions::nonUniformTable::dfdT +( + scalar p, + scalar T +) const +{ + const label i = index(p, T); + + return + (values_[i + 1].second() - values_[i].second()) + /(values_[i + 1].first() - values_[i].first()); +} + + void Foam::thermophysicalFunctions::nonUniformTable::write(Ostream& os) const { writeEntry(os, "values", values_); diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H b/src/thermophysicalModels/specie/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H similarity index 86% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H rename to src/thermophysicalModels/specie/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H index b229ed215d..4659d41243 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H +++ b/src/thermophysicalModels/specie/thermophysicalFunctions/nonUniformTable/nonUniformTableThermophysicalFunction.H @@ -79,7 +79,7 @@ class nonUniformTable // Private member data //- Name of dictionary from which this function is instantiated - fileName dictName_; + word name_; //- Lowest temperature in the nonUniformTable scalar Tlow_; @@ -96,6 +96,13 @@ class nonUniformTable List