LCOV - code coverage report
Current view: top level - src/materials - FluidPropertiesMaterialPT.C (source / functions) Hit Total Coverage
Test: idaholab/moose fluid_properties: #31405 (292dce) with base fef103 Lines: 39 40 97.5 %
Date: 2025-09-04 07:53:14 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "FluidPropertiesMaterialPT.h"
      11             : 
      12             : registerMooseObject("FluidPropertiesApp", FluidPropertiesMaterialPT);
      13             : 
      14             : InputParameters
      15        1450 : FluidPropertiesMaterialPT::validParams()
      16             : {
      17        1450 :   InputParameters params = Material::validParams();
      18        2900 :   params.addRequiredCoupledVar("pressure", "Fluid pressure (Pa)");
      19        2900 :   params.addRequiredCoupledVar("temperature", "Fluid temperature (K)");
      20        2900 :   params.addRequiredParam<UserObjectName>("fp", "The name of the user object for fluid properties");
      21        1450 :   params.addClassDescription("Fluid properties using the (pressure, temperature) formulation");
      22             : 
      23             :   // Restrict properties created
      24        2900 :   params.addParam<bool>("compute_entropy", true, "Whether to compute the entropy");
      25        2900 :   params.addParam<bool>("compute_sound_speed", true, "Whether to compute the speed of sound");
      26             : 
      27        1450 :   return params;
      28           0 : }
      29             : 
      30        1128 : FluidPropertiesMaterialPT::FluidPropertiesMaterialPT(const InputParameters & parameters)
      31             :   : Material(parameters),
      32        1128 :     _pressure(coupledValue("pressure")),
      33        1128 :     _temperature(coupledValue("temperature")),
      34             : 
      35        1128 :     _rho(declareProperty<Real>("density")),
      36        1128 :     _mu(declareProperty<Real>("viscosity")),
      37        1128 :     _cp(declareProperty<Real>("cp")),
      38        1128 :     _cv(declareProperty<Real>("cv")),
      39        1128 :     _k(declareProperty<Real>("k")),
      40        1128 :     _h(declareProperty<Real>("h")),
      41        1128 :     _e(declareProperty<Real>("e")),
      42             : 
      43        2256 :     _compute_s(getParam<bool>("compute_entropy")),
      44        2256 :     _compute_c(getParam<bool>("compute_sound_speed")),
      45             : 
      46        1128 :     _s(_compute_s ? &declareProperty<Real>("s") : nullptr),
      47        1128 :     _c(_compute_c ? &declareProperty<Real>("c") : nullptr),
      48             : 
      49        2256 :     _fp(getUserObject<SinglePhaseFluidProperties>("fp"))
      50             : {
      51        1128 : }
      52             : 
      53        2184 : FluidPropertiesMaterialPT::~FluidPropertiesMaterialPT() {}
      54             : 
      55             : void
      56        1125 : FluidPropertiesMaterialPT::computeQpProperties()
      57             : {
      58        1125 :   _rho[_qp] = _fp.rho_from_p_T(_pressure[_qp], _temperature[_qp]);
      59        1121 :   _mu[_qp] = _fp.mu_from_p_T(_pressure[_qp], _temperature[_qp]);
      60        1121 :   _cp[_qp] = _fp.cp_from_p_T(_pressure[_qp], _temperature[_qp]);
      61        1121 :   _cv[_qp] = _fp.cv_from_p_T(_pressure[_qp], _temperature[_qp]);
      62        1121 :   _k[_qp] = _fp.k_from_p_T(_pressure[_qp], _temperature[_qp]);
      63        1121 :   _h[_qp] = _fp.h_from_p_T(_pressure[_qp], _temperature[_qp]);
      64        1121 :   _e[_qp] = _fp.e_from_p_T(_pressure[_qp], _temperature[_qp]);
      65        1121 :   if (_compute_s)
      66        1076 :     (*_s)[_qp] = _fp.s_from_p_T(_pressure[_qp], _temperature[_qp]);
      67        1121 :   if (_compute_c)
      68        1076 :     (*_c)[_qp] = _fp.c_from_p_T(_pressure[_qp], _temperature[_qp]);
      69        1121 : }

Generated by: LCOV version 1.14