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

Computes the advective flux of heat energy in a given phase, assuming unsaturated conditions. More...

#include <PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat.h>

Inheritance diagram for PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat:
[legend]

Public Member Functions

 PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat (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::map< dof_id_type, std::map< dof_id_type, Real > > & getdFluxOutdKjk (dof_id_type node_i) const
 Returns r where r[j] = d(flux out of global node i)/dK[global node j][global node k] used in Jacobian computations. More...
 
unsigned getValence (dof_id_type node_i, dof_id_type node_j) const
 Returns the valence of the i-j edge. 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::vector< Real > & getdU_dvar (dof_id_type node_i) const
 Returns _du_dvar[node_i] which is the set of derivatives d(u)/d(porous_flow_variable) This will have been computed during execute() by computedU_dvar() More...
 
bool getdU_dvarComputedByThread (dof_id_type node_i) const
 Returns _du_dvar_computed_by_thread[node_i] This is initialized to false in initialize() and potentially set to true during execute() 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]) param node_i global node id param node_j global node id. 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 node_i, std::map< dof_id_type, Real > &dlimited_du, std::map< dof_id_type, Real > &dlimited_dk) const
 Returns the value of R_{i}^{+}, Eqn (49) of KT. More...
 
Real rMinus (dof_id_type node_i, std::map< dof_id_type, Real > &dlimited_du, std::map< dof_id_type, Real > &dlimited_dk) const
 Returns the value of R_{i}^{-}, Eqn (49) of KT. More...
 
Real getKij (dof_id_type node_i, dof_id_type node_j) const
 Returns the value of k_ij as computed by KT Eqns (18)-(20). More...
 
Real PQPlusMinus (dof_id_type node_i, const PQPlusMinusEnum pq_plus_minus, std::map< dof_id_type, Real > &derivs, std::map< dof_id_type, 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...
 
Real getUnodal (dof_id_type node_i) const
 Returns the value of u at the global id node_i. More...
 
bool getUnodalComputedByThread (dof_id_type node_i) const
 Returns the value of _u_nodal_computed_by_thread at the global id 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 MaterialProperty< std::vector< Real > > & _enthalpy
 Enthalpy of each phase. More...
 
const MaterialProperty< std::vector< std::vector< Real > > > & _denthalpy_dvar
 Derivative of enthalpy 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::map< dof_id_type, std::vector< Real > > _du_dvar
 _du_dvar[i][a] = d(u[global node i])/d(porous_flow_variable[a]) More...
 
std::map< dof_id_type, bool > _du_dvar_computed_by_thread
 Whether _du_dvar has been computed by the local thread. More...
 
std::map< dof_id_type, std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > > _dkij_dvar
 _dkij_dvar[i][j][k][a] = d(K[global node i][global node j])/d(porous_flow_variable[global_node k][porous_flow_variable a]) More...
 
std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > _dflux_out_dvars
 _dflux_out_dvars[i][j][pvar] = d(flux_out[global node i])/d(porous_flow_variable pvar at global node j) 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::map< dof_id_type, std::map< dof_id_type, Real > > _kij
 Kuzmin-Turek K_ij matrix. More...
 
std::map< dof_id_type, Real > _flux_out
 _flux_out[i] = flux of "heat" from node i More...
 
std::map< dof_id_type, std::map< dof_id_type, Real > > _dflux_out_du
 _dflux_out_du[i][j] = d(flux_out[i])/d(u[j]). Here j must be connected to i, or to a node that is connected to i. More...
 
std::map< dof_id_type, std::map< dof_id_type, std::map< dof_id_type, Real > > > _dflux_out_dKjk
 _dflux_out_dKjk[i][j][k] = d(flux_out[i])/d(K[j][k]). Here j must be connected to i (this does include j = i), and k must be connected to j (this does include k = i and k = j) More...
 
std::map< std::pair< dof_id_type, dof_id_type >, unsigned > _valence
 _valence[(i, j)] = 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 i-j edge is encountered More...
 
std::map< dof_id_type, Real > _u_nodal
 _u_nodal[i] = value of _u at global node number i More...
 
std::map< dof_id_type, 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...
 

Detailed Description

Computes the advective flux of heat energy in a 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 * enthalpy * relative_permeability / viscosity) * (- permeability * (grad(P) - density * gravity))

Definition at line 28 of file PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat.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 162 of file AdvectiveFluxCalculatorBase.h.

162 { MinMod, VanLeer, MC, superbee, None } _flux_limiter_type;
enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum _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 193 of file AdvectiveFluxCalculatorBase.h.

194  {
195  PPlus,
196  PMinus,
197  QPlus,
198  QMinus
199  };

Constructor & Destructor Documentation

◆ PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat()

PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat::PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat ( const InputParameters &  parameters)

Definition at line 27 of file PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat.C.

31  getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_nodal")),
32  _drelative_permeability_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
33  "dPorousFlow_relative_permeability_nodal_dvar"))
34 {
35 }
const MaterialProperty< std::vector< std::vector< Real > > > & _drelative_permeability_dvar
Derivative of relative permeability of each phase wrt PorousFlow variables.
const MaterialProperty< std::vector< Real > > & _relative_permeability
Relative permeability of each phase.

Member Function Documentation

◆ computedU_dvar()

Real PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat::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 PorousFlowAdvectiveFluxCalculatorSaturatedHeat.

Definition at line 45 of file PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat.C.

46 {
47  Real du = _drelative_permeability_dvar[i][_phase][pvar] *
49  du += _relative_permeability[i][_phase] *
51  return du;
52 }
const MaterialProperty< std::vector< std::vector< Real > > > & _drelative_permeability_dvar
Derivative of relative permeability of each phase wrt PorousFlow variables.
virtual Real computeU(unsigned i) const override
Computes the value of u at the local node id of the current element (_current_elem) ...
const MaterialProperty< std::vector< Real > > & _relative_permeability
Relative permeability of each phase.
virtual Real computedU_dvar(unsigned i, unsigned pvar) const override
Compute d(u)/d(porous_flow_variable)

