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

#include <DomainIntegralAction.h>

Inheritance diagram for DomainIntegralAction:
[legend]

Public Member Functions

 DomainIntegralAction (const InputParameters &params)
 
 ~DomainIntegralAction ()
 
virtual void act ()
 

Protected Types

enum  INTEGRAL {
  J_INTEGRAL, INTERACTION_INTEGRAL_KI, INTERACTION_INTEGRAL_KII, INTERACTION_INTEGRAL_KIII,
  INTERACTION_INTEGRAL_T
}
 
enum  Q_FUNCTION_TYPE { GEOMETRY, TOPOLOGY }
 

Protected Member Functions

unsigned int calcNumCrackFrontPoints ()
 

Protected Attributes

std::set< INTEGRAL_integrals
 
const std::vector< BoundaryName > & _boundary_names
 
std::vector< Point > _crack_front_points
 
bool _closed_loop
 
UserObjectName _crack_front_points_provider
 
bool _use_crack_front_points_provider
 
const std::string _order
 
const std::string _family
 
MooseEnum _direction_method_moose_enum
 
MooseEnum _end_direction_method_moose_enum
 
bool _have_crack_direction_vector
 
RealVectorValue _crack_direction_vector
 
bool _have_crack_direction_vector_end_1
 
RealVectorValue _crack_direction_vector_end_1
 
bool _have_crack_direction_vector_end_2
 
RealVectorValue _crack_direction_vector_end_2
 
std::vector< BoundaryName > _crack_mouth_boundary_names
 
std::vector< BoundaryName > _intersecting_boundary_names
 
bool _treat_as_2d
 
unsigned int _axis_2d
 
std::vector< Real > _radius_inner
 
std::vector< Real > _radius_outer
 
unsigned int _ring_first
 
unsigned int _ring_last
 
std::vector< VariableName > _output_variables
 
Real _poissons_ratio
 
Real _youngs_modulus
 
std::vector< SubdomainName > _blocks
 
std::vector< VariableName > _displacements
 
VariableName _temp
 
bool _convert_J_to_K
 
bool _has_symmetry_plane
 
unsigned int _symmetry_plane
 
MooseEnum _position_type
 
MooseEnum _q_function_type
 
bool _get_equivalent_k
 
bool _use_displaced_mesh
 
bool _output_q
 
std::vector< unsigned int > _ring_vec
 
bool _solid_mechanics
 
bool _incremental
 

Detailed Description

Definition at line 25 of file DomainIntegralAction.h.

Member Enumeration Documentation

◆ INTEGRAL

◆ Q_FUNCTION_TYPE

Enumerator
GEOMETRY 
TOPOLOGY 

Definition at line 44 of file DomainIntegralAction.h.

Constructor & Destructor Documentation

◆ DomainIntegralAction()

DomainIntegralAction::DomainIntegralAction ( const InputParameters &  params)

Definition at line 97 of file DomainIntegralAction.C.

