Skip to content

Commit

Permalink
Implemented ThermalFunctionSolidProperties::cp_integral(T)
Browse files Browse the repository at this point in the history
Refs #23118
  • Loading branch information
joshuahansel committed Oct 1, 2024
1 parent 6b2406c commit 6184923
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string>("value") = "1200.0";
_fe_problem->addFunction("ParsedFunction", "cp", cp_pars);
InputParameters cp_pars = _factory.getValidParams("PiecewiseLinear");
cp_pars.set<std::vector<Real>>("x") = {700.0, 900.0};
cp_pars.set<std::vector<Real>>("y") = {1000.0, 1400.0};
_fe_problem->addFunction("PiecewiseLinear", "cp", cp_pars);
Function & cp = _fe_problem->getFunction("cp");
cp.initialSetup();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 6184923

Please sign in to comment.