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

#include <RigidBodyMultiKernelAction.h>

Inheritance diagram for RigidBodyMultiKernelAction:
[legend]

Public Member Functions

 RigidBodyMultiKernelAction (const InputParameters &params)
 
virtual void act ()
 

Public Attributes

unsigned int _op_num
 
std::string _var_name_base
 
bool _implicit
 

Detailed Description

Definition at line 15 of file RigidBodyMultiKernelAction.h.

Constructor & Destructor Documentation

◆ RigidBodyMultiKernelAction()

RigidBodyMultiKernelAction::RigidBodyMultiKernelAction ( const InputParameters &  params)

Definition at line 50 of file RigidBodyMultiKernelAction.C.

51  : Action(params),
52  _op_num(getParam<unsigned int>("op_num")),
53  _var_name_base(getParam<std::string>("var_name_base")),
54  _implicit(getParam<bool>("implicit"))
55 {
56 }

Member Function Documentation

◆ act()

void RigidBodyMultiKernelAction::act ( )
virtual

Definition at line 59 of file RigidBodyMultiKernelAction.C.

60 {
61  for (unsigned int op = 0; op < _op_num; ++op)
62  {
63  //
64  // Create variable names
65  //
66 
67  std::string var_name = _var_name_base + Moose::stringify(op);
68 
69  //
70  // Create vector of coupled variables
71  //
72 
73  std::vector<VariableName> arg;
74  unsigned int ind = 0;
75 
76  if (isParamValid("c"))
77  {
78  VariableName c = getParam<VariableName>("c");
79  arg.resize(_op_num);
80 
81  for (unsigned int j = 0; j < _op_num; ++j)
82  if (j != op)
83  arg[ind++] = _var_name_base + Moose::stringify(j);
84 
85  arg[ind++] = c;
86  }
87  else
88  {
89  arg.resize(_op_num - 1);
90  for (unsigned int j = 0; j < _op_num; ++j)
91  if (j != op)
92  arg[ind++] = _var_name_base + Moose::stringify(j);
93  }
94 
95  //
96  // Create vector of order parameters
97  //
98 
99  std::vector<VariableName> v(_op_num);
100  for (unsigned int j = 0; j < _op_num; ++j)
101  v[j] = _var_name_base + Moose::stringify(j);
102 
103  //
104  // Set up ACInterface kernels
105  //
106 
107  {
108  InputParameters params = _factory.getValidParams("ACInterface");
109  params.set<NonlinearVariableName>("variable") = var_name;
110  params.set<bool>("implicit") = getParam<bool>("implicit");
111  params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
112  params.set<MaterialPropertyName>("kappa_name") = getParam<MaterialPropertyName>("kappa_name");
113  params.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mob_name");
114 
115  std::string kernel_name = "ACInt_" + var_name;
116  _problem->addKernel("ACInterface", kernel_name, params);
117  }
118 
119  //
120  // Set up the AllenCahn kernels
121  //
122 
123  {
124  InputParameters params = _factory.getValidParams("AllenCahn");
125  params.set<NonlinearVariableName>("variable") = var_name;
126  params.set<std::vector<VariableName>>("args") = arg;
127  params.set<MaterialPropertyName>("mob_name") = getParam<MaterialPropertyName>("mob_name");
128  params.set<MaterialPropertyName>("f_name") = getParam<MaterialPropertyName>("f_name");
129  params.set<bool>("implicit") = _implicit;
130  params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
131 
132  std::string kernel_name = "AC_" + var_name;
133  _problem->addKernel("AllenCahn", kernel_name, params);
134  }
135 
136  //
137  // Set up SingleGrainRigidBodyMotion kernels
138  //
139 
140  {
141  InputParameters params = _factory.getValidParams("SingleGrainRigidBodyMotion");
142  params.set<NonlinearVariableName>("variable") = var_name;
143  params.set<std::vector<VariableName>>("v") = v;
144  params.set<unsigned int>("op_index") = op;
145  params.set<std::vector<VariableName>>("c") = {getParam<VariableName>("c")};
146  if (isParamValid("base_name"))
147  params.set<std::string>("base_name") = getParam<std::string>("base_name");
148  params.set<Real>("translation_constant") = getParam<Real>("translation_constant");
149  params.set<Real>("rotation_constant") = getParam<Real>("rotation_constant");
150  params.set<UserObjectName>("grain_force") = getParam<UserObjectName>("grain_force");
151  params.set<UserObjectName>("grain_tracker_object") =
152  getParam<UserObjectName>("grain_tracker_object");
153  params.set<VectorPostprocessorName>("grain_volumes") =
154  getParam<VectorPostprocessorName>("grain_volumes");
155 
156  params.set<bool>("implicit") = _implicit;
157  params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
158 
159  std::string kernel_name = "RigidBody_" + var_name;
160  _problem->addKernel("SingleGrainRigidBodyMotion", kernel_name, params);
161  }
162 
163  //
164  // Set up TimeDerivative kernels
165  //
166 
167  {
168  InputParameters params = _factory.getValidParams("TimeDerivative");
169  params.set<NonlinearVariableName>("variable") = var_name;
170  params.set<bool>("implicit") = true;
171  params.set<bool>("use_displaced_mesh") = getParam<bool>("use_displaced_mesh");
172 
173  std::string kernel_name = "IE_" + var_name;
174  _problem->addKernel("TimeDerivative", kernel_name, params);
175  }
176  }
177 }

Member Data Documentation

◆ _implicit

bool RigidBodyMultiKernelAction::_implicit

Definition at line 23 of file RigidBodyMultiKernelAction.h.

Referenced by act().

◆ _op_num

unsigned int RigidBodyMultiKernelAction::_op_num

Definition at line 21 of file RigidBodyMultiKernelAction.h.

Referenced by act().

◆ _var_name_base

std::string RigidBodyMultiKernelAction::_var_name_base

Definition at line 22 of file RigidBodyMultiKernelAction.h.

Referenced by act().


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