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
 
UserObjectName _crack_front_points_provider
 
unsigned int _number_crack_front_points
 
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
 

Detailed Description

Definition at line 22 of file DomainIntegralAction.h.

Member Enumeration Documentation

Enumerator
GEOMETRY 
TOPOLOGY 

Definition at line 41 of file DomainIntegralAction.h.

Constructor & Destructor Documentation

DomainIntegralAction::DomainIntegralAction ( const InputParameters &  params)

Definition at line 84 of file DomainIntegralAction.C.

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

Definition at line 266 of file DomainIntegralAction.C.

266 {}

Member Function Documentation

void DomainIntegralAction::act ( )
virtual

Definition at line 269 of file DomainIntegralAction.C.

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

Definition at line 771 of file DomainIntegralAction.C.

Referenced by act().

772 {
773  unsigned int num_points = 0;
774  if (_boundary_names.size() != 0)
775  {
776  std::vector<BoundaryID> bids = _mesh->getBoundaryIDs(_boundary_names, true);
777  std::set<unsigned int> nodes;
778 
779  ConstBndNodeRange & bnd_nodes = *_mesh->getBoundaryNodeRange();
780  for (ConstBndNodeRange::const_iterator nd = bnd_nodes.begin(); nd != bnd_nodes.end(); ++nd)
781  {
782  const BndNode * bnode = *nd;
783  BoundaryID boundary_id = bnode->_bnd_id;
784 
785  for (unsigned int ibid = 0; ibid < bids.size(); ++ibid)
786  {
787  if (boundary_id == bids[ibid])
788  {
789  nodes.insert(bnode->_node->id());
790  break;
791  }
792  }
793  }
794  num_points = nodes.size();
795  }
796  else if (_crack_front_points.size() != 0)
797  num_points = _crack_front_points.size();
799  num_points = _number_crack_front_points;
800  else
801  mooseError("Must define either 'boundary' or 'crack_front_points'");
802  return num_points;
803 }
unsigned int _number_crack_front_points
const std::vector< BoundaryName > & _boundary_names
std::vector< Point > _crack_front_points

Member Data Documentation

unsigned int DomainIntegralAction::_axis_2d
protected

Definition at line 68 of file DomainIntegralAction.h.

Referenced by act().

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

Definition at line 76 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

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

Definition at line 50 of file DomainIntegralAction.h.

Referenced by act(), and calcNumCrackFrontPoints().

bool DomainIntegralAction::_convert_J_to_K
protected

Definition at line 79 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

RealVectorValue DomainIntegralAction::_crack_direction_vector
protected

Definition at line 60 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

RealVectorValue DomainIntegralAction::_crack_direction_vector_end_1
protected

Definition at line 62 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

RealVectorValue DomainIntegralAction::_crack_direction_vector_end_2
protected

Definition at line 64 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

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

Definition at line 51 of file DomainIntegralAction.h.

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

UserObjectName DomainIntegralAction::_crack_front_points_provider
protected

Definition at line 52 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

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

Definition at line 65 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

MooseEnum DomainIntegralAction::_direction_method_moose_enum
protected

Definition at line 57 of file DomainIntegralAction.h.

Referenced by act().

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

Definition at line 77 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

MooseEnum DomainIntegralAction::_end_direction_method_moose_enum
protected

Definition at line 58 of file DomainIntegralAction.h.

Referenced by act().

const std::string DomainIntegralAction::_family
protected

Definition at line 56 of file DomainIntegralAction.h.

Referenced by act().

bool DomainIntegralAction::_get_equivalent_k
protected

Definition at line 84 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

bool DomainIntegralAction::_has_symmetry_plane
protected

Definition at line 80 of file DomainIntegralAction.h.

Referenced by act().

bool DomainIntegralAction::_have_crack_direction_vector
protected

Definition at line 59 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

bool DomainIntegralAction::_have_crack_direction_vector_end_1
protected

Definition at line 61 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

bool DomainIntegralAction::_have_crack_direction_vector_end_2
protected

Definition at line 63 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

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

Definition at line 49 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

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

Definition at line 66 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

unsigned int DomainIntegralAction::_number_crack_front_points
protected

Definition at line 53 of file DomainIntegralAction.h.

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

const std::string DomainIntegralAction::_order
protected

Definition at line 55 of file DomainIntegralAction.h.

Referenced by act().

bool DomainIntegralAction::_output_q
protected

Definition at line 86 of file DomainIntegralAction.h.

Referenced by act().

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

Definition at line 73 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

Real DomainIntegralAction::_poissons_ratio
protected

Definition at line 74 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

MooseEnum DomainIntegralAction::_position_type
protected

Definition at line 82 of file DomainIntegralAction.h.

Referenced by act().

MooseEnum DomainIntegralAction::_q_function_type
protected

Definition at line 83 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

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

Definition at line 69 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

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

Definition at line 70 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

unsigned int DomainIntegralAction::_ring_first
protected

Definition at line 71 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

unsigned int DomainIntegralAction::_ring_last
protected

Definition at line 72 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

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

Definition at line 87 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

bool DomainIntegralAction::_solid_mechanics
protected

Definition at line 88 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

unsigned int DomainIntegralAction::_symmetry_plane
protected

Definition at line 81 of file DomainIntegralAction.h.

Referenced by act().

VariableName DomainIntegralAction::_temp
protected

Definition at line 78 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().

bool DomainIntegralAction::_treat_as_2d
protected

Definition at line 67 of file DomainIntegralAction.h.

Referenced by act().

bool DomainIntegralAction::_use_crack_front_points_provider
protected

Definition at line 54 of file DomainIntegralAction.h.

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

bool DomainIntegralAction::_use_displaced_mesh
protected

Definition at line 85 of file DomainIntegralAction.h.

Referenced by act().

Real DomainIntegralAction::_youngs_modulus
protected

Definition at line 75 of file DomainIntegralAction.h.

Referenced by act(), and DomainIntegralAction().


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