https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Attributes | List of all members
JvarMapIntegratedBCInterface< T > Class Template Reference

Interface class ("Veneer") for IntegratedBC to provide a mapping from 'jvar' in computeJacobianBlock into the _coupled_moose_vars array. More...

#include <JvarMapInterface.h>

Inheritance diagram for JvarMapIntegratedBCInterface< T >:
[legend]

Public Types

typedef std::vector< int > JvarMap
 

Public Member Functions

 JvarMapIntegratedBCInterface (const InputParameters &parameters)
 
virtual void computeOffDiagJacobian (unsigned int jvar) override
 
unsigned int mapJvarToCvar (unsigned int jvar)
 Return index into the _coupled_moose_vars array for a given jvar.
 
int mapJvarToCvar (unsigned int jvar, const JvarMap &jvar_map)
 Return an index into a specific coupled variable vector for a given jvar.
 
bool mapJvarToCvar (unsigned int jvar, unsigned int &cvar)
 Set the cvar value to the mapped jvar value and return true if the mapping exists.
 
const JvarMap & getJvarMap ()
 Obtain the map connecting libmesh variable ID number to its position in the _coupled_moose_vars vector.
 
const JvarMap & getParameterJvarMap (std::string parameter_name)
 Make a specific map for a given parameter name representing a couple variable (vector)
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

const unsigned int _n_args
 number of coupled moose variables
 

Private Attributes

const std::size_t _jvar_max_size
 number of nonlinear variables in the system
 
JvarMap _jvar_map
 look-up table to determine the _coupled_moose_vars index for the jvar parameter
 
std::map< std::string, JvarMap > _jvar_local_map
 map of local look-up tables for specific parameters
 

Detailed Description

template<class T>
class JvarMapIntegratedBCInterface< T >

Interface class ("Veneer") for IntegratedBC to provide a mapping from 'jvar' in computeJacobianBlock into the _coupled_moose_vars array.

This class is useful in conjunction with DerivativeMaterialInterface, where vectors of material property derivatives with respect to all coupled variables (iterating over _coupled_moose_vars array) are generated. The mapping enabled the look up of the correct material property derivatives for the current jvar.

Definition at line 48 of file JvarMapInterface.h.

Member Typedef Documentation

◆ JvarMap

template<class T >
typedef std::vector<int> JvarMapInterfaceBase< T >::JvarMap
inherited

Definition at line 63 of file JvarMapInterface.h.

Constructor & Destructor Documentation

◆ JvarMapIntegratedBCInterface()

template<class T >
JvarMapIntegratedBCInterface< T >::JvarMapIntegratedBCInterface ( const InputParameters &  parameters)

Definition at line 194 of file JvarMapInterface.h.

195 : JvarMapInterfaceBase<T>(parameters)
196{
197}
Base class ("Veneer") that implements the actual mapping from 'jvar' in into the _coupled_moose_vars ...

Member Function Documentation

◆ computeOffDiagJacobian()

template<class T >
void JvarMapIntegratedBCInterface< T >::computeOffDiagJacobian ( unsigned int  jvar)
overridevirtual

Definition at line 213 of file JvarMapInterface.h.

214{
215 // the Kernel is not coupled to the variable; no need to loop over QPs
216 if (this->_jvar_map[jvar] < 0)
217 return;
218
219 // call the underlying class' off-diagonal Jacobian
220 T::computeOffDiagJacobian(jvar);
221}
JvarMap _jvar_map
look-up table to determine the _coupled_moose_vars index for the jvar parameter

◆ getJvarMap()

template<class T >
const JvarMap & JvarMapInterfaceBase< T >::getJvarMap ( )
inlineinherited

Obtain the map connecting libmesh variable ID number to its position in the _coupled_moose_vars vector.

Definition at line 80 of file JvarMapInterface.h.

80{ return _jvar_map; }

◆ getParameterJvarMap()

template<class T >
const JvarMapInterfaceBase< T >::JvarMap & JvarMapInterfaceBase< T >::getParameterJvarMap ( std::string  parameter_name)
inherited

Make a specific map for a given parameter name representing a couple variable (vector)

