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

#include <GlobalStrainUserObject.h>

Inheritance diagram for GlobalStrainUserObject:
[legend]

Public Member Functions

 GlobalStrainUserObject (const InputParameters &parameters)
 
void initialize () override
 
void execute () override
 
void threadJoin (const UserObject &uo) override
 
void finalize () override
 
virtual const RankTwoTensor & getResidual () const override
 
virtual const RankFourTensor & getJacobian () const override
 
virtual const VectorValue< bool > & getPeriodicDirections () const override
 
virtual void computeAdditionalStress ()
 Calculate additional applied stresses. More...
 

Protected Attributes

std::string _base_name
 
const MaterialProperty< RankFourTensor > & _dstress_dstrain
 
const MaterialProperty< RankTwoTensor > & _stress
 
RankTwoTensor _applied_stress_tensor
 
RankTwoTensor _residual
 
RankFourTensor _jacobian
 
const unsigned int _dim
 
const unsigned int _ndisp
 
std::vector< unsigned int > _disp_var
 
VectorValue< bool > _periodic_dir
 

Detailed Description

Definition at line 24 of file GlobalStrainUserObject.h.

Constructor & Destructor Documentation

◆ GlobalStrainUserObject()

GlobalStrainUserObject::GlobalStrainUserObject ( const InputParameters &  parameters)

Definition at line 33 of file GlobalStrainUserObject.C.

34  : ElementUserObject(parameters),
36  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
37  _dstress_dstrain(getMaterialProperty<RankFourTensor>(_base_name + "Jacobian_mult")),
38  _stress(getMaterialProperty<RankTwoTensor>(_base_name + "stress")),
39  _dim(_mesh.dimension()),
40  _ndisp(coupledComponents("displacements")),
43 {
44  for (unsigned int i = 0; i < _ndisp; ++i)
45  _disp_var[i] = coupled("displacements", i);
46 
47  for (unsigned int dir = 0; dir < _dim; ++dir)
48  {
49  _periodic_dir(dir) = _mesh.isTranslatedPeriodic(_disp_var[0], dir);
50 
51  for (unsigned int i = 1; i < _ndisp; ++i)
52  if (_mesh.isTranslatedPeriodic(_disp_var[i], dir) != _periodic_dir(dir))
53  mooseError("All the displacement components in a particular direction should have same "
54  "periodicity.");
55  }
56 
57  if (isParamValid("applied_stress_tensor"))
58  _applied_stress_tensor.fillFromInputVector(
59  getParam<std::vector<Real>>("applied_stress_tensor"));
60  else
62 }
const MaterialProperty< RankTwoTensor > & _stress
const MaterialProperty< RankFourTensor > & _dstress_dstrain
VectorValue< bool > _periodic_dir
std::vector< unsigned int > _disp_var
This class provides interface for extracting the periodic directions, residual, and jacobian values f...

Member Function Documentation

◆ computeAdditionalStress()

virtual void GlobalStrainUserObject::computeAdditionalStress ( )
inlinevirtual

Calculate additional applied stresses.

Definition at line 40 of file GlobalStrainUserObject.h.

Referenced by execute().

40 {};

◆ execute()

void GlobalStrainUserObject::execute ( )
override

Definition at line 72 of file GlobalStrainUserObject.C.

73 {
75 
76  for (unsigned int _qp = 0; _qp < _qrule->n_points(); _qp++)
77  {
78  // residual, integral of stress components
79  _residual += _JxW[_qp] * _coord[_qp] * (_stress[_qp] - _applied_stress_tensor);
80 
81  // diagonal jacobian, integral of elasticity tensor components
82  _jacobian += _JxW[_qp] * _coord[_qp] * _dstress_dstrain[_qp];
83  }
84 }
const MaterialProperty< RankTwoTensor > & _stress
const MaterialProperty< RankFourTensor > & _dstress_dstrain
virtual void computeAdditionalStress()
Calculate additional applied stresses.

◆ finalize()

void GlobalStrainUserObject::finalize ( )
override

Definition at line 95 of file GlobalStrainUserObject.C.

