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

#include <GeneralizedPlaneStrainUserObject.h>

Inheritance diagram for GeneralizedPlaneStrainUserObject:
[legend]

Public Member Functions

 GeneralizedPlaneStrainUserObject (const InputParameters &parameters)
 
void initialize () override
 
void execute () override
 
void threadJoin (const UserObject &uo) override
 
void finalize () override
 
virtual Real returnResidual (unsigned int scalar_var_id=0) const
 
virtual Real returnReferenceResidual (unsigned int scalar_var_id=0) const
 
virtual Real returnJacobian (unsigned int scalar_var_id=0) const
 

Protected Attributes

std::string _base_name
 
const MaterialProperty< RankFourTensor > & _Cijkl
 
const MaterialProperty< RankTwoTensor > & _stress
 
const SubblockIndexProvider_subblock_id_provider
 
Function & _out_of_plane_pressure
 
const Real _factor
 
unsigned int _scalar_out_of_plane_strain_direction
 
std::vector< Real > _residual
 
std::vector< Real > _reference_residual
 
std::vector< Real > _jacobian
 

Detailed Description

Definition at line 24 of file GeneralizedPlaneStrainUserObject.h.

Constructor & Destructor Documentation

◆ GeneralizedPlaneStrainUserObject()

GeneralizedPlaneStrainUserObject::GeneralizedPlaneStrainUserObject ( const InputParameters &  parameters)

Definition at line 43 of file GeneralizedPlaneStrainUserObject.C.

45  : ElementUserObject(parameters),
46  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
47  _Cijkl(getMaterialProperty<RankFourTensor>(_base_name + "elasticity_tensor")),
48  _stress(getMaterialProperty<RankTwoTensor>(_base_name + "stress")),
49  _subblock_id_provider(nullptr),
50  _out_of_plane_pressure(getFunction("out_of_plane_pressure")),
51  _factor(getParam<Real>("factor"))
52 {
53 }
const MaterialProperty< RankTwoTensor > & _stress
const SubblockIndexProvider * _subblock_id_provider
const MaterialProperty< RankFourTensor > & _Cijkl

Member Function Documentation

◆ execute()

void GeneralizedPlaneStrainUserObject::execute ( )
override

Definition at line 74 of file GeneralizedPlaneStrainUserObject.C.

75 {
76  const unsigned int subblock_id =
78 
79  for (unsigned int _qp = 0; _qp < _qrule->n_points(); _qp++)
80  {
81  // residual, integral of stress_zz for COORD_XYZ
82  _residual[subblock_id] += _JxW[_qp] * _coord[_qp] *
85  _out_of_plane_pressure.value(_t, _q_point[_qp]) * _factor);
86 
87  _reference_residual[subblock_id] += std::abs(
88  _JxW[_qp] * _coord[_qp] *
90 
91  // diagonal jacobian, integral of C(2, 2, 2, 2) for COORD_XYZ
92  _jacobian[subblock_id] += _JxW[_qp] * _coord[_qp] *
97  }
98 }
const MaterialProperty< RankTwoTensor > & _stress
const SubblockIndexProvider * _subblock_id_provider
virtual unsigned int getSubblockIndex(const Elem &) const =0
The index of subblock this element is on.
const MaterialProperty< RankFourTensor > & _Cijkl

◆ finalize()

void GeneralizedPlaneStrainUserObject::finalize ( )
override

Definition at line 114 of file GeneralizedPlaneStrainUserObject.C.

115 {
116  gatherSum(_residual);
117  gatherSum(_reference_residual);
118  gatherSum(_jacobian);
119 }

◆ initialize()

void GeneralizedPlaneStrainUserObject::initialize ( )
override

Definition at line 56 of file GeneralizedPlaneStrainUserObject.C.

57 {
58  if (isParamValid("subblock_index_provider"))
59  _subblock_id_provider = &getUserObject<SubblockIndexProvider>("subblock_index_provider");
60  if (_assembly.coordSystem() == Moose::COORD_XYZ)
61  _scalar_out_of_plane_strain_direction = getParam<MooseEnum>("out_of_plane_direction");
62  else if (_assembly.coordSystem() == Moose::COORD_RZ)
64  else
65  mooseError("Unsupported coordinate system for generalized plane strain formulation");
66 
67  unsigned int max_size = _subblock_id_provider ? _subblock_id_provider->getMaxSubblockIndex() : 1;
68  _residual.assign(max_size, 0.0);
69  _reference_residual.assign(max_size, 0.0);
70  _jacobian.assign(max_size, 0.0);
71 }
virtual unsigned int getMaxSubblockIndex() const =0
The max index of subblock.
const SubblockIndexProvider * _subblock_id_provider