◆ computeU()

Real PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat::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 PorousFlowAdvectiveFluxCalculatorSaturatedHeat.

Definition at line 38 of file PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat.C.

39 {
40  return _relative_permeability[i][_phase] *
42 }
virtual Real computeU(unsigned i) const override
Computes the value of u at the local node id of the current element (_current_elem) ...
const MaterialProperty< std::vector< Real > > & _relative_permeability
Relative permeability of each phase.

◆ 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 91 of file PorousFlowAdvectiveFluxCalculatorBase.C.

92 {
93  // The following is but one choice for PorousFlow situations
94  // If you change this, you will probably have to change
95  // - the derivative in executeOnElement
96  // - computeU
97  // - coputedU_dvar
98  return -_grad_phi[i][qp] *
100  _phi[j][qp];
101 }
const MaterialProperty< RealTensorValue > & _permeability
Permeability of porous material.
const VariablePhiGradient & _grad_phi
grad(Kuzmin-Turek shape function)
const VariablePhiValue & _phi
Kuzmin-Turek shape function.
const MaterialProperty< std::vector< RealGradient > > & _grad_p
Gradient of the pore pressure in each phase.
const MaterialProperty< std::vector< Real > > & _fluid_density_qp
Fluid density for each phase (at the qp)

◆ execute()

void PorousFlowAdvectiveFluxCalculatorBase::execute ( )
overrideprotectedvirtualinherited

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 187 of file PorousFlowAdvectiveFluxCalculatorBase.C.

188 {
190 
191  // compute d(U)/d(porous_flow_variables) for nodes in _current_elem and for this
192  // execution thread. In threadJoin all these computations get gathered
193  // using _du_dvar_computed_by_thread
194  for (unsigned i = 0; i < _current_elem->n_nodes(); ++i)
195  {
196  const dof_id_type node_i = _current_elem->node_id(i);
197  if (_du_dvar_computed_by_thread[node_i])
198  continue;
199  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
200  _du_dvar[node_i][pvar] = computedU_dvar(i, pvar);
201  _du_dvar_computed_by_thread[node_i] = true;
202  }
203 }
virtual Real computedU_dvar(unsigned i, unsigned pvar) const =0
Compute d(u)/d(porous_flow_variable)
std::map< dof_id_type, bool > _du_dvar_computed_by_thread
Whether _du_dvar has been computed by the local thread.
const unsigned _num_vars
Number of PorousFlow variables.
std::map< dof_id_type, std::vector< Real > > _du_dvar
_du_dvar[i][a] = d(u[global node i])/d(porous_flow_variable[a])

◆ 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 104 of file PorousFlowAdvectiveFluxCalculatorBase.C.

