www.mooseframework.org
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
PorousFlowAdvectiveFluxCalculatorUnsaturated Class Reference

Computes the advective flux of fluid of given phase, assuming unsaturated conditions. More...

#include <PorousFlowAdvectiveFluxCalculatorUnsaturated.h>

Inheritance diagram for PorousFlowAdvectiveFluxCalculatorUnsaturated:
[legend]

Public Member Functions

 PorousFlowAdvectiveFluxCalculatorUnsaturated (const InputParameters &parameters)
 
const std::map< dof_id_type, std::vector< Real > > & getdFluxOut_dvars (unsigned node_id) const
 Returns d(flux_out)/d(porous_flow_variables. More...
 
virtual void meshChanged () override
 
Real getFluxOut (dof_id_type node_i) const
 Returns the flux out of lobal node id. More...
 
const std::map< dof_id_type, Real > & getdFluxOutdu (dof_id_type node_i) const
 Returns r where r[j] = d(flux out of global node i)/du(global node j) used in Jacobian computations. More...
 
const std::vector< std::vector< Real > > & getdFluxOutdKjk (dof_id_type node_i) const
 Returns r where r[j][k] = d(flux out of global node i)/dK[connected node j][connected node k] used in Jacobian computations. More...
 
unsigned getValence (dof_id_type node_i) const
 Returns the valence of the global node i Valence is the number of times the node is encountered in a loop over elements (that have appropriate subdomain_id, if the user has employed the "blocks=" parameter) seen by this processor (including ghosted elements) More...
 

Protected Types

enum  FluxLimiterTypeEnum {
  FluxLimiterTypeEnum::MinMod, FluxLimiterTypeEnum::VanLeer, FluxLimiterTypeEnum::MC, FluxLimiterTypeEnum::superbee,
  FluxLimiterTypeEnum::None
}
 Determines Flux Limiter type (Page 135 of Kuzmin and Turek) "None" means that limitFlux=0 always, which implies zero antidiffusion will be added. More...
 
enum  PQPlusMinusEnum { PQPlusMinusEnum::PPlus, PQPlusMinusEnum::PMinus, PQPlusMinusEnum::QPlus, PQPlusMinusEnum::QMinus }
 Signals to the PQPlusMinus method what should be computed. More...
 

Protected Member Functions

virtual Real computeU (unsigned i) const override
 Computes the value of u at the local node id of the current element (_current_elem) More...
 
virtual Real computedU_dvar (unsigned i, unsigned pvar) const override
 Compute d(u)/d(porous_flow_variable) More...
 
virtual void timestepSetup () override
 
virtual void initialize () override
 
virtual void execute () override
 
virtual void finalize () override
 
virtual void threadJoin (const UserObject &uo) override
 
virtual Real computeVelocity (unsigned i, unsigned j, unsigned qp) const override
 Computes the transfer velocity between current node i and current node j at the current qp in the current element (_current_elem). More...
 
virtual void executeOnElement (dof_id_type global_i, dof_id_type global_j, unsigned local_i, unsigned local_j, unsigned qp) override
 This is called by multiple times in execute() in a double loop over _current_elem's nodes (local_i and local_j) nested in a loop over each of _current_elem's quadpoints (qp). More...
 
const std::map< dof_id_type, std::vector< Real > > & getdK_dvar (dof_id_type node_i, dof_id_type node_j) const
 Returns, r, where r[global node k][a] = d(K[node_i][node_j])/d(porous_flow_variable[global node k][porous_flow_variable a]) More...
 
virtual void buildCommLists () override
 When using multiple processors, other processors will compute: More...
 
virtual void exchangeGhostedInfo () override
 Sends and receives multi-processor information regarding u_nodal and k_ij. More...
 
void limitFlux (Real a, Real b, Real &limited, Real &dlimited_db) const
 flux limiter, L, on Page 135 of Kuzmin and Turek More...
 
Real rPlus (dof_id_type sequential_i, std::vector< Real > &dlimited_du, std::vector< Real > &dlimited_dk) const
 Returns the value of R_{i}^{+}, Eqn (49) of KT. More...
 
Real rMinus (dof_id_type sequential_i, std::vector< Real > &dlimited_du, std::vector< Real > &dlimited_dk) const
 Returns the value of R_{i}^{-}, Eqn (49) of KT. More...
 
Real PQPlusMinus (dof_id_type sequential_i, const PQPlusMinusEnum pq_plus_minus, std::vector< Real > &derivs, std::vector< Real > &dpq_dk) const
 Returns the value of P_{i}^{+}, P_{i}^{-}, Q_{i}^{+} or Q_{i}^{-} (depending on pq_plus_minus) which are defined in Eqns (47) and (48) of KT. More...
 
void zeroedConnection (std::map< dof_id_type, Real > &the_map, dof_id_type node_i) const
 Clears the_map, then, using _kij, constructs the_map so that the_map[node_id] = 0.0 for all node_id connected with node_i. More...
 

Protected Attributes

const MaterialProperty< std::vector< Real > > & _relative_permeability
 Relative permeability of each phase. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _drelative_permeability_dvar
 Derivative of relative permeability of each phase wrt PorousFlow variables. More...
 
const bool _multiply_by_density
 Whether to multiply the flux by the fluid density. More...
 
const MaterialProperty< std::vector< Real > > *const _fluid_density_node
 Fluid density for each phase (at the node) More...
 
const MaterialProperty< std::vector< std::vector< Real > > > *const _dfluid_density_node_dvar
 Derivative of the fluid density for each phase wrt PorousFlow variables (at the node) More...
 
const MaterialProperty< std::vector< Real > > & _fluid_viscosity
 Viscosity of each component in each phase. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dfluid_viscosity_dvar
 Derivative of the fluid viscosity for each phase wrt PorousFlow variables. More...
 
const PorousFlowDictator_dictator
 PorousFlowDictator UserObject. More...
 
const unsigned _num_vars
 Number of PorousFlow variables. More...
 
const RealVectorValue _gravity
 Gravity. More...
 
const unsigned int _phase
 The phase. More...
 
const MaterialProperty< RealTensorValue > & _permeability
 Permeability of porous material. More...
 
const MaterialProperty< std::vector< RealTensorValue > > & _dpermeability_dvar
 d(permeabiity)/d(PorousFlow variable) More...
 
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dpermeability_dgradvar
 d(permeabiity)/d(grad(PorousFlow variable)) More...
 
const MaterialProperty< std::vector< Real > > & _fluid_density_qp
 Fluid density for each phase (at the qp) More...
 
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) More...
 
const MaterialProperty< std::vector< RealGradient > > & _grad_p
 Gradient of the pore pressure in each phase. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _dgrad_p_dgrad_var
 Derivative of Grad porepressure in each phase wrt grad(PorousFlow variables) More...
 
const MaterialProperty< std::vector< std::vector< RealGradient > > > & _dgrad_p_dvar
 Derivative of Grad porepressure in each phase wrt PorousFlow variables. More...
 
const FEType _fe_type
 FEType to use. More...
 
const VariablePhiValue & _phi
 Kuzmin-Turek shape function. More...
 
const VariablePhiGradient & _grad_phi
 grad(Kuzmin-Turek shape function) More...
 
std::vector< std::vector< Real > > _du_dvar
 _du_dvar[sequential_i][a] = d(u[global version of sequential node i])/d(porous_flow_variable[a]) More...
 
std::vector< bool > _du_dvar_computed_by_thread
 Whether _du_dvar has been computed by the local thread. More...
 
std::vector< std::vector< std::map< dof_id_type, std::vector< Real > > > > _dkij_dvar
 _dkij_dvar[sequential_i][j][global_k][a] = d(K[sequential_i][j])/d(porous_flow_variable[global_k][porous_flow_variable a]) Here j is the j^th connection to sequential node sequential_i, and node k must be connected to node i More...
 
std::vector< std::map< dof_id_type, std::vector< Real > > > _dflux_out_dvars
 _dflux_out_dvars[sequential_i][global_j][pvar] = d(flux_out[global version of sequential_i])/d(porous_flow_variable pvar at global node j) More...
 
std::map< processor_id_type, std::vector< dof_id_type > > _triples_to_receive
 _triples_to_receive[proc_id] indicates the dk(i, j)/du_nodal information that we will receive from proc_id. More...
 
std::map< processor_id_type, std::vector< dof_id_type > > _triples_to_send
 _triples_to_send[proc_id] indicates the dk(i, j)/du_nodal information that we will send to proc_id. More...
 
const bool _perm_derivs
 Flag to check whether permeabiity derivatives are non-zero. More...
 
bool _resizing_needed
 whether _kij, etc, need to be sized appropriately (and valence recomputed) at the start of the timestep More...
 
enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum _flux_limiter_type
 
std::vector< std::vector< Real > > _kij
 Kuzmin-Turek K_ij matrix. More...
 
std::vector< Real > _flux_out
 _flux_out[i] = flux of "heat" from sequential node i More...
 
std::vector< std::map< dof_id_type, Real > > _dflux_out_du
 _dflux_out_du[i][j] = d(flux_out[i])/d(u[j]). More...
 
std::vector< std::vector< std::vector< Real > > > _dflux_out_dKjk
 _dflux_out_dKjk[sequential_i][j][k] = d(flux_out[sequential_i])/d(K[j][k]). More...
 
std::vector< unsigned > _valence
 _valence[i] = number of times, in a loop over elements seen by this processor (viz, including ghost elements) and are part of the block-restricted blocks of this UserObject, that the sequential node i is encountered More...
 
std::vector< Real > _u_nodal
 _u_nodal[i] = value of _u at sequential node number i More...
 
std::vector< bool > _u_nodal_computed_by_thread
 _u_nodal_computed_by_thread(i) = true if _u_nodal[i] has been computed in execute() by the thread on this processor More...
 
PorousFlowConnectedNodes _connections
 Holds the sequential and global nodal IDs, and info regarding mesh connections between them. More...
 
std::size_t _number_of_nodes
 Number of nodes held by the _connections object. More...
 
processor_id_type _my_pid
 processor ID of this object More...
 
std::map< processor_id_type, std::vector< dof_id_type > > _nodes_to_receive
 _nodes_to_receive[proc_id] = list of sequential nodal IDs. More...
 
std::map< processor_id_type, std::vector< dof_id_type > > _nodes_to_send
 _nodes_to_send[proc_id] = list of sequential nodal IDs. More...
 
std::map< processor_id_type, std::vector< std::pair< dof_id_type, dof_id_type > > > _pairs_to_receive
 _pairs_to_receive[proc_id] indicates the k(i, j) pairs that will be sent to us from proc_id _pairs_to_receive is first built (in buildCommLists()) using global node IDs, but after construction, a translation to sequential node IDs and the index of connections is performed, for efficiency. More...
 