96 {
97  std::vector<Real> residual(9);
98  std::vector<Real> jacobian(81);
99 
100  std::copy(&_residual(0, 0), &_residual(0, 0) + 9, residual.begin());
101  std::copy(&_jacobian(0, 0, 0, 0), &_jacobian(0, 0, 0, 0) + 81, jacobian.begin());
102 
103  gatherSum(residual);
104  gatherSum(jacobian);
105 
106  std::copy(residual.begin(), residual.end(), &_residual(0, 0));
107  std::copy(jacobian.begin(), jacobian.end(), &_jacobian(0, 0, 0, 0));
108 }

◆ getJacobian()

const RankFourTensor & GlobalStrainUserObject::getJacobian ( ) const
overridevirtual

Implements GlobalStrainUserObjectInterface.

Definition at line 117 of file GlobalStrainUserObject.C.

118 {
119  return _jacobian;
120 }

◆ getPeriodicDirections()

const VectorValue< bool > & GlobalStrainUserObject::getPeriodicDirections ( ) const
overridevirtual

Implements GlobalStrainUserObjectInterface.

Definition at line 123 of file GlobalStrainUserObject.C.

124 {
125  return _periodic_dir;
126 }
VectorValue< bool > _periodic_dir

◆ getResidual()

const RankTwoTensor & GlobalStrainUserObject::getResidual ( ) const
overridevirtual

Implements GlobalStrainUserObjectInterface.

Definition at line 111 of file GlobalStrainUserObject.C.

112 {
113  return _residual;
114 }

◆ initialize()

void GlobalStrainUserObject::initialize ( )
override

Definition at line 65 of file GlobalStrainUserObject.C.

66 {
67  _residual.zero();
68  _jacobian.zero();
69 }

◆ threadJoin()

void GlobalStrainUserObject::threadJoin ( const UserObject &  uo)
override

Definition at line 87 of file GlobalStrainUserObject.C.

88 {
89  const GlobalStrainUserObject & pstuo = static_cast<const GlobalStrainUserObject &>(uo);
90  _residual += pstuo._residual;
91  _jacobian += pstuo._jacobian;
92 }

Member Data Documentation

◆ _applied_stress_tensor

RankTwoTensor GlobalStrainUserObject::_applied_stress_tensor
protected

Definition at line 48 of file GlobalStrainUserObject.h.

Referenced by execute(), and GlobalStrainUserObject().

◆ _base_name

std::string GlobalStrainUserObject::_base_name
protected

Definition at line 40 of file GlobalStrainUserObject.h.

◆ _dim

const unsigned int GlobalStrainUserObject::_dim
protected

Definition at line 52 of file GlobalStrainUserObject.h.

Referenced by GlobalStrainUserObject().

◆ _disp_var

std::vector<unsigned int> GlobalStrainUserObject::_disp_var
protected

Definition at line 54 of file GlobalStrainUserObject.h.

Referenced by GlobalStrainUserObject().

◆ _dstress_dstrain

const MaterialProperty<RankFourTensor>& GlobalStrainUserObject::_dstress_dstrain
protected

Definition at line 45 of file GlobalStrainUserObject.h.

Referenced by execute().

◆ _jacobian

RankFourTensor GlobalStrainUserObject::_jacobian
protected

Definition at line 50 of file GlobalStrainUserObject.h.

Referenced by execute(), finalize(), getJacobian(), initialize(), and threadJoin().

◆ _ndisp

const unsigned int GlobalStrainUserObject::_ndisp
protected

Definition at line 53 of file GlobalStrainUserObject.h.

Referenced by GlobalStrainUserObject().

◆ _periodic_dir

VectorValue<bool> GlobalStrainUserObject::_periodic_dir
protected

Definition at line 55 of file GlobalStrainUserObject.h.

Referenced by getPeriodicDirections(), and GlobalStrainUserObject().

◆ _residual

RankTwoTensor GlobalStrainUserObject::_residual
protected

Definition at line 49 of file GlobalStrainUserObject.h.

Referenced by execute(), finalize(), getResidual(), initialize(), and threadJoin().

◆ _stress

const MaterialProperty<RankTwoTensor>& GlobalStrainUserObject::_stress
protected

Definition at line 46 of file GlobalStrainUserObject.h.

Referenced by execute().


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