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

#include <GeneralizedPlaneStrainOffDiag.h>

Inheritance diagram for GeneralizedPlaneStrainOffDiag:
[legend]

Public Member Functions

 GeneralizedPlaneStrainOffDiag (const InputParameters &parameters)
 

Protected Member Functions

Real computeQpResidual () override
 
void computeOffDiagJacobianScalar (unsigned int jvar) override
 These methods are used to compute the off-diagonal jacobian for the coupling between scalar variable strain_yy or strain_zz and nonlinear variables displacements and temperature. More...
 
virtual void computeDispOffDiagJacobianScalar (unsigned int component, unsigned int jvar)
 
virtual void computeTempOffDiagJacobianScalar (unsigned int jvar)
 

Protected Attributes

std::string _base_name
 
const MaterialProperty< RankFourTensor > & _Jacobian_mult
 
const std::vector< MaterialPropertyName > _eigenstrain_names
 
std::vector< const MaterialProperty< RankTwoTensor > * > _deigenstrain_dT
 
unsigned int _scalar_out_of_plane_strain_var
 
const SubblockIndexProvider_subblock_id_provider
 
const unsigned int _scalar_var_id
 
MooseVariable * _temp_var
 
const unsigned int _num_disp_var
 
std::vector< MooseVariable * > _disp_var
 
unsigned int _scalar_out_of_plane_strain_direction
 

Detailed Description

Definition at line 23 of file GeneralizedPlaneStrainOffDiag.h.

Constructor & Destructor Documentation

GeneralizedPlaneStrainOffDiag::GeneralizedPlaneStrainOffDiag ( const InputParameters &  parameters)

Definition at line 44 of file GeneralizedPlaneStrainOffDiag.C.

45  : DerivativeMaterialInterface<Kernel>(parameters),
46  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
47  _Jacobian_mult(getMaterialProperty<RankFourTensor>(_base_name + "Jacobian_mult")),
48  _eigenstrain_names(getParam<std::vector<MaterialPropertyName>>("eigenstrain_names")),
50  _scalar_out_of_plane_strain_var(coupledScalar("scalar_out_of_plane_strain")),
51  _subblock_id_provider(isParamValid("subblock_index_provider")
52  ? &getUserObject<SubblockIndexProvider>("subblock_index_provider")
53  : nullptr),
54  _scalar_var_id(isParamValid("scalar_out_of_plane_strain_index")
55  ? getParam<unsigned int>("scalar_out_of_plane_strain_index")
56  : 0),
57  _temp_var(isParamValid("temperature")
58  ? &_subproblem.getVariable(_tid, getParam<NonlinearVariableName>("temperature"))
59  : NULL),
60  _num_disp_var(getParam<std::vector<NonlinearVariableName>>("displacements").size())
61 {
62  const std::vector<NonlinearVariableName> & nl_vnames(
63  getParam<std::vector<NonlinearVariableName>>("displacements"));
64  if (_num_disp_var > 2)
65  mooseError("GeneralizedPlaneStrainOffDiag only works for 1D axisymmetric or 2D Cartesian "
66  "generalized plane strain cases!");
67 
68  for (unsigned int i = 0; i < _num_disp_var; ++i)
69  _disp_var.push_back(&_subproblem.getVariable(_tid, nl_vnames[i]));
70 
71  for (unsigned int i = 0; i < _deigenstrain_dT.size(); ++i)
72  _deigenstrain_dT[i] = &getMaterialPropertyDerivative<RankTwoTensor>(
74 
75  if (isParamValid("scalar_variable_index_provider") &&
76  !isParamValid("scalar_out_of_plane_strain_index"))
77  mooseError("scalar_out_of_plane_strain_index should be provided if more "
78  "than one is available");
79 }
const std::vector< MaterialPropertyName > _eigenstrain_names
std::vector< MooseVariable * > _disp_var
std::vector< const MaterialProperty< RankTwoTensor > * > _deigenstrain_dT
const MaterialProperty< RankFourTensor > & _Jacobian_mult
const SubblockIndexProvider * _subblock_id_provider

Member Function Documentation

void GeneralizedPlaneStrainOffDiag::computeDispOffDiagJacobianScalar ( unsigned int  component,
unsigned int  jvar 
)
protectedvirtual

Definition at line 104 of file GeneralizedPlaneStrainOffDiag.C.

Referenced by computeOffDiagJacobianScalar(), and computeQpResidual().

106 {
108  {
109  DenseMatrix<Number> & ken = _assembly.jacobianBlock(_var.number(), jvar);
110  DenseMatrix<Number> & kne = _assembly.jacobianBlock(jvar, _var.number());
111  MooseVariableScalar & jv = _sys.getScalarVariable(_tid, jvar);
112 
113  for (_i = 0; _i < _test.size(); ++_i)
114  for (_j = 0; _j < jv.order(); ++_j)
115  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
116  {
117  ken(_i, _j) += _JxW[_qp] * _coord[_qp] *
120  component,
121  component) *
122  _grad_test[_i][_qp](component);
123  kne(_j, _i) += _JxW[_qp] * _coord[_qp] *
126  component,
127  component) *
128  _grad_test[_i][_qp](component);
129  }
130  }
131 }
Real component(const SymmTensor &symm_tensor, unsigned int index)
const MaterialProperty< RankFourTensor > & _Jacobian_mult
void GeneralizedPlaneStrainOffDiag::computeOffDiagJacobianScalar ( unsigned int  jvar)
overrideprotected

