www.mooseframework.org
PorousFlowFluidPropertyIC.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
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 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<InitialCondition>();
20  params.addRequiredCoupledVar("porepressure", "Fluid porepressure");
21  params.addRequiredCoupledVar("temperature", "Fluid temperature");
22  MooseEnum unit_choice("Kelvin=0 Celsius=1", "Kelvin");
23  params.addParam<MooseEnum>(
24  "temperature_unit", unit_choice, "The unit of the temperature variable");
25  params.addRequiredParam<UserObjectName>("fp", "The name of the user object for the fluid");
26  MooseEnum property_enum("enthalpy internal_energy density");
27  params.addRequiredParam<MooseEnum>(
28  "property", property_enum, "The fluid property that this initial condition is to calculate");
29  params.addClassDescription("An initial condition to calculate one fluid property (such as "
30  "enthalpy) from pressure and temperature");
31  return params;
32 }
33 
34 PorousFlowFluidPropertyIC::PorousFlowFluidPropertyIC(const InputParameters & parameters)
35  : InitialCondition(parameters),
36  _porepressure(coupledValue("porepressure")),
37  _temperature(coupledValue("temperature")),
38  _property_enum(getParam<MooseEnum>("property").getEnum<PropertyEnum>()),
39  _fp(getUserObject<SinglePhaseFluidProperties>("fp")),
40  _T_c2k(getParam<MooseEnum>("temperature_unit") == 0 ? 0.0 : 273.15)
41 {
42 }
43 
44 Real
46 {
47  // The FluidProperties userobject uses temperature in K
48  const Real Tk = _temperature[_qp] + _T_c2k;
49 
50  // The fluid property
51  Real property = 0.0;
52 
53  switch (_property_enum)
54  {
56  property = _fp.h_from_p_T(_porepressure[_qp], Tk);
57  break;
58 
60  property = _fp.e_from_p_T(_porepressure[_qp], Tk);
61  break;
62 
64  property = _fp.rho_from_p_T(_porepressure[_qp], Tk);
65  break;
66  }
67 
68  return property;
69 }
PorousFlowFluidPropertyIC
PorousFlowFluidPropertyIC calculates an initial value for a fluid property (such as enthalpy) using p...
Definition: PorousFlowFluidPropertyIC.h:24
PorousFlowFluidPropertyIC::_T_c2k
const Real _T_c2k
Conversion from degrees Celsius to degrees Kelvin.
Definition: PorousFlowFluidPropertyIC.h:41
PorousFlowFluidPropertyIC::PropertyEnum::DENSITY
SinglePhaseFluidProperties
Common class for single phase fluid properties.
Definition: SinglePhaseFluidProperties.h:89
validParams< PorousFlowFluidPropertyIC >
InputParameters validParams< PorousFlowFluidPropertyIC >()
Definition: PorousFlowFluidPropertyIC.C:17
SinglePhaseFluidProperties.h
PorousFlowFluidPropertyIC::_porepressure
const VariableValue & _porepressure
Porepressure (Pa)
Definition: PorousFlowFluidPropertyIC.h:33
PorousFlowFluidPropertyIC::PropertyEnum::ENTHALPY
PorousFlowFluidPropertyIC::_property_enum
enum PorousFlowFluidPropertyIC::PropertyEnum _property_enum
PorousFlowFluidPropertyIC.h
PorousFlowFluidPropertyIC::PropertyEnum::INTERNAL_ENERGY
PorousFlowFluidPropertyIC::_fp
const SinglePhaseFluidProperties & _fp
FluidProperties user object.
Definition: PorousFlowFluidPropertyIC.h:39
registerMooseObject
registerMooseObject("PorousFlowApp", PorousFlowFluidPropertyIC)
PorousFlowFluidPropertyIC::PorousFlowFluidPropertyIC
PorousFlowFluidPropertyIC(const InputParameters &parameters)
Definition: PorousFlowFluidPropertyIC.C:34
PorousFlowFluidPropertyIC::_temperature
const VariableValue & _temperature
Fluid temperature (C or K)
Definition: PorousFlowFluidPropertyIC.h:35
PorousFlowFluidPropertyIC::PropertyEnum
PropertyEnum
Enum of fluid properties that can be set using this IC.
Definition: PorousFlowFluidPropertyIC.h:37
PorousFlowFluidPropertyIC::value
virtual Real value(const Point &p) override
Definition: PorousFlowFluidPropertyIC.C:45