www.mooseframework.org
PorousFlowDarcyBase.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 "PorousFlowDarcyBase.h"
11 
12 #include "Assembly.h"
13 #include "MooseMesh.h"
14 #include "MooseVariable.h"
15 #include "SystemBase.h"
16 
17 #include "libmesh/quadrature.h"
18 
19 template <>
20 InputParameters
22 {
23  InputParameters params = validParams<Kernel>();
24  params.addRequiredParam<RealVectorValue>("gravity",
25  "Gravitational acceleration vector downwards (m/s^2)");
26  params.addRequiredParam<UserObjectName>(
27  "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
28  params.addParam<unsigned>("full_upwind_threshold",
29  5,
30  "If, for each timestep, the number of "
31  "upwind-downwind swaps in an element is less than "
32  "this quantity, then full upwinding is used for that element. "
33  "Otherwise the fallback scheme is employed.");
34  MooseEnum fallback_enum("quick harmonic", "quick");
35  params.addParam<MooseEnum>("fallback_scheme",
36  fallback_enum,
37  "quick: use nodal mobility without "
38  "preserving mass. harmonic: use a "
39  "harmonic mean of nodal mobilities "
40  "and preserve fluid mass");
41  params.addClassDescription("Fully-upwinded advective Darcy flux");
42  return params;
43 }
44 
45 PorousFlowDarcyBase::PorousFlowDarcyBase(const InputParameters & parameters)
46  : Kernel(parameters),
47  _permeability(getMaterialProperty<RealTensorValue>("PorousFlow_permeability_qp")),
48  _dpermeability_dvar(
49  getMaterialProperty<std::vector<RealTensorValue>>("dPorousFlow_permeability_qp_dvar")),
50  _dpermeability_dgradvar(getMaterialProperty<std::vector<std::vector<RealTensorValue>>>(
51  "dPorousFlow_permeability_qp_dgradvar")),
52  _fluid_density_node(
53  getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_nodal")),
54  _dfluid_density_node_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
55  "dPorousFlow_fluid_phase_density_nodal_dvar")),
56  _fluid_density_qp(getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp")),
57  _dfluid_density_qp_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
58  "dPorousFlow_fluid_phase_density_qp_dvar")),
59  _fluid_viscosity(getMaterialProperty<std::vector<Real>>("PorousFlow_viscosity_nodal")),
60  _dfluid_viscosity_dvar(
61  getMaterialProperty<std::vector<std::vector<Real>>>("dPorousFlow_viscosity_nodal_dvar")),
62  _pp(getMaterialProperty<std::vector<Real>>("PorousFlow_porepressure_nodal")),
63  _grad_p(getMaterialProperty<std::vector<RealGradient>>("PorousFlow_grad_porepressure_qp")),
64  _dgrad_p_dgrad_var(getMaterialProperty<std::vector<std::vector<Real>>>(
65  "dPorousFlow_grad_porepressure_qp_dgradvar")),
66  _dgrad_p_dvar(getMaterialProperty<std::vector<std::vector<RealGradient>>>(
67  "dPorousFlow_grad_porepressure_qp_dvar")),
68  _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
69  _num_phases(_dictator.numPhases()),
70  _gravity(getParam<RealVectorValue>("gravity")),
71  _perm_derivs(_dictator.usePermDerivs()),
72  _full_upwind_threshold(getParam<unsigned>("full_upwind_threshold")),
73  _fallback_scheme(getParam<MooseEnum>("fallback_scheme").getEnum<FallbackEnum>()),
74  _proto_flux(_num_phases),
75  _jacobian(_num_phases),
76  _num_upwinds(),
77  _num_downwinds()
78 {
79 #ifdef LIBMESH_HAVE_TBB_API
80  if (libMesh::n_threads() > 1)
81  mooseWarning("PorousFlowDarcyBase: num_upwinds and num_downwinds may not be computed "
82  "accurately when using TBB and greater than 1 thread");
83 #endif
84 }
85 
86 void
88 {
89  Kernel::timestepSetup();
90  _num_upwinds = std::unordered_map<unsigned, std::vector<std::vector<unsigned>>>();
91  _num_downwinds = std::unordered_map<unsigned, std::vector<std::vector<unsigned>>>();
92 }
93 
94 Real
95 PorousFlowDarcyBase::darcyQp(unsigned int ph) const
96 {
97  return _grad_test[_i][_qp] *
98  (_permeability[_qp] * (_grad_p[_qp][ph] - _fluid_density_qp[_qp][ph] * _gravity));
99 }
100 
101 Real
102 PorousFlowDarcyBase::darcyQpJacobian(unsigned int jvar, unsigned int ph) const
103 {
105  return 0.0;
106 
107  const unsigned int pvar = _dictator.porousFlowVariableNum(jvar);
108 
109  RealVectorValue deriv =
110  _permeability[_qp] * (_grad_phi[_j][_qp] * _dgrad_p_dgrad_var[_qp][ph][pvar] -
111  _phi[_j][_qp] * _dfluid_density_qp_dvar[_qp][ph][pvar] * _gravity);
112 
113  deriv += _permeability[_qp] * (_dgrad_p_dvar[_qp][ph][pvar] * _phi[_j][_qp]);
114 
115  if (_perm_derivs)
116  {
117  deriv += _dpermeability_dvar[_qp][pvar] * _phi[_j][_qp] *
118  (_grad_p[_qp][ph] - _fluid_density_qp[_qp][ph] * _gravity);
119  for (unsigned int i = 0; i < LIBMESH_DIM; ++i)
120  deriv += _dpermeability_dgradvar[_qp][i][pvar] * _grad_phi[_j][_qp](i) *
121  (_grad_p[_qp][ph] - _fluid_density_qp[_qp][ph] * _gravity);
122  }
123 
124  return _grad_test[_i][_qp] * deriv;
125 }
126 
127 Real
129 {
130  mooseError("PorousFlowDarcyBase: computeQpResidual called");
131  return 0.0;
132 }
133 
134 void
136 {
138 }
139 
140 void
142 {
144 }
145 
146 void
148 {
150 }
151 
152 void
154 {
155  if ((res_or_jac == JacRes::CALCULATE_JACOBIAN) && _dictator.notPorousFlowVariable(jvar))
156  return;
157 
158  // The PorousFlow variable index corresponding to the variable number jvar
159  const unsigned int pvar =
160  ((res_or_jac == JacRes::CALCULATE_JACOBIAN) ? _dictator.porousFlowVariableNum(jvar) : 0);
161 
162  DenseMatrix<Number> & ke = _assembly.jacobianBlock(_var.number(), jvar);
163  if ((ke.n() == 0) && (res_or_jac == JacRes::CALCULATE_JACOBIAN)) // this removes a problem
164  // encountered in the initial
165  // timestep when
166  // use_displaced_mesh=true
167  return;
168 
169  // The number of nodes in the element
170  const unsigned int num_nodes = _test.size();
171 
172  // Compute the residual and jacobian without the mobility terms. Even if we are computing the
173  // Jacobian we still need this in order to see which nodes are upwind and which are downwind.
174  for (unsigned ph = 0; ph < _num_phases; ++ph)
175  {
176  _proto_flux[ph].assign(num_nodes, 0);
177  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
178  {
179  for (_i = 0; _i < num_nodes; ++_i)
180  _proto_flux[ph][_i] += _JxW[_qp] * _coord[_qp] * darcyQp(ph);
181  }
182  }
183 
184  // for this element, record whether each node is "upwind" or "downwind" (or neither)
185  const unsigned elem = _current_elem->id();
186  if (_num_upwinds.find(elem) == _num_upwinds.end())
187  {
188  _num_upwinds[elem] = std::vector<std::vector<unsigned>>(_num_phases);
189  _num_downwinds[elem] = std::vector<std::vector<unsigned>>(_num_phases);
190  for (unsigned ph = 0; ph < _num_phases; ++ph)
191  {
192  _num_upwinds[elem][ph].assign(num_nodes, 0);
193  _num_downwinds[elem][ph].assign(num_nodes, 0);
194  }
195  }
196  // record the information once per nonlinear iteration
197  if (res_or_jac == JacRes::CALCULATE_JACOBIAN && jvar == _var.number())
198  {
199  for (unsigned ph = 0; ph < _num_phases; ++ph)
200  {
201  for (unsigned nod = 0; nod < num_nodes; ++nod)
202  {
203  if (_proto_flux[ph][nod] > 0)
204  _num_upwinds[elem][ph][nod]++;
205  else if (_proto_flux[ph][nod] < 0)
206  _num_downwinds[elem][ph][nod]++;
207  }
208  }
209  }
210 
211  // based on _num_upwinds and _num_downwinds, calculate the maximum number
212  // of upwind-downwind swaps that have been encountered in this timestep
213  // for this element
214  std::vector<unsigned> max_swaps(_num_phases, 0);
215  for (unsigned ph = 0; ph < _num_phases; ++ph)
216  {
217  for (unsigned nod = 0; nod < num_nodes; ++nod)
218  max_swaps[ph] = std::max(
219  max_swaps[ph], std::min(_num_upwinds[elem][ph][nod], _num_downwinds[elem][ph][nod]));
220  }
221 
222  // size the _jacobian correctly and calculate it for the case residual = _proto_flux
223  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
224  {
225  for (unsigned ph = 0; ph < _num_phases; ++ph)
226  {
227  _jacobian[ph].resize(ke.m());
228  for (_i = 0; _i < _test.size(); _i++)
229  {
230  _jacobian[ph][_i].assign(ke.n(), 0.0);
231  for (_j = 0; _j < _phi.size(); _j++)
232  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
233  _jacobian[ph][_i][_j] += _JxW[_qp] * _coord[_qp] * darcyQpJacobian(jvar, ph);
234  }
235  }
236  }
237 
238  // Loop over all the phases, computing the mass flux, which
239  // gets placed into _proto_flux, and the derivative of this
240  // which gets placed into _jacobian
241  for (unsigned int ph = 0; ph < _num_phases; ++ph)
242  {
243  if (max_swaps[ph] < _full_upwind_threshold)
244  fullyUpwind(res_or_jac, ph, pvar);
245  else
246  {
247  switch (_fallback_scheme)
248  {
249  case FallbackEnum::QUICK:
250  quickUpwind(res_or_jac, ph, pvar);
251  break;
253  harmonicMean(res_or_jac, ph, pvar);
254  break;
255  }
256  }
257  }
258 
259  // Add results to the Residual or Jacobian
260  if (res_or_jac == JacRes::CALCULATE_RESIDUAL)
261  {
262  DenseVector<Number> & re = _assembly.residualBlock(_var.number());
263 
264  _local_re.resize(re.size());
265  _local_re.zero();
266  for (_i = 0; _i < _test.size(); _i++)
267  for (unsigned int ph = 0; ph < _num_phases; ++ph)
268  _local_re(_i) += _proto_flux[ph][_i];
269 
270  re += _local_re;
271 
272  if (_has_save_in)
273  {
274  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
275  for (unsigned int i = 0; i < _save_in.size(); i++)
276  _save_in[i]->sys().solution().add_vector(_local_re, _save_in[i]->dofIndices());
277  }
278  }
279 
280  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
281  {
282  _local_ke.resize(ke.m(), ke.n());
283  _local_ke.zero();
284 
285  for (_i = 0; _i < _test.size(); _i++)
286  for (_j = 0; _j < _phi.size(); _j++)
287  for (unsigned int ph = 0; ph < _num_phases; ++ph)
288  _local_ke(_i, _j) += _jacobian[ph][_i][_j];
289 
290  ke += _local_ke;
291 
292  if (_has_diag_save_in && jvar == _var.number())
293  {
294  unsigned int rows = ke.m();
295  DenseVector<Number> diag(rows);
296  for (unsigned int i = 0; i < rows; i++)
297  diag(i) = _local_ke(i, i);
298 
299  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
300  for (unsigned int i = 0; i < _diag_save_in.size(); i++)
301  _diag_save_in[i]->sys().solution().add_vector(diag, _diag_save_in[i]->dofIndices());
302  }
303  }
304 }
305 
306 void
307 PorousFlowDarcyBase::fullyUpwind(JacRes res_or_jac, unsigned int ph, unsigned int pvar)
308 {
338  // The number of nodes in the element
339  const unsigned int num_nodes = _test.size();
340 
341  Real mob;
342  Real dmob;
343  // Define variables used to ensure mass conservation
344  Real total_mass_out = 0.0;
345  Real total_in = 0.0;
346 
347  // The following holds derivatives of these
348  std::vector<Real> dtotal_mass_out;
349  std::vector<Real> dtotal_in;
350  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
351  {
352  dtotal_mass_out.assign(num_nodes, 0.0);
353  dtotal_in.assign(num_nodes, 0.0);
354  }
355 
356  // Perform the upwinding using the mobility
357  std::vector<bool> upwind_node(num_nodes);
358  for (unsigned int n = 0; n < num_nodes; ++n)
359  {
360  if (_proto_flux[ph][n] >= 0.0) // upstream node
361  {
362  upwind_node[n] = true;
363  // The mobility at the upstream node
364  mob = mobility(n, ph);
365  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
366  {
367  // The derivative of the mobility wrt the PorousFlow variable
368  dmob = dmobility(n, ph, pvar);
369 
370  for (_j = 0; _j < _phi.size(); _j++)
371  _jacobian[ph][n][_j] *= mob;
372 
373  if (_test.size() == _phi.size())
374  /* mobility at node=n depends only on the variables at node=n, by construction. For
375  * linear-lagrange variables, this means that Jacobian entries involving the derivative
376  * of mobility will only be nonzero for derivatives wrt variables at node=n. Hence the
377  * [n][n] in the line below. However, for other variable types (eg constant monomials)
378  * I cannot tell what variable number contributes to the derivative. However, in all
379  * cases I can possibly imagine, the derivative is zero anyway, since in the full
380  * upwinding scheme, mobility shouldn't depend on these other sorts of variables.
381  */
382  _jacobian[ph][n][n] += dmob * _proto_flux[ph][n];
383 
384  for (_j = 0; _j < _phi.size(); _j++)
385  dtotal_mass_out[_j] += _jacobian[ph][n][_j];
386  }
387  _proto_flux[ph][n] *= mob;
388  total_mass_out += _proto_flux[ph][n];
389  }
390  else
391  {
392  upwind_node[n] = false;
393  total_in -= _proto_flux[ph][n];
394  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
395  for (_j = 0; _j < _phi.size(); _j++)
396  dtotal_in[_j] -= _jacobian[ph][n][_j];
397  }
398  }
399 
400  // Conserve mass over all phases by proportioning the total_mass_out mass to the inflow nodes,
401  // weighted by their proto_flux values
402  for (unsigned int n = 0; n < num_nodes; ++n)
403  {
404  if (!upwind_node[n]) // downstream node
405  {
406  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
407  for (_j = 0; _j < _phi.size(); _j++)
408  {
409  _jacobian[ph][n][_j] *= total_mass_out / total_in;
410  _jacobian[ph][n][_j] +=
411  _proto_flux[ph][n] * (dtotal_mass_out[_j] / total_in -
412  dtotal_in[_j] * total_mass_out / total_in / total_in);
413  }
414  _proto_flux[ph][n] *= total_mass_out / total_in;
415  }
416  }
417 }
418 
419 void
420 PorousFlowDarcyBase::quickUpwind(JacRes res_or_jac, unsigned int ph, unsigned int pvar)
421 {
422  // The number of nodes in the element
423  const unsigned int num_nodes = _test.size();
424 
425  Real mob;
426  Real dmob;
427 
428  // Use the raw nodal mobility
429  for (unsigned int n = 0; n < num_nodes; ++n)
430  {
431  // The mobility at the node
432  mob = mobility(n, ph);
433  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
434  {
435  // The derivative of the mobility wrt the PorousFlow variable
436  dmob = dmobility(n, ph, pvar);
437 
438  for (_j = 0; _j < _phi.size(); _j++)
439  _jacobian[ph][n][_j] *= mob;
440 
441  if (_test.size() == _phi.size())
442  /* mobility at node=n depends only on the variables at node=n, by construction. For
443  * linear-lagrange variables, this means that Jacobian entries involving the derivative
444  * of mobility will only be nonzero for derivatives wrt variables at node=n. Hence the
445  * [n][n] in the line below. However, for other variable types (eg constant monomials)
446  * I cannot tell what variable number contributes to the derivative. However, in all
447  * cases I can possibly imagine, the derivative is zero anyway, since in the full
448  * upwinding scheme, mobility shouldn't depend on these other sorts of variables.
449  */
450  _jacobian[ph][n][n] += dmob * _proto_flux[ph][n];
451  }
452  _proto_flux[ph][n] *= mob;
453  }
454 }
455 
456 void
457 PorousFlowDarcyBase::harmonicMean(JacRes res_or_jac, unsigned int ph, unsigned int pvar)
458 {
459  // The number of nodes in the element
460  const unsigned int num_nodes = _test.size();
461 
462  std::vector<Real> mob(num_nodes);
463  unsigned num_zero = 0;
464  unsigned zero_mobility_node = std::numeric_limits<unsigned>::max();
465  Real harmonic_mob = 0;
466  for (unsigned n = 0; n < num_nodes; ++n)
467  {
468  mob[n] = mobility(n, ph);
469  if (mob[n] == 0.0)
470  {
471  zero_mobility_node = n;
472  num_zero++;
473  }
474  else
475  harmonic_mob += 1.0 / mob[n];
476  }
477  if (num_zero > 0)
478  harmonic_mob = 0.0;
479  else
480  harmonic_mob = (1.0 * num_nodes) / harmonic_mob;
481 
482  // d(harmonic_mob)/d(PorousFlow variable at node n)
483  std::vector<Real> dharmonic_mob(num_nodes, 0.0);
484  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
485  {
486  const Real harm2 = std::pow(harmonic_mob, 2) / (1.0 * num_nodes);
487  if (num_zero == 0)
488  for (unsigned n = 0; n < num_nodes; ++n)
489  dharmonic_mob[n] = dmobility(n, ph, pvar) * harm2 / std::pow(mob[n], 2);
490  else if (num_zero == 1)
491  dharmonic_mob[zero_mobility_node] =
492  num_nodes * dmobility(zero_mobility_node, ph, pvar); // other derivs are zero
493  // if num_zero > 1 then all dharmonic_mob = 0.0
494  }
495 
496  if (res_or_jac == JacRes::CALCULATE_JACOBIAN)
497  for (unsigned n = 0; n < num_nodes; ++n)
498  for (_j = 0; _j < _phi.size(); _j++)
499  {
500  _jacobian[ph][n][_j] *= harmonic_mob;
501  if (_test.size() == _phi.size())
502  _jacobian[ph][n][_j] += dharmonic_mob[_j] * _proto_flux[ph][n];
503  }
504 
505  if (res_or_jac == JacRes::CALCULATE_RESIDUAL)
506  for (unsigned n = 0; n < num_nodes; ++n)
507  _proto_flux[ph][n] *= harmonic_mob;
508 }
509 
510 Real
511 PorousFlowDarcyBase::mobility(unsigned nodenum, unsigned phase) const
512 {
513  return _fluid_density_node[nodenum][phase] / _fluid_viscosity[nodenum][phase];
514 }
515 
516 Real
517 PorousFlowDarcyBase::dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const
518 {
519  Real dm = _dfluid_density_node_dvar[nodenum][phase][pvar] / _fluid_viscosity[nodenum][phase];
520  dm -= _fluid_density_node[nodenum][phase] * _dfluid_viscosity_dvar[nodenum][phase][pvar] /
521  std::pow(_fluid_viscosity[nodenum][phase], 2);
522  return dm;
523 }
PorousFlowDarcyBase::computeOffDiagJacobian
virtual void computeOffDiagJacobian(MooseVariableFEBase &jvar) override
Definition: PorousFlowDarcyBase.C:147
PorousFlowDarcyBase::_dictator
const PorousFlowDictator & _dictator
PorousFlowDictator UserObject.
Definition: PorousFlowDarcyBase.h:126
PorousFlowDarcyBase::_full_upwind_threshold
const unsigned _full_upwind_threshold
If the number of upwind-downwind swaps is less than this amount then full upwinding is used.
Definition: PorousFlowDarcyBase.h:141
PorousFlowDarcyBase::_dgrad_p_dgrad_var
const MaterialProperty< std::vector< std::vector< Real > > > & _dgrad_p_dgrad_var
Derivative of Grad porepressure in each phase wrt grad(PorousFlow variables)
Definition: PorousFlowDarcyBase.h:120
PorousFlowDarcyBase::quickUpwind
void quickUpwind(JacRes res_or_jac, unsigned int ph, unsigned int pvar)
Calculate the residual or Jacobian using the nodal mobilities, but without conserving fluid mass.
Definition: PorousFlowDarcyBase.C:420
PorousFlowDarcyBase::JacRes::CALCULATE_RESIDUAL
PorousFlowDarcyBase::_fallback_scheme
enum PorousFlowDarcyBase::FallbackEnum _fallback_scheme
PorousFlowDarcyBase.h
PorousFlowDarcyBase::_grad_p
const MaterialProperty< std::vector< RealGradient > > & _grad_p
Gradient of the pore pressure in each phase.
Definition: PorousFlowDarcyBase.h:117
PorousFlowDarcyBase::_fluid_viscosity
const MaterialProperty< std::vector< Real > > & _fluid_viscosity
Viscosity of each component in each phase.
Definition: PorousFlowDarcyBase.h:108
PorousFlowDarcyBase::_dfluid_density_qp_dvar
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_qp_dvar
Derivative of the fluid density for each phase wrt PorousFlow variables (at the qp)
Definition: PorousFlowDarcyBase.h:105
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
libMesh::RealGradient
VectorValue< Real > RealGradient
Definition: GrainForceAndTorqueInterface.h:17
PorousFlowDictator::notPorousFlowVariable
bool notPorousFlowVariable(unsigned int moose_var_num) const
Returns true if moose_var_num is not a porous flow variabe.
Definition: PorousFlowDictator.C:161
PorousFlowDarcyBase::_perm_derivs
const bool _perm_derivs
Flag to check whether permeabiity derivatives are non-zero.
Definition: PorousFlowDarcyBase.h:135
PorousFlowDarcyBase::_fluid_density_node
const MaterialProperty< std::vector< Real > > & _fluid_density_node
Fluid density for each phase (at the node)
Definition: PorousFlowDarcyBase.h:96
PorousFlowDarcyBase::JacRes
JacRes
Definition: PorousFlowDarcyBase.h:63
PorousFlowDarcyBase::_num_upwinds
std::unordered_map< unsigned, std::vector< std::vector< unsigned > > > _num_upwinds
Number of nonlinear iterations (in this timestep and this element) that a node is an upwind node for ...
Definition: PorousFlowDarcyBase.h:174
PorousFlowDarcyBase::timestepSetup
virtual void timestepSetup() override
Definition: PorousFlowDarcyBase.C:87
PorousFlowDarcyBase::_permeability
const MaterialProperty< RealTensorValue > & _permeability
Permeability of porous material.
Definition: PorousFlowDarcyBase.h:87
PorousFlowDarcyBase::JacRes::CALCULATE_JACOBIAN
PorousFlowDarcyBase::_dpermeability_dvar
const MaterialProperty< std::vector< RealTensorValue > > & _dpermeability_dvar
d(permeabiity)/d(PorousFlow variable)
Definition: PorousFlowDarcyBase.h:90
PorousFlowDictator::porousFlowVariableNum
unsigned int porousFlowVariableNum(unsigned int moose_var_num) const
The PorousFlow variable number.
Definition: PorousFlowDictator.C:135
PorousFlowDarcyBase::_jacobian
std::vector< std::vector< std::vector< Real > > > _jacobian
Derivative of _proto_flux with respect to nodal variables.
Definition: PorousFlowDarcyBase.h:167
PorousFlowDarcyBase::_dgrad_p_dvar
const MaterialProperty< std::vector< std::vector< RealGradient > > > & _dgrad_p_dvar
Derivative of Grad porepressure in each phase wrt PorousFlow variables.
Definition: PorousFlowDarcyBase.h:123
PorousFlowDarcyBase::mobility
virtual Real mobility(unsigned nodenum, unsigned phase) const
The mobility of the fluid.
Definition: PorousFlowDarcyBase.C:511
PorousFlowDictator
This holds maps between the nonlinear variables used in a PorousFlow simulation and the variable numb...
Definition: PorousFlowDictator.h:71
PorousFlowDarcyBase::fullyUpwind
void fullyUpwind(JacRes res_or_jac, unsigned int ph, unsigned int pvar)
Calculate the residual or Jacobian using full upwinding.
Definition: PorousFlowDarcyBase.C:307
PorousFlowDarcyBase::_num_downwinds
std::unordered_map< unsigned, std::vector< std::vector< unsigned > > > _num_downwinds
Number of nonlinear iterations (in this timestep and this element) that a node is an downwind node fo...
Definition: PorousFlowDarcyBase.h:181
PorousFlowDarcyBase::_dfluid_viscosity_dvar
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_viscosity_dvar
Derivative of the fluid viscosity for each phase wrt PorousFlow variables.
Definition: PorousFlowDarcyBase.h:111
PorousFlowDarcyBase::FallbackEnum::HARMONIC
PorousFlowDarcyBase::_dfluid_density_node_dvar
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_density_node_dvar
Derivative of the fluid density for each phase wrt PorousFlow variables (at the node)
Definition: PorousFlowDarcyBase.h:99
PorousFlowDarcyBase::harmonicMean
void harmonicMean(JacRes res_or_jac, unsigned int ph, unsigned int pvar)
Calculate the residual or Jacobian by using the harmonic mean of the nodal mobilities for the entire ...
Definition: PorousFlowDarcyBase.C:457
PorousFlowDarcyBase::darcyQp
virtual Real darcyQp(unsigned int ph) const
The Darcy part of the flux (this is the non-upwinded part)
Definition: PorousFlowDarcyBase.C:95
PorousFlowDarcyBase::computeQpResidual
virtual Real computeQpResidual() override
Definition: PorousFlowDarcyBase.C:128
PorousFlowDarcyBase::darcyQpJacobian
virtual Real darcyQpJacobian(unsigned int jvar, unsigned int ph) const
Jacobian of the Darcy part of the flux.
Definition: PorousFlowDarcyBase.C:102
PorousFlowDarcyBase::_num_phases
const unsigned int _num_phases
The number of fluid phases.
Definition: PorousFlowDarcyBase.h:129
PorousFlowDarcyBase::computeJacobian
virtual void computeJacobian() override
Definition: PorousFlowDarcyBase.C:141
PorousFlowDarcyBase::computeResidual
virtual void computeResidual() override
Definition: PorousFlowDarcyBase.C:135
PorousFlowDarcyBase::computeResidualAndJacobian
void computeResidualAndJacobian(JacRes res_or_jac, unsigned int jvar)
Computation of the residual and Jacobian.
Definition: PorousFlowDarcyBase.C:153
PorousFlowDarcyBase::_gravity
const RealVectorValue _gravity
Gravity. Defaults to 9.81 m/s^2.
Definition: PorousFlowDarcyBase.h:132
PorousFlowDarcyBase::FallbackEnum::QUICK
PorousFlowDarcyBase::_fluid_density_qp
const MaterialProperty< std::vector< Real > > & _fluid_density_qp
Fluid density for each phase (at the qp)
Definition: PorousFlowDarcyBase.h:102
validParams< PorousFlowDarcyBase >
InputParameters validParams< PorousFlowDarcyBase >()
Definition: PorousFlowDarcyBase.C:21
PorousFlowDarcyBase::PorousFlowDarcyBase
PorousFlowDarcyBase(const InputParameters &parameters)
Definition: PorousFlowDarcyBase.C:45
PorousFlowDarcyBase::dmobility
virtual Real dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const
The derivative of mobility with respect to PorousFlow variable pvar.
Definition: PorousFlowDarcyBase.C:517
PorousFlowDarcyBase::FallbackEnum
FallbackEnum
If full upwinding is failing due to nodes swapping between upwind and downwind in successive nonlinea...
Definition: PorousFlowDarcyBase.h:152
PorousFlowDarcyBase::_proto_flux
std::vector< std::vector< Real > > _proto_flux
The Darcy flux.
Definition: PorousFlowDarcyBase.h:160
PorousFlowDarcyBase::_dpermeability_dgradvar
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dpermeability_dgradvar
d(permeabiity)/d(grad(PorousFlow variable))
Definition: PorousFlowDarcyBase.h:93