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

#include <GlobalStrain.h>

Inheritance diagram for GlobalStrain:
[legend]

Public Member Functions

 GlobalStrain (const InputParameters &parameters)
 
virtual void reinit ()
 
virtual void computeResidual ()
 
virtual void computeJacobian ()
 
virtual void computeOffDiagJacobian (unsigned int)
 

Protected Member Functions

virtual void assignComponentIndices (Order var_order)
 

Protected Attributes

const GlobalStrainUserObjectInterface_pst
 
const RankTwoTensor & _pst_residual
 
const RankFourTensor & _pst_jacobian
 
const VectorValue< bool > & _periodic_dir
 
std::vector< std::pair< unsigned int, unsigned int > > _components
 
const unsigned int _dim
 

Detailed Description

Definition at line 24 of file GlobalStrain.h.

Constructor & Destructor Documentation

◆ GlobalStrain()

GlobalStrain::GlobalStrain ( const InputParameters &  parameters)

Definition at line 34 of file GlobalStrain.C.

35  : ScalarKernel(parameters),
36  _pst(getUserObject<GlobalStrainUserObjectInterface>("global_strain_uo")),
40  _components(_var.order()),
41  _dim(_mesh.dimension())
42 {
43  if ((_dim == 1 && _var.order() != FIRST) || (_dim == 2 && _var.order() != THIRD) ||
44  (_dim == 3 && _var.order() != SIXTH))
45  mooseError("PerdiodicStrain ScalarKernel is only compatible with scalar variables of order "
46  "FIRST in 1D, THIRD in 2D, and SIXTH in 3D. Please change the order of the scalar"
47  "variable acoording to the mesh dimension.");
48 
49  assignComponentIndices(_var.order());
50 }
const RankTwoTensor & _pst_residual
Definition: GlobalStrain.h:38
const RankFourTensor & _pst_jacobian
Definition: GlobalStrain.h:39
const unsigned int _dim
Definition: GlobalStrain.h:43
std::vector< std::pair< unsigned int, unsigned int > > _components
Definition: GlobalStrain.h:42
const VectorValue< bool > & _periodic_dir
Definition: GlobalStrain.h:40
virtual const RankFourTensor & getJacobian() const =0
virtual const RankTwoTensor & getResidual() const =0
virtual void assignComponentIndices(Order var_order)
Definition: GlobalStrain.C:82
virtual const VectorValue< bool > & getPeriodicDirections() const =0
const GlobalStrainUserObjectInterface & _pst
Definition: GlobalStrain.h:37

Member Function Documentation

◆ assignComponentIndices()

void GlobalStrain::assignComponentIndices ( Order  var_order)
protectedvirtual

Definition at line 82 of file GlobalStrain.C.

Referenced by GlobalStrain().

83 {
84  switch (order)
85  {
86  case 1:
87  _components[0].first = 0;
88  _components[0].second = 0;
89  break;
90 
91  case 3:
92  _components[0].first = 0;
93  _components[0].second = 0;
94  _components[1].first = 1;
95  _components[1].second = 1;
96  _components[2].first = 0;
97  _components[2].second = 1;
98  break;
99 
100  case 6:
101  _components[0].first = 0;
102  _components[0].second = 0;
103  _components[1].first = 1;
104  _components[1].second = 1;
105  _components[2].first = 2;
106  _components[2].second = 2;
107  _components[3].first = 1;
108  _components[3].second = 2;
109  _components[4].first = 0;
110  _components[4].second = 2;
111  _components[5].first = 0;
112  _components[5].second = 1;
113  break;
114 
115  default:
116  mooseError("PerdiodicStrain ScalarKernel is only compatible with FIRST, THIRD, and SIXTH "
117  "order scalar variables.");
118  }
119 }
std::vector< std::pair< unsigned int, unsigned int > > _components
Definition: GlobalStrain.h:42

◆ computeJacobian()

void GlobalStrain::computeJacobian ( )
virtual

Definition at line 64 of file GlobalStrain.C.

65 {
66  DenseMatrix<Number> & ke = _assembly.jacobianBlock(_var.number(), _var.number());
67  for (_i = 0; _i < ke.m(); ++_i)
68  for (_j = 0; _j < ke.m(); ++_j)
69  // periodic direction check is not done for jacobian calculations to avoid zero pivot error
70  ke(_i, _j) += _pst_jacobian(_components[_i].first,
71  _components[_i].second,
72  _components[_j].first,
73  _components[_j].second);
74 }
const RankFourTensor & _pst_jacobian
Definition: GlobalStrain.h:39
std::vector< std::pair< unsigned int, unsigned int > > _components
Definition: GlobalStrain.h:42

◆ computeOffDiagJacobian()

void GlobalStrain::computeOffDiagJacobian ( unsigned  int)
virtual

Definition at line 77 of file GlobalStrain.C.

78 {
79 }

◆ computeResidual()

void GlobalStrain::computeResidual ( )
virtual

Definition at line 53 of file GlobalStrain.C.

54 {
55  DenseVector<Number> & re = _assembly.residualBlock(_var.number());
56  for (_i = 0; _i < re.size(); ++_i)
57  {
58  if (_periodic_dir(_components[_i].first) || _periodic_dir(_components[_i].second))
59  re(_i) += _pst_residual(_components[_i].first, _components[_i].second);
60  }
61 }
const RankTwoTensor & _pst_residual
Definition: GlobalStrain.h:38
std::vector< std::pair< unsigned int, unsigned int > > _components
Definition: GlobalStrain.h:42
const VectorValue< bool > & _periodic_dir
Definition: GlobalStrain.h:40

◆ reinit()

virtual void GlobalStrain::reinit ( )
inlinevirtual

Definition at line 29 of file GlobalStrain.h.

29 {};

Member Data Documentation

◆ _components

std::vector<std::pair<unsigned int, unsigned int> > GlobalStrain::_components
protected

Definition at line 42 of file GlobalStrain.h.

Referenced by assignComponentIndices(), computeJacobian(), and computeResidual().

◆ _dim

const unsigned int GlobalStrain::_dim
protected

Definition at line 43 of file GlobalStrain.h.

Referenced by GlobalStrain().

◆ _periodic_dir

const VectorValue<bool>& GlobalStrain::_periodic_dir
protected

Definition at line 40 of file GlobalStrain.h.

Referenced by computeResidual().

◆ _pst

const GlobalStrainUserObjectInterface& GlobalStrain::_pst
protected

Definition at line 37 of file GlobalStrain.h.

◆ _pst_jacobian

const RankFourTensor& GlobalStrain::_pst_jacobian
protected

Definition at line 39 of file GlobalStrain.h.

Referenced by computeJacobian().

◆ _pst_residual

const RankTwoTensor& GlobalStrain::_pst_residual
protected

Definition at line 38 of file GlobalStrain.h.

Referenced by computeResidual().


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