12 #include "MooseVariable.h"
20 InputParameters params = validParams<TimeKernel>();
21 params.addParam<
bool>(
"strain_at_nearest_qp",
23 "When calculating nodal porosity that depends on strain, use the strain at "
24 "the nearest quadpoint. This adds a small extra computational burden, and "
25 "is not necessary for simulations involving only linear lagrange elements. "
26 " If you set this to true, you will also want to set the same parameter to "
27 "true for related Kernels and Materials");
28 params.addRequiredParam<UserObjectName>(
29 "PorousFlowDictator",
"The UserObject that holds the list of PorousFlow variable names.");
30 params.addClassDescription(
"Derivative of heat-energy-density wrt time");
35 : TimeKernel(parameters),
37 _var_is_porflow_var(_dictator.isPorousFlowVariable(_var.number())),
38 _num_phases(_dictator.numPhases()),
39 _fluid_present(_num_phases > 0),
40 _strain_at_nearest_qp(getParam<bool>(
"strain_at_nearest_qp")),
41 _porosity(getMaterialProperty<Real>(
"PorousFlow_porosity_nodal")),
42 _porosity_old(getMaterialPropertyOld<Real>(
"PorousFlow_porosity_nodal")),
43 _dporosity_dvar(getMaterialProperty<std::vector<Real>>(
"dPorousFlow_porosity_nodal_dvar")),
45 getMaterialProperty<std::vector<
RealGradient>>(
"dPorousFlow_porosity_nodal_dgradvar")),
46 _nearest_qp(_strain_at_nearest_qp
47 ? &getMaterialProperty<unsigned int>(
"PorousFlow_nearestqp_nodal")
49 _rock_energy_nodal(getMaterialProperty<Real>(
"PorousFlow_matrix_internal_energy_nodal")),
50 _rock_energy_nodal_old(getMaterialPropertyOld<Real>(
"PorousFlow_matrix_internal_energy_nodal")),
51 _drock_energy_nodal_dvar(
52 getMaterialProperty<std::vector<Real>>(
"dPorousFlow_matrix_internal_energy_nodal_dvar")),
53 _fluid_density(_fluid_present ? &getMaterialProperty<std::vector<Real>>(
54 "PorousFlow_fluid_phase_density_nodal")
56 _fluid_density_old(_fluid_present ? &getMaterialPropertyOld<std::vector<Real>>(
57 "PorousFlow_fluid_phase_density_nodal")
59 _dfluid_density_dvar(_fluid_present ? &getMaterialProperty<std::vector<std::vector<Real>>>(
60 "dPorousFlow_fluid_phase_density_nodal_dvar")
62 _fluid_saturation_nodal(
63 _fluid_present ? &getMaterialProperty<std::vector<Real>>(
"PorousFlow_saturation_nodal")
65 _fluid_saturation_nodal_old(
66 _fluid_present ? &getMaterialPropertyOld<std::vector<Real>>(
"PorousFlow_saturation_nodal")
68 _dfluid_saturation_nodal_dvar(_fluid_present
69 ? &getMaterialProperty<std::vector<std::vector<Real>>>(
70 "dPorousFlow_saturation_nodal_dvar")
72 _energy_nodal(_fluid_present ? &getMaterialProperty<std::vector<Real>>(
73 "PorousFlow_fluid_phase_internal_energy_nodal")
75 _energy_nodal_old(_fluid_present ? &getMaterialPropertyOld<std::vector<Real>>(
76 "PorousFlow_fluid_phase_internal_energy_nodal")
78 _denergy_nodal_dvar(_fluid_present ? &getMaterialProperty<std::vector<std::vector<Real>>>(
79 "dPorousFlow_fluid_phase_internal_energy_nodal_dvar")
91 energy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
93 energy_old += (*_fluid_density_old)[_i][ph] * (*_fluid_saturation_nodal_old)[_i][ph] *
97 return _test[_i][_qp] * (energy - energy_old) / _dt;
128 denergy += (*
_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
132 return _test[_i][_qp] * denergy / _dt;
139 denergy += (*_dfluid_density_dvar)[_i][ph][pvar] * (*_fluid_saturation_nodal)[_i][ph] *
140 (*_energy_nodal)[_i][ph] *
_porosity[_i];
141 denergy += (*_fluid_density)[_i][ph] * (*_dfluid_saturation_nodal_dvar)[_i][ph][pvar] *
142 (*_energy_nodal)[_i][ph] *
_porosity[_i];
143 denergy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
144 (*_denergy_nodal_dvar)[_i][ph][pvar] *
_porosity[_i];
145 denergy += (*_fluid_density)[_i][ph] * (*_fluid_saturation_nodal)[_i][ph] *
148 return _test[_i][_qp] * denergy / _dt;