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

#include <StressDivergenceTensorsTruss.h>

Inheritance diagram for StressDivergenceTensorsTruss:
[legend]

Public Member Functions

 StressDivergenceTensorsTruss (const InputParameters &parameters)
 

Protected Member Functions

virtual void initialSetup () override
 
virtual void computeResidual () override
 
virtual Real computeQpResidual () override
 
virtual Real computeStiffness (unsigned int i, unsigned int j)
 
virtual void computeJacobian () override
 
virtual void computeOffDiagJacobian (MooseVariableFEBase &jvar) override
 

Protected Attributes

std::string _base_name
 
const MaterialProperty< Real > & _axial_stress
 
const MaterialProperty< Real > & _e_over_l
 

Private Attributes

const unsigned int _component
 
const unsigned int _ndisp
 
const bool _temp_coupled
 
const unsigned int _temp_var
 
std::vector< unsigned int > _disp_var
 
const VariableValue & _area
 
const std::vector< RealGradient > * _orientation
 

Detailed Description

Definition at line 21 of file StressDivergenceTensorsTruss.h.

Constructor & Destructor Documentation

◆ StressDivergenceTensorsTruss()

StressDivergenceTensorsTruss::StressDivergenceTensorsTruss ( const InputParameters &  parameters)

Definition at line 39 of file StressDivergenceTensorsTruss.C.

40  : Kernel(parameters),
41  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
42  _axial_stress(getMaterialPropertyByName<Real>(_base_name + "axial_stress")),
43  _e_over_l(getMaterialPropertyByName<Real>(_base_name + "e_over_l")),
44  _component(getParam<unsigned int>("component")),
45  _ndisp(coupledComponents("displacements")),
46  _temp_coupled(isCoupled("temperature")),
47  _temp_var(_temp_coupled ? coupled("temperature") : 0),
48  _area(coupledValue("area")),
49  _orientation(NULL)
50 {
51  for (unsigned int i = 0; i < _ndisp; ++i)
52  _disp_var.push_back(coupled("displacements", i));
53 }
const std::vector< RealGradient > * _orientation
std::vector< unsigned int > _disp_var
const MaterialProperty< Real > & _axial_stress
const MaterialProperty< Real > & _e_over_l

Member Function Documentation

◆ computeJacobian()

void StressDivergenceTensorsTruss::computeJacobian ( )
overrideprotectedvirtual

Definition at line 97 of file StressDivergenceTensorsTruss.C.

Referenced by computeOffDiagJacobian().

98 {
99  DenseMatrix<Number> & ke = _assembly.jacobianBlock(_var.number(), _var.number());
100  _local_ke.resize(ke.m(), ke.n());
101  _local_ke.zero();
102 
103  for (unsigned int i = 0; i < _test.size(); ++i)
104  for (unsigned int j = 0; j < _phi.size(); ++j)
105  _local_ke(i, j) += (i == j ? 1 : -1) * computeStiffness(_component, _component);
106 
107  ke += _local_ke;
108 
109  if (_has_diag_save_in)
110  {
111  unsigned int rows = ke.m();
112  DenseVector<Number> diag(rows);
113  for (unsigned int i = 0; i < rows; ++i)
114  diag(i) = _local_ke(i, i);
115 
116  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
117  for (unsigned int i = 0; i < _diag_save_in.size(); ++i)
118  _diag_save_in[i]->sys().solution().add_vector(diag, _diag_save_in[i]->dofIndices());
119  }
120 }
virtual Real computeStiffness(unsigned int i, unsigned int j)

◆ computeOffDiagJacobian()

void StressDivergenceTensorsTruss::computeOffDiagJacobian ( MooseVariableFEBase &  jvar)
overrideprotectedvirtual

Definition at line 123 of file StressDivergenceTensorsTruss.C.

124 {
125  size_t jvar_num = jvar.number();
126  if (jvar_num == _var.number())
127  computeJacobian();
128  else
129  {
130  unsigned int coupled_component = 0;
131  bool disp_coupled = false;
132 
133  for (unsigned int i = 0; i < _ndisp; ++i)
134  if (jvar_num == _disp_var[i])
135  {
136  coupled_component = i;
137  disp_coupled = true;
138  break;
139  }
140 
141  DenseMatrix<Number> & ke = _assembly.jacobianBlock(_var.number(), jvar_num);
142 
143  if (disp_coupled)
144  for (unsigned int i = 0; i < _test.size(); ++i)
145  for (unsigned int j = 0; j < jvar.phiSize(); ++j)
146  ke(i, j) += (i == j ? 1 : -1) * computeStiffness(_component, coupled_component);
147  else if (false) // Need some code here for coupling with temperature
148  {
149  }
150  }
151 }
virtual Real computeStiffness(unsigned int i, unsigned int j)
std::vector< unsigned int > _disp_var

