Skip to content

Commit

Permalink
Add cp derivatives to NaCl, was done for testing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
GiudGiud committed Dec 20, 2024
1 parent 4c3f05c commit 66eaa5d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class NaClFluidProperties : public SinglePhaseFluidProperties

virtual Real cp_from_p_T(Real pressure, Real temperature) const override;

using SinglePhaseFluidProperties::cp_from_p_T;
virtual void cp_from_p_T(
Real pressure, Real temperature, Real & cp, Real & dcp_dp, Real & dcp_dT) const override;

virtual Real cv_from_p_T(Real pressure, Real temperature) const override;

Expand Down
39 changes: 31 additions & 8 deletions modules/fluid_properties/src/fluidproperties/NaClFluidProperties.C
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ NaClFluidProperties::rho_from_p_T(Real pressure, Real temperature) const
{
// Correlation needs pressure in bar
Real pbar = pressure * 1.0e-5;
// Correlation requires temperature in Celcius
// Correlation requires temperature in Celsius
Real Tc = temperature - _T_c2k;

// Halite density at 0 Pa
Expand All @@ -99,7 +99,7 @@ NaClFluidProperties::rho_from_p_T(

// Correlation needs pressure in bar
Real pbar = pressure * 1.0e-5;
// Correlation requires temperature in Celcius
// Correlation requires temperature in Celsius
Real Tc = temperature - _T_c2k;

// Halite density at 0 Pa
Expand Down Expand Up @@ -137,19 +137,42 @@ NaClFluidProperties::cp_from_p_T(Real pressure, Real temperature) const
{
// Correlation needs pressure in bar
Real pbar = pressure * 10.0e-5;
// Correlation requires temperature in Celcius
// Correlation requires temperature in Celsius
Real Tc = temperature - _T_c2k;
// Triple point temperature of NaCl (in C)
Real Tt = _T_triple - _T_c2k;
// Coefficients used in the correlation
Real r3 = -1.7099e-3 - 3.82734e-6 * Tc - 8.65455e-9 * Tc * Tc;
Real r4 = 5.29063e-8 - 9.63084e-11 * Tc + 6.50745e-13 * Tc * Tc;

// Halite isobaric heat capapcity
// Halite isobaric heat capacity
return 1148.81 + 0.551548 * (Tc - Tt) + 2.64309e-4 * (Tc - Tt) * (Tc - Tt) + r3 * pbar +
r4 * pbar * pbar;
}

void
NaClFluidProperties::cp_from_p_T(
Real pressure, Real temperature, Real & cp, Real & dcp_dp, Real & dcp_dT) const
{
// Correlation needs pressure in bar
Real pbar = pressure * 10.0e-5;
// Correlation requires temperature in Celsius
Real Tc = temperature - _T_c2k;
// Triple point temperature of NaCl (in C)
Real Tt = _T_triple - _T_c2k;
// Coefficients used in the correlation
Real r3 = -1.7099e-3 - 3.82734e-6 * Tc - 8.65455e-9 * Tc * Tc;
Real r4 = 5.29063e-8 - 9.63084e-11 * Tc + 6.50745e-13 * Tc * Tc;
Real dr3_dT = -3.82734e-6 - 2 * 8.65455e-9 * Tc;
Real dr4_dT = -9.63084e-11 + 2 * 6.50745e-13 * Tc;

// Halite isobaric heat capacity
cp = 1148.81 + 0.551548 * (Tc - Tt) + 2.64309e-4 * (Tc - Tt) * (Tc - Tt) + r3 * pbar +
r4 * pbar * pbar;
dcp_dp = r3 * 1e-5 + 2 * r4 * pbar * 1e-5;
dcp_dT = 0.551548 + 2 * 2.64309e-4 * (Tc - Tt) + dr3_dT * pbar + dr4_dT * pbar * pbar;
}

Real
NaClFluidProperties::cv_from_p_T(Real pressure, Real temperature) const
{
Expand All @@ -159,7 +182,7 @@ NaClFluidProperties::cv_from_p_T(Real pressure, Real temperature) const
Real
NaClFluidProperties::k_from_p_T(Real /*pressure*/, Real temperature) const
{
// Correlation requires temperature in Celcius
// Correlation requires temperature in Celsius
Real Tc = temperature - _T_c2k;

return 6.82793 - 3.16584e-2 * Tc + 1.03451e-4 * Tc * Tc - 1.48207e-7 * Tc * Tc * Tc;
Expand All @@ -169,7 +192,7 @@ void
NaClFluidProperties::k_from_p_T(
Real /*pressure*/, Real temperature, Real & k, Real & dk_dp, Real & dk_dT) const
{
// Correlation requires temperature in Celcius
// Correlation requires temperature in Celsius
Real Tc = temperature - _T_c2k;

k = 6.82793 - 3.16584e-2 * Tc + 1.03451e-4 * Tc * Tc - 1.48207e-7 * Tc * Tc * Tc;
Expand All @@ -182,7 +205,7 @@ NaClFluidProperties::h_from_p_T(Real pressure, Real temperature) const
{
// Correlation needs pressure in bar
Real pbar = pressure * 1.0e-5;
// Correlation requires temperature in Celcius
// Correlation requires temperature in Celsius
Real Tc = temperature - _T_c2k;
// Triple point temperature of water (in C)
Real Tt = 273.16 - _T_c2k;
Expand All @@ -200,7 +223,7 @@ NaClFluidProperties::h_from_p_T(
{
// Correlation needs pressure in bar
Real pbar = pressure * 1.0e-5;
// Correlation requires temperature in Celcius
// Correlation requires temperature in Celsius
Real Tc = temperature - _T_c2k;
// Triple point temperature of water (in C)
Real Tt = 273.16 - _T_c2k;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ TEST_F(NaClFluidPropertiesTest, derivatives)
DERIV_TEST(_fp->e_from_p_T, p, T, tol);
DERIV_TEST(_fp->h_from_p_T, p, T, tol);
DERIV_TEST(_fp->k_from_p_T, p, T, tol);
DERIV_TEST(_fp->cp_from_p_T, p, T, tol)
}

/**
Expand Down

0 comments on commit 66eaa5d

Please sign in to comment.