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 12 of file RigidBodyMultiKernelAction.h.

Constructor & Destructor Documentation

RigidBodyMultiKernelAction::RigidBodyMultiKernelAction ( const InputParameters &  params)

Definition at line 45 of file RigidBodyMultiKernelAction.C.

46  : Action(params),
47  _op_num(getParam<unsigned int>("op_num")),
48  _var_name_base(getParam<std::string>("var_name_base")),
49  _implicit(getParam<bool>("implicit"))
50 {
51 }

Member Function Documentation

void RigidBodyMultiKernelAction::act ( )
virtual

Definition at line 54 of file RigidBodyMultiKernelAction.C.

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

Member Data Documentation

bool RigidBodyMultiKernelAction::_implicit

Definition at line 20 of file RigidBodyMultiKernelAction.h.

Referenced by act().

unsigned int RigidBodyMultiKernelAction::_op_num

Definition at line 18 of file RigidBodyMultiKernelAction.h.

Referenced by act().

std::string RigidBodyMultiKernelAction::_var_name_base

Definition at line 19 of file RigidBodyMultiKernelAction.h.

Referenced by act().


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