www.mooseframework.org
PorousFlowFluidState.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 
10 #include "PorousFlowFluidState.h"
12 
14 
15 template <>
16 InputParameters
18 {
19  InputParameters params = validParams<PorousFlowVariableBase>();
20  params.addRequiredCoupledVar("gas_porepressure",
21  "Variable that is the porepressure of the gas phase");
22  params.addRequiredCoupledVar("z", "Total mass fraction of component i summed over all phases");
23  params.addCoupledVar(
24  "temperature", 20, "The fluid temperature (C or K, depending on temperature_unit)");
25  params.addCoupledVar("xnacl", 0, "The salt mass fraction in the brine (kg/kg)");
26  MooseEnum unit_choice("Kelvin=0 Celsius=1", "Kelvin");
27  params.addParam<MooseEnum>(
28  "temperature_unit", unit_choice, "The unit of the temperature variable");
29  params.addRequiredParam<UserObjectName>("capillary_pressure",
30  "Name of the UserObject defining the capillary pressure");
31  params.addRequiredParam<UserObjectName>("fluid_state", "Name of the FluidState UserObject");
32  params.addPrivateParam<std::string>("pf_material_type", "fluid_state");
33  params.addClassDescription("Class for fluid state calculations using persistent primary "
34  "variables and a vapor-liquid flash");
35  return params;
36 }
37 
38 PorousFlowFluidState::PorousFlowFluidState(const InputParameters & parameters)
39  : PorousFlowVariableBase(parameters),
40 
41  _gas_porepressure(_nodal_material ? coupledDofValues("gas_porepressure")
42  : coupledValue("gas_porepressure")),
43  _gas_gradp_qp(coupledGradient("gas_porepressure")),
44  _gas_porepressure_varnum(coupled("gas_porepressure")),
45  _pvar(_dictator.isPorousFlowVariable(_gas_porepressure_varnum)
46  ? _dictator.porousFlowVariableNum(_gas_porepressure_varnum)
47  : 0),
48 
49  _num_Z_vars(coupledComponents("z")),
50  _Xnacl(_nodal_material ? coupledDofValues("xnacl") : coupledValue("xnacl")),
51  _grad_Xnacl_qp(coupledGradient("xnacl")),
52  _Xnacl_varnum(coupled("xnacl")),
53  _Xvar(_dictator.isPorousFlowVariable(_Xnacl_varnum)
54  ? _dictator.porousFlowVariableNum(_Xnacl_varnum)
55  : 0),
56 
57  _fs(getUserObject<PorousFlowFluidStateMultiComponentBase>("fluid_state")),
58  _aqueous_phase_number(_fs.aqueousPhaseIndex()),
59  _gas_phase_number(_fs.gasPhaseIndex()),
60  _aqueous_fluid_component(_fs.aqueousComponentIndex()),
61  _gas_fluid_component(_fs.gasComponentIndex()),
62  _salt_component(_fs.saltComponentIndex()),
63 
64  _temperature(_nodal_material ? getMaterialProperty<Real>("PorousFlow_temperature_nodal")
65  : getMaterialProperty<Real>("PorousFlow_temperature_qp")),
66  _gradT_qp(getMaterialProperty<RealGradient>("PorousFlow_grad_temperature_qp")),
67  _dtemperature_dvar(
68  _nodal_material
69  ? getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_nodal_dvar")
70  : getMaterialProperty<std::vector<Real>>("dPorousFlow_temperature_qp_dvar")),
71  _temperature_varnum(coupled("temperature")),
72  _Tvar(_dictator.isPorousFlowVariable(_temperature_varnum)
73  ? _dictator.porousFlowVariableNum(_temperature_varnum)
74  : 0),
75  _mass_frac(_nodal_material
76  ? declareProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")
77  : declareProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_qp")),
78  _grad_mass_frac_qp(_nodal_material ? nullptr
79  : &declareProperty<std::vector<std::vector<RealGradient>>>(
80  "PorousFlow_grad_mass_frac_qp")),
81  _dmass_frac_dvar(_nodal_material ? declareProperty<std::vector<std::vector<std::vector<Real>>>>(
82  "dPorousFlow_mass_frac_nodal_dvar")
83  : declareProperty<std::vector<std::vector<std::vector<Real>>>>(
84  "dPorousFlow_mass_frac_qp_dvar")),
85 
86  _fluid_density(_nodal_material
87  ? declareProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_nodal")
88  : declareProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp")),
89  _dfluid_density_dvar(_nodal_material ? declareProperty<std::vector<std::vector<Real>>>(
90  "dPorousFlow_fluid_phase_density_nodal_dvar")
91  : declareProperty<std::vector<std::vector<Real>>>(
92  "dPorousFlow_fluid_phase_density_qp_dvar")),
93  _fluid_viscosity(_nodal_material
94  ? declareProperty<std::vector<Real>>("PorousFlow_viscosity_nodal")
95  : declareProperty<std::vector<Real>>("PorousFlow_viscosity_qp")),
96  _dfluid_viscosity_dvar(
97  _nodal_material
98  ? declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_viscosity_nodal_dvar")
99  : declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_viscosity_qp_dvar")),
100 
101  _fluid_enthalpy(
102  _nodal_material
103  ? declareProperty<std::vector<Real>>("PorousFlow_fluid_phase_enthalpy_nodal")
104  : declareProperty<std::vector<Real>>("PorousFlow_fluid_phase_enthalpy_qp")),
105  _dfluid_enthalpy_dvar(_nodal_material ? declareProperty<std::vector<std::vector<Real>>>(
106  "dPorousFlow_fluid_phase_enthalpy_nodal_dvar")
107  : declareProperty<std::vector<std::vector<Real>>>(
108  "dPorousFlow_fluid_phase_enthalpy_qp_dvar")),
109 
110  _fluid_internal_energy(
111  _nodal_material
112  ? declareProperty<std::vector<Real>>("PorousFlow_fluid_phase_internal_energy_nodal")
113  : declareProperty<std::vector<Real>>("PorousFlow_fluid_phase_internal_energy_qp")),
114  _dfluid_internal_energy_dvar(_nodal_material
115  ? declareProperty<std::vector<std::vector<Real>>>(
116  "dPorousFlow_fluid_phase_internal_energy_nodal_dvar")
117  : declareProperty<std::vector<std::vector<Real>>>(
118  "dPorousFlow_fluid_phase_internal_energy_qp_dvar")),
119 
120  _T_c2k(getParam<MooseEnum>("temperature_unit") == 0 ? 0.0 : 273.15),
121  _is_initqp(false),
122  _pc(getUserObject<PorousFlowCapillaryPressure>("capillary_pressure")),
123  _pidx(_fs.getPressureIndex()),
124  _Tidx(_fs.getTemperatureIndex()),
125  _Zidx(_fs.getZIndex()),
126  _Xidx(_fs.getXIndex())
127 {
128  // Check that the number of phases in the fluidstate class is also provided in the Dictator
129  if (_fs.numPhases() != _num_phases)
130  mooseError(name(),
131  ": only ",
132  _fs.numPhases(),
133  " phases are allowed. Please check the number of phases entered in the dictator is "
134  "correct");
135 
136  // Store all total mass fractions and associated variable numbers
137  _Z.resize(_num_Z_vars);
138  _gradZ_qp.resize(_num_Z_vars);
139  _Z_varnum.resize(_num_Z_vars);
140  _Zvar.resize(_num_Z_vars);
141 
142  for (unsigned int i = 0; i < _num_Z_vars; ++i)
143  {
144  _Z[i] = (_nodal_material ? &coupledDofValues("z", i) : &coupledValue("z", i));
145  _gradZ_qp[i] = &coupledGradient("z", i);
146  _Z_varnum[i] = coupled("z", i);
147  _Zvar[i] = (_dictator.isPorousFlowVariable(_Z_varnum[i])
148  ? _dictator.porousFlowVariableNum(_Z_varnum[i])
149  : 0);
150  }
151 
152  // Set the size of the FluidStateProperties vector
154 }
155 
156 void
158 {
159  // The FluidProperty objects use temperature in K
160  Real Tk = _temperature[_qp] + _T_c2k;
161 
162  _fs.thermophysicalProperties(_gas_porepressure[_qp], Tk, _Xnacl[_qp], (*_Z[0])[_qp], _qp, _fsp);
163 }
164 
165 void
167 {
168  _is_initqp = true;
169  // Set the size of pressure and saturation vectors
171 
172  // Set the size of all other vectors
174 
176 
177  // Set the initial values of the properties at the nodes.
178  // Note: not required for qp materials as no old values at the qps are requested
179  if (_nodal_material)
180  for (unsigned int ph = 0; ph < _num_phases; ++ph)
181  {
182  _saturation[_qp][ph] = _fsp[ph].saturation.value();
183  _porepressure[_qp][ph] = _fsp[ph].pressure.value();
184  _fluid_density[_qp][ph] = _fsp[ph].density.value();
185  _fluid_viscosity[_qp][ph] = _fsp[ph].viscosity.value();
186  _fluid_enthalpy[_qp][ph] = _fsp[ph].enthalpy.value();
187  _fluid_internal_energy[_qp][ph] = _fsp[ph].internal_energy.value();
188 
189  for (unsigned int comp = 0; comp < _num_components; ++comp)
190  _mass_frac[_qp][ph][comp] = _fsp[ph].mass_fraction[comp].value();
191  }
192 }
193 
194 void
196 {
197  _is_initqp = false;
198  // Prepare the derivative vectors
200 
201  // Set the size of all other vectors
203 
204  // Calculate all required thermophysical properties
206 
207  for (unsigned int ph = 0; ph < _num_phases; ++ph)
208  {
209  _saturation[_qp][ph] = _fsp[ph].saturation.value();
210  _porepressure[_qp][ph] = _fsp[ph].pressure.value();
211  _fluid_density[_qp][ph] = _fsp[ph].density.value();
212  _fluid_viscosity[_qp][ph] = _fsp[ph].viscosity.value();
213  _fluid_enthalpy[_qp][ph] = _fsp[ph].enthalpy.value();
214  _fluid_internal_energy[_qp][ph] = _fsp[ph].internal_energy.value();
215 
216  for (unsigned int comp = 0; comp < _num_components; ++comp)
217  _mass_frac[_qp][ph][comp] = _fsp[ph].mass_fraction[comp].value();
218  }
219 
220  // Derivative of properties wrt variables (calculated in fluid state class)
221  for (unsigned int ph = 0; ph < _num_phases; ++ph)
222  {
223  // If porepressure is a PorousFlow variable (it usually is), add derivatives wrt porepressure
224  if (_dictator.isPorousFlowVariable(_gas_porepressure_varnum))
225  {
226  _dporepressure_dvar[_qp][ph][_pvar] = _fsp[ph].pressure.derivatives()[_pidx];
227  _dsaturation_dvar[_qp][ph][_pvar] = _fsp[ph].saturation.derivatives()[_pidx];
228  _dfluid_density_dvar[_qp][ph][_pvar] = _fsp[ph].density.derivatives()[_pidx];
229  _dfluid_viscosity_dvar[_qp][ph][_pvar] = _fsp[ph].viscosity.derivatives()[_pidx];
230  _dfluid_enthalpy_dvar[_qp][ph][_pvar] = _fsp[ph].enthalpy.derivatives()[_pidx];
231  _dfluid_internal_energy_dvar[_qp][ph][_pvar] = _fsp[ph].internal_energy.derivatives()[_pidx];
232 
233  for (unsigned int comp = 0; comp < _num_components; ++comp)
234  _dmass_frac_dvar[_qp][ph][comp][_pvar] = _fsp[ph].mass_fraction[comp].derivatives()[_pidx];
235  }
236 
237  // If Z is a PorousFlow variable (it usually is), add derivatives wrt Z
238  if (_dictator.isPorousFlowVariable(_Z_varnum[0]))
239  {
240  _dporepressure_dvar[_qp][ph][_Zvar[0]] = _fsp[ph].pressure.derivatives()[_Zidx];
241  _dsaturation_dvar[_qp][ph][_Zvar[0]] = _fsp[ph].saturation.derivatives()[_Zidx];
242  _dfluid_density_dvar[_qp][ph][_Zvar[0]] = _fsp[ph].density.derivatives()[_Zidx];
243  _dfluid_viscosity_dvar[_qp][ph][_Zvar[0]] = _fsp[ph].viscosity.derivatives()[_Zidx];
244  _dfluid_enthalpy_dvar[_qp][ph][_Zvar[0]] = _fsp[ph].enthalpy.derivatives()[_Zidx];
245  _dfluid_internal_energy_dvar[_qp][ph][_Zvar[0]] =
246  _fsp[ph].internal_energy.derivatives()[_Zidx];
247 
248  for (unsigned int comp = 0; comp < _num_components; ++comp)
249  _dmass_frac_dvar[_qp][ph][comp][_Zvar[0]] =
250  _fsp[ph].mass_fraction[comp].derivatives()[_Zidx];
251  }
252 
253  // If temperature is a PorousFlow variable (nonisothermal case), add derivatives wrt temperature
254  if (_dictator.isPorousFlowVariable(_temperature_varnum))
255  {
256  _dporepressure_dvar[_qp][ph][_Tvar] = _fsp[ph].pressure.derivatives()[_Tidx];
257  _dsaturation_dvar[_qp][ph][_Tvar] = _fsp[ph].saturation.derivatives()[_Tidx];
258  _dfluid_density_dvar[_qp][ph][_Tvar] = _fsp[ph].density.derivatives()[_Tidx];
259  _dfluid_viscosity_dvar[_qp][ph][_Tvar] = _fsp[ph].viscosity.derivatives()[_Tidx];
260  _dfluid_enthalpy_dvar[_qp][ph][_Tvar] = _fsp[ph].enthalpy.derivatives()[_Tidx];
261  _dfluid_internal_energy_dvar[_qp][ph][_Tvar] = _fsp[ph].internal_energy.derivatives()[_Tidx];
262 
263  for (unsigned int comp = 0; comp < _num_components; ++comp)
264  _dmass_frac_dvar[_qp][ph][comp][_Tvar] = _fsp[ph].mass_fraction[comp].derivatives()[_Tidx];
265  }
266 
267  // If Xnacl is a PorousFlow variable, add derivatives wrt Xnacl
268  if (_dictator.isPorousFlowVariable(_Xnacl_varnum))
269  {
270  _dporepressure_dvar[_qp][ph][_Xvar] = _fsp[ph].pressure.derivatives()[_Xidx];
271  _dsaturation_dvar[_qp][ph][_Xvar] = _fsp[ph].saturation.derivatives()[_Xidx];
272  _dfluid_density_dvar[_qp][ph][_Xvar] += _fsp[ph].density.derivatives()[_Xidx];
273  _dfluid_viscosity_dvar[_qp][ph][_Xvar] += _fsp[ph].viscosity.derivatives()[_Xidx];
274  _dfluid_enthalpy_dvar[_qp][ph][_Xvar] = _fsp[ph].enthalpy.derivatives()[_Xidx];
275  _dfluid_internal_energy_dvar[_qp][ph][_Xvar] = _fsp[ph].internal_energy.derivatives()[_Xidx];
276 
277  for (unsigned int comp = 0; comp < _num_components; ++comp)
278  _dmass_frac_dvar[_qp][ph][comp][_Xvar] = _fsp[ph].mass_fraction[comp].derivatives()[_Xidx];
279  }
280  }
281 
282  // If the material properties are being evaluated at the qps, calculate the gradients as well
283  // Note: only nodal properties are evaluated in initQpStatefulProperties(), so no need to check
284  // _is_initqp flag for qp properties
285  if (!_nodal_material)
286  {
287  // Derivatives of capillary pressure
288  const Real dpc = _pc.dCapillaryPressure(_fsp[_aqueous_phase_number].saturation.value(), _qp);
289  const Real d2pc = _pc.d2CapillaryPressure(_fsp[_aqueous_phase_number].saturation.value(), _qp);
290 
291  // Gradients of saturation and porepressure in all phases
292  (*_grads_qp)[_qp][_gas_phase_number] =
294  _dsaturation_dvar[_qp][_gas_phase_number][_Zvar[0]] * (*_gradZ_qp[0])[_qp] +
296  (*_grads_qp)[_qp][_aqueous_phase_number] = -(*_grads_qp)[_qp][_gas_phase_number];
297 
298  (*_gradp_qp)[_qp][_gas_phase_number] = _gas_gradp_qp[_qp];
299  (*_gradp_qp)[_qp][_aqueous_phase_number] =
300  _gas_gradp_qp[_qp] - dpc * (*_grads_qp)[_qp][_aqueous_phase_number];
301 
302  // Gradients of mass fractions for each component in each phase
303  (*_grad_mass_frac_qp)[_qp][_aqueous_phase_number][_aqueous_fluid_component] =
304  _fsp[_aqueous_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_pidx] *
305  _gas_gradp_qp[_qp] +
306  _fsp[_aqueous_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_Zidx] *
307  (*_gradZ_qp[0])[_qp] +
308  _fsp[_aqueous_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_Tidx] *
309  _gradT_qp[_qp];
310  (*_grad_mass_frac_qp)[_qp][_aqueous_phase_number][_gas_fluid_component] =
311  -(*_grad_mass_frac_qp)[_qp][_aqueous_phase_number][_aqueous_fluid_component];
312 
313  (*_grad_mass_frac_qp)[_qp][_gas_phase_number][_aqueous_fluid_component] =
314  _fsp[_gas_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_pidx] *
315  _gas_gradp_qp[_qp] +
316  _fsp[_gas_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_Zidx] *
317  (*_gradZ_qp[0])[_qp] +
318  _fsp[_gas_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_Tidx] *
319  _gradT_qp[_qp];
320  (*_grad_mass_frac_qp)[_qp][_gas_phase_number][_gas_fluid_component] =
321  -(*_grad_mass_frac_qp)[_qp][_gas_phase_number][_aqueous_fluid_component];
322 
323  // Derivatives of gradients wrt variables
324  if (_dictator.isPorousFlowVariable(_gas_porepressure_varnum))
325  {
326  for (unsigned int ph = 0; ph < _num_phases; ++ph)
327  (*_dgradp_qp_dgradv)[_qp][ph][_pvar] = 1.0;
328 
329  (*_dgradp_qp_dgradv)[_qp][_aqueous_phase_number][_pvar] +=
331 
332  (*_dgradp_qp_dv)[_qp][_aqueous_phase_number][_pvar] =
333  -d2pc * (*_grads_qp)[_qp][_aqueous_phase_number] *
335  }
336 
337  if (_dictator.isPorousFlowVariable(_Z_varnum[0]))
338  {
339  (*_dgradp_qp_dgradv)[_qp][_aqueous_phase_number][_Zvar[0]] =
341 
342  (*_dgradp_qp_dv)[_qp][_aqueous_phase_number][_Zvar[0]] =
343  -d2pc * (*_grads_qp)[_qp][_aqueous_phase_number] *
345  }
346 
347  if (_dictator.isPorousFlowVariable(_temperature_varnum))
348  {
349  (*_dgradp_qp_dgradv)[_qp][_aqueous_phase_number][_Tvar] =
351 
352  (*_dgradp_qp_dv)[_qp][_aqueous_phase_number][_Tvar] =
353  -d2pc * (*_grads_qp)[_qp][_aqueous_phase_number] *
355  }
356 
357  // If Xnacl is a PorousFlow variable, add gradients and derivatives wrt Xnacl
358  if (_dictator.isPorousFlowVariable(_Xnacl_varnum))
359  {
360  (*_dgradp_qp_dgradv)[_qp][_aqueous_phase_number][_Xvar] =
362 
363  (*_grads_qp)[_qp][_aqueous_phase_number] +=
365 
366  (*_grads_qp)[_qp][_gas_phase_number] -=
368 
369  (*_gradp_qp)[_qp][_aqueous_phase_number] -=
371 
372  (*_dgradp_qp_dv)[_qp][_aqueous_phase_number][_Xvar] =
373  -d2pc * (*_grads_qp)[_qp][_aqueous_phase_number] *
375 
376  (*_grad_mass_frac_qp)[_qp][_aqueous_phase_number][_salt_component] = _grad_Xnacl_qp[_qp];
377  (*_grad_mass_frac_qp)[_qp][_aqueous_phase_number][_aqueous_fluid_component] +=
378  _fsp[_aqueous_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_Xidx] *
379  _grad_Xnacl_qp[_qp];
380  (*_grad_mass_frac_qp)[_qp][_aqueous_phase_number][_gas_fluid_component] -=
381  _fsp[_aqueous_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_Xidx] *
382  _grad_Xnacl_qp[_qp];
383  (*_grad_mass_frac_qp)[_qp][_gas_phase_number][_aqueous_fluid_component] +=
384  _fsp[_gas_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_Xidx] *
385  _grad_Xnacl_qp[_qp];
386  (*_grad_mass_frac_qp)[_qp][_gas_phase_number][_gas_fluid_component] -=
387  _fsp[_gas_phase_number].mass_fraction[_aqueous_fluid_component].derivatives()[_Xidx] *
388  _grad_Xnacl_qp[_qp];
389  }
390  }
391 }
392 
393 void
395 {
396  _fluid_density[_qp].assign(_num_phases, 0.0);
397  _fluid_viscosity[_qp].assign(_num_phases, 0.0);
398  _fluid_enthalpy[_qp].assign(_num_phases, 0.0);
399  _fluid_internal_energy[_qp].assign(_num_phases, 0.0);
400  _mass_frac[_qp].resize(_num_phases);
401 
402  for (unsigned int ph = 0; ph < _num_phases; ++ph)
403  _mass_frac[_qp][ph].resize(_num_components);
404 
405  // Derivatives and gradients are not required in initQpStatefulProperties
406  if (!_is_initqp)
407  {
408  _dfluid_density_dvar[_qp].resize(_num_phases);
409  _dfluid_viscosity_dvar[_qp].resize(_num_phases);
410  _dfluid_enthalpy_dvar[_qp].resize(_num_phases);
412  _dmass_frac_dvar[_qp].resize(_num_phases);
413 
414  if (!_nodal_material)
415  (*_grad_mass_frac_qp)[_qp].resize(_num_phases);
416 
417  for (unsigned int ph = 0; ph < _num_phases; ++ph)
418  {
419  _dfluid_density_dvar[_qp][ph].assign(_num_pf_vars, 0.0);
420  _dfluid_viscosity_dvar[_qp][ph].assign(_num_pf_vars, 0.0);
421  _dfluid_enthalpy_dvar[_qp][ph].assign(_num_pf_vars, 0.0);
422  _dfluid_internal_energy_dvar[_qp][ph].assign(_num_pf_vars, 0.0);
423  _dmass_frac_dvar[_qp][ph].resize(_num_components);
424 
425  for (unsigned int comp = 0; comp < _num_components; ++comp)
426  _dmass_frac_dvar[_qp][ph][comp].assign(_num_pf_vars, 0.0);
427 
428  if (!_nodal_material)
429  (*_grad_mass_frac_qp)[_qp][ph].assign(_num_components, RealGradient());
430  }
431  }
432 }
PorousFlowFluidState::_fluid_density
MaterialProperty< std::vector< Real > > & _fluid_density
Fluid density of each phase.
Definition: PorousFlowFluidState.h:124
PorousFlowFluidState::_Z
std::vector< const VariableValue * > _Z
Total mass fraction(s) of the gas component(s) summed over all phases.
Definition: PorousFlowFluidState.h:77
PorousFlowFluidState::_aqueous_phase_number
const unsigned int _aqueous_phase_number
Phase number of the aqueous phase.
Definition: PorousFlowFluidState.h:97
PorousFlowFluidState::_Xidx
const unsigned int _Xidx
Index of derivative wrt salt mass fraction X.
Definition: PorousFlowFluidState.h:155
PorousFlowFluidState::_gradZ_qp
std::vector< const VariableGradient * > _gradZ_qp
Gradient(s) of total mass fraction(s) of the gas component(s) (only defined at the qps)
Definition: PorousFlowFluidState.h:79
PorousFlowFluidState::_aqueous_fluid_component
const unsigned int _aqueous_fluid_component
Fluid component number of the aqueous component.
Definition: PorousFlowFluidState.h:101
PorousFlowVariableBase::computeQpProperties
virtual void computeQpProperties() override
Definition: PorousFlowVariableBase.C:74
PorousFlowFluidState::PorousFlowFluidState
PorousFlowFluidState(const InputParameters &parameters)
Definition: PorousFlowFluidState.C:38
PorousFlowFluidState.h
PorousFlowVariableBase::_num_components
const unsigned int _num_components
Number of components.
Definition: PorousFlowVariableBase.h:38
PorousFlowFluidStateMultiComponentBase
Compositional flash routines for miscible multiphase flow classes with multiple fluid components.
Definition: PorousFlowFluidStateMultiComponentBase.h:23
PorousFlowFluidState
Fluid state class using a persistent set of primary variables for the mutliphase, multicomponent case...
Definition: PorousFlowFluidState.h:50
PorousFlowFluidStateMultiComponentBase::thermophysicalProperties
virtual void thermophysicalProperties(Real pressure, Real temperature, Real Xnacl, Real Z, unsigned int qp, std::vector< FluidStateProperties > &fsp) const =0
Determines the complete thermophysical state of the system for a given set of primary variables.
PorousFlowFluidState::_dfluid_density_dvar
MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_dvar
Derivative of the fluid density for each phase wrt PorousFlow variables.
Definition: PorousFlowFluidState.h:126
libMesh::RealGradient
VectorValue< Real > RealGradient
Definition: GrainForceAndTorqueInterface.h:17
PorousFlowFluidState::_gas_porepressure_varnum
const unsigned int _gas_porepressure_varnum
Moose variable number of the gas porepressure.
Definition: PorousFlowFluidState.h:73
PorousFlowFluidState::_fluid_enthalpy
MaterialProperty< std::vector< Real > > & _fluid_enthalpy
Enthalpy of each phase.
Definition: PorousFlowFluidState.h:132
PorousFlowFluidState::_dfluid_viscosity_dvar
MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_viscosity_dvar
Derivative of the fluid viscosity for each phase wrt PorousFlow variables.
Definition: PorousFlowFluidState.h:130
PorousFlowCapillaryPressure
Base class for capillary pressure for multiphase flow in porous media.
Definition: PorousFlowCapillaryPressure.h:39
PorousFlowFluidState::_Tvar
const unsigned int _Tvar
PorousFlow variable number of the temperature.
Definition: PorousFlowFluidState.h:115
PorousFlowFluidState::_grad_Xnacl_qp
const VariableGradient & _grad_Xnacl_qp
Gradient of salt mass fraction (only defined at the qps)
Definition: PorousFlowFluidState.h:89
PorousFlowFluidState::_fs
const PorousFlowFluidStateMultiComponentBase & _fs
FluidState UserObject.
Definition: PorousFlowFluidState.h:95
PorousFlowVariableBase::_num_phases
const unsigned int _num_phases
Number of phases.
Definition: PorousFlowVariableBase.h:35
PorousFlowFluidState::_pidx
const unsigned int _pidx
Index of derivative wrt pressure.
Definition: PorousFlowFluidState.h:149
PorousFlowVariableBase::_dgradp_qp_dgradv
MaterialProperty< std::vector< std::vector< Real > > > *const _dgradp_qp_dgradv
d(grad porepressure)/d(grad PorousFlow variable) at the quadpoints
Definition: PorousFlowVariableBase.h:53
PorousFlowCapillaryPressure.h
PorousFlowFluidStateBase::numPhases
unsigned int numPhases() const
The maximum number of phases in this model.
Definition: PorousFlowFluidStateBase.h:68
PorousFlowVariableBase
Base class for thermophysical variable materials, which assemble materials for primary variables such...
Definition: PorousFlowVariableBase.h:25
PorousFlowFluidState::_num_Z_vars
const unsigned int _num_Z_vars
Number of coupled total mass fractions. Should be _num_phases - 1.
Definition: PorousFlowFluidState.h:85
PorousFlowFluidState::_Xnacl_varnum
const unsigned int _Xnacl_varnum
Salt mass fraction variable number.
Definition: PorousFlowFluidState.h:91
PorousFlowFluidState::setMaterialVectorSize
void setMaterialVectorSize() const
Size material property vectors and initialise with zeros.
Definition: PorousFlowFluidState.C:394
PorousFlowFluidState::_gas_porepressure
const VariableValue & _gas_porepressure
Porepressure.
Definition: PorousFlowFluidState.h:69
PorousFlowFluidState::computeQpProperties
virtual void computeQpProperties() override
Definition: PorousFlowFluidState.C:195
PorousFlowFluidState::_fluid_internal_energy
MaterialProperty< std::vector< Real > > & _fluid_internal_energy
Internal energy of each phase.
Definition: PorousFlowFluidState.h:136
PorousFlowFluidState::_Z_varnum
std::vector< unsigned int > _Z_varnum
Moose variable number of Z.
Definition: PorousFlowFluidState.h:81
PorousFlowFluidState::_gas_phase_number
const unsigned int _gas_phase_number
Phase number of the gas phase.
Definition: PorousFlowFluidState.h:99
PorousFlowFluidState::_mass_frac
MaterialProperty< std::vector< std::vector< Real > > > & _mass_frac
Mass fraction matrix.
Definition: PorousFlowFluidState.h:117
FluidStateProperties
AD data structure to pass calculated thermophysical properties.
Definition: PorousFlowFluidStateBase.h:26
PorousFlowVariableBase::_porepressure
MaterialProperty< std::vector< Real > > & _porepressure
Computed nodal or quadpoint values of porepressure of the phases.
Definition: PorousFlowVariableBase.h:44
PorousFlowVariableBase::_dporepressure_dvar
MaterialProperty< std::vector< std::vector< Real > > > & _dporepressure_dvar
d(porepressure)/d(PorousFlow variable)
Definition: PorousFlowVariableBase.h:47
PorousFlowVariableBase::_num_pf_vars
const unsigned int _num_pf_vars
Number of PorousFlow variables.
Definition: PorousFlowVariableBase.h:41
name
const std::string name
Definition: Setup.h:21
PorousFlowFluidState::_gas_fluid_component
const unsigned int _gas_fluid_component
Fluid component number of the gas phase.
Definition: PorousFlowFluidState.h:103
PorousFlowFluidState::_Zidx
const unsigned int _Zidx
Index of derivative wrt total mass fraction Z.
Definition: PorousFlowFluidState.h:153
PorousFlowFluidState::_salt_component
const unsigned int _salt_component
Salt component index.
Definition: PorousFlowFluidState.h:105
PorousFlowCapillaryPressure::dCapillaryPressure
virtual Real dCapillaryPressure(Real saturation, unsigned qp=0) const
Derivative of capillary pressure wrt true saturation.
Definition: PorousFlowCapillaryPressure.C:73
PorousFlowFluidState::_gas_gradp_qp
const VariableGradient & _gas_gradp_qp
Gradient of porepressure (only defined at the qps)
Definition: PorousFlowFluidState.h:71
PorousFlowFluidState::thermophysicalProperties
virtual void thermophysicalProperties()
Calculates all required thermophysical properties and derivatives for each phase and fluid component.
Definition: PorousFlowFluidState.C:157
PorousFlowFluidState::_dfluid_enthalpy_dvar
MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_enthalpy_dvar
Derivative of the fluid enthalpy for each phase wrt PorousFlow variables.
Definition: PorousFlowFluidState.h:134
PorousFlowFluidState::_dmass_frac_dvar
MaterialProperty< std::vector< std::vector< std::vector< Real > > > > & _dmass_frac_dvar
Derivative of the mass fraction matrix with respect to the Porous Flow variables.
Definition: PorousFlowFluidState.h:121
validParams< PorousFlowFluidState >
InputParameters validParams< PorousFlowFluidState >()
Definition: PorousFlowFluidState.C:17
PorousFlowCapillaryPressure::d2CapillaryPressure
virtual Real d2CapillaryPressure(Real saturation, unsigned qp=0) const
Second derivative of capillary pressure wrt true saturation.
Definition: PorousFlowCapillaryPressure.C:82
PorousFlowFluidState::_gradT_qp
const MaterialProperty< RealGradient > & _gradT_qp
Gradient of temperature (only defined at the qps)
Definition: PorousFlowFluidState.h:109
PorousFlowFluidState::_is_initqp
bool _is_initqp
Flag to indicate whether to calculate stateful properties.
Definition: PorousFlowFluidState.h:143
PorousFlowFluidState::_Tidx
const unsigned int _Tidx
Index of derivative wrt temperature.
Definition: PorousFlowFluidState.h:151
PorousFlowFluidState::_Zvar
std::vector< unsigned int > _Zvar
PorousFlow variable number of Z.
Definition: PorousFlowFluidState.h:83
PorousFlowFluidState::_fluid_viscosity
MaterialProperty< std::vector< Real > > & _fluid_viscosity
Viscosity of each phase.
Definition: PorousFlowFluidState.h:128
PorousFlowFluidState::_pc
const PorousFlowCapillaryPressure & _pc
Capillary pressure UserObject.
Definition: PorousFlowFluidState.h:147
PorousFlowFluidState::_Xvar
const unsigned int _Xvar
Salt mass fraction PorousFlow variable number.
Definition: PorousFlowFluidState.h:93
PorousFlowFluidState::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: PorousFlowFluidState.C:166
PorousFlowVariableBase::initQpStatefulProperties
virtual void initQpStatefulProperties() override
Definition: PorousFlowVariableBase.C:66
PorousFlowFluidState::_dfluid_internal_energy_dvar
MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_internal_energy_dvar
Derivative of the fluid internal energy for each phase wrt PorousFlow variables.
Definition: PorousFlowFluidState.h:138
PorousFlowVariableBase::_saturation
MaterialProperty< std::vector< Real > > & _saturation
Computed nodal or qp saturation of the phases.
Definition: PorousFlowVariableBase.h:59
registerMooseObject
registerMooseObject("PorousFlowApp", PorousFlowFluidState)
PorousFlowFluidState::_temperature
const MaterialProperty< Real > & _temperature
Temperature.
Definition: PorousFlowFluidState.h:107
PorousFlowFluidState::_pvar
const unsigned int _pvar
PorousFlow variable number of the gas porepressure.
Definition: PorousFlowFluidState.h:75
PorousFlowFluidState::_T_c2k
const Real _T_c2k
Conversion from degrees Celsius to degrees Kelvin.
Definition: PorousFlowFluidState.h:141
PorousFlowVariableBase::_dsaturation_dvar
MaterialProperty< std::vector< std::vector< Real > > > & _dsaturation_dvar
d(saturation)/d(PorousFlow variable)
Definition: PorousFlowVariableBase.h:62
PorousFlowFluidState::_temperature_varnum
const unsigned int _temperature_varnum
Moose variable number of the temperature.
Definition: PorousFlowFluidState.h:113
validParams< PorousFlowVariableBase >
InputParameters validParams< PorousFlowVariableBase >()
Definition: PorousFlowVariableBase.C:14
PorousFlowFluidState::_fsp
std::vector< FluidStateProperties > _fsp
FluidStateProperties data structure.
Definition: PorousFlowFluidState.h:145
PorousFlowFluidState::_Xnacl
const VariableValue & _Xnacl
Salt mass fraction (kg/kg)
Definition: PorousFlowFluidState.h:87