106 {
107  AdvectiveFluxCalculatorBase::executeOnElement(global_i, global_j, local_i, local_j, qp);
108 
109  // compute d(Kij)/d(porous_flow_variables)
110  for (unsigned local_k = 0; local_k < _current_elem->n_nodes(); ++local_k)
111  {
112  const dof_id_type global_k = _current_elem->node_id(local_k);
113  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
114  {
115  RealVectorValue deriv = _dpermeability_dvar[qp][pvar] * _phi[local_k][qp] *
117  for (unsigned i = 0; i < LIBMESH_DIM; ++i)
118  deriv += _dpermeability_dgradvar[qp][i][pvar] * _grad_phi[local_k][qp](i) *
120  deriv += _permeability[qp] *
121  (_grad_phi[local_k][qp] * _dgrad_p_dgrad_var[qp][_phase][pvar] -
122  _phi[local_k][qp] * _dfluid_density_qp_dvar[qp][_phase][pvar] * _gravity);
123  deriv += _permeability[qp] * (_dgrad_p_dvar[qp][_phase][pvar] * _phi[local_k][qp]);
124  _dkij_dvar[global_i][global_j][global_k][pvar] +=
125  _JxW[qp] * _coord[qp] * (-_grad_phi[local_i][qp] * deriv * _phi[local_j][qp]);
126  }
127  }
128 }
const MaterialProperty< RealTensorValue > & _permeability
Permeability of porous material.
const VariablePhiGradient & _grad_phi
grad(Kuzmin-Turek shape function)
const MaterialProperty< std::vector< std::vector< RealTensorValue > > > & _dpermeability_dgradvar
d(permeabiity)/d(grad(PorousFlow variable))
const VariablePhiValue & _phi
Kuzmin-Turek shape function.
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&#39;s nodes (local_i an...
const MaterialProperty< std::vector< RealTensorValue > > & _dpermeability_dvar
d(permeabiity)/d(PorousFlow variable)
const MaterialProperty< std::vector< RealGradient > > & _grad_p
Gradient of the pore pressure in each phase.
const MaterialProperty< std::vector< Real > > & _fluid_density_qp
Fluid density for each phase (at the qp)
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) ...
const MaterialProperty< std::vector< std::vector< Real > > > & _dgrad_p_dgrad_var
Derivative of Grad porepressure in each phase wrt grad(PorousFlow variables)
const unsigned _num_vars
Number of PorousFlow variables.
const MaterialProperty< std::vector< std::vector< RealGradient > > > & _dgrad_p_dvar
Derivative of Grad porepressure in each phase wrt PorousFlow variables.
std::map< dof_id_type, std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > > _dkij_dvar
_dkij_dvar[i][j][k][a] = d(K[global node i][global node j])/d(porous_flow_variable[global_node k][por...

◆ finalize()

void PorousFlowAdvectiveFluxCalculatorBase::finalize ( )
overrideprotectedvirtualinherited

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 284 of file PorousFlowAdvectiveFluxCalculatorBase.C.

285 {
287 
288  // compute d(flux_out)/d(porous flow variable)
289  for (auto & nodes : _kij)
290  {
291  const dof_id_type node_i = nodes.first;
292  _dflux_out_dvars[node_i].clear();
293 
294  const std::map<dof_id_type, Real> dflux_out_du =
296  for (const auto & node_du : dflux_out_du)
297  {
298  const dof_id_type j = node_du.first;
299  const Real dflux_out_du_j = node_du.second;
300  _dflux_out_dvars[node_i][j] = getdU_dvar(j);
301  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
302  _dflux_out_dvars[node_i][j][pvar] *= dflux_out_du_j;
303  }
304 
305  // _dflux_out_dvars is now sized correctly, because getdFluxOutdu(i) contains all nodes
306  // connected to i and all nodes connected to nodes connected to i. The
307  // getdFluxOutdKij contains no extra nodes, so just += the dflux/dK terms
308  const std::map<dof_id_type, std::map<dof_id_type, Real>> dflux_out_dKjk =
310  for (const auto & nodes : dflux_out_dKjk)
311  {
312  const dof_id_type j = nodes.first;
313  for (const auto & node_du : nodes.second)
314  {
315  const dof_id_type k = node_du.first;
316  const Real dflux_out_dK_jk = node_du.second;
317  const std::map<dof_id_type, std::vector<Real>> dkj_dvarl = getdK_dvar(j, k);
318  for (const auto & nodel_deriv : dkj_dvarl)
319  {
320  const dof_id_type l = nodel_deriv.first;
321  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
322  _dflux_out_dvars[node_i][l][pvar] += dflux_out_dK_jk * nodel_deriv.second[pvar];
323  }
324  }
325  }
326  }
327 }
const std::vector< Real > & getdU_dvar(dof_id_type node_i) const
Returns _du_dvar[node_i] which is the set of derivatives d(u)/d(porous_flow_variable) This will have ...
std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > _dflux_out_dvars
_dflux_out_dvars[i][j][pvar] = d(flux_out[global node i])/d(porous_flow_variable pvar at global node ...
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...
std::map< dof_id_type, std::map< dof_id_type, Real > > _kij
Kuzmin-Turek K_ij matrix.
const unsigned _num_vars
Number of PorousFlow variables.
const std::map< dof_id_type, std::map< dof_id_type, Real > > & getdFluxOutdKjk(dof_id_type node_i) const
Returns r where r[j] = d(flux out of global node i)/dK[global node j][global node k] used in Jacobian...
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...

◆ 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 274 of file PorousFlowAdvectiveFluxCalculatorBase.C.

Referenced by PorousFlowFluxLimitedTVDAdvection::computeJacobian().

275 {
276  const auto & row_find = _dflux_out_dvars.find(node_id);
277  if (row_find == _dflux_out_dvars.end())
278  mooseError("PorousFlowAdvectiveFluxCalculatorBase UserObject " + name() +
279  " _dflux_out_dvars does not contain node " + Moose::stringify(node_id));
280  return row_find->second;
281 }
std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > _dflux_out_dvars
_dflux_out_dvars[i][j][pvar] = d(flux_out[global node i])/d(porous_flow_variable pvar at global node ...
const std::string name
Definition: Setup.h:22

◆ getdFluxOutdKjk()

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

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

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

Definition at line 723 of file AdvectiveFluxCalculatorBase.C.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::finalize().

724 {
725  const auto & row_find = _dflux_out_dKjk.find(node_i);
726  if (row_find == _dflux_out_dKjk.end())
727  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() +
728  " _dflux_out_dKjk does not contain node " + Moose::stringify(node_i));
729  return row_find->second;
730 }
std::map< dof_id_type, std::map< dof_id_type, std::map< dof_id_type, Real > > > _dflux_out_dKjk
_dflux_out_dKjk[i][j][k] = d(flux_out[i])/d(K[j][k]). Here j must be connected to i (this does includ...
const std::string name
Definition: Setup.h:22

◆ 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 713 of file AdvectiveFluxCalculatorBase.C.

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

714 {
715  const auto & row_find = _dflux_out_du.find(node_i);
716  if (row_find == _dflux_out_du.end())
717  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() +
718  " _dflux_out_du does not contain node " + Moose::stringify(node_i));
719  return row_find->second;
720 }
const std::string name
Definition: Setup.h:22
std::map< dof_id_type, std::map< dof_id_type, Real > > _dflux_out_du
_dflux_out_du[i][j] = d(flux_out[i])/d(u[j]). Here j must be connected to i, or to a node that is con...

◆ 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]) param node_i global node id param node_j global node id.

Definition at line 257 of file PorousFlowAdvectiveFluxCalculatorBase.C.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::finalize().

258 {
259  const auto & row_find = _dkij_dvar.find(node_i);
260  if (row_find == _dkij_dvar.end())
261  mooseError("PorousFlowAdvectiveFluxCalculatorBase UserObject " + name() +
262  " _dkij_dvar does not contain node " + Moose::stringify(node_i));
263  const std::map<dof_id_type, std::map<dof_id_type, std::vector<Real>>> & dkij_dvar_row =
264  row_find->second;
265  const auto & column_find = dkij_dvar_row.find(node_j);
266  if (column_find == dkij_dvar_row.end())
267  mooseError("PorousFlowAdvectiveFluxCalculatorBase UserObject " + name() +
268  " _dkij_dvar on row " + Moose::stringify(node_i) + " does not contain node " +
269  Moose::stringify(node_j));
270  return column_find->second;
271 }
const std::string name
Definition: Setup.h:22
std::map< dof_id_type, std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > > _dkij_dvar
_dkij_dvar[i][j][k][a] = d(K[global node i][global node j])/d(porous_flow_variable[global_node k][por...

◆ getdU_dvar()

const std::vector< Real > & PorousFlowAdvectiveFluxCalculatorBase::getdU_dvar ( dof_id_type  node_i) const
protectedinherited

Returns _du_dvar[node_i] which is the set of derivatives d(u)/d(porous_flow_variable) This will have been computed during execute() by computedU_dvar()

Parameters
node_iglobal node id

Definition at line 237 of file PorousFlowAdvectiveFluxCalculatorBase.C.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::finalize().

238 {
239  const auto & node_du = _du_dvar.find(node_i);
240  if (node_du == _du_dvar.end())
241  mooseError("PorousFlowAdvectiveFluxCalculatorBase UserObject " + name() +
242  " _du_dvar does not contain node " + Moose::stringify(node_i));
243  return node_du->second;
244 }
const std::string name
Definition: Setup.h:22
std::map< dof_id_type, std::vector< Real > > _du_dvar
_du_dvar[i][a] = d(u[global node i])/d(porous_flow_variable[a])

◆ getdU_dvarComputedByThread()

bool PorousFlowAdvectiveFluxCalculatorBase::getdU_dvarComputedByThread ( dof_id_type  node_i) const
protectedinherited

Returns _du_dvar_computed_by_thread[node_i] This is initialized to false in initialize() and potentially set to true during execute()

Parameters
node_iglobal node id

Definition at line 247 of file PorousFlowAdvectiveFluxCalculatorBase.C.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::threadJoin().

248 {
249  const auto & node_du = _du_dvar_computed_by_thread.find(node_i);
250  if (node_du == _du_dvar_computed_by_thread.end())
251  mooseError("PorousFlowAdvectiveFluxCalculatorBase UserObject " + name() +
252  " _du_dvar_computed_by_thread does not contain node " + Moose::stringify(node_i));
253  return node_du->second;
254 }
std::map< dof_id_type, bool > _du_dvar_computed_by_thread
Whether _du_dvar has been computed by the local thread.
const std::string name
Definition: Setup.h:22

◆ 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 733 of file AdvectiveFluxCalculatorBase.C.

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

734 {
735  const auto & entry_find = _flux_out.find(node_i);
736  if (entry_find == _flux_out.end())
737  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() +
738  " _flux_out does not contain node " + Moose::stringify(node_i));
739  return entry_find->second;
740 }
const std::string name
Definition: Setup.h:22
std::map< dof_id_type, Real > _flux_out
_flux_out[i] = flux of "heat" from node i

◆ getKij()

Real AdvectiveFluxCalculatorBase::getKij ( dof_id_type  node_i,
dof_id_type  node_j 
) const
protectedinherited

Returns the value of k_ij as computed by KT Eqns (18)-(20).

Parameters
node_iid of i^th node
node_jid of j^th node
Returns
k_ij of KT

Definition at line 696 of file AdvectiveFluxCalculatorBase.C.

697 {
698 
699  const auto & row_find = _kij.find(node_i);
700  if (row_find == _kij.end())
701  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() + " Kij does not contain node " +
702  Moose::stringify(node_i));
703  const std::map<dof_id_type, Real> & kij_row = row_find->second;
704  const auto & entry_find = kij_row.find(node_j);
705  if (entry_find == kij_row.end())
706  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() + " Kij on row " +
707  Moose::stringify(node_i) + " does not contain node " + Moose::stringify(node_j));
708 
709  return entry_find->second;
710 }
const std::string name
Definition: Setup.h:22
std::map< dof_id_type, std::map< dof_id_type, Real > > _kij
Kuzmin-Turek K_ij matrix.

