LCOV - code coverage report
Current view: top level - src/materials - FluidPropertiesMaterialPT.C (source / functions) Hit Total Coverage
Test: idaholab/moose fluid_properties: #32971 (54bef8) with base c6cf66 Lines: 39 40 97.5 %
Date: 2026-05-29 20:36:28 Functions: 4 5 80.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         749 : FluidPropertiesMaterialPT::validParams()
      16             : {
      17         749 :   InputParameters params = Material::validParams();
      18        1498 :   params.addRequiredCoupledVar("pressure", "Fluid pressure (Pa)");
      19        1498 :   params.addRequiredCoupledVar("temperature", "Fluid temperature (K)");
      20        1498 :   params.addRequiredParam<UserObjectName>("fp", "The name of the user object for fluid properties");
      21         749 :   params.addClassDescription("Fluid properties using the (pressure, temperature) formulation");
      22             : 
      23             :   // Restrict properties created
      24        1498 :   params.addParam<bool>("compute_entropy", true, "Whether to compute the entropy");
      25        1498 :   params.addParam<bool>("compute_sound_speed", true, "Whether to compute the speed of sound");
      26             : 
      27         749 :   return params;
      28           0 : }
      29             : 
      30         576 : FluidPropertiesMaterialPT::FluidPropertiesMaterialPT(const InputParameters & parameters)
      31             :   : Material(parameters),
      32         576 :     _pressure(coupledValue("pressure")),
      33         576 :     _temperature(coupledValue("temperature")),
      34             : 
      35         576 :     _rho(declareProperty<Real>("density")),
      36         576 :     _mu(declareProperty<Real>("viscosity")),
      37         576 :     _cp(declareProperty<Real>("cp")),
      38         576 :     _cv(declareProperty<Real>("cv")),
      39         576 :     _k(declareProperty<Real>("k")),
      40         576 :     _h(declareProperty<Real>("h")),
      41         576 :     _e(declareProperty<Real>("e")),
      42             : 
      43        1152 :     _compute_s(getParam<bool>("compute_entropy")),
      44        1152 :     _compute_c(getParam<bool>("compute_sound_speed")),
      45             : 
      46         576 :     _s(_compute_s ? &declareProperty<Real>("s") : nullptr),
      47         576 :     _c(_compute_c ? &declareProperty<Real>("c") : nullptr),
      48             : 
      49        1152 :     _fp(getUserObject<SinglePhaseFluidProperties>("fp"))
      50             : {
      51         576 : }
      52             : 
      53         540 : FluidPropertiesMaterialPT::~FluidPropertiesMaterialPT() {}
      54             : 
      55             : void
      56         802 : FluidPropertiesMaterialPT::computeQpProperties()
      57             : {
      58         802 :   _rho[_qp] = _fp.rho_from_p_T(_pressure[_qp], _temperature[_qp]);
      59         798 :   _mu[_qp] = _fp.mu_from_p_T(_pressure[_qp], _temperature[_qp]);
      60         798 :   _cp[_qp] = _fp.cp_from_p_T(_pressure[_qp], _temperature[_qp]);
      61         798 :   _cv[_qp] = _fp.cv_from_p_T(_pressure[_qp], _temperature[_qp]);
      62         798 :   _k[_qp] = _fp.k_from_p_T(_pressure[_qp], _temperature[_qp]);
      63         798 :   _h[_qp] = _fp.h_from_p_T(_pressure[_qp], _temperature[_qp]);
      64         798 :   _e[_qp] = _fp.e_from_p_T(_pressure[_qp], _temperature[_qp]);
      65         798 :   if (_compute_s)
      66         768 :     (*_s)[_qp] = _fp.s_from_p_T(_pressure[_qp], _temperature[_qp]);
      67         798 :   if (_compute_c)
      68         768 :     (*_c)[_qp] = _fp.c_from_p_T(_pressure[_qp], _temperature[_qp]);
      69         798 : }

Generated by: LCOV version 1.14