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

This postprocessor computes the J-Integral. More...

#include <JIntegral.h>

Inheritance diagram for JIntegral:
[legend]

Public Member Functions

 JIntegral (const InputParameters &parameters)
 
virtual Real getValue ()
 

Protected Member Functions

virtual void initialSetup ()
 
virtual Real computeQpIntegral ()
 
virtual Real computeIntegral ()
 

Protected Attributes

const CrackFrontDefinition *const _crack_front_definition
 
bool _has_crack_front_point_index
 
const unsigned int _crack_front_point_index
 
bool _treat_as_2d
 
const MaterialProperty< RankTwoTensor > & _Eshelby_tensor
 
const MaterialProperty< RealVectorValue > * _J_thermal_term_vec
 
bool _convert_J_to_K
 
bool _has_symmetry_plane
 
Real _poissons_ratio
 
Real _youngs_modulus
 
unsigned int _ring_index
 
unsigned int _ring_first
 
MooseEnum _q_function_type
 
std::vector< Real > _q_curr_elem
 
const std::vector< std::vector< Real > > * _phi_curr_elem
 
const std::vector< std::vector< RealGradient > > * _dphi_curr_elem
 

Detailed Description

This postprocessor computes the J-Integral.

Definition at line 27 of file JIntegral.h.

Constructor & Destructor Documentation

◆ JIntegral()

JIntegral::JIntegral ( const InputParameters &  parameters)

Definition at line 50 of file JIntegral.C.

51  : ElementIntegralPostprocessor(parameters),
52  _crack_front_definition(&getUserObject<CrackFrontDefinition>("crack_front_definition")),
53  _has_crack_front_point_index(isParamValid("crack_front_point_index")),
55  _has_crack_front_point_index ? getParam<unsigned int>("crack_front_point_index") : 0),
56  _treat_as_2d(false),
57  _Eshelby_tensor(getMaterialProperty<RankTwoTensor>("Eshelby_tensor")),
58  _J_thermal_term_vec(hasMaterialProperty<RealVectorValue>("J_thermal_term_vec")
59  ? &getMaterialProperty<RealVectorValue>("J_thermal_term_vec")
60  : NULL),
61  _convert_J_to_K(getParam<bool>("convert_J_to_K")),
62  _has_symmetry_plane(isParamValid("symmetry_plane")),
63  _poissons_ratio(isParamValid("poissons_ratio") ? getParam<Real>("poissons_ratio") : 0),
64  _youngs_modulus(isParamValid("youngs_modulus") ? getParam<Real>("youngs_modulus") : 0),
65  _ring_index(getParam<unsigned int>("ring_index")),
66  _q_function_type(getParam<MooseEnum>("q_function_type"))
67 {
68  if (_q_function_type == "TOPOLOGY")
69  _ring_first = getParam<unsigned int>("ring_first");
70 }
Real _poissons_ratio
Definition: JIntegral.h:45
Real _youngs_modulus
Definition: JIntegral.h:46
unsigned int _ring_index
Definition: JIntegral.h:47
unsigned int _ring_first
Definition: JIntegral.h:48
const CrackFrontDefinition *const _crack_front_definition
Definition: JIntegral.h:37
const unsigned int _crack_front_point_index
Definition: JIntegral.h:39
bool _convert_J_to_K
Definition: JIntegral.h:43
const MaterialProperty< RankTwoTensor > & _Eshelby_tensor
Definition: JIntegral.h:41
bool _has_symmetry_plane
Definition: JIntegral.h:44
MooseEnum _q_function_type
Definition: JIntegral.h:49
const MaterialProperty< RealVectorValue > * _J_thermal_term_vec
Definition: JIntegral.h:42
bool _treat_as_2d
Definition: JIntegral.h:40
bool _has_crack_front_point_index
Definition: JIntegral.h:38

Member Function Documentation

◆ computeIntegral()

Real JIntegral::computeIntegral ( )
protectedvirtual

Definition at line 136 of file JIntegral.C.

