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 22 of file ADDensity.C.

23  : ADMaterial<compute_stage>(parameters),
24  _coord_system(getBlockCoordSystem()),
25  _disp_r(adCoupledValue("displacements", 0)),
26  _initial_density(adGetParam<Real>("density")),
27  _density(adDeclareADProperty<Real>("density"))
28 {
29  // get coupled gradients
30  const unsigned int ndisp = coupledComponents("displacements");
31  _grad_disp.resize(ndisp);
32  for (unsigned int i = 0; i < ndisp; ++i)
33  _grad_disp[i] = &adCoupledGradient("displacements", i);
34 
35  // fill remaining components with zero
36  _grad_disp.resize(3, &adZeroGradient());
37 }
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 48 of file ADDensity.C.

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

42 {
43  _density[_qp] = _initial_density;
44 }
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: