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 21 of file XFEMAction.h.

Constructor & Destructor Documentation

◆ XFEMAction()

XFEMAction::XFEMAction ( InputParameters  params)

Definition at line 74 of file XFEMAction.C.

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

Member Function Documentation

◆ act()

void XFEMAction::act ( )
virtual

Definition at line 124 of file XFEMAction.C.

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

Member Data Documentation

◆ _crack_front_definition

UserObjectName XFEMAction::_crack_front_definition
protected

Definition at line 37 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _cut_off_bc

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

Definition at line 40 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _cut_off_radius

Real XFEMAction::_cut_off_radius
protected

Definition at line 41 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _displacements

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

Definition at line 39 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _enrich_displacements

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

Definition at line 38 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _family

std::string XFEMAction::_family
protected

Definition at line 32 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _geom_cut_userobjects

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

Definition at line 29 of file XFEMAction.h.

◆ _order

std::string XFEMAction::_order
protected

Definition at line 31 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _use_crack_tip_enrichment

bool XFEMAction::_use_crack_tip_enrichment
protected

Definition at line 36 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _xfem_crack_growth_increment

Real XFEMAction::_xfem_crack_growth_increment
protected

Definition at line 35 of file XFEMAction.h.

Referenced by act().

◆ _xfem_cut_plane

bool XFEMAction::_xfem_cut_plane
protected

Definition at line 33 of file XFEMAction.h.

Referenced by act(), and XFEMAction().

◆ _xfem_qrule

std::string XFEMAction::_xfem_qrule
protected

Definition at line 30 of file XFEMAction.h.

Referenced by act().

◆ _xfem_use_crack_growth_increment

bool XFEMAction::_xfem_use_crack_growth_increment
protected

Definition at line 34 of file XFEMAction.h.

Referenced by act().


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