std::map< processor_id_type, std::vector< std::pair< dof_id_type, dof_id_type > > > _pairs_to_send
 _pairs_to_send[proc_id] indicates the k(i, j) pairs that we will send to proc_id _pairs_to_send is first built (in buildCommLists()) using global node IDs, but after construction, a translation to sequential node IDs and the index of connections is performed, for efficiency. More...
 
const Real _allowable_MB_wastage
 A mooseWarning is issued if mb_wasted = (_connections.sizeSequential() - _connections.numNodes()) * 4 / 1048576 > _allowable_MB_wastage. More...
 
std::vector< std::vector< Real > > _dij
 Vectors used in finalize() More...
 
std::vector< std::vector< Real > > _dDij_dKij
 dDij_dKij[i][j] = d(D[i][j])/d(K[i][j]) for i!=j More...
 
std::vector< std::vector< Real > > _dDij_dKji
 dDij_dKji[i][j] = d(D[i][j])/d(K[j][i]) for i!=j More...
 
std::vector< std::vector< Real > > _dDii_dKij
 dDii_dKij[i][j] = d(D[i][i])/d(K[i][j]) More...
 
std::vector< std::vector< Real > > _dDii_dKji
 dDii_dKji[i][j] = d(D[i][i])/d(K[j][i]) More...
 
std::vector< std::vector< Real > > _lij
 
std::vector< Real > _rP
 
std::vector< Real > _rM
 
std::vector< std::vector< Real > > _drP
 drP[i][j] = d(rP[i])/d(u[j]). Here j indexes the j^th node connected to i More...
 
std::vector< std::vector< Real > > _drM
 drM[i][j] = d(rM[i])/d(u[j]). Here j indexes the j^th node connected to i More...
 
std::vector< std::vector< Real > > _drP_dk
 drP_dk[i][j] = d(rP[i])/d(K[i][j]). Here j indexes the j^th node connected to i More...
 
std::vector< std::vector< Real > > _drM_dk
 drM_dk[i][j] = d(rM[i])/d(K[i][j]). Here j indexes the j^th node connected to i More...
 
std::vector< std::vector< Real > > _fa
 fa[sequential_i][j] sequential_j is the j^th connection to sequential_i More...
 
std::vector< std::vector< std::map< dof_id_type, Real > > > _dfa
 dfa[sequential_i][j][global_k] = d(fa[sequential_i][j])/du[global_k]. More...
 
std::vector< std::vector< std::vector< Real > > > _dFij_dKik
 dFij_dKik[sequential_i][j][k] = d(fa[sequential_i][j])/d(K[sequential_i][k]). More...
 
std::vector< std::vector< std::vector< Real > > > _dFij_dKjk
 dFij_dKjk[sequential_i][j][k] = d(fa[sequential_i][j])/d(K[sequential_j][k]). More...
 

Detailed Description

Computes the advective flux of fluid of given phase, assuming unsaturated conditions.

Hence this UserObject is only relevant to single-phase situations, or multi-phase situations where each fluid component appears in one phase only. Explicitly, the UserObject computes (density * relative_permeability / viscosity) * (- permeability * (grad(P) - density * gravity))

Definition at line 26 of file PorousFlowAdvectiveFluxCalculatorUnsaturated.h.

Member Enumeration Documentation

◆ FluxLimiterTypeEnum

enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum
strongprotectedinherited

Determines Flux Limiter type (Page 135 of Kuzmin and Turek) "None" means that limitFlux=0 always, which implies zero antidiffusion will be added.

Enumerator
MinMod 
VanLeer 
MC 
superbee 
None 

Definition at line 169 of file AdvectiveFluxCalculatorBase.h.

169 { MinMod, VanLeer, MC, superbee, None } _flux_limiter_type;

◆ PQPlusMinusEnum

enum AdvectiveFluxCalculatorBase::PQPlusMinusEnum
strongprotectedinherited

Signals to the PQPlusMinus method what should be computed.

Enumerator
PPlus 
PMinus 
QPlus 
QMinus 

Definition at line 255 of file AdvectiveFluxCalculatorBase.h.

256  {
257  PPlus,
258  PMinus,
259  QPlus,
260  QMinus
261  };

Constructor & Destructor Documentation

◆ PorousFlowAdvectiveFluxCalculatorUnsaturated()

PorousFlowAdvectiveFluxCalculatorUnsaturated::PorousFlowAdvectiveFluxCalculatorUnsaturated ( const InputParameters &  parameters)

Definition at line 29 of file PorousFlowAdvectiveFluxCalculatorUnsaturated.C.

33  getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_nodal")),
34  _drelative_permeability_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
35  "dPorousFlow_relative_permeability_nodal_dvar"))
36 {
37 }

Member Function Documentation

◆ buildCommLists()

void PorousFlowAdvectiveFluxCalculatorBase::buildCommLists ( )
overrideprotectedvirtualinherited

When using multiple processors, other processors will compute:

  • u_nodal for nodes that we don't "own", but that we need when doing the stabilization
  • k_ij for node pairs that we don't "own", and contributions to node pairs that we do "own" (on the boundary of our set of elements), that are used in the stabilization This method builds _nodes_to_receive and _pairs_to_receive that describe which processors we are going to receive this info from, and similarly it builds _nodes_to_send and _pairs_to_send.

Build the multi-processor communication lists.

(A) We will have to send _u_nodal information to other processors. This is because although we can Evaluate Variables at all elements in _fe_problem.getEvaluableElementRange(), in the PorousFlow setting _u_nodal could depend on Material Properties within the elements, and we can't access those Properties within the ghosted elements.

(B) In a similar way, we need to send _kij information to other processors. A similar strategy is followed

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 302 of file PorousFlowAdvectiveFluxCalculatorBase.C.

303 {
304  // build nodes and pairs to exchange
306 
307  // Build _triples_to_receive
308  // tpr_global is essentially _triples_to_receive, but its key-pairs have global nodal IDs: later
309  // we build _triples_to_receive by flattening the data structure and making these key-pairs into
310  // sequential nodal IDs
311  std::map<processor_id_type,
312  std::map<std::pair<dof_id_type, dof_id_type>, std::vector<dof_id_type>>>
313  tpr_global;
314  for (const auto & elem : _fe_problem.getEvaluableElementRange())
315  if (this->hasBlocks(elem->subdomain_id()))
316  {
317  const processor_id_type elem_pid = elem->processor_id();
318  if (elem_pid != _my_pid)
319  {
320  if (tpr_global.find(elem_pid) == tpr_global.end())
321  tpr_global[elem_pid] =
322  std::map<std::pair<dof_id_type, dof_id_type>, std::vector<dof_id_type>>();
323  for (unsigned i = 0; i < elem->n_nodes(); ++i)
324  for (unsigned j = 0; j < elem->n_nodes(); ++j)
325  {
326  std::pair<dof_id_type, dof_id_type> the_pair(elem->node_id(i), elem->node_id(j));
327  if (tpr_global[elem_pid].find(the_pair) == tpr_global[elem_pid].end())
328  tpr_global[elem_pid][the_pair] = std::vector<dof_id_type>();
329 
330  for (const auto & global_neighbor_to_i :
331  _connections.globalConnectionsToGlobalID(elem->node_id(i)))
332  if (std::find(tpr_global[elem_pid][the_pair].begin(),
333  tpr_global[elem_pid][the_pair].end(),
334  global_neighbor_to_i) == tpr_global[elem_pid][the_pair].end())
335  tpr_global[elem_pid][the_pair].push_back(global_neighbor_to_i);
336  }
337  }
338  }
339 
340  // flattening makes later manipulations a lot more concise. Store the result in
341  // _triples_to_receive
342  _triples_to_receive.clear();
343  for (const auto & kv : tpr_global)
344  {
345  const processor_id_type pid = kv.first;
346  _triples_to_receive[pid] = std::vector<dof_id_type>();
347  for (const auto & pr_vec : kv.second)
348  {
349  const dof_id_type i = pr_vec.first.first;
350  const dof_id_type j = pr_vec.first.second;
351  for (const auto & global_nd : pr_vec.second)
352  {
353  _triples_to_receive[pid].push_back(i);
354  _triples_to_receive[pid].push_back(j);
355  _triples_to_receive[pid].push_back(global_nd);
356  }
357  }
358  }
359 
360  _triples_to_send.clear();
361  auto triples_action_functor = [this](processor_id_type pid,
362  const std::vector<dof_id_type> & tts) {
363  _triples_to_send[pid] = tts;
364  };
365  Parallel::push_parallel_vector_data(this->comm(), _triples_to_receive, triples_action_functor);
366 
367  // _triples_to_send and _triples_to_receive have been built using global node IDs
368  // since all processors know about that. However, using global IDs means
369  // that every time we send/receive, we keep having to do things like
370  // _dkij_dvar[_connections.sequentialID(_triples_to_send[pid][i])][_connections.indexOfGlobalConnection(_triples_to_send[pid][i],
371  // _triples_to_send[pid][i + 1])] which is quite inefficient. So:
372  for (auto & kv : _triples_to_send)
373  {
374  const processor_id_type pid = kv.first;
375  const std::size_t num = kv.second.size();
376  for (std::size_t i = 0; i < num; i += 3)
377  {
379  _triples_to_send[pid][i], _triples_to_send[pid][i + 1]);
381  }
382  }
383  for (auto & kv : _triples_to_receive)
384  {
385  const processor_id_type pid = kv.first;
386  const std::size_t num = kv.second.size();
387  for (std::size_t i = 0; i < num; i += 3)
388  {
390  _triples_to_receive[pid][i], _triples_to_receive[pid][i + 1]);
392  }
393  }
394 }

◆ computedU_dvar()

Real PorousFlowAdvectiveFluxCalculatorUnsaturated::computedU_dvar ( unsigned  i,
unsigned  pvar 
) const
overrideprotectedvirtual

Compute d(u)/d(porous_flow_variable)

Parameters
inode number of the current element
pvarporous flow variable number

Reimplemented from PorousFlowAdvectiveFluxCalculatorSaturated.

Definition at line 47 of file PorousFlowAdvectiveFluxCalculatorUnsaturated.C.

◆ computeU()

Real PorousFlowAdvectiveFluxCalculatorUnsaturated::computeU ( unsigned  i) const
overrideprotectedvirtual

Computes the value of u at the local node id of the current element (_current_elem)

Parameters
ilocal node id of the current element

Reimplemented from PorousFlowAdvectiveFluxCalculatorSaturated.

Definition at line 40 of file PorousFlowAdvectiveFluxCalculatorUnsaturated.C.

◆ computeVelocity()

Real PorousFlowAdvectiveFluxCalculatorBase::computeVelocity ( unsigned  i,
unsigned  j,
unsigned  qp 
) const
overrideprotectedvirtualinherited