137 {
138  Real sum = 0;
139 
140  // calculate phi and dphi for this element
141  FEType fe_type(Utility::string_to_enum<Order>("first"),
142  Utility::string_to_enum<FEFamily>("lagrange"));
143  const unsigned int dim = _current_elem->dim();
144  std::unique_ptr<FEBase> fe(FEBase::build(dim, fe_type));
145  fe->attach_quadrature_rule(_qrule);
146  _phi_curr_elem = &fe->get_phi();
147  _dphi_curr_elem = &fe->get_dphi();
148  fe->reinit(_current_elem);
149 
150  // calculate q for all nodes in this element
151  _q_curr_elem.clear();
152  unsigned int ring_base = (_q_function_type == "TOPOLOGY") ? 0 : 1;
153 
154  for (unsigned int i = 0; i < _current_elem->n_nodes(); ++i)
155  {
156  Node * this_node = _current_elem->get_node(i);
157  Real q_this_node;
158 
159  if (_q_function_type == "GEOMETRY")
161  _crack_front_point_index, _ring_index - ring_base, this_node);
162  else if (_q_function_type == "TOPOLOGY")
164  _crack_front_point_index, _ring_index - ring_base, this_node);
165 
166  _q_curr_elem.push_back(q_this_node);
167  }
168 
169  for (_qp = 0; _qp < _qrule->n_points(); _qp++)
170  sum += _JxW[_qp] * _coord[_qp] * computeQpIntegral();
171  return sum;
172 }
virtual Real computeQpIntegral()
Definition: JIntegral.C:82
const std::vector< std::vector< Real > > * _phi_curr_elem
Definition: JIntegral.h:51
unsigned int _ring_index
Definition: JIntegral.h:47
const std::vector< std::vector< RealGradient > > * _dphi_curr_elem
Definition: JIntegral.h:52
const CrackFrontDefinition *const _crack_front_definition
Definition: JIntegral.h:37
const unsigned int _crack_front_point_index
Definition: JIntegral.h:39
std::vector< Real > _q_curr_elem
Definition: JIntegral.h:50
MooseEnum _q_function_type
Definition: JIntegral.h:49
Real DomainIntegralTopologicalQFunction(unsigned int crack_front_point_index, unsigned int ring_index, const Node *const current_node) const
Real DomainIntegralQFunction(unsigned int crack_front_point_index, unsigned int ring_index, const Node *const current_node) const

◆ computeQpIntegral()

Real JIntegral::computeQpIntegral ( )
protectedvirtual

Definition at line 82 of file JIntegral.C.

Referenced by computeIntegral().

83 {
84  Real scalar_q = 0.0;
85  RealVectorValue grad_of_scalar_q(0.0, 0.0, 0.0);
86 
87  const std::vector<std::vector<Real>> & phi_curr_elem = *_phi_curr_elem;
88  const std::vector<std::vector<RealGradient>> & dphi_curr_elem = *_dphi_curr_elem;
89 
90  for (unsigned int i = 0; i < _current_elem->n_nodes(); ++i)
91  {
92  scalar_q += phi_curr_elem[i][_qp] * _q_curr_elem[i];
93 
94  for (unsigned int j = 0; j < _current_elem->dim(); ++j)
95  grad_of_scalar_q(j) += dphi_curr_elem[i][_qp](j) * _q_curr_elem[i];
96  }
97 
98  RankTwoTensor grad_of_vector_q;
99  const RealVectorValue & crack_direction =
101  grad_of_vector_q(0, 0) = crack_direction(0) * grad_of_scalar_q(0);
102  grad_of_vector_q(0, 1) = crack_direction(0) * grad_of_scalar_q(1);
103  grad_of_vector_q(0, 2) = crack_direction(0) * grad_of_scalar_q(2);
104  grad_of_vector_q(1, 0) = crack_direction(1) * grad_of_scalar_q(0);
105  grad_of_vector_q(1, 1) = crack_direction(1) * grad_of_scalar_q(1);
106  grad_of_vector_q(1, 2) = crack_direction(1) * grad_of_scalar_q(2);
107  grad_of_vector_q(2, 0) = crack_direction(2) * grad_of_scalar_q(0);
108  grad_of_vector_q(2, 1) = crack_direction(2) * grad_of_scalar_q(1);
109  grad_of_vector_q(2, 2) = crack_direction(2) * grad_of_scalar_q(2);
110 
111  Real eq = _Eshelby_tensor[_qp].doubleContraction(grad_of_vector_q);
112 
113  // Thermal component
114  Real eq_thermal = 0.0;
116  {
117  for (unsigned int i = 0; i < 3; i++)
118  eq_thermal += crack_direction(i) * scalar_q * (*_J_thermal_term_vec)[_qp](i);
119  }
120 
121  Real q_avg_seg = 1.0;
123  {
124  q_avg_seg =
127  2.0;
128  }
129 
130  Real etot = -eq + eq_thermal;
131 
132  return etot / q_avg_seg;
133 }
Real getCrackFrontBackwardSegmentLength(const unsigned int point_index) const
const RealVectorValue & getCrackDirection(const unsigned int point_index) const
const std::vector< std::vector< Real > > * _phi_curr_elem
Definition: JIntegral.h:51
const std::vector< std::vector< RealGradient > > * _dphi_curr_elem
Definition: JIntegral.h:52
const CrackFrontDefinition *const _crack_front_definition
Definition: JIntegral.h:37
const unsigned int _crack_front_point_index
Definition: JIntegral.h:39
std::vector< Real > _q_curr_elem
Definition: JIntegral.h:50
const MaterialProperty< RankTwoTensor > & _Eshelby_tensor
Definition: JIntegral.h:41
Real getCrackFrontForwardSegmentLength(const unsigned int point_index) const
const MaterialProperty< RealVectorValue > * _J_thermal_term_vec
Definition: JIntegral.h:42