98  : Action(params),
99  _boundary_names(getParam<std::vector<BoundaryName>>("boundary")),
100  _closed_loop(getParam<bool>("closed_loop")),
102  _order(getParam<std::string>("order")),
103  _family(getParam<std::string>("family")),
104  _direction_method_moose_enum(getParam<MooseEnum>("crack_direction_method")),
105  _end_direction_method_moose_enum(getParam<MooseEnum>("crack_end_direction_method")),
109  _treat_as_2d(getParam<bool>("2d")),
110  _axis_2d(getParam<unsigned int>("axis_2d")),
111  _convert_J_to_K(false),
112  _has_symmetry_plane(isParamValid("symmetry_plane")),
113  _symmetry_plane(_has_symmetry_plane ? getParam<unsigned int>("symmetry_plane")
114  : std::numeric_limits<unsigned int>::max()),
115  _position_type(getParam<MooseEnum>("position_type")),
116  _q_function_type(getParam<MooseEnum>("q_function_type")),
117  _get_equivalent_k(getParam<bool>("equivalent_k")),
118  _use_displaced_mesh(false),
119  _output_q(getParam<bool>("output_q")),
120  _solid_mechanics(getParam<bool>("solid_mechanics")),
121  _incremental(getParam<bool>("incremental"))
122 {
123  if (_q_function_type == GEOMETRY)
124  {
125  if (isParamValid("radius_inner") && isParamValid("radius_outer"))
126  {
127  _radius_inner = getParam<std::vector<Real>>("radius_inner");
128  _radius_outer = getParam<std::vector<Real>>("radius_outer");
129  }
130  else
131  mooseError("DomainIntegral error: must set radius_inner and radius_outer.");
132  for (unsigned int i = 0; i < _radius_inner.size(); ++i)
133  _ring_vec.push_back(i + 1);
134  }
135  else if (_q_function_type == TOPOLOGY)
136  {
137  if (isParamValid("ring_first") && isParamValid("ring_last"))
138  {
139  _ring_first = getParam<unsigned int>("ring_first");
140  _ring_last = getParam<unsigned int>("ring_last");
141  }
142  else
143  mooseError(
144  "DomainIntegral error: must set ring_first and ring_last if q_function_type = Topology.");
145  for (unsigned int i = _ring_first; i <= _ring_last; ++i)
146  _ring_vec.push_back(i);
147  }
148  else
149  mooseError("DomainIntegral error: invalid q_function_type.");
150 
151  if (isParamValid("crack_front_points"))
152  _crack_front_points = getParam<std::vector<Point>>("crack_front_points");
153 
154  if (isParamValid("crack_front_points_provider"))
155  {
156  if (!isParamValid("number_points_from_provider"))
157  mooseError("DomainIntegral error: when crack_front_points_provider is used, the "
158  "number_points_from_provider must be "
159  "provided.");
161  _crack_front_points_provider = getParam<UserObjectName>("crack_front_points_provider");
162  }
163  else if (isParamValid("number_points_from_provider"))
164  mooseError("DomainIntegral error: number_points_from_provider is provided but "
165  "crack_front_points_provider cannot "
166  "be found.");
167  if (isParamValid("crack_direction_vector"))
168  {
169  _crack_direction_vector = getParam<RealVectorValue>("crack_direction_vector");
171  }
172  if (isParamValid("crack_direction_vector_end_1"))
173  {
174  _crack_direction_vector_end_1 = getParam<RealVectorValue>("crack_direction_vector_end_1");
176  }
177  if (isParamValid("crack_direction_vector_end_2"))
178  {
179  _crack_direction_vector_end_2 = getParam<RealVectorValue>("crack_direction_vector_end_2");
181  }
182  if (isParamValid("crack_mouth_boundary"))
183  _crack_mouth_boundary_names = getParam<std::vector<BoundaryName>>("crack_mouth_boundary");
184  if (isParamValid("intersecting_boundary"))
185  _intersecting_boundary_names = getParam<std::vector<BoundaryName>>("intersecting_boundary");
186  if (_radius_inner.size() != _radius_outer.size())
187  mooseError("Number of entries in 'radius_inner' and 'radius_outer' must match.");
188 
189  bool youngs_modulus_set(false);
190  bool poissons_ratio_set(false);
191  MultiMooseEnum integral_moose_enums = getParam<MultiMooseEnum>("integrals");
192  if (integral_moose_enums.size() == 0)
193  mooseError("Must specify at least one domain integral to perform.");
194  for (unsigned int i = 0; i < integral_moose_enums.size(); ++i)
195  {
196  if (integral_moose_enums[i] != "JIntegral")
197  {
198  // Check that parameters required for interaction integrals are defined
199  if (isParamValid("displacements"))
200  {
201  _displacements = getParam<std::vector<VariableName>>("displacements");
202 
203  if (_displacements.size() < 2)
204  mooseError(
205  "DomainIntegral error: The size of the displacements vector should atleast be 2.");
206  }
207  else
208  {
209  if (isParamValid("disp_x") || isParamValid("disp_y") || isParamValid("disp_z"))
210  mooseDeprecated("DomainIntegral Warning: disp_x, disp_y and disp_z are deprecated. "
211  "Please specify displacements using the `dispalcements` parameter.");
212 
213  if (!isParamValid("disp_x") || !isParamValid("disp_y"))
214  mooseError(
215  "DomainIntegral error: Specify displacements using the `displacements` parameter.");
216  else
217  {
218  _displacements.clear();
219  _displacements.push_back(getParam<VariableName>("disp_x"));
220  _displacements.push_back(getParam<VariableName>("disp_y"));
221  if (isParamValid("disp_z"))
222  _displacements.push_back(getParam<VariableName>("disp_z"));
223  }
224  }
225 
226  if (!(isParamValid("poissons_ratio")) || !(isParamValid("youngs_modulus")))
227  mooseError(
228  "DomainIntegral error: must set Poisson's ratio and Young's modulus for integral: ",
229  integral_moose_enums[i]);
230 
231  if (!(isParamValid("block")))
232  mooseError("DomainIntegral error: must set block ID or name for integral: ",
233  integral_moose_enums[i]);
234 
235  _poissons_ratio = getParam<Real>("poissons_ratio");
236  poissons_ratio_set = true;
237  _youngs_modulus = getParam<Real>("youngs_modulus");
238  youngs_modulus_set = true;
239  _blocks = getParam<std::vector<SubdomainName>>("block");
240  }
241 
242  _integrals.insert(INTEGRAL(int(integral_moose_enums.get(i))));
243  }
244 
245  if (isParamValid("temperature"))
246  _temp = getParam<VariableName>("temperature");
247 
248  if (_temp != "" && !isParamValid("eigenstrain_names") && !_solid_mechanics)
249  mooseError(
250  "DomainIntegral error: must provide `eigenstrain_names` when temperature is coupled.");
251 
253  _integrals.count(INTERACTION_INTEGRAL_KII) == 0 ||
255  mooseError("DomainIntegral error: must calculate KI, KII and KIII to get equivalent K.");
256 
257  if (isParamValid("output_variable"))
258  {
259  _output_variables = getParam<std::vector<VariableName>>("output_variable");
260  if (_crack_front_points.size() > 0)
261  mooseError("'output_variables' not yet supported with 'crack_front_points'");
262  }
263 
264  if (isParamValid("convert_J_to_K"))
265  _convert_J_to_K = getParam<bool>("convert_J_to_K");
266  if (_convert_J_to_K)
267  {
268  if (!isParamValid("youngs_modulus") || !isParamValid("poissons_ratio"))
269  mooseError("DomainIntegral error: must set Young's modulus and Poisson's ratio for "
270  "J-integral if convert_J_to_K = true.");
271  if (!youngs_modulus_set)
272  _youngs_modulus = getParam<Real>("youngs_modulus");
273  if (!poissons_ratio_set)
274  _poissons_ratio = getParam<Real>("poissons_ratio");
275  }
276 }
std::vector< VariableName > _output_variables
const std::vector< BoundaryName > & _boundary_names
UserObjectName _crack_front_points_provider
const std::string _order
RealVectorValue _crack_direction_vector_end_1
std::vector< BoundaryName > _intersecting_boundary_names
RealVectorValue _crack_direction_vector
std::vector< Real > _radius_inner
const std::string _family
MooseEnum _direction_method_moose_enum
std::vector< VariableName > _displacements
std::vector< BoundaryName > _crack_mouth_boundary_names
std::vector< SubdomainName > _blocks
MooseEnum _end_direction_method_moose_enum
std::vector< unsigned int > _ring_vec
std::vector< Real > _radius_outer
std::vector< Point > _crack_front_points
RealVectorValue _crack_direction_vector_end_2
std::set< INTEGRAL > _integrals