Computes the transfer velocity between current node i and current node j at the current qp in the current element (_current_elem).

For instance, (_grad_phi[i][qp] * _velocity) * _phi[j][qp];

Parameters
inode number in the current element
jnode number in the current element
qpquadpoint number in the current element

Implements AdvectiveFluxCalculatorBase.

Definition at line 96 of file PorousFlowAdvectiveFluxCalculatorBase.C.

97 {
98  // The following is but one choice for PorousFlow situations
99  // If you change this, you will probably have to change
100  // - the derivative in executeOnElement
101  // - computeU
102  // - computedU_dvar
103  return -_grad_phi[i][qp] *
104  (_permeability[qp] * (_grad_p[qp][_phase] - _fluid_density_qp[qp][_phase] * _gravity)) *
105  _phi[j][qp];
106 }

◆ exchangeGhostedInfo()

void PorousFlowAdvectiveFluxCalculatorBase::exchangeGhostedInfo ( )
overrideprotectedvirtualinherited

Sends and receives multi-processor information regarding u_nodal and k_ij.

See buildCommLists for some more explanation.

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 397 of file PorousFlowAdvectiveFluxCalculatorBase.C.

398 {
399  // Exchange u_nodal and k_ij
401 
402  // Exchange _du_dvar
403  std::map<processor_id_type, std::vector<std::vector<Real>>> du_dvar_to_send;
404  for (const auto & kv : _nodes_to_send)
405  {
406  const processor_id_type pid = kv.first;
407  du_dvar_to_send[pid] = std::vector<std::vector<Real>>();
408  for (const auto & nd : kv.second)
409  du_dvar_to_send[pid].push_back(_du_dvar[nd]);
410  }
411 
412  auto du_action_functor = [this](processor_id_type pid,
413  const std::vector<std::vector<Real>> & du_dvar_received) {
414  const std::size_t msg_size = du_dvar_received.size();
415  mooseAssert(
416  msg_size == _nodes_to_receive[pid].size(),
417  "Message size, "
418  << msg_size
419  << ", in du_dvar communication is incompatible with nodes_to_receive, which has size "
420  << _nodes_to_receive[pid].size());
421  for (unsigned i = 0; i < msg_size; ++i)
422  _du_dvar[_nodes_to_receive[pid][i]] = du_dvar_received[i];
423  };
424  Parallel::push_parallel_vector_data(this->comm(), du_dvar_to_send, du_action_functor);
425 
426  // Exchange _dkij_dvar
427  std::map<processor_id_type, std::vector<std::vector<Real>>> dkij_dvar_to_send;
428  for (const auto & kv : _triples_to_send)
429  {
430  const processor_id_type pid = kv.first;
431  dkij_dvar_to_send[pid] = std::vector<std::vector<Real>>();
432  const std::size_t num = kv.second.size();
433  for (std::size_t i = 0; i < num; i += 3)
434  {
435  const dof_id_type sequential_id = kv.second[i];
436  const unsigned index_to_seq = kv.second[i + 1];
437  const dof_id_type global_id = kv.second[i + 2];
438  dkij_dvar_to_send[pid].push_back(_dkij_dvar[sequential_id][index_to_seq][global_id]);
439  }
440  }
441 
442  auto dk_action_functor = [this](processor_id_type pid,
443  const std::vector<std::vector<Real>> & dkij_dvar_received) {
444  const std::size_t num = _triples_to_receive[pid].size();
445  mooseAssert(dkij_dvar_received.size() == num / 3,
446  "Message size, " << dkij_dvar_received.size()
447  << ", in dkij_dvar communication is incompatible with "
448  "triples_to_receive, which has size "
449  << _triples_to_receive[pid].size());
450  for (std::size_t i = 0; i < num; i += 3)
451  {
452  const dof_id_type sequential_id = _triples_to_receive[pid][i];
453  const unsigned index_to_seq = _triples_to_receive[pid][i + 1];
454  const dof_id_type global_id = _triples_to_receive[pid][i + 2];
455  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
456  _dkij_dvar[sequential_id][index_to_seq][global_id][pvar] += dkij_dvar_received[i / 3][pvar];
457  }
458  };
459  Parallel::push_parallel_vector_data(this->comm(), dkij_dvar_to_send, dk_action_functor);
460 }

◆ execute()

void PorousFlowAdvectiveFluxCalculatorBase::execute ( )
overrideprotectedvirtualinherited

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 193 of file PorousFlowAdvectiveFluxCalculatorBase.C.

194 {
196 
197  // compute d(U)/d(porous_flow_variables) for nodes in _current_elem and for this
198  // execution thread. In threadJoin all these computations get gathered
199  // using _du_dvar_computed_by_thread
200  for (unsigned i = 0; i < _current_elem->n_nodes(); ++i)
201  {
202  const dof_id_type global_i = _current_elem->node_id(i);
203  const dof_id_type sequential_i = _connections.sequentialID(global_i);
204  if (_du_dvar_computed_by_thread[sequential_i])
205  continue;
206  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
207  _du_dvar[sequential_i][pvar] = computedU_dvar(i, pvar);
208  _du_dvar_computed_by_thread[sequential_i] = true;
209  }
210 }

◆ executeOnElement()

void PorousFlowAdvectiveFluxCalculatorBase::executeOnElement ( dof_id_type  global_i,
dof_id_type  global_j,
unsigned  local_i,
unsigned  local_j,
unsigned  qp 
)
overrideprotectedvirtualinherited

This is called by multiple times in execute() in a double loop over _current_elem's nodes (local_i and local_j) nested in a loop over each of _current_elem's quadpoints (qp).

It is used to compute _kij and its derivatives

Parameters
global_iglobal node id corresponding to the local node local_i
global_jglobal node id corresponding to the local node local_j
local_ilocal node number of the _current_elem
local_jlocal node number of the _current_elem
qpquadpoint number of the _current_elem

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 109 of file PorousFlowAdvectiveFluxCalculatorBase.C.

111 {
112  AdvectiveFluxCalculatorBase::executeOnElement(global_i, global_j, local_i, local_j, qp);
113  const dof_id_type sequential_i = _connections.sequentialID(global_i);
114  const unsigned j = _connections.indexOfGlobalConnection(global_i, global_j);
115 
116  // compute d(Kij)/d(porous_flow_variables)
117  for (unsigned local_k = 0; local_k < _current_elem->n_nodes(); ++local_k)
118  {
119  const dof_id_type global_k = _current_elem->node_id(local_k);
120  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
121  {
122  RealVectorValue deriv =
123  _permeability[qp] *
124  (_grad_phi[local_k][qp] * _dgrad_p_dgrad_var[qp][_phase][pvar] -
125  _phi[local_k][qp] * _dfluid_density_qp_dvar[qp][_phase][pvar] * _gravity);
126  deriv += _permeability[qp] * (_dgrad_p_dvar[qp][_phase][pvar] * _phi[local_k][qp]);
127 
128  if (_perm_derivs)
129  {
130  deriv += _dpermeability_dvar[qp][pvar] * _phi[local_k][qp] *
132  for (unsigned i = 0; i < LIBMESH_DIM; ++i)
133  deriv += _dpermeability_dgradvar[qp][i][pvar] * _grad_phi[local_k][qp](i) *
135  }
136 
137  _dkij_dvar[sequential_i][j][global_k][pvar] +=
138  _JxW[qp] * _coord[qp] * (-_grad_phi[local_i][qp] * deriv * _phi[local_j][qp]);
139  }
140  }
141 }

◆ finalize()

void PorousFlowAdvectiveFluxCalculatorBase::finalize ( )
overrideprotectedvirtualinherited

_dflux_out_dvars[sequential_i][global_j][pvar] = d(flux_out[global version of sequential_i])/d(porous_flow_variable pvar at global node j)

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 253 of file PorousFlowAdvectiveFluxCalculatorBase.C.

254 {
256 
257  // compute d(flux_out)/d(porous flow variable)
259  for (const auto & node_i : _connections.globalIDs())
260  {
261  const dof_id_type sequential_i = _connections.sequentialID(node_i);
262  _dflux_out_dvars[sequential_i].clear();
263 
264  const std::map<dof_id_type, Real> & dflux_out_du =
266  for (const auto & node_du : dflux_out_du)
267  {
268  const dof_id_type j = node_du.first;
269  const Real dflux_out_du_j = node_du.second;
270  _dflux_out_dvars[sequential_i][j] = _du_dvar[_connections.sequentialID(j)];
271  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
272  _dflux_out_dvars[sequential_i][j][pvar] *= dflux_out_du_j;
273  }
274 
275  // _dflux_out_dvars is now sized correctly, because getdFluxOutdu(i) contains all nodes
276  // connected to i and all nodes connected to nodes connected to i. The
277  // getdFluxOutdKij contains no extra nodes, so just += the dflux/dK terms
278  const std::vector<std::vector<Real>> & dflux_out_dKjk =
280  const std::vector<dof_id_type> & con_i = _connections.globalConnectionsToGlobalID(node_i);
281  for (std::size_t index_j = 0; index_j < con_i.size(); ++index_j)
282  {
283  const dof_id_type node_j = con_i[index_j];
284  const std::vector<dof_id_type> & con_j = _connections.globalConnectionsToGlobalID(node_j);
285  for (std::size_t index_k = 0; index_k < con_j.size(); ++index_k)
286  {
287  const dof_id_type node_k = con_j[index_k];
288  const Real dflux_out_dK_jk = dflux_out_dKjk[index_j][index_k];
289  const std::map<dof_id_type, std::vector<Real>> & dkj_dvarl = getdK_dvar(node_j, node_k);
290  for (const auto & nodel_deriv : dkj_dvarl)
291  {
292  const dof_id_type l = nodel_deriv.first;
293  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
294  _dflux_out_dvars[sequential_i][l][pvar] += dflux_out_dK_jk * nodel_deriv.second[pvar];
295  }
296  }
297  }
298  }
299 }

◆ getdFluxOut_dvars()

const std::map< dof_id_type, std::vector< Real > > & PorousFlowAdvectiveFluxCalculatorBase::getdFluxOut_dvars ( unsigned  node_id) const
inherited