These methods are used to compute the off-diagonal jacobian for the coupling between scalar variable strain_yy or strain_zz and nonlinear variables displacements and temperature.

disp indicates the coupling is between displacements and strain_yy or strain_zz and temp is for temperature and strain_yy or strain_zz

Definition at line 82 of file GeneralizedPlaneStrainOffDiag.C.

Referenced by computeQpResidual().

83 {
84  const unsigned int elem_scalar_var_id =
86 
87  if (elem_scalar_var_id == _scalar_var_id)
88  {
89  if (_assembly.coordSystem() == Moose::COORD_XYZ)
91  else if (_assembly.coordSystem() == Moose::COORD_RZ)
93 
94  if (_var.number() == _disp_var[0]->number())
96  else if (_num_disp_var == 2 && _var.number() == _disp_var[1]->number())
98  else if (isParamValid("temperature") ? _var.number() == _temp_var->number() : 0)
100  }
101 }
virtual unsigned int getSubblockIndex(const Elem &) const =0
The index of subblock this element is on.
virtual void computeDispOffDiagJacobianScalar(unsigned int component, unsigned int jvar)
std::vector< MooseVariable * > _disp_var
virtual void computeTempOffDiagJacobianScalar(unsigned int jvar)
const SubblockIndexProvider * _subblock_id_provider
Real GeneralizedPlaneStrainOffDiag::computeQpResidual ( )
inlineoverrideprotected

Definition at line 29 of file GeneralizedPlaneStrainOffDiag.h.

29 { return 0; }
void GeneralizedPlaneStrainOffDiag::computeTempOffDiagJacobianScalar ( unsigned int  jvar)
protectedvirtual

Definition at line 134 of file GeneralizedPlaneStrainOffDiag.C.

Referenced by computeOffDiagJacobianScalar(), and computeQpResidual().

135 {
137  {
138  DenseMatrix<Number> & kne = _assembly.jacobianBlock(jvar, _var.number());
139  MooseVariableScalar & jv = _sys.getScalarVariable(_tid, jvar);
140  unsigned int n_eigenstrains = _deigenstrain_dT.size();
141 
142  for (_i = 0; _i < _test.size(); ++_i)
143  for (_j = 0; _j < jv.order(); ++_j)
144  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
145  for (unsigned int ies = 0; ies < n_eigenstrains; ++ies)
146  kne(_j, _i) +=
147  _JxW[_qp] * _coord[_qp] *
148  (_Jacobian_mult[_qp] * (*_deigenstrain_dT[ies])[_qp])(
150  _test[_i][_qp];
151  }
152 }
std::vector< const MaterialProperty< RankTwoTensor > * > _deigenstrain_dT
const MaterialProperty< RankFourTensor > & _Jacobian_mult

Member Data Documentation

std::string GeneralizedPlaneStrainOffDiag::_base_name
protected

Definition at line 42 of file GeneralizedPlaneStrainOffDiag.h.

Referenced by GeneralizedPlaneStrainOffDiag().

std::vector<const MaterialProperty<RankTwoTensor> *> GeneralizedPlaneStrainOffDiag::_deigenstrain_dT
protected
std::vector<MooseVariable *> GeneralizedPlaneStrainOffDiag::_disp_var
protected
const std::vector<MaterialPropertyName> GeneralizedPlaneStrainOffDiag::_eigenstrain_names
protected

Definition at line 45 of file GeneralizedPlaneStrainOffDiag.h.

Referenced by GeneralizedPlaneStrainOffDiag().

const MaterialProperty<RankFourTensor>& GeneralizedPlaneStrainOffDiag::_Jacobian_mult
protected
const unsigned int GeneralizedPlaneStrainOffDiag::_num_disp_var
protected
unsigned int GeneralizedPlaneStrainOffDiag::_scalar_out_of_plane_strain_direction
protected
unsigned int GeneralizedPlaneStrainOffDiag::_scalar_out_of_plane_strain_var
protected
const unsigned int GeneralizedPlaneStrainOffDiag::_scalar_var_id
protected

Definition at line 50 of file GeneralizedPlaneStrainOffDiag.h.

Referenced by computeOffDiagJacobianScalar().

const SubblockIndexProvider* GeneralizedPlaneStrainOffDiag::_subblock_id_provider
protected

Definition at line 49 of file GeneralizedPlaneStrainOffDiag.h.

Referenced by computeOffDiagJacobianScalar().

MooseVariable* GeneralizedPlaneStrainOffDiag::_temp_var
protected

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