www.mooseframework.org
GrainRigidBodyMotionBase.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
8 
9 // MOOSE includes
10 #include "GrainTrackerInterface.h"
11 #include "MooseVariable.h"
12 
13 template <>
14 InputParameters
16 {
17  InputParameters params = validParams<NonlocalKernel>();
18  params.addClassDescription("Base class for adding rigid body motion to grains");
19  params.addRequiredCoupledVar("c", "Concentration");
20  params.addRequiredCoupledVarWithAutoBuild(
21  "v", "var_name_base", "op_num", "Array of coupled variable names");
22  params.addParam<std::string>("base_name",
23  "Optional parameter that allows the user to define "
24  "type of force density under consideration");
25  params.addParam<Real>(
26  "translation_constant", 500, "constant value characterizing grain translation");
27  params.addParam<Real>("rotation_constant", 1.0, "constant value characterizing grain rotation");
28  params.addRequiredParam<UserObjectName>(
29  "grain_force", "UserObject for getting force and torque acting on grains");
30  params.addRequiredParam<UserObjectName>("grain_tracker_object",
31  "The FeatureFloodCount UserObject to get values from.");
32  params.addRequiredParam<VectorPostprocessorName>("grain_volumes",
33  "The feature volume VectorPostprocessorValue.");
34  return params;
35 }
36 
37 GrainRigidBodyMotionBase::GrainRigidBodyMotionBase(const InputParameters & parameters)
38  : NonlocalKernel(parameters),
39  _var_dofs(_var.dofIndices()),
40  _c_var(coupled("c")),
41  _c(coupledValue("c")),
42  _grad_c(coupledGradient("c")),
43  _c_dofs(getVar("c", 0)->dofIndices()),
44  _op_num(coupledComponents("v")),
45  _vals(_op_num),
46  _vals_var(_op_num),
47  _grad_vals(_op_num),
48  _base_name(isParamValid("base_name") ? getParam<std::string>("base_name") + "_" : ""),
49  _grain_force_torque(getUserObject<GrainForceAndTorqueInterface>("grain_force")),
50  _grain_forces(_grain_force_torque.getForceValues()),
51  _grain_torques(_grain_force_torque.getTorqueValues()),
52  _grain_force_c_jacobians(_grain_force_torque.getForceCJacobians()),
53  _grain_force_eta_jacobians(_grain_force_torque.getForceEtaJacobians()),
54  _mt(getParam<Real>("translation_constant")),
55  _mr(getParam<Real>("rotation_constant")),
56  _grain_tracker(getUserObject<GrainTrackerInterface>("grain_tracker_object")),
57  _grain_volumes(getVectorPostprocessorValue("grain_volumes", "feature_volumes"))
58 {
59  // Loop through grains and load coupled variables into the arrays
60  for (unsigned int i = 0; i < _op_num; ++i)
61  {
62  _vals[i] = &coupledValue("v", i);
63  _vals_var[i] = coupled("v", i);
64  _grad_vals[i] = &coupledGradient("v", i);
65  }
66 }
67 
68 void
70 {
71  _total_dofs = _subproblem.es().n_dofs();
72 }
73 
74 bool
75 GrainRigidBodyMotionBase::globalDoFEnabled(MooseVariable & /*var*/, dof_id_type /*dof_index*/)
76 {
79  return false;
80 
81  return true;
82 }
83 
84 void
86 {
88 }
89 
90 void
92 {
94 }
95 
96 void
98 {
100 }
virtual void precalculateOffDiagJacobian(unsigned int jvar)
const unsigned int _op_num
no. of order parameters
GrainRigidBodyMotionBase(const InputParameters &parameters)
This class defines the interface for the GrainTracking objects.
This class provides interface for extracting the forces and torques computed in other UserObjects...
std::vector< unsigned int > _vals_var
unsigned int _total_dofs
get the total no. of dofs in the system
virtual bool globalDoFEnabled(MooseVariable &, dof_id_type)
std::vector< const VariableValue * > _vals
Variable value for the order parameters.
InputParameters validParams< GrainRigidBodyMotionBase >()
std::vector< const VariableGradient * > _grad_vals