Returns d(flux_out)/d(porous_flow_variables.

Parameters
[in]node_idglobal node id
Returns
deriv[j][pvar] = d(flux_out[node_id])/d(porous_flow_variable pvar at global node j)

Definition at line 247 of file PorousFlowAdvectiveFluxCalculatorBase.C.

248 {
249  return _dflux_out_dvars[_connections.sequentialID(node_id)];
250 }

Referenced by PorousFlowFluxLimitedTVDAdvection::computeJacobian().

◆ getdFluxOutdKjk()

const std::vector< std::vector< Real > > & AdvectiveFluxCalculatorBase::getdFluxOutdKjk ( dof_id_type  node_i) const
inherited

Returns r where r[j][k] = d(flux out of global node i)/dK[connected node j][connected node k] used in Jacobian computations.

Parameters
node_iglobal id of node
Returns
the derivatives (after applying the KT procedure)

Definition at line 737 of file AdvectiveFluxCalculatorBase.C.

738 {
739  return _dflux_out_dKjk[_connections.sequentialID(node_i)];
740 }

Referenced by PorousFlowAdvectiveFluxCalculatorBase::finalize().

◆ getdFluxOutdu()

const std::map< dof_id_type, Real > & AdvectiveFluxCalculatorBase::getdFluxOutdu ( dof_id_type  node_i) const
inherited

Returns r where r[j] = d(flux out of global node i)/du(global node j) used in Jacobian computations.

Parameters
node_iglobal id of node
Returns
the derivatives (after applying the KT procedure)

Definition at line 731 of file AdvectiveFluxCalculatorBase.C.

732 {
733  return _dflux_out_du[_connections.sequentialID(node_i)];
734 }

Referenced by FluxLimitedTVDAdvection::computeJacobian(), and PorousFlowAdvectiveFluxCalculatorBase::finalize().

◆ getdK_dvar()

const std::map< dof_id_type, std::vector< Real > > & PorousFlowAdvectiveFluxCalculatorBase::getdK_dvar ( dof_id_type  node_i,
dof_id_type  node_j 
) const
protectedinherited

Returns, r, where r[global node k][a] = d(K[node_i][node_j])/d(porous_flow_variable[global node k][porous_flow_variable a])

Parameters
node_iglobal node id param node_j global node id

Definition at line 239 of file PorousFlowAdvectiveFluxCalculatorBase.C.

240 {
241  const dof_id_type sequential_i = _connections.sequentialID(node_i);
242  const unsigned j = _connections.indexOfGlobalConnection(node_i, node_j);
243  return _dkij_dvar[sequential_i][j];
244 }

Referenced by PorousFlowAdvectiveFluxCalculatorBase::finalize().

◆ getFluxOut()

Real AdvectiveFluxCalculatorBase::getFluxOut ( dof_id_type  node_i) const
inherited

Returns the flux out of lobal node id.

Parameters
node_iid of node
Returns
advective flux out of node after applying the KT procedure

Definition at line 743 of file AdvectiveFluxCalculatorBase.C.

744 {
745  return _flux_out[_connections.sequentialID(node_i)];
746 }

Referenced by FluxLimitedTVDAdvection::computeResidual(), and PorousFlowFluxLimitedTVDAdvection::computeResidual().

◆ getValence()

unsigned AdvectiveFluxCalculatorBase::getValence ( dof_id_type  node_i) const
inherited

Returns the valence of the global node i Valence is the number of times the node is encountered in a loop over elements (that have appropriate subdomain_id, if the user has employed the "blocks=" parameter) seen by this processor (including ghosted elements)

Parameters
node_igloal id of i^th node
Returns
valence of the node

Definition at line 749 of file AdvectiveFluxCalculatorBase.C.

750 {
751  return _valence[_connections.sequentialID(node_i)];
752 }

Referenced by FluxLimitedTVDAdvection::computeJacobian(), PorousFlowFluxLimitedTVDAdvection::computeJacobian(), FluxLimitedTVDAdvection::computeResidual(), and PorousFlowFluxLimitedTVDAdvection::computeResidual().

◆ initialize()

void PorousFlowAdvectiveFluxCalculatorBase::initialize ( )
overrideprotectedvirtualinherited

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 176 of file PorousFlowAdvectiveFluxCalculatorBase.C.

177 {
179  const std::size_t num_nodes = _connections.numNodes();
180  _du_dvar_computed_by_thread.assign(num_nodes, false);
181  for (dof_id_type sequential_i = 0; sequential_i < num_nodes; ++sequential_i)
182  {
183  const std::vector<dof_id_type> & con_i =
185  const std::size_t num_con_i = con_i.size();
186  for (unsigned j = 0; j < num_con_i; ++j)
187  for (const auto & global_neighbor_to_i : con_i)
188  _dkij_dvar[sequential_i][j][global_neighbor_to_i] = std::vector<Real>(_num_vars, 0.0);
189  }
190 }

◆ limitFlux()

void AdvectiveFluxCalculatorBase::limitFlux ( Real  a,
Real  b,
Real &  limited,
Real &  dlimited_db 
) const
protectedinherited

flux limiter, L, on Page 135 of Kuzmin and Turek

Parameters
aKT's "a" parameter
bKT's "b" parameter
limited[out]The value of the flux limiter, L
dlimited_db[out]The derivative dL/db

Definition at line 631 of file AdvectiveFluxCalculatorBase.C.

632 {
633  limited = 0.0;
634  dlimited_db = 0.0;
636  return;
637 
638  if ((a >= 0.0 && b <= 0.0) || (a <= 0.0 && b >= 0.0))
639  return;
640  const Real s = (a > 0.0 ? 1.0 : -1.0);
641 
642  const Real lal = std::abs(a);
643  const Real lbl = std::abs(b);
644  const Real dlbl = (b >= 0.0 ? 1.0 : -1.0); // d(lbl)/db
645  switch (_flux_limiter_type)
646  {
648  {
649  if (lal <= lbl)
650  {
651  limited = s * lal;
652  dlimited_db = 0.0;
653  }
654  else
655  {
656  limited = s * lbl;
657  dlimited_db = s * dlbl;
658  }
659  return;
660  }
662  {
663  limited = s * 2 * lal * lbl / (lal + lbl);
664  dlimited_db = s * 2 * lal * (dlbl / (lal + lbl) - lbl * dlbl / std::pow(lal + lbl, 2));
665  return;
666  }
668  {
669  const Real av = 0.5 * std::abs(a + b);
670  if (2 * lal <= av && lal <= lbl)
671  {
672  // 2 * lal is the smallest
673  limited = s * 2.0 * lal;
674  dlimited_db = 0.0;
675  }
676  else if (2 * lbl <= av && lbl <= lal)
677  {
678  // 2 * lbl is the smallest
679  limited = s * 2.0 * lbl;
680  dlimited_db = s * 2.0 * dlbl;
681  }
682  else
683  {
684  // av is the smallest
685  limited = s * av;
686  // if (a>0 and b>0) then d(av)/db = 0.5 = 0.5 * dlbl
687  // if (a<0 and b<0) then d(av)/db = -0.5 = 0.5 * dlbl
688  // if a and b have different sign then limited=0, above
689  dlimited_db = s * 0.5 * dlbl;
690  }
691  return;
692  }
694  {
695  const Real term1 = std::min(2.0 * lal, lbl);
696  const Real term2 = std::min(lal, 2.0 * lbl);
697  if (term1 >= term2)
698  {
699  if (2.0 * lal <= lbl)
700  {
701  limited = s * 2 * lal;
702  dlimited_db = 0.0;
703  }
704  else
705  {
706  limited = s * lbl;
707  dlimited_db = s * dlbl;
708  }
709  }
710  else
711  {
712  if (lal <= 2.0 * lbl)
713  {
714  limited = s * lal;
715  dlimited_db = 0.0;
716  }
717  else
718  {
719  limited = s * 2.0 * lbl;
720  dlimited_db = s * 2.0 * dlbl;
721  }
722  }
723  return;
724  }
725  default:
726  return;
727  }
728 }

Referenced by AdvectiveFluxCalculatorBase::rMinus(), and AdvectiveFluxCalculatorBase::rPlus().

◆ meshChanged()

void AdvectiveFluxCalculatorBase::meshChanged ( )
overridevirtualinherited

Definition at line 198 of file AdvectiveFluxCalculatorBase.C.

199 {
200  ElementUserObject::meshChanged();
201 
202  // Signal that _kij, _valence, etc need to be rebuilt
203  _resizing_needed = true;
204 }

◆ PQPlusMinus()

Real AdvectiveFluxCalculatorBase::PQPlusMinus ( dof_id_type  sequential_i,
const PQPlusMinusEnum  pq_plus_minus,
std::vector< Real > &  derivs,
std::vector< Real > &  dpq_dk 
) const
protectedinherited

Returns the value of P_{i}^{+}, P_{i}^{-}, Q_{i}^{+} or Q_{i}^{-} (depending on pq_plus_minus) which are defined in Eqns (47) and (48) of KT.

Parameters
sequential_isequential nodal ID
pq_plus_minusindicates whether P_{i}^{+}, P_{i}^{-}, Q_{i}^{+} or Q_{i}^{-} should be returned
derivs[out]derivs[j] = d(result)/d(u[sequential_j]). Here sequential_j is the j^th connection to sequential_i
dpq_dk[out]dpq_dk[j] = d(result)/d(K[node_i][j]). Here j indexes a connection to sequential_i. Recall that d(result)/d(K[l][m]) are zero unless l=sequential_i

Definition at line 764 of file AdvectiveFluxCalculatorBase.C.

768 {
769  // Find the value of u at sequential_i
770  const Real u_i = _u_nodal[sequential_i];
771 
772  // Connections to sequential_i
773  const std::vector<dof_id_type> con_i =
775  const std::size_t num_con = con_i.size();
776  // The neighbor number of sequential_i to sequential_i
777  const unsigned i_index_i = _connections.indexOfSequentialConnection(sequential_i, sequential_i);
778 
779  // Initialize the results
780  Real result = 0.0;
781  derivs.assign(num_con, 0.0);
782  dpqdk.assign(num_con, 0.0);
783 
784  // Sum over all nodes connected with node_i.
785  for (std::size_t j = 0; j < num_con; ++j)
786  {
787  const dof_id_type sequential_j = con_i[j];
788  if (sequential_j == sequential_i)
789  continue;
790  const Real kentry = _kij[sequential_i][j];
791 
792  // Find the value of u at node_j
793  const Real u_j = _u_nodal[sequential_j];
794  const Real ujminusi = u_j - u_i;
795 
796  // Evaluate the i-j contribution to the result
797  switch (pq_plus_minus)
798  {
800  {
801  if (ujminusi < 0.0 && kentry < 0.0)
802  {
803  result += kentry * ujminusi;
804  derivs[j] += kentry;
805  derivs[i_index_i] -= kentry;
806  dpqdk[j] += ujminusi;
807  }
808  break;
809  }
811  {
812  if (ujminusi > 0.0 && kentry < 0.0)
813  {
814  result += kentry * ujminusi;
815  derivs[j] += kentry;
816  derivs[i_index_i] -= kentry;
817  dpqdk[j] += ujminusi;
818  }
819  break;
820  }
822  {
823  if (ujminusi > 0.0 && kentry > 0.0)
824  {
825  result += kentry * ujminusi;
826  derivs[j] += kentry;
827  derivs[i_index_i] -= kentry;
828  dpqdk[j] += ujminusi;
829  }
830  break;
831  }
833  {
834  if (ujminusi < 0.0 && kentry > 0.0)
835  {
836  result += kentry * ujminusi;
837  derivs[j] += kentry;
838  derivs[i_index_i] -= kentry;
839  dpqdk[j] += ujminusi;
840  }
841  break;
842  }
843  }
844  }
845 
846  return result;
847 }

Referenced by AdvectiveFluxCalculatorBase::rMinus(), and AdvectiveFluxCalculatorBase::rPlus().

◆ rMinus()

Real AdvectiveFluxCalculatorBase::rMinus ( dof_id_type  sequential_i,
std::vector< Real > &  dlimited_du,
std::vector< Real > &  dlimited_dk 
) const
protectedinherited

Returns the value of R_{i}^{-}, Eqn (49) of KT.

Parameters
sequential_iSequential nodal ID
dlimited_du[out]dlimited_du[j] = d(R_{sequential_i}^{-})/du[sequential_j]. Here sequential_j is the j^th connection to sequential_i
dlimited_dk[out]dlimited_dk[j] = d(R_{sequential_i}^{-})/d(K[sequential_i][j]). Note Derivatives w.r.t. K[l][m] with l!=i are zero

Definition at line 595 of file AdvectiveFluxCalculatorBase.C.

598 {
599  const std::size_t num_con = _connections.sequentialConnectionsToSequentialID(sequential_i).size();
600  dlimited_du.assign(num_con, 0.0);
601  dlimited_dk.assign(num_con, 0.0);
603  return 0.0;
604  std::vector<Real> dp_du;
605  std::vector<Real> dp_dk;
606  const Real p = PQPlusMinus(sequential_i, PQPlusMinusEnum::PMinus, dp_du, dp_dk);
607  if (p == 0.0)
608  // Comment after Eqn (49): if P=0 then there's no antidiffusion, so no need to remove it
609  return 1.0;
610  std::vector<Real> dq_du;
611  std::vector<Real> dq_dk;
612  const Real q = PQPlusMinus(sequential_i, PQPlusMinusEnum::QMinus, dq_du, dq_dk);
613 
614  const Real r = q / p;
615  Real limited;
616  Real dlimited_dr;
617  limitFlux(1.0, r, limited, dlimited_dr);
618 
619  const Real p2 = std::pow(p, 2);
620  for (std::size_t j = 0; j < num_con; ++j)
621  {
622  const Real dr_du = dq_du[j] / p - q * dp_du[j] / p2;
623  const Real dr_dk = dq_dk[j] / p - q * dp_dk[j] / p2;
624  dlimited_du[j] = dlimited_dr * dr_du;
625  dlimited_dk[j] = dlimited_dr * dr_dk;
626  }
627  return limited;
628 }

Referenced by AdvectiveFluxCalculatorBase::finalize().

◆ rPlus()

Real AdvectiveFluxCalculatorBase::rPlus ( dof_id_type  sequential_i,
std::vector< Real > &  dlimited_du,
std::vector< Real > &  dlimited_dk 
) const
protectedinherited

Returns the value of R_{i}^{+}, Eqn (49) of KT.

Parameters
node_inodal id
dlimited_du[out]dlimited_du[j] = d(R_{sequential_i}^{+})/du[sequential_j]. Here sequential_j is the j^th connection to sequential_i
dlimited_dk[out]dlimited_dk[j] = d(R_{sequential_i}^{+})/d(K[sequential_i][j]). Note Derivatives w.r.t. K[l][m] with l!=i are zero

Definition at line 559 of file AdvectiveFluxCalculatorBase.C.

562 {
563  const std::size_t num_con = _connections.sequentialConnectionsToSequentialID(sequential_i).size();
564  dlimited_du.assign(num_con, 0.0);
565  dlimited_dk.assign(num_con, 0.0);
567  return 0.0;
568  std::vector<Real> dp_du;
569  std::vector<Real> dp_dk;
570  const Real p = PQPlusMinus(sequential_i, PQPlusMinusEnum::PPlus, dp_du, dp_dk);
571  if (p == 0.0)
572  // Comment after Eqn (49): if P=0 then there's no antidiffusion, so no need to remove it
573  return 1.0;
574  std::vector<Real> dq_du;
575  std::vector<Real> dq_dk;
576  const Real q = PQPlusMinus(sequential_i, PQPlusMinusEnum::QPlus, dq_du, dq_dk);
577 
578  const Real r = q / p;
579  Real limited;
580  Real dlimited_dr;
581  limitFlux(1.0, r, limited, dlimited_dr);
582 
583  const Real p2 = std::pow(p, 2);
584  for (std::size_t j = 0; j < num_con; ++j)
585  {
586  const Real dr_du = dq_du[j] / p - q * dp_du[j] / p2;
587  const Real dr_dk = dq_dk[j] / p - q * dp_dk[j] / p2;
588  dlimited_du[j] = dlimited_dr * dr_du;
589  dlimited_dk[j] = dlimited_dr * dr_dk;
590  }
591  return limited;
592 }

Referenced by AdvectiveFluxCalculatorBase::finalize().

◆ threadJoin()

void PorousFlowAdvectiveFluxCalculatorBase::threadJoin ( const UserObject &  uo)
overrideprotectedvirtualinherited

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 213 of file PorousFlowAdvectiveFluxCalculatorBase.C.

214 {
217  static_cast<const PorousFlowAdvectiveFluxCalculatorBase &>(uo);
218  // add the values of _dkij_dvar computed by different threads
219  const std::size_t num_nodes = _connections.numNodes();
220  for (dof_id_type sequential_i = 0; sequential_i < num_nodes; ++sequential_i)
221  {
222  const std::vector<dof_id_type> & con_i =
224  const std::size_t num_con_i = con_i.size();
225  for (unsigned j = 0; j < num_con_i; ++j)
226  for (const auto & global_derivs : pfafc._dkij_dvar[sequential_i][j])
227  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
228  _dkij_dvar[sequential_i][j][global_derivs.first][pvar] += global_derivs.second[pvar];
229  }
230 
231  // gather the values of _du_dvar computed by different threads
232  for (dof_id_type sequential_i = 0; sequential_i < _number_of_nodes; ++sequential_i)
233  if (!_du_dvar_computed_by_thread[sequential_i] &&
234  pfafc._du_dvar_computed_by_thread[sequential_i])
235  _du_dvar[sequential_i] = pfafc._du_dvar[sequential_i];
236 }

◆ timestepSetup()

void PorousFlowAdvectiveFluxCalculatorBase::timestepSetup ( )
overrideprotectedvirtualinherited

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 144 of file PorousFlowAdvectiveFluxCalculatorBase.C.

145 {
146  const bool resizing_was_needed =
147  _resizing_needed; // _resizing_needed gets set to false at the end of
148  // AdvectiveFluxCalculatorBase::timestepSetup()
150 
151  // clear and appropriately size all the derivative info
152  // d(U)/d(porous_flow_variables) and
153  // d(Kij)/d(porous_flow_variables) and
154  // d(flux_out)/d(porous_flow_variables)
155  if (resizing_was_needed)
156  {
157  const std::size_t num_nodes = _connections.numNodes();
158  _du_dvar.assign(num_nodes, std::vector<Real>(_num_vars, 0.0));
159  _du_dvar_computed_by_thread.assign(num_nodes, false);
160  _dflux_out_dvars.assign(num_nodes, std::map<dof_id_type, std::vector<Real>>());
161  _dkij_dvar.resize(num_nodes);
162  for (dof_id_type sequential_i = 0; sequential_i < num_nodes; ++sequential_i)
163  {
164  const std::vector<dof_id_type> con_i =
166  const std::size_t num_con_i = con_i.size();
167  _dkij_dvar[sequential_i].assign(num_con_i, std::map<dof_id_type, std::vector<Real>>());
168  for (unsigned j = 0; j < num_con_i; ++j)
169  for (const auto & global_neighbor_to_i : con_i)
170  _dkij_dvar[sequential_i][j][global_neighbor_to_i] = std::vector<Real>(_num_vars, 0.0);
171  }
172  }
173 }

◆ zeroedConnection()

void AdvectiveFluxCalculatorBase::zeroedConnection ( std::map< dof_id_type, Real > &  the_map,
dof_id_type  node_i 
) const
protectedinherited

Clears the_map, then, using _kij, constructs the_map so that the_map[node_id] = 0.0 for all node_id connected with node_i.

Parameters
[out]the_mapthe map to be zeroed appropriately
[in]node_inodal id

Definition at line 755 of file AdvectiveFluxCalculatorBase.C.

757 {
758  the_map.clear();
759  for (const auto & node_j : _connections.globalConnectionsToGlobalID(node_i))
760  the_map[node_j] = 0.0;
761 }

Referenced by AdvectiveFluxCalculatorBase::timestepSetup().

Member Data Documentation

◆ _allowable_MB_wastage

const Real AdvectiveFluxCalculatorBase::_allowable_MB_wastage
protectedinherited

A mooseWarning is issued if mb_wasted = (_connections.sizeSequential() - _connections.numNodes()) * 4 / 1048576 > _allowable_MB_wastage.

The _connections object uses sequential node numbering for computational efficiency, but this leads to memory being used inefficiently: the number of megabytes wasted is mb_wasted.

Definition at line 252 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::timestepSetup().

◆ _connections

PorousFlowConnectedNodes AdvectiveFluxCalculatorBase::_connections
protectedinherited

◆ _dDii_dKij

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_dDii_dKij
protectedinherited

dDii_dKij[i][j] = d(D[i][i])/d(K[i][j])

Definition at line 294 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dDii_dKji

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_dDii_dKji
protectedinherited

dDii_dKji[i][j] = d(D[i][i])/d(K[j][i])

Definition at line 296 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dDij_dKij

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_dDij_dKij
protectedinherited

dDij_dKij[i][j] = d(D[i][j])/d(K[i][j]) for i!=j

Definition at line 290 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dDij_dKji

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_dDij_dKji
protectedinherited

dDij_dKji[i][j] = d(D[i][j])/d(K[j][i]) for i!=j

Definition at line 292 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dfa

std::vector<std::vector<std::map<dof_id_type, Real> > > AdvectiveFluxCalculatorBase::_dfa
protectedinherited

dfa[sequential_i][j][global_k] = d(fa[sequential_i][j])/du[global_k].

Here global_k can be a neighbor to sequential_i or a neighbour to sequential_j (sequential_j is the j^th connection to sequential_i)

Definition at line 316 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dFij_dKik

std::vector<std::vector<std::vector<Real> > > AdvectiveFluxCalculatorBase::_dFij_dKik
protectedinherited

dFij_dKik[sequential_i][j][k] = d(fa[sequential_i][j])/d(K[sequential_i][k]).

Here j denotes the j^th connection to sequential_i, while k denotes the k^th connection to sequential_i

Definition at line 321 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dFij_dKjk

std::vector<std::vector<std::vector<Real> > > AdvectiveFluxCalculatorBase::_dFij_dKjk
protectedinherited

dFij_dKjk[sequential_i][j][k] = d(fa[sequential_i][j])/d(K[sequential_j][k]).

Here sequential_j is the j^th connection to sequential_i, and k denotes the k^th connection to sequential_j (this will include sequential_i itself)

Definition at line 326 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dfluid_density_node_dvar

const MaterialProperty<std::vector<std::vector<Real> > >* const PorousFlowAdvectiveFluxCalculatorSaturated::_dfluid_density_node_dvar
protectedinherited

Derivative of the fluid density for each phase wrt PorousFlow variables (at the node)

Definition at line 41 of file PorousFlowAdvectiveFluxCalculatorSaturated.h.

◆ _dfluid_density_qp_dvar

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowAdvectiveFluxCalculatorBase::_dfluid_density_qp_dvar
protectedinherited

Derivative of the fluid density for each phase wrt PorousFlow variables (at the qp)

Definition at line 102 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::executeOnElement().

◆ _dfluid_viscosity_dvar

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowAdvectiveFluxCalculatorSaturated::_dfluid_viscosity_dvar
protectedinherited

Derivative of the fluid viscosity for each phase wrt PorousFlow variables.

Definition at line 47 of file PorousFlowAdvectiveFluxCalculatorSaturated.h.

Referenced by PorousFlowAdvectiveFluxCalculatorSaturated::computedU_dvar().

◆ _dflux_out_dKjk

std::vector<std::vector<std::vector<Real> > > AdvectiveFluxCalculatorBase::_dflux_out_dKjk
protectedinherited

_dflux_out_dKjk[sequential_i][j][k] = d(flux_out[sequential_i])/d(K[j][k]).

Here sequential_i is a sequential node number according to the _connections object, and j represents the j^th node connected to i according to the _connections object, and k represents the k^th node connected to j according to the _connections object. Here j must be connected to i (this does include (the sequential version of j) == i), and k must be connected to j (this does include (the sequential version of k) = i and (the sequential version of k) == (sequential version of j)))

