https://mooseframework.inl.gov
Loading...
Searching...
No Matches
FluidPropertiesMaterialPT.C
Go to the documentation of this file.
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
11
13
16{
18 params.addRequiredCoupledVar("pressure", "Fluid pressure (Pa)");
19 params.addRequiredCoupledVar("temperature", "Fluid temperature (K)");
20 params.addRequiredParam<UserObjectName>("fp", "The name of the user object for fluid properties");
21 params.addClassDescription("Fluid properties using the (pressure, temperature) formulation");
22
23 // Restrict properties created
24 params.addParam<bool>("compute_entropy", true, "Whether to compute the entropy");
25 params.addParam<bool>("compute_sound_speed", true, "Whether to compute the speed of sound");
26
27 return params;
28}
29
31 : Material(parameters),
32 _pressure(coupledValue("pressure")),
33 _temperature(coupledValue("temperature")),
34
35 _rho(declareProperty<Real>("density")),
36 _mu(declareProperty<Real>("viscosity")),
37 _cp(declareProperty<Real>("cp")),
38 _cv(declareProperty<Real>("cv")),
39 _k(declareProperty<Real>("k")),
40 _h(declareProperty<Real>("h")),
41 _e(declareProperty<Real>("e")),
42
43 _compute_s(getParam<bool>("compute_entropy")),
44 _compute_c(getParam<bool>("compute_sound_speed")),
45
46 _s(_compute_s ? &declareProperty<Real>("s") : nullptr),
47 _c(_compute_c ? &declareProperty<Real>("c") : nullptr),
48
49 _fp(getUserObject<SinglePhaseFluidProperties>("fp"))
50{
51}
52
54
55void
57{
58 _rho[_qp] = _fp.rho_from_p_T(_pressure[_qp], _temperature[_qp]);
59 _mu[_qp] = _fp.mu_from_p_T(_pressure[_qp], _temperature[_qp]);
60 _cp[_qp] = _fp.cp_from_p_T(_pressure[_qp], _temperature[_qp]);
61 _cv[_qp] = _fp.cv_from_p_T(_pressure[_qp], _temperature[_qp]);
62 _k[_qp] = _fp.k_from_p_T(_pressure[_qp], _temperature[_qp]);
63 _h[_qp] = _fp.h_from_p_T(_pressure[_qp], _temperature[_qp]);
64 _e[_qp] = _fp.e_from_p_T(_pressure[_qp], _temperature[_qp]);
65 if (_compute_s)
66 (*_s)[_qp] = _fp.s_from_p_T(_pressure[_qp], _temperature[_qp]);
67 if (_compute_c)
68 (*_c)[_qp] = _fp.c_from_p_T(_pressure[_qp], _temperature[_qp]);
69}
registerMooseObject("FluidPropertiesApp", FluidPropertiesMaterialPT)
Computes fluid properties using (pressure, temperature) formulation.
MaterialProperty< Real > & _h
Specific enthalpy (J/kg)
static InputParameters validParams()
MaterialProperty< Real > & _e
Internal energy (J/kg)
const VariableValue & _pressure
Pressure (Pa)
FluidPropertiesMaterialPT(const InputParameters &parameters)
MaterialProperty< Real > & _cv
Isochoric specific heat capacity (J/kg/K)
const VariableValue & _temperature
Temperature (K)
MaterialProperty< Real > & _mu
Viscosity (Pa.s)
MaterialProperty< Real > & _cp
Isobaric specific heat capacity (J/kg/K)
const SinglePhaseFluidProperties & _fp
Fluid properties UserObject.
const bool _compute_s
Whether to compute entropy.
const bool _compute_c
Whether to compute the speed of sound.
MaterialProperty< Real > & _rho
Density (kg/m^3)
MaterialProperty< Real > & _k
Thermal conductivity (W/m/K)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
unsigned int _qp
static InputParameters validParams()
Common class for single phase fluid properties.