◆ getValue()

Real JIntegral::getValue ( )
virtual

Definition at line 175 of file JIntegral.C.

176 {
177  gatherSum(_integral_value);
179  _integral_value *= 2.0;
180 
181  Real sign = (_integral_value > 0.0) ? 1.0 : ((_integral_value < 0.0) ? -1.0 : 0.0);
182  if (_convert_J_to_K)
183  _integral_value = sign * std::sqrt(std::abs(_integral_value) * _youngs_modulus /
184  (1 - std::pow(_poissons_ratio, 2)));
185 
186  return _integral_value;
187 }
Real _poissons_ratio
Definition: JIntegral.h:45
Real _youngs_modulus
Definition: JIntegral.h:46
bool _convert_J_to_K
Definition: JIntegral.h:43
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
bool _has_symmetry_plane
Definition: JIntegral.h:44

◆ initialSetup()

void JIntegral::initialSetup ( )
protectedvirtual

Definition at line 73 of file JIntegral.C.

74 {
76 
77  if (_convert_J_to_K && (!isParamValid("youngs_modulus") || !isParamValid("poissons_ratio")))
78  mooseError("youngs_modulus and poissons_ratio must be specified if convert_J_to_K = true");
79 }
const CrackFrontDefinition *const _crack_front_definition
Definition: JIntegral.h:37
bool _convert_J_to_K
Definition: JIntegral.h:43
bool _treat_as_2d
Definition: JIntegral.h:40

Member Data Documentation

◆ _convert_J_to_K

bool JIntegral::_convert_J_to_K
protected

Definition at line 43 of file JIntegral.h.

Referenced by getValue(), and initialSetup().

◆ _crack_front_definition

const CrackFrontDefinition* const JIntegral::_crack_front_definition
protected

Definition at line 37 of file JIntegral.h.

Referenced by computeIntegral(), computeQpIntegral(), and initialSetup().

◆ _crack_front_point_index

const unsigned int JIntegral::_crack_front_point_index
protected

Definition at line 39 of file JIntegral.h.

Referenced by computeIntegral(), and computeQpIntegral().

◆ _dphi_curr_elem

const std::vector<std::vector<RealGradient> >* JIntegral::_dphi_curr_elem
protected

Definition at line 52 of file JIntegral.h.

Referenced by computeIntegral(), and computeQpIntegral().

◆ _Eshelby_tensor

const MaterialProperty<RankTwoTensor>& JIntegral::_Eshelby_tensor
protected

Definition at line 41 of file JIntegral.h.

Referenced by computeQpIntegral().

◆ _has_crack_front_point_index

bool JIntegral::_has_crack_front_point_index
protected

Definition at line 38 of file JIntegral.h.

◆ _has_symmetry_plane

bool JIntegral::_has_symmetry_plane
protected

Definition at line 44 of file JIntegral.h.

Referenced by getValue().

◆ _J_thermal_term_vec

const MaterialProperty<RealVectorValue>* JIntegral::_J_thermal_term_vec
protected

Definition at line 42 of file JIntegral.h.

Referenced by computeQpIntegral().

◆ _phi_curr_elem

const std::vector<std::vector<Real> >* JIntegral::_phi_curr_elem
protected

Definition at line 51 of file JIntegral.h.

Referenced by computeIntegral(), and computeQpIntegral().

◆ _poissons_ratio

Real JIntegral::_poissons_ratio
protected

Definition at line 45 of file JIntegral.h.

Referenced by getValue().

◆ _q_curr_elem

std::vector<Real> JIntegral::_q_curr_elem
protected

Definition at line 50 of file JIntegral.h.

Referenced by computeIntegral(), and computeQpIntegral().

◆ _q_function_type

MooseEnum JIntegral::_q_function_type
protected

Definition at line 49 of file JIntegral.h.

Referenced by computeIntegral(), and JIntegral().

◆ _ring_first

unsigned int JIntegral::_ring_first
protected

Definition at line 48 of file JIntegral.h.

Referenced by JIntegral().

◆ _ring_index

unsigned int JIntegral::_ring_index
protected

Definition at line 47 of file JIntegral.h.

Referenced by computeIntegral().

◆ _treat_as_2d

bool JIntegral::_treat_as_2d
protected

Definition at line 40 of file JIntegral.h.

Referenced by initialSetup().

◆ _youngs_modulus

Real JIntegral::_youngs_modulus
protected

Definition at line 46 of file JIntegral.h.

Referenced by getValue().


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