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

#include <XFEMAction.h>

Inheritance diagram for XFEMAction:
[legend]

Public Member Functions

 XFEMAction (InputParameters params)
 
virtual void act ()
 

Protected Attributes

std::vector< UserObjectName > _geom_cut_userobjects
 
std::string _xfem_qrule
 
std::string _order
 
std::string _family
 
bool _xfem_cut_plane
 
bool _xfem_use_crack_growth_increment
 
Real _xfem_crack_growth_increment
 
bool _use_crack_tip_enrichment
 
UserObjectName _crack_front_definition
 
std::vector< VariableName > _enrich_displacements
 
std::vector< VariableName > _displacements
 
std::vector< BoundaryName > _cut_off_bc
 
Real _cut_off_radius
 

Detailed Description

Definition at line 19 of file XFEMAction.h.

Constructor & Destructor Documentation

XFEMAction::XFEMAction ( InputParameters  params)

Definition at line 62 of file XFEMAction.C.

63  : Action(params),
64  _geom_cut_userobjects(getParam<std::vector<UserObjectName>>("geometric_cut_userobjects")),
65  _xfem_qrule(getParam<std::string>("qrule")),
66  _xfem_cut_plane(false),
67  _xfem_use_crack_growth_increment(getParam<bool>("use_crack_growth_increment")),
68  _xfem_crack_growth_increment(getParam<Real>("crack_growth_increment")),
69  _use_crack_tip_enrichment(getParam<bool>("use_crack_tip_enrichment"))
70 {
71  _order = "CONSTANT";
72  _family = "MONOMIAL";
73  if (isParamValid("output_cut_plane"))
74  _xfem_cut_plane = getParam<bool>("output_cut_plane");
75 
77  {
78  if (isParamValid("crack_front_definition"))
79  _crack_front_definition = getParam<UserObjectName>("crack_front_definition");
80  else
81  mooseError("To add crack tip enrichment, crack_front_definition must be provided.");
82 
83  if (isParamValid("displacements"))
84  _displacements = getParam<std::vector<VariableName>>("displacements");
85  else
86  mooseError("To add crack tip enrichment, displacements must be provided.");
87 
88  if (isParamValid("enrichment_displacements"))
89  {
90  _enrich_displacements = getParam<std::vector<VariableName>>("enrichment_displacements");
91  if (_enrich_displacements.size() != 8 && _displacements.size() == 2)
92  mooseError("The number of enrichment displacements should be total 8 for 2D.");
93  else if (_enrich_displacements.size() != 12 && _displacements.size() == 3)
94  mooseError("The number of enrichment displacements should be total 12 for 3D.");
95  }
96  else
97  mooseError("To add crack tip enrichment, enrichment_displacements must be provided.");
98 
99  if (isParamValid("cut_off_boundary"))
100  _cut_off_bc = getParam<std::vector<BoundaryName>>("cut_off_boundary");
101  else
102  mooseError("To add crack tip enrichment, cut_off_boundary must be provided.");
103 
104  if (isParamValid("cut_off_radius"))
105  _cut_off_radius = getParam<Real>("cut_off_radius");
106  else
107  mooseError("To add crack tip enrichment, cut_off_radius must be provided.");
108  }
109 }
UserObjectName _crack_front_definition
Definition: XFEMAction.h:35
bool _xfem_use_crack_growth_increment
Definition: XFEMAction.h:32
Real _cut_off_radius
Definition: XFEMAction.h:39
std::string _order
Definition: XFEMAction.h:29
std::string _xfem_qrule
Definition: XFEMAction.h:28
bool _use_crack_tip_enrichment
Definition: XFEMAction.h:34
std::vector< VariableName > _enrich_displacements
Definition: XFEMAction.h:36
std::vector< VariableName > _displacements
Definition: XFEMAction.h:37
bool _xfem_cut_plane
Definition: XFEMAction.h:31
std::vector< BoundaryName > _cut_off_bc
Definition: XFEMAction.h:38
Real _xfem_crack_growth_increment
Definition: XFEMAction.h:33
std::vector< UserObjectName > _geom_cut_userobjects
Definition: XFEMAction.h:27
std::string _family
Definition: XFEMAction.h:30

Member Function Documentation

void XFEMAction::act ( )
virtual

Definition at line 112 of file XFEMAction.C.

