From 6184923fc80b73076d79e86990b8c44adfcb37d2 Mon Sep 17 00:00:00 2001 From: "Joshua E. Hansel" Date: Mon, 30 Sep 2024 15:35:24 -0500 Subject: [PATCH] Implemented ThermalFunctionSolidProperties::cp_integral(T) Refs #23118 --- .../ThermalFunctionSolidProperties.h | 2 ++ .../ThermalFunctionSolidProperties.C | 6 ++++++ .../include/ThermalFunctionSolidPropertiesTest.h | 7 ++++--- .../unit/src/ThermalFunctionSolidPropertiesTest.C | 13 ++++++++++++- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/modules/solid_properties/include/solidproperties/ThermalFunctionSolidProperties.h b/modules/solid_properties/include/solidproperties/ThermalFunctionSolidProperties.h index 2cd220b8ad37..f329c0328541 100644 --- a/modules/solid_properties/include/solidproperties/ThermalFunctionSolidProperties.h +++ b/modules/solid_properties/include/solidproperties/ThermalFunctionSolidProperties.h @@ -37,6 +37,8 @@ class ThermalFunctionSolidProperties : public ThermalSolidProperties virtual void cp_from_T(const Real & T, Real & cp, Real & dcp_dT) const override; + virtual Real cp_integral(const Real & T) const override; + virtual Real rho_from_T(const Real & T) const override; virtual void rho_from_T(const Real & T, Real & rho, Real & drho_dT) const override; diff --git a/modules/solid_properties/src/solidproperties/ThermalFunctionSolidProperties.C b/modules/solid_properties/src/solidproperties/ThermalFunctionSolidProperties.C index 7171d479327b..3b335476d9a3 100644 --- a/modules/solid_properties/src/solidproperties/ThermalFunctionSolidProperties.C +++ b/modules/solid_properties/src/solidproperties/ThermalFunctionSolidProperties.C @@ -44,6 +44,12 @@ ThermalFunctionSolidProperties::cp_from_T(const Real & T, Real & cp, Real & dcp_ dcp_dT = _cp_function.timeDerivative(T); } +Real +ThermalFunctionSolidProperties::cp_integral(const Real & T) const +{ + return _cp_function.timeIntegral(_T_zero_e, T, Point(0, 0, 0)); +} + Real ThermalFunctionSolidProperties::k_from_T(const Real & T) const { diff --git a/modules/solid_properties/unit/include/ThermalFunctionSolidPropertiesTest.h b/modules/solid_properties/unit/include/ThermalFunctionSolidPropertiesTest.h index 47366eae9c70..d72e57c20752 100644 --- a/modules/solid_properties/unit/include/ThermalFunctionSolidPropertiesTest.h +++ b/modules/solid_properties/unit/include/ThermalFunctionSolidPropertiesTest.h @@ -30,9 +30,10 @@ class ThermalFunctionSolidPropertiesTest : public MooseObjectUnitTest Function & rho = _fe_problem->getFunction("rho"); rho.initialSetup(); - InputParameters cp_pars = _factory.getValidParams("ParsedFunction"); - cp_pars.set("value") = "1200.0"; - _fe_problem->addFunction("ParsedFunction", "cp", cp_pars); + InputParameters cp_pars = _factory.getValidParams("PiecewiseLinear"); + cp_pars.set>("x") = {700.0, 900.0}; + cp_pars.set>("y") = {1000.0, 1400.0}; + _fe_problem->addFunction("PiecewiseLinear", "cp", cp_pars); Function & cp = _fe_problem->getFunction("cp"); cp.initialSetup(); diff --git a/modules/solid_properties/unit/src/ThermalFunctionSolidPropertiesTest.C b/modules/solid_properties/unit/src/ThermalFunctionSolidPropertiesTest.C index cac84a9aadc9..c962d593f8fd 100644 --- a/modules/solid_properties/unit/src/ThermalFunctionSolidPropertiesTest.C +++ b/modules/solid_properties/unit/src/ThermalFunctionSolidPropertiesTest.C @@ -28,12 +28,23 @@ TEST_F(ThermalFunctionSolidPropertiesTest, k) */ TEST_F(ThermalFunctionSolidPropertiesTest, cp) { - Real T = 10.0; + Real T = 800.0; REL_TEST(_sp->cp_from_T(T), 1200.0, REL_TOL_SAVED_VALUE); DERIV_TEST(_sp->cp_from_T, T, REL_TOL_DERIVATIVE); } +/** + * Test that the specific internal energy and its derivatives are + * correctly computed. + */ +TEST_F(ThermalFunctionSolidPropertiesTest, e) +{ + const Real T = 800.0; + REL_TEST(_sp->e_from_T(T), 536850.0, REL_TOL_SAVED_VALUE); + SPECIFIC_INTERNAL_ENERGY_TESTS(_sp, T, 1e-6, 1e-6); +} + /** * Test that the density and its derivatives are * correctly computed.