Definition at line 168 of file JvarMapInterface.h.

169{
170 auto & jvar_map = _jvar_local_map[parameter_name];
171 jvar_map.assign(_jvar_max_size, -1);
172
173 // populate local map
174 const auto num = this->coupledComponents(parameter_name);
175 for (std::size_t i = 0; i < num; ++i)
176 {
177 const auto number = this->getVar(parameter_name, i)->number();
178
179 // skip AuxVars as off-diagonal jacobian entries are not calculated for them
180 if (number < _jvar_max_size)
181 jvar_map[number] = i;
182 }
183
184 return jvar_map;
185}
std::map< std::string, JvarMap > _jvar_local_map
map of local look-up tables for specific parameters
const std::size_t _jvar_max_size
number of nonlinear variables in the system

◆ mapJvarToCvar() [1/3]

template<class T >
unsigned int JvarMapInterfaceBase< T >::mapJvarToCvar ( unsigned int  jvar)
inherited

Return index into the _coupled_moose_vars array for a given jvar.

Definition at line 147 of file JvarMapInterface.h.

148{
149 mooseAssert(jvar < _jvar_max_size,
150 "Calling mapJvarToCvar for an invalid Moose variable number. Maybe an AuxVariable?");
151 int cit = _jvar_map[jvar];
152
153 mooseAssert(cit >= 0, "Calling mapJvarToCvar for a variable not coupled to this kernel.");
154 return cit;
155}

Referenced by MatReaction::computeQpOffDiagJacobian(), MaterialDerivativeRankFourTestKernel::computeQpOffDiagJacobian(), MaterialDerivativeRankTwoTestKernel::computeQpOffDiagJacobian(), and MaterialDerivativeTestKernel::computeQpOffDiagJacobian().

◆ mapJvarToCvar() [2/3]

template<class T >
int JvarMapInterfaceBase< T >::mapJvarToCvar ( unsigned int  jvar,
const JvarMap &  jvar_map 
)
inherited

Return an index into a specific coupled variable vector for a given jvar.

A negative return value indicates that the jvar value does not point to a variable in the couple variable vector corresponding to the mapped parameter.

Definition at line 159 of file JvarMapInterface.h.

160{
161 mooseAssert(jvar < _jvar_max_size,
162 "Calling mapJvarToCvar for an invalid Moose variable number. Maybe an AuxVariable?");
163 return jvar_map[jvar];
164}

◆ mapJvarToCvar() [3/3]

template<class T >
bool JvarMapInterfaceBase< T >::mapJvarToCvar ( unsigned int  jvar,
unsigned int &  cvar 
)
inherited

Set the cvar value to the mapped jvar value and return true if the mapping exists.

Otherwise return false.

Parameters
[in]jvarVariable number passed as argument to computeQpOffDiagJacobian
[out]cvarCorresponding index into the _coupled_moose_vars array
Returns
true if the requested variable is coupled, false otherwise

◆ validParams()

template<class T >
InputParameters JvarMapInterfaceBase< T >::validParams ( )
staticinherited

Definition at line 115 of file JvarMapInterface.h.

116{
117 auto params = T::validParams();
118 params.addCoupledVar("coupled_variables",
119 "Vector of nonlinear variable arguments this object depends on");
120
121 return params;
122}

Member Data Documentation

◆ _jvar_local_map

template<class T >
std::map<std::string, JvarMap> JvarMapInterfaceBase< T >::_jvar_local_map
privateinherited

map of local look-up tables for specific parameters

Definition at line 107 of file JvarMapInterface.h.

Referenced by JvarMapInterfaceBase< T >::getParameterJvarMap().

◆ _jvar_map

template<class T >
JvarMap JvarMapInterfaceBase< T >::_jvar_map
privateinherited

◆ _jvar_max_size

template<class T >
const std::size_t JvarMapInterfaceBase< T >::_jvar_max_size
privateinherited

◆ _n_args

template<class T >
const unsigned int JvarMapInterfaceBase< T >::_n_args
protectedinherited

number of coupled moose variables

Definition at line 97 of file JvarMapInterface.h.

Referenced by MatReaction::MatReaction().


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