www.mooseframework.org
CohesiveZoneMasterAction.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
11 #include "Factory.h"
12 #include "FEProblem.h"
13 #include "Conversion.h"
14 
15 registerMooseAction("TensorMechanicsApp", CohesiveZoneMasterAction, "add_interface_kernel");
16 
17 template <>
18 InputParameters
20 {
21  InputParameters params = validParams<Action>();
22  params.addClassDescription("Action to create an instance of the cohesive zone model kernel for "
23  "each displacement component");
24 
25  params.addRequiredParam<std::vector<BoundaryName>>(
26  "boundary", "The list of boundary IDs from the mesh where the cohesive zone will be applied");
27 
28  params.addRequiredParam<std::vector<VariableName>>(
29  "displacements",
30  "The displacements appropriate for the simulation geometry and coordinate system");
31 
32  return params;
33 }
34 
35 CohesiveZoneMasterAction::CohesiveZoneMasterAction(const InputParameters & params) : Action(params)
36 {
37 }
38 
39 void
41 {
42  std::string kernel_name = "CZMInterfaceKernel";
43 
44  std::vector<VariableName> displacements;
45  if (isParamValid("displacements"))
46  displacements = getParam<std::vector<VariableName>>("displacements");
47 
48  if (_current_task == "add_interface_kernel")
49  {
50  for (unsigned int i = 0; i < displacements.size(); ++i)
51  {
52  // Create unique kernel name for each of the components
53  std::string unique_kernel_name = kernel_name + "_" + _name + "_" + Moose::stringify(i);
54 
55  InputParameters paramsk = _factory.getValidParams(kernel_name);
56 
57  paramsk.set<bool>("use_displaced_mesh") = false;
58  paramsk.set<unsigned int>("component") = i;
59  paramsk.set<NonlinearVariableName>("variable") = displacements[i];
60  paramsk.set<std::vector<VariableName>>("neighbor_var") = {displacements[i]};
61  paramsk.set<std::vector<VariableName>>("displacements") = displacements;
62  paramsk.set<std::vector<BoundaryName>>("boundary") =
63  getParam<std::vector<BoundaryName>>("boundary");
64 
65  _problem->addInterfaceKernel(kernel_name, unique_kernel_name, paramsk);
66  }
67  }
68 }
validParams< CohesiveZoneMasterAction >
InputParameters validParams< CohesiveZoneMasterAction >()
Definition: CohesiveZoneMasterAction.C:19
CohesiveZoneMasterAction::act
void act() override
Definition: CohesiveZoneMasterAction.C:40
CohesiveZoneMasterAction
Definition: CohesiveZoneMasterAction.h:19
CohesiveZoneMasterAction::CohesiveZoneMasterAction
CohesiveZoneMasterAction(const InputParameters &params)
Definition: CohesiveZoneMasterAction.C:35
registerMooseAction
registerMooseAction("TensorMechanicsApp", CohesiveZoneMasterAction, "add_interface_kernel")
CohesiveZoneMasterAction.h