◆ getUnodal()

Real AdvectiveFluxCalculatorBase::getUnodal ( dof_id_type  node_i) const
protectedinherited

Returns the value of u at the global id node_i.

This is _u_nodal[node_i] that has been computed by computeU during execute()

Parameters
node_iglobal node id

Definition at line 853 of file AdvectiveFluxCalculatorBase.C.

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

854 {
855  const auto & node_u = _u_nodal.find(node_i);
856  if (node_u == _u_nodal.end())
857  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() +
858  " _u_nodal does not contain node " + Moose::stringify(node_i));
859  return node_u->second;
860 }
std::map< dof_id_type, Real > _u_nodal
_u_nodal[i] = value of _u at global node number i
const std::string name
Definition: Setup.h:22

◆ getUnodalComputedByThread()

bool AdvectiveFluxCalculatorBase::getUnodalComputedByThread ( dof_id_type  node_i) const
protectedinherited

Returns the value of _u_nodal_computed_by_thread at the global id node_i.

This will have been initialized to false in initialize() and potentially set true during execute()

Parameters
node_iglobal node id

Definition at line 863 of file AdvectiveFluxCalculatorBase.C.

Referenced by AdvectiveFluxCalculatorBase::threadJoin().

864 {
865  const auto & node_u = _u_nodal_computed_by_thread.find(node_i);
866  if (node_u == _u_nodal_computed_by_thread.end())
867  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() +
868  " _u_nodal_computed_by_thread does not contain node " + Moose::stringify(node_i));
869  return node_u->second;
870 }
const std::string name
Definition: Setup.h:22
std::map< dof_id_type, 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 ...

◆ getValence()

unsigned AdvectiveFluxCalculatorBase::getValence ( dof_id_type  node_i,
dof_id_type  node_j 
) const
inherited

Returns the valence of the i-j edge.

Valence is the number of times the edge 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_iid of i^th node
node_jid of j^th node
Returns
valence of the i-j edge

Definition at line 743 of file AdvectiveFluxCalculatorBase.C.

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

