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

Computes grad_i(stress_{i component}) This is exactly the same as StressDivergenceTensors, only the Jacobian entries are correct for the Cosserat case. More...

#include <CosseratStressDivergenceTensors.h>

Inheritance diagram for CosseratStressDivergenceTensors:
[legend]

Public Member Functions

 CosseratStressDivergenceTensors (const InputParameters &parameters)
 
virtual void computeJacobian () override
 
virtual void computeOffDiagJacobian (unsigned int jvar) override
 

Protected Member Functions

virtual Real computeQpOffDiagJacobian (unsigned int jvar)
 
virtual void initialSetup () override
 
virtual void computeResidual () override
 
virtual Real computeQpResidual () override
 
virtual Real computeQpJacobian () override
 
virtual void computeFiniteDeformJacobian ()
 
virtual void computeAverageGradientTest ()
 
virtual void computeAverageGradientPhi ()
 

Protected Attributes

const unsigned int _nrots
 Number of Cosserat rotation variables supplied by user. More...
 
std::vector< unsigned int > _wc_var
 The MOOSE variable numbers of the Cosserat rotation variables. More...
 
std::string _base_name
 
bool _use_finite_deform_jacobian
 
const MaterialProperty< RankTwoTensor > & _stress
 
const MaterialProperty< RankFourTensor > & _Jacobian_mult
 
std::vector< RankFourTensor > _finite_deform_Jacobian_mult
 
const MaterialProperty< RankTwoTensor > * _deformation_gradient
 
const MaterialProperty< RankTwoTensor > * _deformation_gradient_old
 
const MaterialProperty< RankTwoTensor > * _rotation_increment
 
const unsigned int _component
 
unsigned int _ndisp
 Coupled displacement variables. More...
 
std::vector< unsigned int > _disp_var
 
const bool _temp_coupled
 
const unsigned int _temp_var
 
const MaterialProperty< RankTwoTensor > *const _deigenstrain_dT
 d(strain)/d(temperature), if computed by ComputeThermalExpansionEigenstrain More...
 
std::vector< std::vector< Real > > _avg_grad_test
 Gradient of test function averaged over the element. Used in volumetric locking correction calculation. More...
 
std::vector< std::vector< Real > > _avg_grad_phi
 Gradient of phi function averaged over the element. Used in volumetric locking correction calculation. More...
 
bool _volumetric_locking_correction
 Flag for volumetric locking correction. More...
 
Assembly & _assembly_undisplaced
 undisplaced problem More...
 
MooseVariable & _var_undisplaced
 Reference to this Kernel's undisplaced MooseVariable object. More...
 
const VariablePhiGradient & _grad_phi_undisplaced
 Shape and test functions on the undisplaced mesh. More...
 
const VariableTestGradient & _grad_test_undisplaced
 

Detailed Description

Computes grad_i(stress_{i component}) This is exactly the same as StressDivergenceTensors, only the Jacobian entries are correct for the Cosserat case.

Definition at line 23 of file CosseratStressDivergenceTensors.h.

Constructor & Destructor Documentation

CosseratStressDivergenceTensors::CosseratStressDivergenceTensors ( const InputParameters &  parameters)

Definition at line 24 of file CosseratStressDivergenceTensors.C.

25  : StressDivergenceTensors(parameters),
26  _nrots(coupledComponents("Cosserat_rotations")),
28 {
29  for (unsigned i = 0; i < _nrots; ++i)
30  _wc_var[i] = coupled("Cosserat_rotations", i);
31 }
StressDivergenceTensors(const InputParameters &parameters)
const unsigned int _nrots
Number of Cosserat rotation variables supplied by user.
std::vector< unsigned int > _wc_var
The MOOSE variable numbers of the Cosserat rotation variables.

Member Function Documentation

void StressDivergenceTensors::computeAverageGradientPhi ( )
protectedvirtualinherited

Reimplemented in StressDivergenceRZTensors.

Definition at line 374 of file StressDivergenceTensors.C.

Referenced by StressDivergenceTensors::computeJacobian(), and StressDivergenceTensors::computeOffDiagJacobian().

375 {
376  // Calculate volume average derivatives for phi
377  _avg_grad_phi.resize(_phi.size());
378  for (_i = 0; _i < _phi.size(); ++_i)
379  {
380  _avg_grad_phi[_i].resize(3);
381  for (unsigned int component = 0; component < _mesh.dimension(); ++component)
382  {
383  _avg_grad_phi[_i][component] = 0.0;
384  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
385  _avg_grad_phi[_i][component] += _grad_phi[_i][_qp](component) * _JxW[_qp] * _coord[_qp];
386 
387  _avg_grad_phi[_i][component] /= _current_elem_volume;
388  }
389  }
390 }
std::vector< std::vector< Real > > _avg_grad_phi
Gradient of phi function averaged over the element. Used in volumetric locking correction calculation...
Real component(const SymmTensor &symm_tensor, unsigned int index)
void StressDivergenceTensors::computeAverageGradientTest ( )
protectedvirtualinherited

Reimplemented in StressDivergenceRZTensors.

Definition at line 358 of file StressDivergenceTensors.C.

Referenced by StressDivergenceTensors::computeJacobian(), StressDivergenceTensors::computeOffDiagJacobian(), and StressDivergenceTensors::computeResidual().

359 {
360  // Calculate volume averaged value of shape function derivative
361  _avg_grad_test.resize(_test.size());
362  for (_i = 0; _i < _test.size(); ++_i)
363  {
364  _avg_grad_test[_i].resize(3);
365  _avg_grad_test[_i][_component] = 0.0;
366  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
367  _avg_grad_test[_i][_component] += _grad_test[_i][_qp](_component) * _JxW[_qp] * _coord[_qp];
368 
369  _avg_grad_test[_i][_component] /= _current_elem_volume;
370  }
371 }
std::vector< std::vector< Real > > _avg_grad_test
Gradient of test function averaged over the element. Used in volumetric locking correction calculatio...
void StressDivergenceTensors::computeFiniteDeformJacobian ( )
protectedvirtualinherited

Definition at line 301 of file StressDivergenceTensors.C.

Referenced by StressDivergenceTensors::computeJacobian(), and StressDivergenceTensors::computeOffDiagJacobian().

302 {
303  const RankTwoTensor I(RankTwoTensor::initIdentity);
304  const RankFourTensor II_ijkl = I.mixedProductIkJl(I);
305 
306  // Bring back to unrotated config
307  const RankTwoTensor unrotated_stress =
308  (*_rotation_increment)[_qp].transpose() * _stress[_qp] * (*_rotation_increment)[_qp];
309 
310  // Incremental deformation gradient Fhat
311  const RankTwoTensor Fhat =
312  (*_deformation_gradient)[_qp] * (*_deformation_gradient_old)[_qp].inverse();
313  const RankTwoTensor Fhatinv = Fhat.inverse();
314 
315  const RankTwoTensor rot_times_stress = (*_rotation_increment)[_qp] * unrotated_stress;
316  const RankFourTensor dstress_drot =
317  I.mixedProductIkJl(rot_times_stress) + I.mixedProductJkIl(rot_times_stress);
318  const RankFourTensor rot_rank_four =
319  (*_rotation_increment)[_qp].mixedProductIkJl((*_rotation_increment)[_qp]);
320  const RankFourTensor drot_dUhatinv = Fhat.mixedProductIkJl(I);
321 
322  const RankTwoTensor A = I - Fhatinv;
323 
324  // Ctilde = Chat^-1 - I
325  const RankTwoTensor Ctilde = A * A.transpose() - A - A.transpose();
326  const RankFourTensor dCtilde_dFhatinv =
327  -I.mixedProductIkJl(A) - I.mixedProductJkIl(A) + II_ijkl + I.mixedProductJkIl(I);
328 
329  // Second order approximation of Uhat - consistent with strain increment definition
330  // const RankTwoTensor Uhat = I - 0.5 * Ctilde - 3.0/8.0 * Ctilde * Ctilde;
331 
332  RankFourTensor dUhatinv_dCtilde =
333  0.5 * II_ijkl - 1.0 / 8.0 * (I.mixedProductIkJl(Ctilde) + Ctilde.mixedProductIkJl(I));
334  RankFourTensor drot_dFhatinv = drot_dUhatinv * dUhatinv_dCtilde * dCtilde_dFhatinv;
335 
336  drot_dFhatinv -= Fhat.mixedProductIkJl((*_rotation_increment)[_qp].transpose());
337  _finite_deform_Jacobian_mult[_qp] = dstress_drot * drot_dFhatinv;
338 
339  const RankFourTensor dstrain_increment_dCtilde =
340  -0.5 * II_ijkl + 0.25 * (I.mixedProductIkJl(Ctilde) + Ctilde.mixedProductIkJl(I));
342  rot_rank_four * _Jacobian_mult[_qp] * dstrain_increment_dCtilde * dCtilde_dFhatinv;
343  _finite_deform_Jacobian_mult[_qp] += Fhat.mixedProductJkIl(_stress[_qp]);
344 
345  const RankFourTensor dFhat_dFhatinv = -Fhat.mixedProductIkJl(Fhat.transpose());
346  const RankTwoTensor dJ_dFhatinv = dFhat_dFhatinv.innerProductTranspose(Fhat.ddet());
347 
348  // Component from Jacobian derivative
349  _finite_deform_Jacobian_mult[_qp] += _stress[_qp].outerProduct(dJ_dFhatinv);
350 
351  // Derivative of Fhatinv w.r.t. undisplaced coordinates
352  const RankTwoTensor Finv = (*_deformation_gradient)[_qp].inverse();
353  const RankFourTensor dFhatinv_dGradu = -Fhatinv.mixedProductIkJl(Finv.transpose());
354  _finite_deform_Jacobian_mult[_qp] = _finite_deform_Jacobian_mult[_qp] * dFhatinv_dGradu;
355 }
std::vector< RankFourTensor > _finite_deform_Jacobian_mult
const MaterialProperty< RankFourTensor > & _Jacobian_mult
const MaterialProperty< RankTwoTensor > & _stress
void StressDivergenceTensors::computeJacobian ( )
overridevirtualinherited

Reimplemented from ALEKernel.

Definition at line 136 of file StressDivergenceTensors.C.

137 {
139  {
140  _finite_deform_Jacobian_mult.resize(_qrule->n_points());
141 
142  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
144 
146  }
147  else
148  {
150  {
153  }
154  Kernel::computeJacobian();
155  }
156 }
bool _volumetric_locking_correction
Flag for volumetric locking correction.
virtual void computeJacobian()
Definition: ALEKernel.C:33
std::vector< RankFourTensor > _finite_deform_Jacobian_mult
virtual void computeFiniteDeformJacobian()
void StressDivergenceTensors::computeOffDiagJacobian ( unsigned int  jvar)
overridevirtualinherited

Reimplemented from ALEKernel.

Definition at line 159 of file StressDivergenceTensors.C.

160 {
162  {
163  _finite_deform_Jacobian_mult.resize(_qrule->n_points());
164 
165  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
167 
169  }
170  else
171  {
173  {
176  }
177  Kernel::computeOffDiagJacobian(jvar);
178  }
179 }
virtual void computeOffDiagJacobian(unsigned int jvar)
Definition: ALEKernel.C:40
bool _volumetric_locking_correction
Flag for volumetric locking correction.
std::vector< RankFourTensor > _finite_deform_Jacobian_mult
virtual void computeFiniteDeformJacobian()
Real StressDivergenceTensors::computeQpJacobian ( )
overrideprotectedvirtualinherited

Reimplemented in StressDivergenceRSphericalTensors, StressDivergenceRZTensors, and DynamicStressDivergenceTensors.

Definition at line 182 of file StressDivergenceTensors.C.

Referenced by DynamicStressDivergenceTensors::computeQpJacobian().

183 {
186  _component,
187  _component,
188  _grad_test[_i][_qp],
189  _grad_phi_undisplaced[_j][_qp]);
190 
191  Real sum_C3x3 = _Jacobian_mult[_qp].sum3x3();
192  RealGradient sum_C3x1 = _Jacobian_mult[_qp].sum3x1();
193 
194  Real jacobian = 0.0;
195  // B^T_i * C * B_j
197  _Jacobian_mult[_qp], _component, _component, _grad_test[_i][_qp], _grad_phi[_j][_qp]);
198 
200  {
201  // jacobian = Bbar^T_i * C * Bbar_j where Bbar = B + Bvol
202  // jacobian = B^T_i * C * B_j + Bvol^T_i * C * Bvol_j + Bvol^T_i * C * B_j + B^T_i * C * Bvol_j
203 
204  // Bvol^T_i * C * Bvol_j
205  jacobian += sum_C3x3 * (_avg_grad_test[_i][_component] - _grad_test[_i][_qp](_component)) *
206  (_avg_grad_phi[_j][_component] - _grad_phi[_j][_qp](_component)) / 9.0;
207 
208  // B^T_i * C * Bvol_j
209  jacobian += sum_C3x1(_component) * _grad_test[_i][_qp](_component) *
210  (_avg_grad_phi[_j][_component] - _grad_phi[_j][_qp](_component)) / 3.0;
211 
212  // Bvol^T_i * C * B_j
213  RankTwoTensor phi;
214  if (_component == 0)
215  {
216  phi(0, 0) = _grad_phi[_j][_qp](0);
217  phi(0, 1) = phi(1, 0) = _grad_phi[_j][_qp](1);
218  phi(0, 2) = phi(2, 0) = _grad_phi[_j][_qp](2);
219  }
220  else if (_component == 1)
221  {
222  phi(1, 1) = _grad_phi[_j][_qp](1);
223  phi(0, 1) = phi(1, 0) = _grad_phi[_j][_qp](0);
224  phi(1, 2) = phi(2, 1) = _grad_phi[_j][_qp](2);
225  }
226  else if (_component == 2)
227  {
228  phi(2, 2) = _grad_phi[_j][_qp](2);
229  phi(0, 2) = phi(2, 0) = _grad_phi[_j][_qp](0);
230  phi(1, 2) = phi(2, 1) = _grad_phi[_j][_qp](1);
231  }
232 
233  jacobian += (_Jacobian_mult[_qp] * phi).trace() *
234  (_avg_grad_test[_i][_component] - _grad_test[_i][_qp](_component)) / 3.0;
235  }
236  return jacobian;
237 }
std::vector< std::vector< Real > > _avg_grad_phi
Gradient of phi function averaged over the element. Used in volumetric locking correction calculation...
bool _volumetric_locking_correction
Flag for volumetric locking correction.
std::vector< std::vector< Real > > _avg_grad_test
Gradient of test function averaged over the element. Used in volumetric locking correction calculatio...
Real elasticJacobian(const RankFourTensor &r4t, unsigned int i, unsigned int k, const RealGradient &grad_test, const RealGradient &grad_phi)
This is used for the standard kernel stress_ij*d(test)/dx_j, when varied wrt u_k Jacobian entry: d(st...
std::vector< RankFourTensor > _finite_deform_Jacobian_mult
const MaterialProperty< RankFourTensor > & _Jacobian_mult
const VariablePhiGradient & _grad_phi_undisplaced
Shape and test functions on the undisplaced mesh.
Definition: ALEKernel.h:35
Real CosseratStressDivergenceTensors::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Reimplemented from StressDivergenceTensors.

Definition at line 34 of file CosseratStressDivergenceTensors.C.

35 {
36  for (unsigned int v = 0; v < _nrots; ++v)
37  if (jvar == _wc_var[v])
39  _Jacobian_mult[_qp], _component, v, _grad_test[_i][_qp], _phi[_j][_qp]);
40 
42 }
Real elasticJacobianWC(const RankFourTensor &r4t, unsigned int i, unsigned int k, const RealGradient &grad_test, Real phi)
This is used for the standard kernel stress_ij*d(test)/dx_j, when varied wrt w_k (the cosserat rotati...
virtual Real computeQpOffDiagJacobian(unsigned int jvar) override
const MaterialProperty< RankFourTensor > & _Jacobian_mult
const unsigned int _nrots
Number of Cosserat rotation variables supplied by user.
std::vector< unsigned int > _wc_var
The MOOSE variable numbers of the Cosserat rotation variables.
Real StressDivergenceTensors::computeQpResidual ( )
overrideprotectedvirtualinherited

Reimplemented in StressDivergenceRSphericalTensors, StressDivergenceRZTensors, and DynamicStressDivergenceTensors.

Definition at line 124 of file StressDivergenceTensors.C.

Referenced by StressDivergenceTensors::computeResidual().

125 {
126  Real residual = _stress[_qp].row(_component) * _grad_test[_i][_qp];
127  // volumetric locking correction
129  residual += _stress[_qp].trace() / 3.0 *
130  (_avg_grad_test[_i][_component] - _grad_test[_i][_qp](_component));
131 
132  return residual;
133 }
bool _volumetric_locking_correction
Flag for volumetric locking correction.
std::vector< std::vector< Real > > _avg_grad_test
Gradient of test function averaged over the element. Used in volumetric locking correction calculatio...
const MaterialProperty< RankTwoTensor > & _stress
void StressDivergenceTensors::computeResidual ( )
overrideprotectedvirtualinherited

Definition at line 99 of file StressDivergenceTensors.C.

100 {
101  DenseVector<Number> & re = _assembly.residualBlock(_var.number());
102  _local_re.resize(re.size());
103  _local_re.zero();
104 
107 
108  precalculateResidual();
109  for (_i = 0; _i < _test.size(); ++_i)
110  for (_qp = 0; _qp < _qrule->n_points(); ++_qp)
111  _local_re(_i) += _JxW[_qp] * _coord[_qp] * computeQpResidual();
112 
113  re += _local_re;
114 
115  if (_has_save_in)
116  {
117  Threads::spin_mutex::scoped_lock lock(Threads::spin_mtx);
118  for (const auto & var : _save_in)
119  var->sys().solution().add_vector(_local_re, var->dofIndices());
120  }
121 }
bool _volumetric_locking_correction
Flag for volumetric locking correction.
virtual Real computeQpResidual() override
void StressDivergenceTensors::initialSetup ( )
overrideprotectedvirtualinherited

Reimplemented in StressDivergenceRSphericalTensors, and StressDivergenceRZTensors.

Definition at line 91 of file StressDivergenceTensors.C.

92 {
93  if (getBlockCoordSystem() != Moose::COORD_XYZ)
94  mooseError(
95  "The coordinate system in the Problem block must be set to XYZ for cartesian geometries.");
96 }

Member Data Documentation

Assembly& ALEKernel::_assembly_undisplaced
protectedinherited

undisplaced problem

Definition at line 29 of file ALEKernel.h.

std::vector<std::vector<Real> > StressDivergenceTensors::_avg_grad_phi
protectedinherited
std::vector<std::vector<Real> > StressDivergenceTensors::_avg_grad_test
protectedinherited
std::string StressDivergenceTensors::_base_name
protectedinherited
const unsigned int StressDivergenceTensors::_component
protectedinherited
const MaterialProperty<RankTwoTensor>* StressDivergenceTensors::_deformation_gradient
protectedinherited
const MaterialProperty<RankTwoTensor>* StressDivergenceTensors::_deformation_gradient_old
protectedinherited
const MaterialProperty<RankTwoTensor>* const StressDivergenceTensors::_deigenstrain_dT
protectedinherited

d(strain)/d(temperature), if computed by ComputeThermalExpansionEigenstrain

Definition at line 70 of file StressDivergenceTensors.h.

std::vector<unsigned int> StressDivergenceTensors::_disp_var
protectedinherited
std::vector<RankFourTensor> StressDivergenceTensors::_finite_deform_Jacobian_mult
protectedinherited
const VariablePhiGradient& ALEKernel::_grad_phi_undisplaced
protectedinherited

Shape and test functions on the undisplaced mesh.

Definition at line 35 of file ALEKernel.h.

Referenced by StressDivergenceTensors::computeQpJacobian(), and StressDivergenceTensors::computeQpOffDiagJacobian().

const VariableTestGradient& ALEKernel::_grad_test_undisplaced
protectedinherited

Definition at line 36 of file ALEKernel.h.

const MaterialProperty<RankFourTensor>& StressDivergenceTensors::_Jacobian_mult
protectedinherited
unsigned int StressDivergenceTensors::_ndisp
protectedinherited
const unsigned int CosseratStressDivergenceTensors::_nrots
protected

Number of Cosserat rotation variables supplied by user.

Definition at line 32 of file CosseratStressDivergenceTensors.h.

Referenced by computeQpOffDiagJacobian(), and CosseratStressDivergenceTensors().

const MaterialProperty<RankTwoTensor>* StressDivergenceTensors::_rotation_increment
protectedinherited
const MaterialProperty<RankTwoTensor>& StressDivergenceTensors::_stress
protectedinherited
const bool StressDivergenceTensors::_temp_coupled
protectedinherited
const unsigned int StressDivergenceTensors::_temp_var
protectedinherited
bool StressDivergenceTensors::_use_finite_deform_jacobian
protectedinherited
MooseVariable& ALEKernel::_var_undisplaced
protectedinherited

Reference to this Kernel's undisplaced MooseVariable object.

Definition at line 32 of file ALEKernel.h.

bool StressDivergenceTensors::_volumetric_locking_correction
protectedinherited
std::vector<unsigned int> CosseratStressDivergenceTensors::_wc_var
protected

The MOOSE variable numbers of the Cosserat rotation variables.

Definition at line 35 of file CosseratStressDivergenceTensors.h.

Referenced by computeQpOffDiagJacobian(), and CosseratStressDivergenceTensors().


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