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");
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");
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)
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)
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()),
64 _temperature(_nodal_material ? getMaterialProperty<Real>(
"PorousFlow_temperature_nodal")
65 : getMaterialProperty<Real>(
"PorousFlow_temperature_qp")),
66 _gradT_qp(getMaterialProperty<
RealGradient>(
"PorousFlow_grad_temperature_qp")),
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)
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")),
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(
98 ? declareProperty<std::vector<std::vector<Real>>>(
"dPorousFlow_viscosity_nodal_dvar")
99 : declareProperty<std::vector<std::vector<Real>>>(
"dPorousFlow_viscosity_qp_dvar")),
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")),
110 _fluid_internal_energy(
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")),
120 _T_c2k(getParam<MooseEnum>(
"temperature_unit") == 0 ? 0.0 : 273.15),
123 _pidx(_fs.getPressureIndex()),
124 _Tidx(_fs.getTemperatureIndex()),
125 _Zidx(_fs.getZIndex()),
126 _Xidx(_fs.getXIndex())
133 " phases are allowed. Please check the number of phases entered in the dictator is "
144 _Z[i] = (_nodal_material ? &coupledDofValues(
"z", i) : &coupledValue(
"z", i));
148 ? _dictator.porousFlowVariableNum(
_Z_varnum[i])
238 if (_dictator.isPorousFlowVariable(
_Z_varnum[0]))
246 _fsp[ph].internal_energy.derivatives()[
_Zidx];
250 _fsp[ph].mass_fraction[comp].derivatives()[
_Zidx];
285 if (!_nodal_material)
337 if (_dictator.isPorousFlowVariable(
_Z_varnum[0]))
414 if (!_nodal_material)
428 if (!_nodal_material)