113 {
114 
115  MooseSharedPointer<XFEMInterface> xfem_interface = _problem->getXFEM();
116  if (xfem_interface == NULL)
117  {
118  _pars.set<FEProblemBase *>("_fe_problem_base") = &*_problem;
119  MooseSharedPointer<XFEM> new_xfem(new XFEM(_pars));
120  _problem->initXFEM(new_xfem);
121  xfem_interface = _problem->getXFEM();
122  }
123 
124  MooseSharedPointer<XFEM> xfem = MooseSharedNamespace::dynamic_pointer_cast<XFEM>(xfem_interface);
125  if (xfem == NULL)
126  mooseError("dynamic cast of xfem object failed");
127 
128  if (_current_task == "setup_xfem")
129  {
130  xfem->setXFEMQRule(_xfem_qrule);
131 
133 
134  MooseSharedPointer<XFEMElementPairLocator> new_xfem_epl(new XFEMElementPairLocator(xfem, 0));
135  _problem->geomSearchData().addElementPairLocator(0, new_xfem_epl);
136 
137  if (_problem->getDisplacedProblem() != NULL)
138  {
139  MooseSharedPointer<XFEMElementPairLocator> new_xfem_epl2(
140  new XFEMElementPairLocator(xfem, 0, true));
141  _problem->getDisplacedProblem()->geomSearchData().addElementPairLocator(0, new_xfem_epl2);
142  }
143 
144  // Pull in geometric cut user objects by name (getUserObjectByName)
145  // Send to XFEM and store in vector of GeometricCutUserObjects (addGeometricCut)
146  for (unsigned int i = 0; i < _geom_cut_userobjects.size(); ++i)
147  {
148  const UserObject * uo = &(_problem->getUserObjectBase(_geom_cut_userobjects[i]));
149  xfem->addGeometricCut(dynamic_cast<const GeometricCutUserObject *>(uo));
150  }
151  }
152  else if (_current_task == "add_variable" && _use_crack_tip_enrichment)
153  {
154  for (const auto & enrich_disp : _enrich_displacements)
155  _problem->addVariable(enrich_disp,
156  FEType(Utility::string_to_enum<Order>("FIRST"),
157  Utility::string_to_enum<FEFamily>("LAGRANGE")),
158  1.0);
159  }
160  else if (_current_task == "add_kernel" && _use_crack_tip_enrichment)
161  {
162  for (unsigned int i = 0; i < _enrich_displacements.size(); ++i)
163  {
164  InputParameters params = _factory.getValidParams("CrackTipEnrichmentStressDivergenceTensors");
165  params.set<NonlinearVariableName>("variable") = _enrich_displacements[i];
166  params.set<unsigned int>("component") = i / 4;
167  params.set<unsigned int>("enrichment_component") = i % 4;
168  params.set<UserObjectName>("crack_front_definition") = _crack_front_definition;
169  params.set<std::vector<VariableName>>("enrichment_displacements") = _enrich_displacements;
170  params.set<std::vector<VariableName>>("displacements") = _displacements;
171  _problem->addKernel(
172  "CrackTipEnrichmentStressDivergenceTensors", _enrich_displacements[i], params);
173  }
174  }
175  else if (_current_task == "add_bc" && _use_crack_tip_enrichment)
176  {
177  for (unsigned int i = 0; i < _enrich_displacements.size(); ++i)
178  {
179  InputParameters params = _factory.getValidParams("CrackTipEnrichmentCutOffBC");
180  params.set<NonlinearVariableName>("variable") = _enrich_displacements[i];
181  params.set<Real>("value") = 0;
182  params.set<std::vector<BoundaryName>>("boundary") = _cut_off_bc;
183  params.set<Real>("cut_off_radius") = _cut_off_radius;
184  params.set<UserObjectName>("crack_front_definition") = _crack_front_definition;
185  _problem->addBoundaryCondition(
186  "CrackTipEnrichmentCutOffBC", _enrich_displacements[i], params);
187  }
188  }
189  else if (_current_task == "add_aux_variable" && _xfem_cut_plane)
190  {
191  _problem->addAuxVariable(
192  "xfem_cut_origin_x",
193  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
194  _problem->addAuxVariable(
195  "xfem_cut_origin_y",
196  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
197  _problem->addAuxVariable(
198  "xfem_cut_origin_z",
199  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
200  _problem->addAuxVariable(
201  "xfem_cut_normal_x",
202  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
203  _problem->addAuxVariable(
204  "xfem_cut_normal_y",
205  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
206  _problem->addAuxVariable(
207  "xfem_cut_normal_z",
208  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
209 
210  _problem->addAuxVariable(
211  "xfem_cut2_origin_x",
212  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
213  _problem->addAuxVariable(
214  "xfem_cut2_origin_y",
215  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
216  _problem->addAuxVariable(
217  "xfem_cut2_origin_z",
218  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
219  _problem->addAuxVariable(
220  "xfem_cut2_normal_x",
221  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
222  _problem->addAuxVariable(
223  "xfem_cut2_normal_y",
224  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
225  _problem->addAuxVariable(
226  "xfem_cut2_normal_z",
227  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
228 
229  _problem->addAuxVariable(
230  "xfem_volfrac",
231  FEType(Utility::string_to_enum<Order>(_order), Utility::string_to_enum<FEFamily>(_family)));
232  }
233  else if (_current_task == "add_aux_kernel" && _xfem_cut_plane)
234  {
235  InputParameters params = _factory.getValidParams("XFEMVolFracAux");
236  params.set<MultiMooseEnum>("execute_on") = "timestep_begin";
237  params.set<AuxVariableName>("variable") = "xfem_volfrac";
238  _problem->addAuxKernel("XFEMVolFracAux", "xfem_volfrac", params);
239 
240  params = _factory.getValidParams("XFEMCutPlaneAux");
241  params.set<MultiMooseEnum>("execute_on") = "timestep_end";
242 
243  // first cut plane
244  params.set<unsigned int>("plane_id") = 0;
245 
246  params.set<AuxVariableName>("variable") = "xfem_cut_origin_x";
247  params.set<MooseEnum>("quantity") = "origin_x";
248  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_origin_x", params);
249 
250  params.set<AuxVariableName>("variable") = "xfem_cut_origin_y";
251  params.set<MooseEnum>("quantity") = "origin_y";
252  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_origin_y", params);
253 
254  params.set<AuxVariableName>("variable") = "xfem_cut_origin_z";
255  params.set<MooseEnum>("quantity") = "origin_z";
256  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_origin_z", params);
257 
258  params.set<AuxVariableName>("variable") = "xfem_cut_normal_x";
259  params.set<MooseEnum>("quantity") = "normal_x";
260  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_normal_x", params);
261 
262  params.set<AuxVariableName>("variable") = "xfem_cut_normal_y";
263  params.set<MooseEnum>("quantity") = "normal_y";
264  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_normal_y", params);
265 
266  params.set<AuxVariableName>("variable") = "xfem_cut_normal_z";
267  params.set<MooseEnum>("quantity") = "normal_z";
268  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut_normal_z", params);
269 
270  // second cut plane
271  params.set<unsigned int>("plane_id") = 1;
272 
273  params.set<AuxVariableName>("variable") = "xfem_cut2_origin_x";
274  params.set<MooseEnum>("quantity") = "origin_x";
275  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_origin_x", params);
276 
277  params.set<AuxVariableName>("variable") = "xfem_cut2_origin_y";
278  params.set<MooseEnum>("quantity") = "origin_y";
279  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_origin_y", params);
280 
281  params.set<AuxVariableName>("variable") = "xfem_cut2_origin_z";
282  params.set<MooseEnum>("quantity") = "origin_z";
283  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_origin_z", params);
284 
285  params.set<AuxVariableName>("variable") = "xfem_cut2_normal_x";
286  params.set<MooseEnum>("quantity") = "normal_x";
287  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_normal_x", params);
288 
289  params.set<AuxVariableName>("variable") = "xfem_cut2_normal_y";
290  params.set<MooseEnum>("quantity") = "normal_y";
291  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_normal_y", params);
292 
293  params.set<AuxVariableName>("variable") = "xfem_cut2_normal_z";
294  params.set<MooseEnum>("quantity") = "normal_z";
295  _problem->addAuxKernel("XFEMCutPlaneAux", "xfem_cut2_normal_z", params);
296  }
297 }
UserObjectName _crack_front_definition
Definition: XFEMAction.h:35
bool _xfem_use_crack_growth_increment
Definition: XFEMAction.h:32
Real _cut_off_radius
Definition: XFEMAction.h:39
This is the XFEM class.
Definition: XFEM.h:60
std::string _order
Definition: XFEMAction.h:29
std::string _xfem_qrule
Definition: XFEMAction.h:28
bool _use_crack_tip_enrichment
Definition: XFEMAction.h:34
std::vector< VariableName > _enrich_displacements
Definition: XFEMAction.h:36
std::vector< VariableName > _displacements
Definition: XFEMAction.h:37
bool _xfem_cut_plane
Definition: XFEMAction.h:31
std::vector< BoundaryName > _cut_off_bc
Definition: XFEMAction.h:38
Real _xfem_crack_growth_increment
Definition: XFEMAction.h:33
std::vector< UserObjectName > _geom_cut_userobjects
Definition: XFEMAction.h:27
std::string _family
Definition: XFEMAction.h:30

Member Data Documentation

UserObjectName XFEMAction::_crack_front_definition
protected

Definition at line 35 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

std::vector<BoundaryName> XFEMAction::_cut_off_bc
protected

Definition at line 38 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

Real XFEMAction::_cut_off_radius
protected

Definition at line 39 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

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

Definition at line 37 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

std::vector<VariableName> XFEMAction::_enrich_displacements
protected

Definition at line 36 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

std::string XFEMAction::_family
protected

Definition at line 30 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

std::vector<UserObjectName> XFEMAction::_geom_cut_userobjects
protected

Definition at line 27 of file XFEMAction.h.

Referenced by act().

std::string XFEMAction::_order
protected

Definition at line 29 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

bool XFEMAction::_use_crack_tip_enrichment
protected

Definition at line 34 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

Real XFEMAction::_xfem_crack_growth_increment
protected

Definition at line 33 of file XFEMAction.h.

Referenced by act().

bool XFEMAction::_xfem_cut_plane
protected

Definition at line 31 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

std::string XFEMAction::_xfem_qrule
protected

Definition at line 28 of file XFEMAction.h.

Referenced by act().

bool XFEMAction::_xfem_use_crack_growth_increment
protected

Definition at line 32 of file XFEMAction.h.

Referenced by act().


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