◆ ~DomainIntegralAction()

DomainIntegralAction::~DomainIntegralAction ( )

Definition at line 278 of file DomainIntegralAction.C.

278 {}

Member Function Documentation

◆ act()

void DomainIntegralAction::act ( )
virtual

Definition at line 281 of file DomainIntegralAction.C.

282 {
283  const std::string uo_name("crackFrontDefinition");
284  const std::string ak_base_name("q");
285  const std::string av_base_name("q");
286  const unsigned int num_crack_front_points = calcNumCrackFrontPoints();
287  const std::string aux_stress_base_name("aux_stress");
288  const std::string aux_grad_disp_base_name("aux_grad_disp");
289 
290  if (_current_task == "add_user_object")
291  {
292  const std::string uo_type_name("CrackFrontDefinition");
293 
294  InputParameters params = _factory.getValidParams(uo_type_name);
295  params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
296  params.set<MooseEnum>("crack_direction_method") = _direction_method_moose_enum;
297  params.set<MooseEnum>("crack_end_direction_method") = _end_direction_method_moose_enum;
299  params.set<RealVectorValue>("crack_direction_vector") = _crack_direction_vector;
301  params.set<RealVectorValue>("crack_direction_vector_end_1") = _crack_direction_vector_end_1;
303  params.set<RealVectorValue>("crack_direction_vector_end_2") = _crack_direction_vector_end_2;
304  if (_crack_mouth_boundary_names.size() != 0)
305  params.set<std::vector<BoundaryName>>("crack_mouth_boundary") = _crack_mouth_boundary_names;
306  if (_intersecting_boundary_names.size() != 0)
307  params.set<std::vector<BoundaryName>>("intersecting_boundary") = _intersecting_boundary_names;
308  params.set<bool>("2d") = _treat_as_2d;
309  params.set<unsigned int>("axis_2d") = _axis_2d;
311  params.set<unsigned int>("symmetry_plane") = _symmetry_plane;
312  if (_boundary_names.size() != 0)
313  params.set<std::vector<BoundaryName>>("boundary") = _boundary_names;
314  if (_crack_front_points.size() != 0)
315  params.set<std::vector<Point>>("crack_front_points") = _crack_front_points;
317  params.applyParameters(parameters(),
318  {"crack_front_points_provider, number_points_from_provider"});
319  if (_closed_loop)
320  params.set<bool>("closed_loop") = _closed_loop;
321  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
322  if (_integrals.count(INTERACTION_INTEGRAL_T) != 0)
323  {
324  params.set<VariableName>("disp_x") = _displacements[0];
325  params.set<VariableName>("disp_y") = _displacements[1];
326  if (_displacements.size() == 3)
327  params.set<VariableName>("disp_z") = _displacements[2];
328  params.set<bool>("t_stress") = true;
329  }
330 
331  unsigned int nrings = 0;
332  if (_q_function_type == TOPOLOGY)
333  {
334  params.set<bool>("q_function_rings") = true;
335  params.set<unsigned int>("last_ring") = _ring_last;
336  params.set<unsigned int>("first_ring") = _ring_first;
337  nrings = _ring_last - _ring_first + 1;
338  }
339  else if (_q_function_type == GEOMETRY)
340  {
341  params.set<std::vector<Real>>("j_integral_radius_inner") = _radius_inner;
342  params.set<std::vector<Real>>("j_integral_radius_outer") = _radius_outer;
343  nrings = _ring_vec.size();
344  }
345 
346  params.set<unsigned int>("nrings") = nrings;
347  params.set<MooseEnum>("q_function_type") = _q_function_type;
348 
349  _problem->addUserObject(uo_type_name, uo_name, params);
350  }
351  else if (_current_task == "add_aux_variable" && _output_q)
352  {
353  for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
354  {
355  if (_treat_as_2d)
356  {
357  std::ostringstream av_name_stream;
358  av_name_stream << av_base_name << "_" << _ring_vec[ring_index];
359  _problem->addAuxVariable(av_name_stream.str(),
360  FEType(Utility::string_to_enum<Order>(_order),
361  Utility::string_to_enum<FEFamily>(_family)));
362  }
363  else
364  {
365  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
366  {
367  std::ostringstream av_name_stream;
368  av_name_stream << av_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
369  _problem->addAuxVariable(av_name_stream.str(),
370  FEType(Utility::string_to_enum<Order>(_order),
371  Utility::string_to_enum<FEFamily>(_family)));
372  }
373  }
374  }
375  }
376 
377  else if (_current_task == "add_aux_kernel" && _output_q)
378  {
379  std::string ak_type_name;
380  unsigned int nrings = 0;
381  if (_q_function_type == GEOMETRY)
382  {
383  ak_type_name = "DomainIntegralQFunction";
384  nrings = _ring_vec.size();
385  }
386  else if (_q_function_type == TOPOLOGY)
387  {
388  ak_type_name = "DomainIntegralTopologicalQFunction";
389  nrings = _ring_last - _ring_first + 1;
390  }
391 
392  InputParameters params = _factory.getValidParams(ak_type_name);
393  params.set<ExecFlagEnum>("execute_on") = {EXEC_INITIAL, EXEC_TIMESTEP_END};
394  params.set<UserObjectName>("crack_front_definition") = uo_name;
395  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
396 
397  for (unsigned int ring_index = 0; ring_index < nrings; ++ring_index)
398  {
399  if (_q_function_type == GEOMETRY)
400  {
401  params.set<Real>("j_integral_radius_inner") = _radius_inner[ring_index];
402  params.set<Real>("j_integral_radius_outer") = _radius_outer[ring_index];
403  }
404  else if (_q_function_type == TOPOLOGY)
405  {
406  params.set<unsigned int>("ring_index") = _ring_first + ring_index;
407  }
408 
409  if (_treat_as_2d)
410  {
411  std::ostringstream ak_name_stream;
412  ak_name_stream << ak_base_name << "_" << _ring_vec[ring_index];
413  std::ostringstream av_name_stream;
414  av_name_stream << av_base_name << "_" << _ring_vec[ring_index];
415  params.set<AuxVariableName>("variable") = av_name_stream.str();
416  _problem->addAuxKernel(ak_type_name, ak_name_stream.str(), params);
417  }
418  else
419  {
420  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
421  {
422  std::ostringstream ak_name_stream;
423  ak_name_stream << ak_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
424  std::ostringstream av_name_stream;
425  av_name_stream << av_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
426  params.set<AuxVariableName>("variable") = av_name_stream.str();
427  params.set<unsigned int>("crack_front_point_index") = cfp_index;
428  _problem->addAuxKernel(ak_type_name, ak_name_stream.str(), params);
429  }
430  }
431  }
432  }
433 
434  else if (_current_task == "add_postprocessor")
435  {
436  if (_integrals.count(J_INTEGRAL) != 0)
437  {
438  std::string pp_base_name;
439  if (_convert_J_to_K)
440  pp_base_name = "K";
441  else
442  pp_base_name = "J";
443  const std::string pp_type_name("JIntegral");
444  InputParameters params = _factory.getValidParams(pp_type_name);
445  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
446  params.set<UserObjectName>("crack_front_definition") = uo_name;
447  params.set<bool>("convert_J_to_K") = _convert_J_to_K;
448  if (_convert_J_to_K)
449  {
450  params.set<Real>("youngs_modulus") = _youngs_modulus;
451  params.set<Real>("poissons_ratio") = _poissons_ratio;
452  }
454  params.set<unsigned int>("symmetry_plane") = _symmetry_plane;
455  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
456  for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
457  {
458  params.set<unsigned int>("ring_index") = _ring_vec[ring_index];
459  if (_q_function_type == TOPOLOGY)
460  params.set<unsigned int>("ring_first") = _ring_first;
461  params.set<MooseEnum>("q_function_type") = _q_function_type;
462 
463  if (_treat_as_2d)
464  {
465  std::ostringstream av_name_stream;
466  av_name_stream << av_base_name << "_" << _ring_vec[ring_index];
467  std::ostringstream pp_name_stream;
468  pp_name_stream << pp_base_name << "_" << _ring_vec[ring_index];
469  _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
470  }
471  else
472  {
473  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
474  {
475  std::ostringstream av_name_stream;
476  av_name_stream << av_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
477  std::ostringstream pp_name_stream;
478  pp_name_stream << pp_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
479  params.set<unsigned int>("crack_front_point_index") = cfp_index;
480  _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
481  }
482  }
483  }
484  }
485  if (_integrals.count(INTERACTION_INTEGRAL_KI) != 0 ||
486  _integrals.count(INTERACTION_INTEGRAL_KII) != 0 ||
489  {
490 
493  mooseError("In DomainIntegral, symmetry_plane option cannot be used with mode-II or "
494  "mode-III interaction integral");
495 
496  const std::string pp_base_name("II");
497  std::string pp_type_name("InteractionIntegral");
498 
499  if (_solid_mechanics)
500  pp_type_name = "InteractionIntegralSM";
501 
502  InputParameters params = _factory.getValidParams(pp_type_name);
503  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
504  params.set<UserObjectName>("crack_front_definition") = uo_name;
505  params.set<bool>("use_displaced_mesh") = _use_displaced_mesh;
507  params.set<unsigned int>("symmetry_plane") = _symmetry_plane;
508  params.set<Real>("poissons_ratio") = _poissons_ratio;
509  params.set<Real>("youngs_modulus") = _youngs_modulus;
510  params.set<std::vector<VariableName>>("displacements") = _displacements;
511  if (_temp != "")
512  params.set<std::vector<VariableName>>("temperature") = {_temp};
514  params.set<unsigned int>("symmetry_plane") = _symmetry_plane;
515 
516  for (std::set<INTEGRAL>::iterator sit = _integrals.begin(); sit != _integrals.end(); ++sit)
517  {
518  std::string pp_base_name;
519  std::string aux_mode_name;
520  switch (*sit)
521  {
522  case J_INTEGRAL:
523  continue;
524 
526  pp_base_name = "II_KI";
527  aux_mode_name = "_I_";
528  params.set<Real>("K_factor") =
529  0.5 * _youngs_modulus / (1.0 - std::pow(_poissons_ratio, 2.0));
530  params.set<MooseEnum>("sif_mode") = "KI";
531  break;
532 
534  pp_base_name = "II_KII";
535  aux_mode_name = "_II_";
536  params.set<Real>("K_factor") =
537  0.5 * _youngs_modulus / (1.0 - std::pow(_poissons_ratio, 2.0));
538  params.set<MooseEnum>("sif_mode") = "KII";
539  break;
540 
542  pp_base_name = "II_KIII";
543  aux_mode_name = "_III_";
544  params.set<Real>("K_factor") = 0.5 * _youngs_modulus / (1.0 + _poissons_ratio);
545  params.set<MooseEnum>("sif_mode") = "KIII";
546  break;
547 
549  pp_base_name = "II_T";
550  aux_mode_name = "_T_";
551  params.set<Real>("K_factor") = _youngs_modulus / (1 - std::pow(_poissons_ratio, 2));
552  params.set<MooseEnum>("sif_mode") = "T";
553  break;
554  }
555 
556  for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
557  {
558  params.set<unsigned int>("ring_index") = _ring_vec[ring_index];
559  params.set<unsigned int>("ring_first") = _ring_first;
560  params.set<MooseEnum>("q_function_type") = _q_function_type;
561 
562  if (_treat_as_2d)
563  {
564  std::ostringstream av_name_stream;
565  av_name_stream << av_base_name << "_" << _ring_vec[ring_index];
566  std::ostringstream pp_name_stream;
567  pp_name_stream << pp_base_name << "_" << _ring_vec[ring_index];
568 
569  _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
570  }
571  else
572  {
573  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
574  {
575  std::ostringstream av_name_stream;
576  av_name_stream << av_base_name << "_" << cfp_index + 1 << "_"
577  << _ring_vec[ring_index];
578  std::ostringstream pp_name_stream;
579  pp_name_stream << pp_base_name << "_" << cfp_index + 1 << "_"
580  << _ring_vec[ring_index];
581  std::ostringstream cfn_index_stream;
582  cfn_index_stream << cfp_index + 1;
583 
584  params.set<unsigned int>("crack_front_point_index") = cfp_index;
585  _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
586  }
587  }
588  }
589  }
590  }
591  for (unsigned int i = 0; i < _output_variables.size(); ++i)
592  {
593  const std::string ov_base_name(_output_variables[i]);
594  const std::string pp_type_name("CrackFrontData");
595  InputParameters params = _factory.getValidParams(pp_type_name);
596  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
597  params.set<UserObjectName>("crack_front_definition") = uo_name;
598  if (_treat_as_2d)
599  {
600  std::ostringstream pp_name_stream;
601  pp_name_stream << ov_base_name << "_crack";
602  params.set<VariableName>("variable") = _output_variables[i];
603  _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
604  }
605  else
606  {
607  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
608  {
609  std::ostringstream pp_name_stream;
610  pp_name_stream << ov_base_name << "_crack_" << cfp_index + 1;
611  params.set<VariableName>("variable") = _output_variables[i];
612  params.set<unsigned int>("crack_front_point_index") = cfp_index;
613  _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
614  }
615  }
616  }
617  if (_get_equivalent_k)
618  {
619  std::string pp_base_name("Keq");
620  const std::string pp_type_name("MixedModeEquivalentK");
621  InputParameters params = _factory.getValidParams(pp_type_name);
622  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
623  params.set<Real>("poissons_ratio") = _poissons_ratio;
624  for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
625  {
626  if (_treat_as_2d)
627  {
628  std::ostringstream ki_name_stream;
629  ki_name_stream << "II_KI_" << _ring_vec[ring_index];
630  std::ostringstream kii_name_stream;
631  kii_name_stream << "II_KII_" << _ring_vec[ring_index];
632  std::ostringstream kiii_name_stream;
633  kiii_name_stream << "II_KIII_" << _ring_vec[ring_index];
634  params.set<PostprocessorName>("KI_name") = ki_name_stream.str();
635  params.set<PostprocessorName>("KII_name") = kii_name_stream.str();
636  params.set<PostprocessorName>("KIII_name") = kiii_name_stream.str();
637  std::ostringstream pp_name_stream;
638  pp_name_stream << pp_base_name << "_" << _ring_vec[ring_index];
639  _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
640  }
641  else
642  {
643  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
644  {
645  std::ostringstream ki_name_stream;
646  ki_name_stream << "II_KI_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
647  std::ostringstream kii_name_stream;
648  kii_name_stream << "II_KII_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
649  std::ostringstream kiii_name_stream;
650  kiii_name_stream << "II_KIII_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
651  params.set<PostprocessorName>("KI_name") = ki_name_stream.str();
652  params.set<PostprocessorName>("KII_name") = kii_name_stream.str();
653  params.set<PostprocessorName>("KIII_name") = kiii_name_stream.str();
654  std::ostringstream pp_name_stream;
655  pp_name_stream << pp_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
656  params.set<unsigned int>("crack_front_point_index") = cfp_index;
657  _problem->addPostprocessor(pp_type_name, pp_name_stream.str(), params);
658  }
659  }
660  }
661  }
662  }
663 
664  else if (_current_task == "add_vector_postprocessor")
665  {
666  if (!_treat_as_2d)
667  {
668  for (std::set<INTEGRAL>::iterator sit = _integrals.begin(); sit != _integrals.end(); ++sit)
669  {
670  std::string pp_base_name;
671  switch (*sit)
672  {
673  case J_INTEGRAL:
674  if (_convert_J_to_K)
675  pp_base_name = "K";
676  else
677  pp_base_name = "J";
678  break;
680  pp_base_name = "II_KI";
681  break;
683  pp_base_name = "II_KII";
684  break;
686  pp_base_name = "II_KIII";
687  break;
689  pp_base_name = "II_T";
690  break;
691  }
692  const std::string vpp_type_name("CrackDataSampler");
693  InputParameters params = _factory.getValidParams(vpp_type_name);
694  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
695  params.set<UserObjectName>("crack_front_definition") = uo_name;
696  params.set<MooseEnum>("sort_by") = "id";
697  params.set<MooseEnum>("position_type") = _position_type;
698  for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
699  {
700  std::vector<PostprocessorName> postprocessor_names;
701  std::ostringstream vpp_name_stream;
702  vpp_name_stream << pp_base_name << "_" << _ring_vec[ring_index];
703  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
704  {
705  std::ostringstream pp_name_stream;
706  pp_name_stream << pp_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
707  postprocessor_names.push_back(pp_name_stream.str());
708  }
709  params.set<std::vector<PostprocessorName>>("postprocessors") = postprocessor_names;
710  _problem->addVectorPostprocessor(vpp_type_name, vpp_name_stream.str(), params);
711  }
712  }
713 
714  for (unsigned int i = 0; i < _output_variables.size(); ++i)
715  {
716  const std::string vpp_type_name("VectorOfPostprocessors");
717  InputParameters params = _factory.getValidParams(vpp_type_name);
718  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
719  std::ostringstream vpp_name_stream;
720  vpp_name_stream << _output_variables[i] << "_crack";
721  std::vector<PostprocessorName> postprocessor_names;
722  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
723  {
724  std::ostringstream pp_name_stream;
725  pp_name_stream << vpp_name_stream.str() << "_" << cfp_index + 1;
726  postprocessor_names.push_back(pp_name_stream.str());
727  }
728  params.set<std::vector<PostprocessorName>>("postprocessors") = postprocessor_names;
729  _problem->addVectorPostprocessor(vpp_type_name, vpp_name_stream.str(), params);
730  }
731  }
733  {
734  std::string pp_base_name("Keq");
735  const std::string vpp_type_name("CrackDataSampler");
736  InputParameters params = _factory.getValidParams(vpp_type_name);
737  params.set<ExecFlagEnum>("execute_on") = EXEC_TIMESTEP_END;
738  params.set<UserObjectName>("crack_front_definition") = uo_name;
739  params.set<MooseEnum>("sort_by") = "id";
740  params.set<MooseEnum>("position_type") = _position_type;
741  for (unsigned int ring_index = 0; ring_index < _ring_vec.size(); ++ring_index)
742  {
743  std::vector<PostprocessorName> postprocessor_names;
744  std::ostringstream vpp_name_stream;
745  vpp_name_stream << pp_base_name << "_" << _ring_vec[ring_index];
746  for (unsigned int cfp_index = 0; cfp_index < num_crack_front_points; ++cfp_index)
747  {
748  std::ostringstream pp_name_stream;
749  pp_name_stream << pp_base_name << "_" << cfp_index + 1 << "_" << _ring_vec[ring_index];
750  postprocessor_names.push_back(pp_name_stream.str());
751  }
752  params.set<std::vector<PostprocessorName>>("postprocessors") = postprocessor_names;
753  _problem->addVectorPostprocessor(vpp_type_name, vpp_name_stream.str(), params);
754  }
755  }
756  }
757 
758  else if (_current_task == "add_material")
759  {
760  if (_temp != "" && !_solid_mechanics)
761  {
762  std::string mater_name;
763  const std::string mater_type_name("ThermalFractureIntegral");
764  mater_name = "ThermalFractureIntegral";
765 
766  InputParameters params = _factory.getValidParams(mater_type_name);
767  params.set<std::vector<MaterialPropertyName>>("eigenstrain_names") =
768  getParam<std::vector<MaterialPropertyName>>("eigenstrain_names");
769  params.set<std::vector<VariableName>>("temperature") = {_temp};
770  params.set<std::vector<SubdomainName>>("block") = {_blocks};
771  _problem->addMaterial(mater_type_name, mater_name, params);
772  }
773  MultiMooseEnum integral_moose_enums = getParam<MultiMooseEnum>("integrals");
774  bool have_j_integral = false;
775  for (auto ime : integral_moose_enums)
776  {
777  if (ime == "JIntegral")
778  have_j_integral = true;
779  }
780  if (have_j_integral && !_solid_mechanics)
781  {
782  std::string mater_name;
783  const std::string mater_type_name("StrainEnergyDensity");
784  mater_name = "StrainEnergyDensity";
785 
786  InputParameters params = _factory.getValidParams(mater_type_name);
787  _incremental = getParam<bool>("incremental");
788  params.set<bool>("incremental") = _incremental;
789  params.set<std::vector<SubdomainName>>("block") = {_blocks};
790  _problem->addMaterial(mater_type_name, mater_name, params);
791 
792  std::string mater_name2;
793  const std::string mater_type_name2("EshelbyTensor");
794  mater_name2 = "EshelbyTensor";
795 
796  InputParameters params2 = _factory.getValidParams(mater_type_name2);
797  _displacements = getParam<std::vector<VariableName>>("displacements");
798  params2.set<std::vector<VariableName>>("displacements") = _displacements;
799  params2.set<std::vector<SubdomainName>>("block") = {_blocks};
800  if (_temp != "")
801  {
802  params2.set<std::vector<VariableName>>("temperature") = {_temp};
803  }
804  _problem->addMaterial(mater_type_name2, mater_name2, params2);
805  }
806  }
807 }
std::vector< VariableName > _output_variables
const std::vector< BoundaryName > & _boundary_names
const std::string _order
RealVectorValue _crack_direction_vector_end_1
std::vector< BoundaryName > _intersecting_boundary_names
unsigned int calcNumCrackFrontPoints()
RealVectorValue _crack_direction_vector
std::vector< Real > _radius_inner
const std::string _family
MooseEnum _direction_method_moose_enum
std::vector< VariableName > _displacements
std::vector< BoundaryName > _crack_mouth_boundary_names
std::vector< SubdomainName > _blocks
MooseEnum _end_direction_method_moose_enum
std::vector< unsigned int > _ring_vec
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
std::vector< Real > _radius_outer
std::vector< Point > _crack_front_points
RealVectorValue _crack_direction_vector_end_2
std::set< INTEGRAL > _integrals

◆ calcNumCrackFrontPoints()

unsigned int DomainIntegralAction::calcNumCrackFrontPoints ( )
protected

Definition at line 810 of file DomainIntegralAction.C.

Referenced by act().

811 {
812  unsigned int num_points = 0;
813  if (_boundary_names.size() != 0)
814  {
815  std::vector<BoundaryID> bids = _mesh->getBoundaryIDs(_boundary_names, true);
816  std::set<unsigned int> nodes;
817 
818  ConstBndNodeRange & bnd_nodes = *_mesh->getBoundaryNodeRange();
819  for (ConstBndNodeRange::const_iterator nd = bnd_nodes.begin(); nd != bnd_nodes.end(); ++nd)
820  {
821  const BndNode * bnode = *nd;
822  BoundaryID boundary_id = bnode->_bnd_id;
823 
824  for (unsigned int ibid = 0; ibid < bids.size(); ++ibid)
825  {
826  if (boundary_id == bids[ibid])
827  {
828  nodes.insert(bnode->_node->id());
829  break;
830  }
831  }
832  }
833  num_points = nodes.size();
834  }
835  else if (_crack_front_points.size() != 0)
836  num_points = _crack_front_points.size();
838  num_points = getParam<unsigned int>("number_points_from_provider");
839  else
840  mooseError("Must define either 'boundary' or 'crack_front_points'");
841  return num_points;
842 }
const std::vector< BoundaryName > & _boundary_names
std::vector< Point > _crack_front_points

Member Data Documentation

◆ _axis_2d

unsigned int DomainIntegralAction::_axis_2d
protected

Definition at line 71 of file DomainIntegralAction.h.

Referenced by act().

◆ _blocks

std::vector<SubdomainName> DomainIntegralAction::_blocks
protected

Definition at line 79 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _boundary_names

const std::vector<BoundaryName>& DomainIntegralAction::_boundary_names
protected

Definition at line 53 of file DomainIntegralAction.h.

Referenced by act(), and calcNumCrackFrontPoints().

◆ _closed_loop

bool DomainIntegralAction::_closed_loop
protected

Definition at line 55 of file DomainIntegralAction.h.

Referenced by act().

◆ _convert_J_to_K

bool DomainIntegralAction::_convert_J_to_K
protected

Definition at line 82 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _crack_direction_vector

RealVectorValue DomainIntegralAction::_crack_direction_vector
protected

Definition at line 63 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _crack_direction_vector_end_1

RealVectorValue DomainIntegralAction::_crack_direction_vector_end_1
protected

Definition at line 65 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _crack_direction_vector_end_2

RealVectorValue DomainIntegralAction::_crack_direction_vector_end_2
protected

Definition at line 67 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _crack_front_points

std::vector<Point> DomainIntegralAction::_crack_front_points
protected

Definition at line 54 of file DomainIntegralAction.h.

Referenced by act(), calcNumCrackFrontPoints(), and DomainIntegralAction().

◆ _crack_front_points_provider

UserObjectName DomainIntegralAction::_crack_front_points_provider
protected

Definition at line 56 of file DomainIntegralAction.h.

Referenced by DomainIntegralAction().

◆ _crack_mouth_boundary_names

std::vector<BoundaryName> DomainIntegralAction::_crack_mouth_boundary_names
protected

Definition at line 68 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _direction_method_moose_enum

MooseEnum DomainIntegralAction::_direction_method_moose_enum
protected

Definition at line 60 of file DomainIntegralAction.h.

Referenced by act().

◆ _displacements

std::vector<VariableName> DomainIntegralAction::_displacements
protected

Definition at line 80 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _end_direction_method_moose_enum

MooseEnum DomainIntegralAction::_end_direction_method_moose_enum
protected

Definition at line 61 of file DomainIntegralAction.h.

Referenced by act().

◆ _family

const std::string DomainIntegralAction::_family
protected

Definition at line 59 of file DomainIntegralAction.h.

Referenced by act().

◆ _get_equivalent_k

bool DomainIntegralAction::_get_equivalent_k
protected

Definition at line 87 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _has_symmetry_plane

bool DomainIntegralAction::_has_symmetry_plane
protected

Definition at line 83 of file DomainIntegralAction.h.

Referenced by act().

◆ _have_crack_direction_vector

bool DomainIntegralAction::_have_crack_direction_vector
protected

Definition at line 62 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _have_crack_direction_vector_end_1

bool DomainIntegralAction::_have_crack_direction_vector_end_1
protected

Definition at line 64 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _have_crack_direction_vector_end_2

bool DomainIntegralAction::_have_crack_direction_vector_end_2
protected

Definition at line 66 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _incremental

bool DomainIntegralAction::_incremental
protected

Definition at line 92 of file DomainIntegralAction.h.

Referenced by act().

◆ _integrals

std::set<INTEGRAL> DomainIntegralAction::_integrals
protected

Definition at line 52 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _intersecting_boundary_names

std::vector<BoundaryName> DomainIntegralAction::_intersecting_boundary_names
protected

Definition at line 69 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _order

const std::string DomainIntegralAction::_order
protected

Definition at line 58 of file DomainIntegralAction.h.

Referenced by act().

◆ _output_q

bool DomainIntegralAction::_output_q
protected

Definition at line 89 of file DomainIntegralAction.h.

Referenced by act().

◆ _output_variables

std::vector<VariableName> DomainIntegralAction::_output_variables
protected

Definition at line 76 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _poissons_ratio

Real DomainIntegralAction::_poissons_ratio
protected

Definition at line 77 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _position_type

MooseEnum DomainIntegralAction::_position_type
protected

Definition at line 85 of file DomainIntegralAction.h.

Referenced by act().

◆ _q_function_type

MooseEnum DomainIntegralAction::_q_function_type
protected

Definition at line 86 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _radius_inner

std::vector<Real> DomainIntegralAction::_radius_inner
protected

Definition at line 72 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _radius_outer

std::vector<Real> DomainIntegralAction::_radius_outer
protected

Definition at line 73 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _ring_first

unsigned int DomainIntegralAction::_ring_first
protected

Definition at line 74 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _ring_last

unsigned int DomainIntegralAction::_ring_last
protected

Definition at line 75 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _ring_vec

std::vector<unsigned int> DomainIntegralAction::_ring_vec
protected

Definition at line 90 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _solid_mechanics

bool DomainIntegralAction::_solid_mechanics
protected

Definition at line 91 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _symmetry_plane

unsigned int DomainIntegralAction::_symmetry_plane
protected

Definition at line 84 of file DomainIntegralAction.h.

Referenced by act().

◆ _temp

VariableName DomainIntegralAction::_temp
protected

Definition at line 81 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

◆ _treat_as_2d

bool DomainIntegralAction::_treat_as_2d
protected

Definition at line 70 of file DomainIntegralAction.h.

Referenced by act().

◆ _use_crack_front_points_provider

bool DomainIntegralAction::_use_crack_front_points_provider
protected

Definition at line 57 of file DomainIntegralAction.h.

Referenced by act(), calcNumCrackFrontPoints(), and DomainIntegralAction().

◆ _use_displaced_mesh

bool DomainIntegralAction::_use_displaced_mesh
protected

Definition at line 88 of file DomainIntegralAction.h.

Referenced by act().

◆ _youngs_modulus

Real DomainIntegralAction::_youngs_modulus
protected

Definition at line 78 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().


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