◆ computeQpResidual()

virtual Real StressDivergenceTensorsTruss::computeQpResidual ( )
inlineoverrideprotectedvirtual

Definition at line 29 of file StressDivergenceTensorsTruss.h.

29 { return 0.0; }

◆ computeResidual()

void StressDivergenceTensorsTruss::computeResidual ( )
overrideprotectedvirtual

Definition at line 62 of file StressDivergenceTensorsTruss.C.

63 {
64  DenseVector<Number> & re = _assembly.residualBlock(_var.number());
65  mooseAssert(re.size() == 2, "Truss element has and only has two nodes.");
66  _local_re.resize(re.size());
67  _local_re.zero();
68 
69  RealGradient orientation((*_orientation)[0]);
70  orientation /= orientation.norm();
71 
72  VectorValue<Real> force_local = _axial_stress[0] * _area[0] * orientation;
73 
74  _local_re(0) = -force_local(_component);
75  _local_re(1) = -_local_re(0);
76 
77  re += _local_re;
78 
79  if (_has_save_in)
80  {
81  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
82  for (unsigned int i = 0; i < _save_in.size(); ++i)
83  _save_in[i]->sys().solution().add_vector(_local_re, _save_in[i]->dofIndices());
84  }
85 }
const std::vector< RealGradient > * _orientation
const MaterialProperty< Real > & _axial_stress

◆ computeStiffness()

Real StressDivergenceTensorsTruss::computeStiffness ( unsigned int  i,
unsigned int  j 
)
protectedvirtual

Definition at line 88 of file StressDivergenceTensorsTruss.C.

Referenced by computeJacobian(), and computeOffDiagJacobian().

89 {
90  RealGradient orientation((*_orientation)[0]);
91  orientation /= orientation.norm();
92 
93  return orientation(i) * orientation(j) * _e_over_l[0] * _area[0];
94 }
const std::vector< RealGradient > * _orientation
const MaterialProperty< Real > & _e_over_l

◆ initialSetup()

void StressDivergenceTensorsTruss::initialSetup ( )
overrideprotectedvirtual

Definition at line 56 of file StressDivergenceTensorsTruss.C.

57 {
58  _orientation = &_subproblem.assembly(_tid).getFE(FEType(), 1)->get_dxyzdxi();
59 }
const std::vector< RealGradient > * _orientation

Member Data Documentation

◆ _area

const VariableValue& StressDivergenceTensorsTruss::_area
private

Definition at line 48 of file StressDivergenceTensorsTruss.h.

Referenced by computeResidual(), and computeStiffness().

◆ _axial_stress

const MaterialProperty<Real>& StressDivergenceTensorsTruss::_axial_stress
protected

Definition at line 37 of file StressDivergenceTensorsTruss.h.

Referenced by computeResidual().

◆ _base_name

std::string StressDivergenceTensorsTruss::_base_name
protected

Definition at line 35 of file StressDivergenceTensorsTruss.h.

◆ _component

const unsigned int StressDivergenceTensorsTruss::_component
private

◆ _disp_var

std::vector<unsigned int> StressDivergenceTensorsTruss::_disp_var
private

◆ _e_over_l

const MaterialProperty<Real>& StressDivergenceTensorsTruss::_e_over_l
protected

Definition at line 38 of file StressDivergenceTensorsTruss.h.

Referenced by computeStiffness().

◆ _ndisp

const unsigned int StressDivergenceTensorsTruss::_ndisp
private

◆ _orientation

const std::vector<RealGradient>* StressDivergenceTensorsTruss::_orientation
private

Definition at line 49 of file StressDivergenceTensorsTruss.h.

Referenced by computeResidual(), computeStiffness(), and initialSetup().

◆ _temp_coupled

const bool StressDivergenceTensorsTruss::_temp_coupled
private

Definition at line 43 of file StressDivergenceTensorsTruss.h.

◆ _temp_var

const unsigned int StressDivergenceTensorsTruss::_temp_var
private

Definition at line 45 of file StressDivergenceTensorsTruss.h.


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