https://mooseframework.inl.gov
PorousFlowFluidPropertyIC.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 
12 
14 
17 {
19  params.addRequiredCoupledVar("porepressure", "Fluid porepressure");
20  params.addRequiredCoupledVar("temperature", "Fluid temperature");
21  MooseEnum unit_choice("Kelvin=0 Celsius=1", "Kelvin");
22  params.addParam<MooseEnum>(
23  "temperature_unit", unit_choice, "The unit of the temperature variable");
24  params.addRequiredParam<UserObjectName>("fp", "The name of the user object for the fluid");
25  MooseEnum property_enum("enthalpy internal_energy density");
27  "property", property_enum, "The fluid property that this initial condition is to calculate");
28  params.addClassDescription("An initial condition to calculate one fluid property (such as "
29  "enthalpy) from pressure and temperature");
30  return params;
31 }
32 
34  : InitialCondition(parameters),
35  _porepressure(coupledValue("porepressure")),
36  _temperature(coupledValue("temperature")),
37  _property_enum(getParam<MooseEnum>("property").getEnum<PropertyEnum>()),
38  _fp(getUserObject<SinglePhaseFluidProperties>("fp")),
39  _T_c2k(getParam<MooseEnum>("temperature_unit") == 0 ? 0.0 : 273.15)
40 {
41 }
42 
43 Real
45 {
46  // The FluidProperties userobject uses temperature in K
47  const Real Tk = _temperature[_qp] + _T_c2k;
48 
49  // The fluid property
50  Real property = 0.0;
51 
52  switch (_property_enum)
53  {
55  property = _fp.h_from_p_T(_porepressure[_qp], Tk);
56  break;
57 
59  property = _fp.e_from_p_T(_porepressure[_qp], Tk);
60  break;
61 
63  property = _fp.rho_from_p_T(_porepressure[_qp], Tk);
64  break;
65  }
66 
67  return property;
68 }
PorousFlowFluidPropertyIC calculates an initial value for a fluid property (such as enthalpy) using p...
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const Real _T_c2k
Conversion from degrees Celsius to degrees Kelvin.
virtual Real value(const Point &p) override
static InputParameters validParams()
const VariableValue & _porepressure
Porepressure (Pa)
void addRequiredParam(const std::string &name, const std::string &doc_string)
registerMooseObject("PorousFlowApp", PorousFlowFluidPropertyIC)
const SinglePhaseFluidProperties & _fp
FluidProperties user object.
Common class for single phase fluid properties.
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
PorousFlowFluidPropertyIC(const InputParameters &parameters)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
enum PorousFlowFluidPropertyIC::PropertyEnum _property_enum
const VariableValue & _temperature
Fluid temperature (C or K)
PropertyEnum
Enum of fluid properties that can be set using this IC.