https://mooseframework.inl.gov
PorousFlowFluidStateIC.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 
10 #include "PorousFlowFluidStateIC.h"
11 #include "PorousFlowDictator.h"
13 
15 
18 {
20  params.addRequiredCoupledVar("gas_porepressure",
21  "Variable that is the porepressure of the gas phase");
22  params.addRequiredCoupledVar("temperature", "Variable that is the fluid temperature");
23  MooseEnum unit_choice("Kelvin=0 Celsius=1", "Kelvin");
24  params.addParam<MooseEnum>(
25  "temperature_unit", unit_choice, "The unit of the temperature variable");
26  params.addCoupledVar("saturation", 0.0, "Gas saturation");
27  params.addRequiredParam<UserObjectName>("fluid_state", "Name of the FluidState UserObject");
28  params.addCoupledVar("xnacl", 0, "The salt mass fraction in the brine (kg/kg)");
29  params.addRequiredParam<UserObjectName>(
30  "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
31  params.addClassDescription("An initial condition to calculate z from saturation");
32  return params;
33 }
34 
36  : InitialCondition(parameters),
37  _gas_porepressure(coupledValue("gas_porepressure")),
38  _temperature(coupledValue("temperature")),
39  _Xnacl(coupledValue("xnacl")),
40  _saturation(coupledValue("saturation")),
41  _T_c2k(getParam<MooseEnum>("temperature_unit") == 0 ? 0.0 : 273.15),
42  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
43  _fs(getUserObject<PorousFlowFluidStateMultiComponentBase>("fluid_state"))
44 {
45 }
46 
47 Real
48 PorousFlowFluidStateIC::value(const Point & /*p*/)
49 {
50  // The fluid state user object needs temperature in K
51  const Real Tk = _temperature[_qp] + _T_c2k;
52 
53  // The total mass fraction corresponding to the input saturation
55 }
PorousFlowFluidStateIC calculates an initial value for the total mass fraction of a component summed ...
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
const VariableValue & _Xnacl
NaCl mass fraction (kg/kg)
PorousFlowFluidStateIC(const InputParameters &parameters)
virtual Real value(const Point &p) override
Compositional flash routines for miscible multiphase flow classes with multiple fluid components...
static InputParameters validParams()
const VariableValue & _saturation
Gas saturation (-)
void addRequiredParam(const std::string &name, const std::string &doc_string)
registerMooseObject("PorousFlowApp", PorousFlowFluidStateIC)
const Real _T_c2k
Conversion from degrees Celsius to degrees Kelvin.
static InputParameters validParams()
virtual Real totalMassFraction(Real pressure, Real temperature, Real Xnacl, Real saturation, unsigned int qp) const =0
Total mass fraction of fluid component summed over all phases in the two-phase state for a specified ...
const PorousFlowFluidStateMultiComponentBase & _fs
FluidState UserObject.
void addCoupledVar(const std::string &name, const std::string &doc_string)
void addRequiredCoupledVar(const std::string &name, const std::string &doc_string)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
void addClassDescription(const std::string &doc_string)
const VariableValue & _temperature
Fluid temperature (C or K)
const VariableValue & _gas_porepressure
Gas porepressure (Pa)