Definition at line 190 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), AdvectiveFluxCalculatorBase::getdFluxOutdKjk(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dflux_out_du

std::vector<std::map<dof_id_type, Real> > AdvectiveFluxCalculatorBase::_dflux_out_du
protectedinherited

_dflux_out_du[i][j] = d(flux_out[i])/d(u[j]).

Here i is a sequential node number according to the _connections object, and j (global ID) must be connected to i, or to a node that is connected to i.

Definition at line 183 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), AdvectiveFluxCalculatorBase::getdFluxOutdu(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _dflux_out_dvars

std::vector<std::map<dof_id_type, std::vector<Real> > > PorousFlowAdvectiveFluxCalculatorBase::_dflux_out_dvars
protectedinherited

_dflux_out_dvars[sequential_i][global_j][pvar] = d(flux_out[global version of sequential_i])/d(porous_flow_variable pvar at global node j)

Definition at line 136 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::finalize(), PorousFlowAdvectiveFluxCalculatorBase::getdFluxOut_dvars(), and PorousFlowAdvectiveFluxCalculatorBase::timestepSetup().

◆ _dgrad_p_dgrad_var

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowAdvectiveFluxCalculatorBase::_dgrad_p_dgrad_var
protectedinherited

Derivative of Grad porepressure in each phase wrt grad(PorousFlow variables)

Definition at line 108 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::executeOnElement().

◆ _dgrad_p_dvar

const MaterialProperty<std::vector<std::vector<RealGradient> > >& PorousFlowAdvectiveFluxCalculatorBase::_dgrad_p_dvar
protectedinherited

Derivative of Grad porepressure in each phase wrt PorousFlow variables.

Definition at line 111 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::executeOnElement().

◆ _dictator

const PorousFlowDictator& PorousFlowAdvectiveFluxCalculatorBase::_dictator
protectedinherited

◆ _dij

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_dij
protectedinherited

◆ _dkij_dvar

std::vector<std::vector<std::map<dof_id_type, std::vector<Real> > > > PorousFlowAdvectiveFluxCalculatorBase::_dkij_dvar
protectedinherited

_dkij_dvar[sequential_i][j][global_k][a] = d(K[sequential_i][j])/d(porous_flow_variable[global_k][porous_flow_variable a]) Here j is the j^th connection to sequential node sequential_i, and node k must be connected to node i

Definition at line 133 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::exchangeGhostedInfo(), PorousFlowAdvectiveFluxCalculatorBase::executeOnElement(), PorousFlowAdvectiveFluxCalculatorBase::getdK_dvar(), PorousFlowAdvectiveFluxCalculatorBase::initialize(), PorousFlowAdvectiveFluxCalculatorBase::threadJoin(), and PorousFlowAdvectiveFluxCalculatorBase::timestepSetup().

◆ _dpermeability_dgradvar

const MaterialProperty<std::vector<std::vector<RealTensorValue> > >& PorousFlowAdvectiveFluxCalculatorBase::_dpermeability_dgradvar
protectedinherited

d(permeabiity)/d(grad(PorousFlow variable))

Definition at line 96 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::executeOnElement().

◆ _dpermeability_dvar

const MaterialProperty<std::vector<RealTensorValue> >& PorousFlowAdvectiveFluxCalculatorBase::_dpermeability_dvar
protectedinherited

d(permeabiity)/d(PorousFlow variable)

Definition at line 93 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::executeOnElement().

◆ _drelative_permeability_dvar

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowAdvectiveFluxCalculatorUnsaturated::_drelative_permeability_dvar
protected

Derivative of relative permeability of each phase wrt PorousFlow variables.

Definition at line 41 of file PorousFlowAdvectiveFluxCalculatorUnsaturated.h.

Referenced by computedU_dvar().

◆ _drM

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_drM
protectedinherited

drM[i][j] = d(rM[i])/d(u[j]). Here j indexes the j^th node connected to i

Definition at line 305 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _drM_dk

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_drM_dk
protectedinherited

drM_dk[i][j] = d(rM[i])/d(K[i][j]). Here j indexes the j^th node connected to i

Definition at line 309 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _drP

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_drP
protectedinherited

drP[i][j] = d(rP[i])/d(u[j]). Here j indexes the j^th node connected to i

Definition at line 303 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _drP_dk

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_drP_dk
protectedinherited

drP_dk[i][j] = d(rP[i])/d(K[i][j]). Here j indexes the j^th node connected to i

Definition at line 307 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _du_dvar

std::vector<std::vector<Real> > PorousFlowAdvectiveFluxCalculatorBase::_du_dvar
protectedinherited

◆ _du_dvar_computed_by_thread

std::vector<bool> PorousFlowAdvectiveFluxCalculatorBase::_du_dvar_computed_by_thread
protectedinherited

◆ _fa

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_fa
protectedinherited

fa[sequential_i][j] sequential_j is the j^th connection to sequential_i

Definition at line 312 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _fe_type

const FEType PorousFlowAdvectiveFluxCalculatorBase::_fe_type
protectedinherited

FEType to use.

Definition at line 114 of file PorousFlowAdvectiveFluxCalculatorBase.h.

◆ _fluid_density_node

const MaterialProperty<std::vector<Real> >* const PorousFlowAdvectiveFluxCalculatorSaturated::_fluid_density_node
protectedinherited

Fluid density for each phase (at the node)

Definition at line 38 of file PorousFlowAdvectiveFluxCalculatorSaturated.h.

Referenced by PorousFlowAdvectiveFluxCalculatorSaturated::computeU().

◆ _fluid_density_qp

const MaterialProperty<std::vector<Real> >& PorousFlowAdvectiveFluxCalculatorBase::_fluid_density_qp
protectedinherited

◆ _fluid_viscosity

const MaterialProperty<std::vector<Real> >& PorousFlowAdvectiveFluxCalculatorSaturated::_fluid_viscosity
protectedinherited

◆ _flux_limiter_type

enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum AdvectiveFluxCalculatorBase::_flux_limiter_type
protectedinherited

◆ _flux_out

std::vector<Real> AdvectiveFluxCalculatorBase::_flux_out
protectedinherited

_flux_out[i] = flux of "heat" from sequential node i

Definition at line 179 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::finalize(), AdvectiveFluxCalculatorBase::getFluxOut(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _grad_p

const MaterialProperty<std::vector<RealGradient> >& PorousFlowAdvectiveFluxCalculatorBase::_grad_p
protectedinherited

◆ _grad_phi

const VariablePhiGradient& PorousFlowAdvectiveFluxCalculatorBase::_grad_phi
protectedinherited

◆ _gravity

const RealVectorValue PorousFlowAdvectiveFluxCalculatorBase::_gravity
protectedinherited

◆ _kij

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_kij
protectedinherited

Kuzmin-Turek K_ij matrix.

Along with R+ and R-, this is the key quantity computed by this UserObject. _kij[i][j] = k_ij corresponding to the i-j node pair. Here i is a sequential node numbers according to the _connections object, and j represents the j^th node connected to i according to the _connections object.

Definition at line 176 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::exchangeGhostedInfo(), AdvectiveFluxCalculatorBase::executeOnElement(), AdvectiveFluxCalculatorBase::finalize(), AdvectiveFluxCalculatorBase::initialize(), AdvectiveFluxCalculatorBase::PQPlusMinus(), AdvectiveFluxCalculatorBase::threadJoin(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _lij

std::vector<std::vector<Real> > AdvectiveFluxCalculatorBase::_lij
protectedinherited

◆ _multiply_by_density

const bool PorousFlowAdvectiveFluxCalculatorSaturated::_multiply_by_density
protectedinherited

◆ _my_pid

processor_id_type AdvectiveFluxCalculatorBase::_my_pid
protectedinherited

◆ _nodes_to_receive

std::map<processor_id_type, std::vector<dof_id_type> > AdvectiveFluxCalculatorBase::_nodes_to_receive
protectedinherited

_nodes_to_receive[proc_id] = list of sequential nodal IDs.

proc_id will send us _u_nodal at those nodes. _nodes_to_receive is built (in buildCommLists()) using global node IDs, but after construction, a translation to sequential node IDs is made, for efficiency. The result is: we will receive _u_nodal[_nodes_to_receive[proc_id][i]] from proc_id

Definition at line 218 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::buildCommLists(), PorousFlowAdvectiveFluxCalculatorBase::exchangeGhostedInfo(), and AdvectiveFluxCalculatorBase::exchangeGhostedInfo().

◆ _nodes_to_send

std::map<processor_id_type, std::vector<dof_id_type> > AdvectiveFluxCalculatorBase::_nodes_to_send
protectedinherited

_nodes_to_send[proc_id] = list of sequential nodal IDs.

We will send _u_nodal at those nodes to proc_id _nodes_to_send is built (in buildCommLists()) using global node IDs, but after construction, a translation to sequential node IDs is made, for efficiency The result is: we will send _u_nodal[_nodes_to_receive[proc_id][i]] to proc_id

Definition at line 226 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::buildCommLists(), PorousFlowAdvectiveFluxCalculatorBase::exchangeGhostedInfo(), and AdvectiveFluxCalculatorBase::exchangeGhostedInfo().

◆ _num_vars

const unsigned PorousFlowAdvectiveFluxCalculatorBase::_num_vars
protectedinherited

◆ _number_of_nodes

std::size_t AdvectiveFluxCalculatorBase::_number_of_nodes
protectedinherited

◆ _pairs_to_receive

std::map<processor_id_type, std::vector<std::pair<dof_id_type, dof_id_type> > > AdvectiveFluxCalculatorBase::_pairs_to_receive
protectedinherited

_pairs_to_receive[proc_id] indicates the k(i, j) pairs that will be sent to us from proc_id _pairs_to_receive is first built (in buildCommLists()) using global node IDs, but after construction, a translation to sequential node IDs and the index of connections is performed, for efficiency.

The result is we will receive: _kij[_pairs_to_receive[proc_id][i].first][_pairs_to_receive[proc_id][i].second] from proc_id

Definition at line 235 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::buildCommLists(), and AdvectiveFluxCalculatorBase::exchangeGhostedInfo().

◆ _pairs_to_send

std::map<processor_id_type, std::vector<std::pair<dof_id_type, dof_id_type> > > AdvectiveFluxCalculatorBase::_pairs_to_send
protectedinherited

_pairs_to_send[proc_id] indicates the k(i, j) pairs that we will send to proc_id _pairs_to_send is first built (in buildCommLists()) using global node IDs, but after construction, a translation to sequential node IDs and the index of connections is performed, for efficiency.

The result is we will send: _kij[_pairs_to_send[proc_id][i].first][_pairs_to_send[proc_id][i+1].second] to proc_id

Definition at line 244 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::buildCommLists(), and AdvectiveFluxCalculatorBase::exchangeGhostedInfo().

◆ _perm_derivs

const bool PorousFlowAdvectiveFluxCalculatorBase::_perm_derivs
protectedinherited

Flag to check whether permeabiity derivatives are non-zero.

Definition at line 161 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::executeOnElement().

◆ _permeability

const MaterialProperty<RealTensorValue>& PorousFlowAdvectiveFluxCalculatorBase::_permeability
protectedinherited

◆ _phase

const unsigned int PorousFlowAdvectiveFluxCalculatorBase::_phase
protectedinherited

◆ _phi

const VariablePhiValue& PorousFlowAdvectiveFluxCalculatorBase::_phi
protectedinherited

◆ _relative_permeability

const MaterialProperty<std::vector<Real> >& PorousFlowAdvectiveFluxCalculatorUnsaturated::_relative_permeability
protected

Relative permeability of each phase.

Definition at line 38 of file PorousFlowAdvectiveFluxCalculatorUnsaturated.h.

Referenced by computedU_dvar(), and computeU().

◆ _resizing_needed

bool AdvectiveFluxCalculatorBase::_resizing_needed
protectedinherited

whether _kij, etc, need to be sized appropriately (and valence recomputed) at the start of the timestep

Definition at line 130 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::meshChanged(), AdvectiveFluxCalculatorBase::timestepSetup(), and PorousFlowAdvectiveFluxCalculatorBase::timestepSetup().

◆ _rM

std::vector<Real> AdvectiveFluxCalculatorBase::_rM
protectedinherited

◆ _rP

std::vector<Real> AdvectiveFluxCalculatorBase::_rP
protectedinherited

◆ _triples_to_receive

std::map<processor_id_type, std::vector<dof_id_type> > PorousFlowAdvectiveFluxCalculatorBase::_triples_to_receive
protectedinherited

_triples_to_receive[proc_id] indicates the dk(i, j)/du_nodal information that we will receive from proc_id.

_triples_to_receive is first built (in buildCommLists()) using global node IDs, but after construction, a translation to sequential node IDs and the index of connections is performed, for efficiency. The result is that, for i a multiple of 3, we will receive _dkij_dvar[_triples_to_receive[proc_id][i]][_triples_to_receive[proc_id][i + 1]][_triples_to_receive[proc_id][i + 2]][:] from processor proc_id

Definition at line 147 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::buildCommLists(), and PorousFlowAdvectiveFluxCalculatorBase::exchangeGhostedInfo().

◆ _triples_to_send

std::map<processor_id_type, std::vector<dof_id_type> > PorousFlowAdvectiveFluxCalculatorBase::_triples_to_send
protectedinherited

_triples_to_send[proc_id] indicates the dk(i, j)/du_nodal information that we will send to proc_id.

_triples_to_send is first built (in buildCommLists()) using global node IDs, but after construction, a translation to sequential node IDs and the index of connections is performed, for efficiency. The result is that, for i a multiple of 3, we will send _dkij_dvar[_triples_to_send[proc_id][i]][_triples_to_send[proc_id][i + 1]][_triples_to_send[proc_id][i + 2]][:] to processor proc_id

Definition at line 158 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::buildCommLists(), and PorousFlowAdvectiveFluxCalculatorBase::exchangeGhostedInfo().

◆ _u_nodal

std::vector<Real> AdvectiveFluxCalculatorBase::_u_nodal
protectedinherited

◆ _u_nodal_computed_by_thread

std::vector<bool> AdvectiveFluxCalculatorBase::_u_nodal_computed_by_thread
protectedinherited

_u_nodal_computed_by_thread(i) = true if _u_nodal[i] has been computed in execute() by the thread on this processor

Definition at line 201 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::execute(), AdvectiveFluxCalculatorBase::initialize(), AdvectiveFluxCalculatorBase::threadJoin(), and AdvectiveFluxCalculatorBase::timestepSetup().

◆ _valence

std::vector<unsigned> AdvectiveFluxCalculatorBase::_valence
protectedinherited

_valence[i] = number of times, in a loop over elements seen by this processor (viz, including ghost elements) and are part of the block-restricted blocks of this UserObject, that the sequential node i is encountered

Definition at line 195 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::getValence(), and AdvectiveFluxCalculatorBase::timestepSetup().


The documentation for this class was generated from the following files:
PorousFlowAdvectiveFluxCalculatorBase::_triples_to_send
std::map< processor_id_type, std::vector< dof_id_type > > _triples_to_send
_triples_to_send[proc_id] indicates the dk(i, j)/du_nodal information that we will send to proc_id.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:158
AdvectiveFluxCalculatorBase::_nodes_to_send
std::map< processor_id_type, std::vector< dof_id_type > > _nodes_to_send
_nodes_to_send[proc_id] = list of sequential nodal IDs.
Definition: AdvectiveFluxCalculatorBase.h:226
AdvectiveFluxCalculatorBase::threadJoin
virtual void threadJoin(const UserObject &uo) override
Definition: AdvectiveFluxCalculatorBase.C:251
PorousFlowAdvectiveFluxCalculatorBase::_fluid_density_qp
const MaterialProperty< std::vector< Real > > & _fluid_density_qp
Fluid density for each phase (at the qp)
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:99
AdvectiveFluxCalculatorBase::execute
virtual void execute() override
Definition: AdvectiveFluxCalculatorBase.C:218
AdvectiveFluxCalculatorBase::PQPlusMinusEnum::QPlus
AdvectiveFluxCalculatorBase::_nodes_to_receive
std::map< processor_id_type, std::vector< dof_id_type > > _nodes_to_receive
_nodes_to_receive[proc_id] = list of sequential nodal IDs.
Definition: AdvectiveFluxCalculatorBase.h:218
pow
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
Definition: ExpressionBuilder.h:673
AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum::MinMod
PorousFlowAdvectiveFluxCalculatorBase::getdK_dvar
const std::map< dof_id_type, std::vector< Real > > & getdK_dvar(dof_id_type node_i, dof_id_type node_j) const
Returns, r, where r[global node k][a] = d(K[node_i][node_j])/d(porous_flow_variable[global node k][po...
Definition: PorousFlowAdvectiveFluxCalculatorBase.C:239
PorousFlowConnectedNodes::globalConnectionsToSequentialID
const std::vector< dof_id_type > & globalConnectionsToSequentialID(dof_id_type sequential_node_ID) const
Return all the nodes (global node IDs) connected to the given sequential node ID.
Definition: PorousFlowConnectedNodes.C:153
AdvectiveFluxCalculatorBase::_flux_limiter_type
enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum _flux_limiter_type
PorousFlowAdvectiveFluxCalculatorBase::computedU_dvar
virtual Real computedU_dvar(unsigned i, unsigned pvar) const =0
Compute d(u)/d(porous_flow_variable)
PorousFlowAdvectiveFluxCalculatorSaturated::computedU_dvar
virtual Real computedU_dvar(unsigned i, unsigned pvar) const override
Compute d(u)/d(porous_flow_variable)
Definition: PorousFlowAdvectiveFluxCalculatorSaturated.C:64
AdvectiveFluxCalculatorBase::getdFluxOutdKjk
const std::vector< std::vector< Real > > & getdFluxOutdKjk(dof_id_type node_i) const
Returns r where r[j][k] = d(flux out of global node i)/dK[connected node j][connected node k] used in...
Definition: AdvectiveFluxCalculatorBase.C:737
PorousFlowAdvectiveFluxCalculatorBase::_du_dvar_computed_by_thread
std::vector< bool > _du_dvar_computed_by_thread
Whether _du_dvar has been computed by the local thread.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:126
PorousFlowConnectedNodes::numNodes
std::size_t numNodes() const
number of nodes known by this class
Definition: PorousFlowConnectedNodes.C:31
PorousFlowAdvectiveFluxCalculatorBase::_phi
const VariablePhiValue & _phi
Kuzmin-Turek shape function.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:117
AdvectiveFluxCalculatorBase::getdFluxOutdu
const std::map< dof_id_type, Real > & getdFluxOutdu(dof_id_type node_i) const
Returns r where r[j] = d(flux out of global node i)/du(global node j) used in Jacobian computations.
Definition: AdvectiveFluxCalculatorBase.C:731
AdvectiveFluxCalculatorBase::_dflux_out_du
std::vector< std::map< dof_id_type, Real > > _dflux_out_du
_dflux_out_du[i][j] = d(flux_out[i])/d(u[j]).
Definition: AdvectiveFluxCalculatorBase.h:183
AdvectiveFluxCalculatorBase::PQPlusMinus
Real PQPlusMinus(dof_id_type sequential_i, const PQPlusMinusEnum pq_plus_minus, std::vector< Real > &derivs, std::vector< Real > &dpq_dk) const
Returns the value of P_{i}^{+}, P_{i}^{-}, Q_{i}^{+} or Q_{i}^{-} (depending on pq_plus_minus) which ...
Definition: AdvectiveFluxCalculatorBase.C:764
AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum::superbee
AdvectiveFluxCalculatorBase::executeOnElement
virtual void executeOnElement(dof_id_type global_i, dof_id_type global_j, unsigned local_i, unsigned local_j, unsigned qp)
This is called by multiple times in execute() in a double loop over _current_elem's nodes (local_i an...
Definition: AdvectiveFluxCalculatorBase.C:241
PorousFlowConnectedNodes::sequentialConnectionsToSequentialID
const std::vector< dof_id_type > & sequentialConnectionsToSequentialID(dof_id_type sequential_node_ID) const
Return all the nodes (sequential node IDs) connected to the given sequential node ID All elements of ...
Definition: PorousFlowConnectedNodes.C:133
AdvectiveFluxCalculatorBase::_number_of_nodes
std::size_t _number_of_nodes
Number of nodes held by the _connections object.
Definition: AdvectiveFluxCalculatorBase.h:207
PorousFlowAdvectiveFluxCalculatorBase::_dflux_out_dvars
std::vector< std::map< dof_id_type, std::vector< Real > > > _dflux_out_dvars
_dflux_out_dvars[sequential_i][global_j][pvar] = d(flux_out[global version of sequential_i])/d(porous...
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:136
PorousFlowAdvectiveFluxCalculatorSaturated::PorousFlowAdvectiveFluxCalculatorSaturated
PorousFlowAdvectiveFluxCalculatorSaturated(const InputParameters &parameters)
Definition: PorousFlowAdvectiveFluxCalculatorSaturated.C:33
AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum::VanLeer
AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum::MC
AdvectiveFluxCalculatorBase::buildCommLists
virtual void buildCommLists()
When using multiple processors, other processors will compute:
Definition: AdvectiveFluxCalculatorBase.C:850
PorousFlowConnectedNodes::indexOfSequentialConnection
unsigned indexOfSequentialConnection(dof_id_type sequential_node_ID_from, dof_id_type sequential_node_ID_to) const
Return the index of sequential_node_ID_to in the sequentialConnectionsToSequentialID(sequential_node_...
Definition: PorousFlowConnectedNodes.C:189
PorousFlowAdvectiveFluxCalculatorBase::_grad_p
const MaterialProperty< std::vector< RealGradient > > & _grad_p
Gradient of the pore pressure in each phase.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:105
AdvectiveFluxCalculatorBase::timestepSetup
virtual void timestepSetup() override
Definition: AdvectiveFluxCalculatorBase.C:81
PorousFlowAdvectiveFluxCalculatorBase::_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: PorousFlowAdvectiveFluxCalculatorBase.h:102
AdvectiveFluxCalculatorBase::_u_nodal
std::vector< Real > _u_nodal
_u_nodal[i] = value of _u at sequential node number i
Definition: AdvectiveFluxCalculatorBase.h:198
AdvectiveFluxCalculatorBase::finalize
virtual void finalize() override
Definition: AdvectiveFluxCalculatorBase.C:270
AdvectiveFluxCalculatorBase::exchangeGhostedInfo
virtual void exchangeGhostedInfo()
Sends and receives multi-processor information regarding u_nodal and k_ij.
Definition: AdvectiveFluxCalculatorBase.C:968
AdvectiveFluxCalculatorBase::_my_pid
processor_id_type _my_pid
processor ID of this object
Definition: AdvectiveFluxCalculatorBase.h:210
AdvectiveFluxCalculatorBase::_connections
PorousFlowConnectedNodes _connections
Holds the sequential and global nodal IDs, and info regarding mesh connections between them.
Definition: AdvectiveFluxCalculatorBase.h:204
PorousFlowAdvectiveFluxCalculatorBase::_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: PorousFlowAdvectiveFluxCalculatorBase.h:108
AdvectiveFluxCalculatorBase::_resizing_needed
bool _resizing_needed
whether _kij, etc, need to be sized appropriately (and valence recomputed) at the start of the timest...
Definition: AdvectiveFluxCalculatorBase.h:130
AdvectiveFluxCalculatorBase::initialize
virtual void initialize() override
Definition: AdvectiveFluxCalculatorBase.C:207
PorousFlowAdvectiveFluxCalculatorBase::_num_vars
const unsigned _num_vars
Number of PorousFlow variables.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:81
PorousFlowConnectedNodes::indexOfGlobalConnection
unsigned indexOfGlobalConnection(dof_id_type global_node_ID_from, dof_id_type global_node_ID_to) const
Return the index of global_node_ID_to in the globalConnectionsToGlobalID(global_node_ID_from) vector.
Definition: PorousFlowConnectedNodes.C:172
PorousFlowConnectedNodes::globalConnectionsToGlobalID
const std::vector< dof_id_type > & globalConnectionsToGlobalID(dof_id_type global_node_ID) const
Return all the nodes (global node IDs) connected to the given global node ID.
Definition: PorousFlowConnectedNodes.C:143
PorousFlowAdvectiveFluxCalculatorBase::_dgrad_p_dvar
const MaterialProperty< std::vector< std::vector< RealGradient > > > & _dgrad_p_dvar
Derivative of Grad porepressure in each phase wrt PorousFlow variables.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:111
PorousFlowAdvectiveFluxCalculatorUnsaturated::_drelative_permeability_dvar
const MaterialProperty< std::vector< std::vector< Real > > > & _drelative_permeability_dvar
Derivative of relative permeability of each phase wrt PorousFlow variables.
Definition: PorousFlowAdvectiveFluxCalculatorUnsaturated.h:41
AdvectiveFluxCalculatorBase::limitFlux
void limitFlux(Real a, Real b, Real &limited, Real &dlimited_db) const
flux limiter, L, on Page 135 of Kuzmin and Turek
Definition: AdvectiveFluxCalculatorBase.C:631
AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum::None
PorousFlowAdvectiveFluxCalculatorBase::_dkij_dvar
std::vector< std::vector< std::map< dof_id_type, std::vector< Real > > > > _dkij_dvar
_dkij_dvar[sequential_i][j][global_k][a] = d(K[sequential_i][j])/d(porous_flow_variable[global_k][por...
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:133
PorousFlowAdvectiveFluxCalculatorBase::_gravity
const RealVectorValue _gravity
Gravity.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:84
AdvectiveFluxCalculatorBase::_kij
std::vector< std::vector< Real > > _kij
Kuzmin-Turek K_ij matrix.
Definition: AdvectiveFluxCalculatorBase.h:176
PorousFlowConnectedNodes::sequentialID
dof_id_type sequentialID(dof_id_type global_node_ID) const
Return the sequential node ID corresponding to the global node ID This is guaranteed to lie in the ra...
Definition: PorousFlowConnectedNodes.C:87
PorousFlowAdvectiveFluxCalculatorBase::_grad_phi
const VariablePhiGradient & _grad_phi
grad(Kuzmin-Turek shape function)
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:120
PorousFlowAdvectiveFluxCalculatorBase::_phase
const unsigned int _phase
The phase.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:87
PorousFlowAdvectiveFluxCalculatorBase::_dpermeability_dgradvar
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dpermeability_dgradvar
d(permeabiity)/d(grad(PorousFlow variable))
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:96
PorousFlowAdvectiveFluxCalculatorBase
Base class to compute the advective flux of fluid in PorousFlow situations using the Kuzmin-Turek FEM...
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:32
AdvectiveFluxCalculatorBase::_flux_out
std::vector< Real > _flux_out
_flux_out[i] = flux of "heat" from sequential node i
Definition: AdvectiveFluxCalculatorBase.h:179
PorousFlowConnectedNodes::globalIDs
const std::vector< dof_id_type > & globalIDs() const
Vector of all global node IDs (node numbers in the mesh)
Definition: PorousFlowConnectedNodes.C:163
PorousFlowAdvectiveFluxCalculatorBase::_dpermeability_dvar
const MaterialProperty< std::vector< RealTensorValue > > & _dpermeability_dvar
d(permeabiity)/d(PorousFlow variable)
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:93
PorousFlowAdvectiveFluxCalculatorBase::_du_dvar
std::vector< std::vector< Real > > _du_dvar
_du_dvar[sequential_i][a] = d(u[global version of sequential node i])/d(porous_flow_variable[a])
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:123
PorousFlowAdvectiveFluxCalculatorBase::_triples_to_receive
std::map< processor_id_type, std::vector< dof_id_type > > _triples_to_receive
_triples_to_receive[proc_id] indicates the dk(i, j)/du_nodal information that we will receive from pr...
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:147
AdvectiveFluxCalculatorBase::PQPlusMinusEnum::PPlus
AdvectiveFluxCalculatorBase::PQPlusMinusEnum::PMinus
AdvectiveFluxCalculatorBase::_dflux_out_dKjk
std::vector< std::vector< std::vector< Real > > > _dflux_out_dKjk
_dflux_out_dKjk[sequential_i][j][k] = d(flux_out[sequential_i])/d(K[j][k]).
Definition: AdvectiveFluxCalculatorBase.h:190
PorousFlowAdvectiveFluxCalculatorUnsaturated::_relative_permeability
const MaterialProperty< std::vector< Real > > & _relative_permeability
Relative permeability of each phase.
Definition: PorousFlowAdvectiveFluxCalculatorUnsaturated.h:38
AdvectiveFluxCalculatorBase::PQPlusMinusEnum::QMinus
PorousFlowAdvectiveFluxCalculatorSaturated::computeU
virtual Real computeU(unsigned i) const override
Computes the value of u at the local node id of the current element (_current_elem)
Definition: PorousFlowAdvectiveFluxCalculatorSaturated.C:51
PorousFlowAdvectiveFluxCalculatorBase::_perm_derivs
const bool _perm_derivs
Flag to check whether permeabiity derivatives are non-zero.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:161
AdvectiveFluxCalculatorBase::_valence
std::vector< unsigned > _valence
_valence[i] = number of times, in a loop over elements seen by this processor (viz,...
Definition: AdvectiveFluxCalculatorBase.h:195
PorousFlowAdvectiveFluxCalculatorBase::_permeability
const MaterialProperty< RealTensorValue > & _permeability
Permeability of porous material.
Definition: PorousFlowAdvectiveFluxCalculatorBase.h:90