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 ()
 
virtual void computeResidual ()
 
virtual Real computeQpResidual ()
 
virtual Real computeStiffness (unsigned int i, unsigned int j)
 
virtual void computeJacobian ()
 
virtual void computeOffDiagJacobian (unsigned int jvar)
 

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 18 of file StressDivergenceTensorsTruss.h.

Constructor & Destructor Documentation

StressDivergenceTensorsTruss::StressDivergenceTensorsTruss ( const InputParameters &  parameters)

Definition at line 35 of file StressDivergenceTensorsTruss.C.

36  : Kernel(parameters),
37  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
38  _axial_stress(getMaterialPropertyByName<Real>(_base_name + "axial_stress")),
39  _e_over_l(getMaterialPropertyByName<Real>(_base_name + "e_over_l")),
40  _component(getParam<unsigned int>("component")),
41  _ndisp(coupledComponents("displacements")),
42  _temp_coupled(isCoupled("temperature")),
43  _temp_var(_temp_coupled ? coupled("temperature") : 0),
44  _area(coupledValue("area")),
45  _orientation(NULL)
46 {
47  for (unsigned int i = 0; i < _ndisp; ++i)
48  _disp_var.push_back(coupled("displacements", i));
49 }
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

void StressDivergenceTensorsTruss::computeJacobian ( )
protectedvirtual

Definition at line 93 of file StressDivergenceTensorsTruss.C.

Referenced by computeOffDiagJacobian(), and computeQpResidual().

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

Definition at line 119 of file StressDivergenceTensorsTruss.C.

Referenced by computeQpResidual().

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

Definition at line 26 of file StressDivergenceTensorsTruss.h.

26 { return 0.0; }
void StressDivergenceTensorsTruss::computeResidual ( )
protectedvirtual

Definition at line 58 of file StressDivergenceTensorsTruss.C.

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

Definition at line 84 of file StressDivergenceTensorsTruss.C.

Referenced by computeJacobian(), computeOffDiagJacobian(), and computeQpResidual().

85 {
86  RealGradient orientation((*_orientation)[0]);
87  orientation /= orientation.norm();
88 
89  return orientation(i) * orientation(j) * _e_over_l[0] * _area[0];
90 }
const std::vector< RealGradient > * _orientation
const MaterialProperty< Real > & _e_over_l
void StressDivergenceTensorsTruss::initialSetup ( )
protectedvirtual

Definition at line 52 of file StressDivergenceTensorsTruss.C.

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

Member Data Documentation

const VariableValue& StressDivergenceTensorsTruss::_area
private

Definition at line 44 of file StressDivergenceTensorsTruss.h.

Referenced by computeResidual(), and computeStiffness().

const MaterialProperty<Real>& StressDivergenceTensorsTruss::_axial_stress
protected

Definition at line 33 of file StressDivergenceTensorsTruss.h.

Referenced by computeResidual().

std::string StressDivergenceTensorsTruss::_base_name
protected

Definition at line 31 of file StressDivergenceTensorsTruss.h.

const unsigned int StressDivergenceTensorsTruss::_component
private
std::vector<unsigned int> StressDivergenceTensorsTruss::_disp_var
private
const MaterialProperty<Real>& StressDivergenceTensorsTruss::_e_over_l
protected

Definition at line 34 of file StressDivergenceTensorsTruss.h.

Referenced by computeStiffness().

const unsigned int StressDivergenceTensorsTruss::_ndisp
private
const std::vector<RealGradient>* StressDivergenceTensorsTruss::_orientation
private

Definition at line 45 of file StressDivergenceTensorsTruss.h.

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

const bool StressDivergenceTensorsTruss::_temp_coupled
private

Definition at line 39 of file StressDivergenceTensorsTruss.h.

const unsigned int StressDivergenceTensorsTruss::_temp_var
private

Definition at line 41 of file StressDivergenceTensorsTruss.h.


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