◆ returnJacobian()

Real GeneralizedPlaneStrainUserObject::returnJacobian ( unsigned int  scalar_var_id = 0) const
virtual

Definition at line 146 of file GeneralizedPlaneStrainUserObject.C.

Referenced by GeneralizedPlaneStrain::computeJacobian().

147 {
148  if (_jacobian.size() <= scalar_var_id)
149  mooseError("Index out of bounds!");
150 
151  return _jacobian[scalar_var_id];
152 }

◆ returnReferenceResidual()

Real GeneralizedPlaneStrainUserObject::returnReferenceResidual ( unsigned int  scalar_var_id = 0) const
virtual

Definition at line 131 of file GeneralizedPlaneStrainUserObject.C.

Referenced by GeneralizedPlaneStrainReferenceResidual::computeValue().

132 {
133  // At startup, the GeneralizedPlaneStrainReferenceResidual class can ask for this value
134  // before it has been computed. Return 0.0 in this case. The only way size will stay
135  // zero is if initialize is never called.
136  if (_reference_residual.size() == 0)
137  return 0.0;
138 
139  if (_residual.size() <= scalar_var_id)
140  mooseError("Index out of bounds!");
141 
142  return _reference_residual[scalar_var_id];
143 }

◆ returnResidual()

Real GeneralizedPlaneStrainUserObject::returnResidual ( unsigned int  scalar_var_id = 0) const
virtual

Definition at line 122 of file GeneralizedPlaneStrainUserObject.C.

Referenced by GeneralizedPlaneStrain::computeResidual().

123 {
124  if (_residual.size() <= scalar_var_id)
125  mooseError("Index out of bounds!");
126 
127  return _residual[scalar_var_id];
128 }

◆ threadJoin()

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

Definition at line 101 of file GeneralizedPlaneStrainUserObject.C.

102 {
103  const GeneralizedPlaneStrainUserObject & gpsuo =
104  static_cast<const GeneralizedPlaneStrainUserObject &>(uo);
105  for (unsigned int i = 0; i < _residual.size(); ++i)
106  {
107  _residual[i] += gpsuo._residual[i];
109  _jacobian[i] += gpsuo._jacobian[i];
110  }
111 }

Member Data Documentation

◆ _base_name

std::string GeneralizedPlaneStrainUserObject::_base_name
protected

Definition at line 38 of file GeneralizedPlaneStrainUserObject.h.

◆ _Cijkl

const MaterialProperty<RankFourTensor>& GeneralizedPlaneStrainUserObject::_Cijkl
protected

Definition at line 40 of file GeneralizedPlaneStrainUserObject.h.

Referenced by execute().

◆ _factor

const Real GeneralizedPlaneStrainUserObject::_factor
protected

Definition at line 46 of file GeneralizedPlaneStrainUserObject.h.

Referenced by execute().

◆ _jacobian

std::vector<Real> GeneralizedPlaneStrainUserObject::_jacobian
protected

◆ _out_of_plane_pressure

Function& GeneralizedPlaneStrainUserObject::_out_of_plane_pressure
protected

Definition at line 45 of file GeneralizedPlaneStrainUserObject.h.

Referenced by execute().

◆ _reference_residual

std::vector<Real> GeneralizedPlaneStrainUserObject::_reference_residual
protected

◆ _residual

std::vector<Real> GeneralizedPlaneStrainUserObject::_residual
protected

◆ _scalar_out_of_plane_strain_direction

unsigned int GeneralizedPlaneStrainUserObject::_scalar_out_of_plane_strain_direction
protected

Definition at line 47 of file GeneralizedPlaneStrainUserObject.h.

Referenced by execute(), and initialize().

◆ _stress

const MaterialProperty<RankTwoTensor>& GeneralizedPlaneStrainUserObject::_stress
protected

Definition at line 41 of file GeneralizedPlaneStrainUserObject.h.

Referenced by execute().

◆ _subblock_id_provider

const SubblockIndexProvider* GeneralizedPlaneStrainUserObject::_subblock_id_provider
protected

Definition at line 43 of file GeneralizedPlaneStrainUserObject.h.

Referenced by execute(), and initialize().


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