diff --git a/dumux/material/components/constant.hh b/dumux/material/components/constant.hh index ca4118c9391d97f75de736ce8849f2917d35d10d..31114d5e03c466f9effcf512d1a3f4c290992478 100644 --- a/dumux/material/components/constant.hh +++ b/dumux/material/components/constant.hh @@ -154,6 +154,19 @@ public: return thermalConductivity; } + /*! + * \brief Specific internal energy of the component \f$\mathrm{[J/kg]}\f$ as a liquid. + * \param temperature temperature of phase in \f$\mathrm{[K]}\f$ + * \param pressure pressure of phase in \f$\mathrm{[Pa]}\f$ + */ + static Scalar liquidInternalEnergy(Scalar temperature, Scalar pressure) + { + // u = c * dT for incompressible fluids + const Scalar heatCapacity = liquidHeatCapacity(temperature, pressure); + static const Scalar tRef = getParamFromGroup<Scalar>(std::to_string(id), "Component.ReferenceTemperature", 293.15); + return heatCapacity * (temperature - tRef); + } + /*! * \brief Specific enthalpy of the component \f$\mathrm{[J/kg]}\f$ as a liquid. * @@ -162,8 +175,9 @@ public: */ static Scalar liquidEnthalpy(Scalar temperature, Scalar pressure) { - static const Scalar enthalpy = getParamFromGroup<Scalar>(std::to_string(id), "Component.LiquidEnthalpy"); - return enthalpy; + const Scalar u = liquidInternalEnergy(temperature, pressure); + const Scalar rho = liquidDensity(temperature, pressure); + return u + pressure / rho; } /*! diff --git a/test/material/components/CMakeLists.txt b/test/material/components/CMakeLists.txt index 09f2f3b88d5138d88a9d896f65040daadab186b3..a2fa8428da76f8ee4adaf4d7be60d00e2ac11580 100644 --- a/test/material/components/CMakeLists.txt +++ b/test/material/components/CMakeLists.txt @@ -64,6 +64,12 @@ dumux_add_test(NAME plot_ch4 CMD_ARGS "CH4" LABELS unit material) +dumux_add_test(NAME plot_constantcomponent + TARGET plot_component + COMMAND ./plot_component + CMD_ARGS "Constant" + LABELS unit material) + dumux_add_test(NAME plot_chlorideion TARGET plot_component COMMAND ./plot_component diff --git a/test/material/components/plotproperties.cc b/test/material/components/plotproperties.cc index 962a67892c34eeae9fbc7839078577e3e581cb8a..2ad468b5b1d4296ea3cb39f1da32d9823efd9a81 100644 --- a/test/material/components/plotproperties.cc +++ b/test/material/components/plotproperties.cc @@ -43,6 +43,7 @@ #include <dumux/material/components/carbonateion.hh> #include <dumux/material/components/ch4.hh> #include <dumux/material/components/chlorideion.hh> +#include <dumux/material/components/constant.hh> #include <dumux/material/components/co2.hh> #include <dumux/material/components/glucose.hh> #include <dumux/material/components/granite.hh> @@ -365,6 +366,21 @@ int main(int argc, char *argv[]) plotStuff< Components::CH4<double> >(openPlotWindow); else if (compName == "ChlorideIon") plotStuff< Components::ChlorideIon<double> >(openPlotWindow); + else if (compName == "Constant") + { + Parameters::init([](auto& params){ + params["Component.LiquidDensity"] = "1e3"; + params["Component.LiquidKinematicViscosity"] = "1e-3"; + params["Component.LiquidThermalConductivity"] = "0.679"; + params["Component.LiquidHeatCapacity"] = "4.2e3"; + params["Component.GasDensity"] = "1"; + params["Component.GasKinematicViscosity"] = "1"; + params["Component.SolidDensity"] = "1e3"; + params["Component.SolidThermalConductivity"] = "0.679"; + params["Component.SolidHeatCapacity"] = "4.2e3"; + }); + plotStuff< Components::Constant<1, double> >(openPlotWindow); + } else if (compName == "Glucose") plotStuff< Components::Glucose<double> >(openPlotWindow); else if (compName == "Granite")