744 {
745  const std::pair<dof_id_type, dof_id_type> i_j(node_i, node_j);
746  const auto & entry_find = _valence.find(i_j);
747  if (entry_find == _valence.end())
748  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() +
749  " Valence does not contain node-pair " + Moose::stringify(node_i) + " to " +
750  Moose::stringify(node_j));
751  return entry_find->second;
752 }
const std::string name
Definition: Setup.h:22
std::map< std::pair< dof_id_type, dof_id_type >, unsigned > _valence
_valence[(i, j)] = number of times, in a loop over elements seen by this processor (viz...

◆ initialize()

void PorousFlowAdvectiveFluxCalculatorBase::initialize ( )
overrideprotectedvirtualinherited

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 175 of file PorousFlowAdvectiveFluxCalculatorBase.C.

176 {
178  for (const auto & nodes : _kij)
179  _du_dvar_computed_by_thread[nodes.first] = false;
180  for (auto & i_and_jmap : _dkij_dvar)
181  for (auto & j_and_kmap : i_and_jmap.second)
182  for (auto & k_and_derivs : j_and_kmap.second)
183  k_and_derivs.second = std::vector<Real>(_num_vars, 0.0);
184 }
std::map< dof_id_type, bool > _du_dvar_computed_by_thread
Whether _du_dvar has been computed by the local thread.
std::map< dof_id_type, std::map< dof_id_type, Real > > _kij
Kuzmin-Turek K_ij matrix.
const unsigned _num_vars
Number of PorousFlow variables.
std::map< dof_id_type, std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > > _dkij_dvar
_dkij_dvar[i][j][k][a] = d(K[global node i][global node j])/d(porous_flow_variable[global_node k][por...

◆ 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 596 of file AdvectiveFluxCalculatorBase.C.

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

597 {
598  limited = 0.0;
599  dlimited_db = 0.0;
601  return;
602 
603  if ((a >= 0.0 && b <= 0.0) || (a <= 0.0 && b >= 0.0))
604  return;
605  const Real s = (a > 0.0 ? 1.0 : -1.0);
606 
607  const Real lal = std::abs(a);
608  const Real lbl = std::abs(b);
609  const Real dlbl = (b >= 0.0 ? 1.0 : -1.0); // d(lbl)/db
610  switch (_flux_limiter_type)
611  {
613  {
614  if (lal <= lbl)
615  {
616  limited = s * lal;
617  dlimited_db = 0.0;
618  }
619  else
620  {
621  limited = s * lbl;
622  dlimited_db = s * dlbl;
623  }
624  return;
625  }
627  {
628  limited = s * 2 * lal * lbl / (lal + lbl);
629  dlimited_db = s * 2 * lal * (dlbl / (lal + lbl) - lbl * dlbl / std::pow(lal + lbl, 2));
630  return;
631  }
633  {
634  const Real av = 0.5 * std::abs(a + b);
635  if (2 * lal <= av && lal <= lbl)
636  {
637  // 2 * lal is the smallest
638  limited = s * 2.0 * lal;
639  dlimited_db = 0.0;
640  }
641  else if (2 * lbl <= av && lbl <= lal)
642  {
643  // 2 * lbl is the smallest
644  limited = s * 2.0 * lbl;
645  dlimited_db = s * 2.0 * dlbl;
646  }
647  else
648  {
649  // av is the smallest
650  limited = s * av;
651  // if (a>0 and b>0) then d(av)/db = 0.5 = 0.5 * dlbl
652  // if (a<0 and b<0) then d(av)/db = -0.5 = 0.5 * dlbl
653  // if a and b have different sign then limited=0, above
654  dlimited_db = s * 0.5 * dlbl;
655  }
656  return;
657  }
659  {
660  const Real term1 = std::min(2.0 * lal, lbl);
661  const Real term2 = std::min(lal, 2.0 * lbl);
662  if (term1 >= term2)
663  {
664  if (2.0 * lal <= lbl)
665  {
666  limited = s * 2 * lal;
667  dlimited_db = 0.0;
668  }
669  else
670  {
671  limited = s * lbl;
672  dlimited_db = s * dlbl;
673  }
674  }
675  else
676  {
677  if (lal <= 2.0 * lbl)
678  {
679  limited = s * lal;
680  dlimited_db = 0.0;
681  }
682  else
683  {
684  limited = s * 2.0 * lbl;
685  dlimited_db = s * 2.0 * dlbl;
686  }
687  }
688  return;
689  }
690  default:
691  return;
692  }
693 }
enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum _flux_limiter_type
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)

◆ meshChanged()

void AdvectiveFluxCalculatorBase::meshChanged ( )
overridevirtualinherited

Definition at line 149 of file AdvectiveFluxCalculatorBase.C.

150 {
151  ElementUserObject::meshChanged();
152 
153  // Signal that _kij, _valence, etc need to be rebuilt
154  _resizing_needed = true;
155 }
bool _resizing_needed
whether _kij, etc, need to be sized appropriately (and valence recomputed) at the start of the timest...

◆ PQPlusMinus()

Real AdvectiveFluxCalculatorBase::PQPlusMinus ( dof_id_type  node_i,
const PQPlusMinusEnum  pq_plus_minus,
std::map< dof_id_type, Real > &  derivs,
std::map< dof_id_type, 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
node_iglobal 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[global node j])
dpq_dk[out]dpq_dk[j] = d(result)/d(K[node_i][global node j]). Recall that d(result)/d(K[l][m]) are zero unless l=node_i

Definition at line 768 of file AdvectiveFluxCalculatorBase.C.

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

772 {
773  // Find the value of u at node_i
774  const Real u_i = getUnodal(node_i);
775 
776  // We're going to sum over all nodes connected with node_i
777  // These nodes are found in _kij[node_i]
778  const auto & row_find = _kij.find(node_i);
779  if (row_find == _kij.end())
780  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() + " Kij does not contain node " +
781  Moose::stringify(node_i));
782  const std::map<dof_id_type, Real> nodej_and_kij = row_find->second;
783 
784  // Initialize the results
785  Real result = 0.0;
786  zeroedConnection(derivs, node_i);
787  zeroedConnection(dpqdk, node_i);
788 
789  // Sum over all nodes connected with node_i.
790  for (const auto & nk : nodej_and_kij)
791  {
792  const dof_id_type node_j = nk.first;
793  const Real kentry = nk.second;
794 
795  // Find the value of u at node_j
796  const Real u_j = getUnodal(node_j);
797  const Real ujminusi = u_j - u_i;
798 
799  // Evaluate the i-j contribution to the result
800  switch (pq_plus_minus)
801  {
803  {
804  if (ujminusi < 0.0 && kentry < 0.0)
805  {
806  result += kentry * ujminusi;
807  derivs[node_j] += kentry;
808  derivs[node_i] -= kentry;
809  dpqdk[node_j] += ujminusi;
810  }
811  break;
812  }
814  {
815  if (ujminusi > 0.0 && kentry < 0.0)
816  {
817  result += kentry * ujminusi;
818  derivs[node_j] += kentry;
819  derivs[node_i] -= kentry;
820  dpqdk[node_j] += ujminusi;
821  }
822  break;
823  }
825  {
826  if (ujminusi > 0.0 && kentry > 0.0)
827  {
828  result += kentry * ujminusi;
829  derivs[node_j] += kentry;
830  derivs[node_i] -= kentry;
831  dpqdk[node_j] += ujminusi;
832  }
833  break;
834  }
836  {
837  if (ujminusi < 0.0 && kentry > 0.0)
838  {
839  result += kentry * ujminusi;
840  derivs[node_j] += kentry;
841  derivs[node_i] -= kentry;
842  dpqdk[node_j] += ujminusi;
843  }
844  break;
845  }
846  }
847  }
848 
849  return result;
850 }
const std::string name
Definition: Setup.h:22
Real getUnodal(dof_id_type node_i) const
Returns the value of u at the global id node_i.
std::map< dof_id_type, std::map< dof_id_type, Real > > _kij
Kuzmin-Turek K_ij matrix.
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.

◆ rMinus()

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

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

Parameters
node_inodal id
dlimited_du[out]dlimited_du[node_id] = d(R_{i}^{-})/du[node_id]
dlimited_dk[out]dlimited_dk[node_id] = d(R_{i}^{-})/d(K[i][node_id]). Derivatives w.r.t. K[l][m] with l!=i are zero

Definition at line 561 of file AdvectiveFluxCalculatorBase.C.

Referenced by AdvectiveFluxCalculatorBase::finalize().

564 {
565  zeroedConnection(dlimited_du, node_i);
566  zeroedConnection(dlimited_dk, node_i);
568  return 0.0;
569  std::map<dof_id_type, Real> dp_du;
570  std::map<dof_id_type, Real> dp_dk;
571  const Real p = PQPlusMinus(node_i, PQPlusMinusEnum::PMinus, dp_du, dp_dk);
572  if (p == 0.0)
573  // Comment after Eqn (49): if P=0 then there's no antidiffusion, so no need to remove it
574  return 1.0;
575  std::map<dof_id_type, Real> dq_du;
576  std::map<dof_id_type, Real> dq_dk;
577  const Real q = PQPlusMinus(node_i, PQPlusMinusEnum::QMinus, dq_du, dq_dk);
578  const Real r = q / p;
579  std::map<dof_id_type, Real> dr_du;
580  for (const auto & node_deriv : dp_du)
581  dr_du[node_deriv.first] = dq_du[node_deriv.first] / p - q * node_deriv.second / std::pow(p, 2);
582  std::map<dof_id_type, Real> dr_dk;
583  for (const auto & node_deriv : dp_dk)
584  dr_dk[node_deriv.first] = dq_dk[node_deriv.first] / p - q * node_deriv.second / std::pow(p, 2);
585  Real limited;
586  Real dlimited_dr;
587  limitFlux(1.0, r, limited, dlimited_dr);
588  for (const auto & node_deriv : dr_du)
589  dlimited_du[node_deriv.first] = dlimited_dr * node_deriv.second;
590  for (const auto & node_deriv : dr_dk)
591  dlimited_dk[node_deriv.first] = dlimited_dr * node_deriv.second;
592  return limited;
593 }
void limitFlux(Real a, Real b, Real &limited, Real &dlimited_db) const
flux limiter, L, on Page 135 of Kuzmin and Turek
Real PQPlusMinus(dof_id_type node_i, const PQPlusMinusEnum pq_plus_minus, std::map< dof_id_type, Real > &derivs, std::map< dof_id_type, Real > &dpq_dk) const
Returns the value of P_{i}^{+}, P_{i}^{-}, Q_{i}^{+} or Q_{i}^{-} (depending on pq_plus_minus) which ...
enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum _flux_limiter_type
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
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.

◆ rPlus()

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

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

Parameters
node_inodal id
dlimited_du[out]dlimited_du[node_id] = d(R_{i}^{+})/du[node_id] (Here node_id is a global node id)
dlimited_dk[out]dlimited_dk[node_id] = d(R_{i}^{+})/d(K[i][node_id]). Derivatives w.r.t. K[l][m] with l!=i are zero

Definition at line 526 of file AdvectiveFluxCalculatorBase.C.

Referenced by AdvectiveFluxCalculatorBase::finalize().

529 {
530  zeroedConnection(dlimited_du, node_i);
531  zeroedConnection(dlimited_dk, node_i);
533  return 0.0;
534  std::map<dof_id_type, Real> dp_du;
535  std::map<dof_id_type, Real> dp_dk;
536  const Real p = PQPlusMinus(node_i, PQPlusMinusEnum::PPlus, dp_du, dp_dk);
537  if (p == 0.0)
538  // Comment after Eqn (49): if P=0 then there's no antidiffusion, so no need to remove it
539  return 1.0;
540  std::map<dof_id_type, Real> dq_du;
541  std::map<dof_id_type, Real> dq_dk;
542  const Real q = PQPlusMinus(node_i, PQPlusMinusEnum::QPlus, dq_du, dq_dk);
543  const Real r = q / p;
544  std::map<dof_id_type, Real> dr_du;
545  for (const auto & node_deriv : dp_du)
546  dr_du[node_deriv.first] = dq_du[node_deriv.first] / p - q * node_deriv.second / std::pow(p, 2);
547  std::map<dof_id_type, Real> dr_dk;
548  for (const auto & node_deriv : dp_dk)
549  dr_dk[node_deriv.first] = dq_dk[node_deriv.first] / p - q * node_deriv.second / std::pow(p, 2);
550  Real limited;
551  Real dlimited_dr;
552  limitFlux(1.0, r, limited, dlimited_dr);
553  for (const auto & node_deriv : dr_du)
554  dlimited_du[node_deriv.first] = dlimited_dr * node_deriv.second;
555  for (const auto & node_deriv : dr_dk)
556  dlimited_dk[node_deriv.first] = dlimited_dr * node_deriv.second;
557  return limited;
558 }
void limitFlux(Real a, Real b, Real &limited, Real &dlimited_db) const
flux limiter, L, on Page 135 of Kuzmin and Turek
Real PQPlusMinus(dof_id_type node_i, const PQPlusMinusEnum pq_plus_minus, std::map< dof_id_type, Real > &derivs, std::map< dof_id_type, Real > &dpq_dk) const
Returns the value of P_{i}^{+}, P_{i}^{-}, Q_{i}^{+} or Q_{i}^{-} (depending on pq_plus_minus) which ...
enum AdvectiveFluxCalculatorBase::FluxLimiterTypeEnum _flux_limiter_type
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
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.

◆ threadJoin()

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

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 206 of file PorousFlowAdvectiveFluxCalculatorBase.C.

207 {
210  static_cast<const PorousFlowAdvectiveFluxCalculatorBase &>(uo);
211  // add the values of _dkij_dvar computed by different threads
212  for (const auto & i_and_jmap : pfafc._dkij_dvar)
213  {
214  const dof_id_type i = i_and_jmap.first;
215  for (const auto & j_and_kmap : i_and_jmap.second)
216  {
217  const dof_id_type j = j_and_kmap.first;
218  for (const auto & k_and_derivs : j_and_kmap.second)
219  {
220  const dof_id_type k = k_and_derivs.first;
221  const std::vector<Real> derivs = k_and_derivs.second;
222  for (unsigned pvar = 0; pvar < _num_vars; ++pvar)
223  _dkij_dvar[i][j][k][pvar] += derivs[pvar];
224  }
225  }
226  }
227  // gather the values of _du_dvar computed by different threads
228  for (const auto & node_du : pfafc._du_dvar)
229  {
230  const dof_id_type i = node_du.first;
232  _du_dvar[i] = node_du.second;
233  }
234 }
Base class to compute the advective flux of fluid in PorousFlow situations using the Kuzmin-Turek FEM...
std::map< dof_id_type, bool > _du_dvar_computed_by_thread
Whether _du_dvar has been computed by the local thread.
bool getdU_dvarComputedByThread(dof_id_type node_i) const
Returns _du_dvar_computed_by_thread[node_i] This is initialized to false in initialize() and potentia...
const unsigned _num_vars
Number of PorousFlow variables.
virtual void threadJoin(const UserObject &uo) override
std::map< dof_id_type, std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > > _dkij_dvar
_dkij_dvar[i][j][k][a] = d(K[global node i][global node j])/d(porous_flow_variable[global_node k][por...
std::map< dof_id_type, std::vector< Real > > _du_dvar
_du_dvar[i][a] = d(u[global node i])/d(porous_flow_variable[a])

◆ timestepSetup()

void PorousFlowAdvectiveFluxCalculatorBase::timestepSetup ( )
overrideprotectedvirtualinherited

Reimplemented from AdvectiveFluxCalculatorBase.

Definition at line 131 of file PorousFlowAdvectiveFluxCalculatorBase.C.

132 {
133  const bool resizing_was_needed =
134  _resizing_needed; // _resizing_needed gets set to false at the end of
135  // AdvectiveFluxCalculatorBase::timestepSetup()
137 
138  // clear and appropriately size all the derivative info
139  // d(U)/d(porous_flow_variables) and
140  // d(Kij)/d(porous_flow_variables) and
141  // d(flux_out)/d(porous_flow_variables)
142  if (resizing_was_needed)
143  {
144  _du_dvar.clear();
146  _dflux_out_dvars.clear();
147  for (const auto & nodes : _kij)
148  {
149  const dof_id_type node_i = nodes.first;
150  _du_dvar[node_i] = std::vector<Real>(_num_vars, 0.0);
151  _du_dvar_computed_by_thread[node_i] = false;
152  _dflux_out_dvars[node_i] = {};
153  }
154 
155  _dkij_dvar.clear();
156  for (const auto & nodes : _kij)
157  {
158  const dof_id_type node_i = nodes.first;
159  _dkij_dvar[node_i] = {};
160  for (const auto & neighbours_i : nodes.second)
161  {
162  const dof_id_type node_j = neighbours_i.first;
163  _dkij_dvar[node_i][node_j] = {};
164  for (const auto & also_neighbours_i : nodes.second)
165  {
166  const dof_id_type node_k = also_neighbours_i.first;
167  _dkij_dvar[node_i][node_j][node_k] = std::vector<Real>(_num_vars, 0.0);
168  }
169  }
170  }
171  }
172 }
std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > _dflux_out_dvars
_dflux_out_dvars[i][j][pvar] = d(flux_out[global node i])/d(porous_flow_variable pvar at global node ...
std::map< dof_id_type, bool > _du_dvar_computed_by_thread
Whether _du_dvar has been computed by the local thread.
bool _resizing_needed
whether _kij, etc, need to be sized appropriately (and valence recomputed) at the start of the timest...
std::map< dof_id_type, std::map< dof_id_type, Real > > _kij
Kuzmin-Turek K_ij matrix.
const unsigned _num_vars
Number of PorousFlow variables.
std::map< dof_id_type, std::map< dof_id_type, std::map< dof_id_type, std::vector< Real > > > > _dkij_dvar
_dkij_dvar[i][j][k][a] = d(K[global node i][global node j])/d(porous_flow_variable[global_node k][por...
std::map< dof_id_type, std::vector< Real > > _du_dvar
_du_dvar[i][a] = d(u[global node i])/d(porous_flow_variable[a])

◆ 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.

Referenced by AdvectiveFluxCalculatorBase::finalize(), AdvectiveFluxCalculatorBase::PQPlusMinus(), AdvectiveFluxCalculatorBase::rMinus(), AdvectiveFluxCalculatorBase::rPlus(), and AdvectiveFluxCalculatorBase::timestepSetup().

757 {
758  the_map.clear();
759  const auto & row_find = _kij.find(node_i);
760  if (row_find == _kij.end())
761  mooseError("AdvectiveFluxCalculatorBase UserObject " + name() + " Kij does not contain node " +
762  Moose::stringify(node_i));
763  for (const auto & nk : row_find->second)
764  the_map[nk.first] = 0.0;
765 }
const std::string name
Definition: Setup.h:22
std::map< dof_id_type, std::map< dof_id_type, Real > > _kij
Kuzmin-Turek K_ij matrix.

Member Data Documentation

◆ _denthalpy_dvar

const MaterialProperty<std::vector<std::vector<Real> > >& PorousFlowAdvectiveFluxCalculatorSaturatedHeat::_denthalpy_dvar
protectedinherited

Derivative of enthalpy of each phase wrt PorousFlow variables.

Definition at line 41 of file PorousFlowAdvectiveFluxCalculatorSaturatedHeat.h.

Referenced by PorousFlowAdvectiveFluxCalculatorSaturatedHeat::computedU_dvar().

◆ _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 42 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 113 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 48 of file PorousFlowAdvectiveFluxCalculatorSaturated.h.

Referenced by PorousFlowAdvectiveFluxCalculatorSaturated::computedU_dvar().

◆ _dflux_out_dKjk

std::map<dof_id_type, std::map<dof_id_type, std::map<dof_id_type, Real> > > AdvectiveFluxCalculatorBase::_dflux_out_dKjk
protectedinherited

_dflux_out_dKjk[i][j][k] = d(flux_out[i])/d(K[j][k]). Here j must be connected to i (this does include j = i), and k must be connected to j (this does include k = i and k = j)

Definition at line 179 of file AdvectiveFluxCalculatorBase.h.

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

◆ _dflux_out_du

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

_dflux_out_du[i][j] = d(flux_out[i])/d(u[j]). Here j must be connected to i, or to a node that is connected to i.

Definition at line 176 of file AdvectiveFluxCalculatorBase.h.

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

◆ _dflux_out_dvars

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

_dflux_out_dvars[i][j][pvar] = d(flux_out[global node i])/d(porous_flow_variable pvar at global node j)

Definition at line 143 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 119 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 122 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::executeOnElement().

◆ _dictator

const PorousFlowDictator& PorousFlowAdvectiveFluxCalculatorBase::_dictator
protectedinherited

◆ _dkij_dvar

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

◆ _dpermeability_dgradvar

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

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

Definition at line 107 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 104 of file PorousFlowAdvectiveFluxCalculatorBase.h.

Referenced by PorousFlowAdvectiveFluxCalculatorBase::executeOnElement().

◆ _drelative_permeability_dvar

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

Derivative of relative permeability of each phase wrt PorousFlow variables.

Definition at line 43 of file PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat.h.

Referenced by computedU_dvar().

◆ _du_dvar

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

◆ _du_dvar_computed_by_thread

std::map<dof_id_type, bool> PorousFlowAdvectiveFluxCalculatorBase::_du_dvar_computed_by_thread
protectedinherited

◆ _enthalpy

const MaterialProperty<std::vector<Real> >& PorousFlowAdvectiveFluxCalculatorSaturatedHeat::_enthalpy
protectedinherited

◆ _fe_type

const FEType PorousFlowAdvectiveFluxCalculatorBase::_fe_type
protectedinherited

FEType to use.

Definition at line 125 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 39 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::map<dof_id_type, Real> AdvectiveFluxCalculatorBase::_flux_out
protectedinherited

◆ _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::map<dof_id_type, std::map<dof_id_type, 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. Because it explicitly holds info which nodes are paired with which other nodes, it is also used to perform: given a node_id, loop over all neighbouring nodes. This occurs in the computation of R+ and R-.

Definition at line 170 of file AdvectiveFluxCalculatorBase.h.

Referenced by AdvectiveFluxCalculatorBase::executeOnElement(), AdvectiveFluxCalculatorBase::finalize(), PorousFlowAdvectiveFluxCalculatorBase::finalize(), AdvectiveFluxCalculatorBase::getKij(), AdvectiveFluxCalculatorBase::initialize(), PorousFlowAdvectiveFluxCalculatorBase::initialize(), AdvectiveFluxCalculatorBase::PQPlusMinus(), AdvectiveFluxCalculatorBase::threadJoin(), AdvectiveFluxCalculatorBase::timestepSetup(), PorousFlowAdvectiveFluxCalculatorBase::timestepSetup(), and AdvectiveFluxCalculatorBase::zeroedConnection().

◆ _multiply_by_density

const bool PorousFlowAdvectiveFluxCalculatorSaturated::_multiply_by_density
protectedinherited

◆ _num_vars

const unsigned PorousFlowAdvectiveFluxCalculatorBase::_num_vars
protectedinherited

◆ _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> >& PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat::_relative_permeability
protected

Relative permeability of each phase.

Definition at line 40 of file PorousFlowAdvectiveFluxCalculatorUnsaturatedHeat.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 116 of file AdvectiveFluxCalculatorBase.h.

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

◆ _u_nodal

std::map<dof_id_type, Real> AdvectiveFluxCalculatorBase::_u_nodal
protectedinherited

◆ _u_nodal_computed_by_thread

std::map<dof_id_type, bool> AdvectiveFluxCalculatorBase::_u_nodal_computed_by_thread
protectedinherited

◆ _valence

std::map<std::pair<dof_id_type, dof_id_type>, unsigned> AdvectiveFluxCalculatorBase::_valence
protectedinherited

_valence[(i, j)] = 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 i-j edge is encountered

Definition at line 184 of file AdvectiveFluxCalculatorBase.h.

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


The documentation for this class was generated from the following files: