www.mooseframework.org
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ADDensity< compute_stage > Class Template Reference

#include <ADDensity.h>

Inheritance diagram for ADDensity< compute_stage >:
[legend]

Public Member Functions

 ADDensity (const InputParameters &parameters)
 

Protected Member Functions

virtual void initQpStatefulProperties ()
 
virtual void computeQpProperties ()
 

Private Member Functions

 ADMaterialProperty (Real) &_density
 

Private Attributes

Moose::CoordinateSystemType _coord_system
 
std::vector< const ADVariableGradient * > _grad_disp
 
const ADVariableValue & _disp_r
 
const Real _initial_density
 
 usingMaterialMembers
 

Detailed Description

template<ComputeStage compute_stage>
class ADDensity< compute_stage >

Definition at line 16 of file ADDensity.h.

Constructor & Destructor Documentation

◆ ADDensity()

template<ComputeStage compute_stage>
ADDensity< compute_stage >::ADDensity ( const InputParameters &  parameters)

Definition at line 21 of file ADDensity.C.

22  : ADMaterial<compute_stage>(parameters),
23  _coord_system(getBlockCoordSystem()),
24  _disp_r(adCoupledValue("displacements", 0)),
25  _initial_density(adGetParam<Real>("density")),
26  _density(adDeclareADProperty<Real>("density"))
27 {
28  // get coupled gradients
29  const unsigned int ndisp = coupledComponents("displacements");
30  _grad_disp.resize(ndisp);
31  for (unsigned int i = 0; i < ndisp; ++i)
32  _grad_disp[i] = &adCoupledGradient("displacements", i);
33 
34  // fill remaining components with zero
35  _grad_disp.resize(3, &adZeroGradient());
36 }
Moose::CoordinateSystemType _coord_system
Definition: ADDensity.h:31
std::vector< const ADVariableGradient * > _grad_disp
Definition: ADDensity.h:32
const Real _initial_density
Definition: ADDensity.h:35
const ADVariableValue & _disp_r
Definition: ADDensity.h:33

Member Function Documentation

◆ ADMaterialProperty()

template<ComputeStage compute_stage>
ADDensity< compute_stage >::ADMaterialProperty ( Real  ) &
private

◆ computeQpProperties()

template<ComputeStage compute_stage>
void ADDensity< compute_stage >::computeQpProperties ( )
protectedvirtual

Definition at line 47 of file ADDensity.C.

48 {
49  // rho * V = rho0 * V0
50  // rho = rho0 * V0 / V
51  // rho = rho0 / det(F)
52  // rho = rho0 / det(grad(u) + 1)
53 
54  const auto Axx = (*_grad_disp[0])[_qp](0) + 1.0;
55  const auto & Axy = (*_grad_disp[0])[_qp](1);
56  const auto & Axz = (*_grad_disp[0])[_qp](2);
57  const auto & Ayx = (*_grad_disp[1])[_qp](0);
58  auto Ayy = (*_grad_disp[1])[_qp](1) + 1.0;
59  const auto & Ayz = (*_grad_disp[1])[_qp](2);
60  const auto & Azx = (*_grad_disp[2])[_qp](0);
61  const auto & Azy = (*_grad_disp[2])[_qp](1);
62  auto Azz = (*_grad_disp[2])[_qp](2) + 1.0;
63 
64  switch (_coord_system)
65  {
66  case Moose::COORD_XYZ:
67  Azz = (*_grad_disp[2])[_qp](2) + 1.0;
68  break;
69 
70  case Moose::COORD_RZ:
71  if (_q_point[_qp](0) != 0.0)
72  Azz = _disp_r[_qp] / _q_point[_qp](0) + 1.0;
73  break;
74 
75  case Moose::COORD_RSPHERICAL:
76  if (_q_point[_qp](0) != 0.0)
77  Ayy = Azz = _disp_r[_qp] / _q_point[_qp](0) + 1.0;
78  break;
79  }
80 
81  const auto detF = Axx * Ayy * Azz + Axy * Ayz * Azx + Axz * Ayx * Azy - Azx * Ayy * Axz -
82  Azy * Ayz * Axx - Azz * Ayx * Axy;
83  _density[_qp] = _initial_density / detF;
84 }
Moose::CoordinateSystemType _coord_system
Definition: ADDensity.h:31
std::vector< const ADVariableGradient * > _grad_disp
Definition: ADDensity.h:32
const Real _initial_density
Definition: ADDensity.h:35
const ADVariableValue & _disp_r
Definition: ADDensity.h:33

◆ initQpStatefulProperties()

template<ComputeStage compute_stage>
void ADDensity< compute_stage >::initQpStatefulProperties ( )
protectedvirtual

Definition at line 40 of file ADDensity.C.

41 {
42  _density[_qp] = _initial_density;
43 }
const Real _initial_density
Definition: ADDensity.h:35

Member Data Documentation

◆ _coord_system

template<ComputeStage compute_stage>
Moose::CoordinateSystemType ADDensity< compute_stage >::_coord_system
private

Definition at line 31 of file ADDensity.h.

◆ _disp_r

template<ComputeStage compute_stage>
const ADVariableValue& ADDensity< compute_stage >::_disp_r
private

Definition at line 33 of file ADDensity.h.

◆ _grad_disp

template<ComputeStage compute_stage>
std::vector<const ADVariableGradient *> ADDensity< compute_stage >::_grad_disp
private

Definition at line 32 of file ADDensity.h.

Referenced by ADDensity< compute_stage >::ADDensity().

◆ _initial_density

template<ComputeStage compute_stage>
const Real ADDensity< compute_stage >::_initial_density
private

Definition at line 35 of file ADDensity.h.

◆ usingMaterialMembers

template<ComputeStage compute_stage>
ADDensity< compute_stage >::usingMaterialMembers
private

Definition at line 38 of file ADDensity.h.


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