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

#include <MultiGrainRigidBodyMotion.h>

Inheritance diagram for MultiGrainRigidBodyMotion:
[legend]

Public Member Functions

 MultiGrainRigidBodyMotion (const InputParameters &parameters)
 
virtual void timestepSetup ()
 

Protected Member Functions

virtual Real computeQpResidual ()
 
virtual Real computeQpJacobian ()
 
virtual Real computeQpOffDiagJacobian (unsigned int)
 
virtual Real computeQpNonlocalJacobian (dof_id_type)
 
virtual Real computeQpNonlocalOffDiagJacobian (unsigned int, dof_id_type)
 
virtual void calculateAdvectionVelocity ()
 
virtual void getUserObjectJacobian (unsigned int jvar, dof_id_type dof_index)
 
virtual bool globalDoFEnabled (MooseVariable &, dof_id_type)
 
virtual void precalculateResidual ()
 
virtual void precalculateJacobian ()
 
virtual void precalculateOffDiagJacobian (unsigned int jvar)
 

Protected Attributes

const std::vector< dof_id_type > & _var_dofs
 Variable's local dof indices. More...
 
unsigned int _c_var
 int label for the Concentration More...
 
const VariableValue & _c
 Variable value for the concentration. More...
 
const VariableGradient & _grad_c
 Variable gradient for the concentration. More...
 
const std::vector< dof_id_type > & _c_dofs
 local dof indices of variable c More...
 
const unsigned int _op_num
 no. of order parameters More...
 
std::vector< const VariableValue * > _vals
 Variable value for the order parameters. More...
 
std::vector< unsigned int > _vals_var
 
std::vector< const VariableGradient * > _grad_vals
 
std::string _base_name
 base name specifying type of force density material More...
 
const GrainForceAndTorqueInterface_grain_force_torque
 getting userobject for calculating grain forces and torques More...
 
const std::vector< RealGradient > & _grain_forces
 
const std::vector< RealGradient > & _grain_torques
 
const std::vector< Real > & _grain_force_c_jacobians
 
const std::vector< std::vector< Real > > & _grain_force_eta_jacobians
 
const Real _mt
 constant value corresponding to grain translation More...
 
const Real _mr
 constant value corresponding to grain rotation More...
 
const GrainTrackerInterface_grain_tracker
 grain tracker object More...
 
const VectorPostprocessorValue & _grain_volumes
 The grain volumes. More...
 
unsigned int _total_dofs
 get the total no. of dofs in the system More...
 
RealGradient _velocity_advection
 storing the advection velocity and corresponding jacobian entries calculated in userobjects More...
 
RealGradient _velocity_advection_jacobian
 
std::vector< unsigned int > _grain_ids
 obtain the active grain ids More...
 

Detailed Description

Definition at line 18 of file MultiGrainRigidBodyMotion.h.

Constructor & Destructor Documentation

MultiGrainRigidBodyMotion::MultiGrainRigidBodyMotion ( const InputParameters &  parameters)

Definition at line 22 of file MultiGrainRigidBodyMotion.C.

23  : GrainRigidBodyMotionBase(parameters)
24 {
25 }
GrainRigidBodyMotionBase(const InputParameters &parameters)

Member Function Documentation

void MultiGrainRigidBodyMotion::calculateAdvectionVelocity ( )
protectedvirtual

Reimplemented from GrainRigidBodyMotionBase.

Definition at line 121 of file MultiGrainRigidBodyMotion.C.

122 {
123  _velocity_advection = 0.0;
124  _grain_ids = _grain_tracker.getVarToFeatureVector(_current_elem->id());
125 
126  for (auto i = beginIndex(_grain_ids); i < _grain_ids.size(); ++i)
127  {
128  auto grain_id = _grain_ids[i];
129  if (grain_id != FeatureFloodCount::invalid_id)
130  {
131  mooseAssert(grain_id < _grain_volumes.size(), "grain_id out of bounds");
132  const auto volume = _grain_volumes[grain_id];
133  const auto centroid = _grain_tracker.getGrainCentroid(grain_id);
134  const auto force = _mt / volume * _grain_forces[grain_id];
135  const auto torque =
136  _mr / volume * (_grain_torques[grain_id].cross(_current_elem->centroid() - centroid));
137 
138  _velocity_advection += (force + torque);
139  }
140  }
141 }
virtual Point getGrainCentroid(unsigned int grain_id) const =0
Returns the centroid for the given grain number.
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...
const Real _mr
constant value corresponding to grain rotation
std::vector< unsigned int > _grain_ids
obtain the active grain ids
const VectorPostprocessorValue & _grain_volumes
The grain volumes.
const std::vector< RealGradient > & _grain_torques
virtual const std::vector< unsigned int > & getVarToFeatureVector(dof_id_type elem_id) const =0
Returns a list of active unique feature ids for a particular element.
const std::vector< RealGradient > & _grain_forces
static const unsigned int invalid_id
const GrainTrackerInterface & _grain_tracker
grain tracker object
const Real _mt
constant value corresponding to grain translation
Real MultiGrainRigidBodyMotion::computeQpJacobian ( )
protectedvirtual

Definition at line 34 of file MultiGrainRigidBodyMotion.C.

35 {
36  if (_var.number() == _c_var) // Requires c jacobian
37  return _velocity_advection * _grad_phi[_j][_qp] * _test[_i][_qp] +
38  _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
39 
40  return 0.0;
41 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...
const VariableGradient & _grad_c
Variable gradient for the concentration.
unsigned int _c_var
int label for the Concentration
Real MultiGrainRigidBodyMotion::computeQpNonlocalJacobian ( dof_id_type  )
protectedvirtual

Definition at line 53 of file MultiGrainRigidBodyMotion.C.

54 {
55  if (_var.number() == _c_var) // Requires c jacobian
56  return _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
57 
58  return 0.0;
59 }
const VariableGradient & _grad_c
Variable gradient for the concentration.
unsigned int _c_var
int label for the Concentration
Real MultiGrainRigidBodyMotion::computeQpNonlocalOffDiagJacobian ( unsigned  int,
dof_id_type   
)
protectedvirtual

Definition at line 62 of file MultiGrainRigidBodyMotion.C.

64 {
65  return _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
66 }
const VariableGradient & _grad_c
Variable gradient for the concentration.
Real MultiGrainRigidBodyMotion::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 44 of file MultiGrainRigidBodyMotion.C.

45 {
46  if (jvar == _c_var) // Requires c jacobian
47  return _velocity_advection * _grad_phi[_j][_qp] * _test[_i][_qp] +
48  _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
49  else
50  return _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
51 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...
const VariableGradient & _grad_c
Variable gradient for the concentration.
unsigned int _c_var
int label for the Concentration
Real MultiGrainRigidBodyMotion::computeQpResidual ( )
protectedvirtual

Definition at line 28 of file MultiGrainRigidBodyMotion.C.

29 {
30  return _velocity_advection * _grad_c[_qp] * _test[_i][_qp];
31 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...
const VariableGradient & _grad_c
Variable gradient for the concentration.
void MultiGrainRigidBodyMotion::getUserObjectJacobian ( unsigned int  jvar,
dof_id_type  dof_index 
)
protectedvirtual

Definition at line 69 of file MultiGrainRigidBodyMotion.C.

70 {
72 
73  for (auto i = beginIndex(_grain_ids); i < _grain_ids.size(); ++i)
74  {
75  auto grain_id = _grain_ids[i];
76  if (grain_id != FeatureFloodCount::invalid_id)
77  {
78  mooseAssert(grain_id < _grain_volumes.size(), "grain_id out of bounds");
79  const auto volume = _grain_volumes[grain_id];
80  const auto centroid = _grain_tracker.getGrainCentroid(grain_id);
81  RealGradient force_jacobian;
82  RealGradient torque_jacobian;
83 
84  if (jvar == _c_var)
85  {
86  force_jacobian(0) = _grain_force_c_jacobians[(6 * grain_id + 0) * _total_dofs + dof_index];
87  force_jacobian(1) = _grain_force_c_jacobians[(6 * grain_id + 1) * _total_dofs + dof_index];
88  force_jacobian(2) = _grain_force_c_jacobians[(6 * grain_id + 2) * _total_dofs + dof_index];
89  torque_jacobian(0) = _grain_force_c_jacobians[(6 * grain_id + 3) * _total_dofs + dof_index];
90  torque_jacobian(1) = _grain_force_c_jacobians[(6 * grain_id + 4) * _total_dofs + dof_index];
91  torque_jacobian(2) = _grain_force_c_jacobians[(6 * grain_id + 5) * _total_dofs + dof_index];
92  }
93 
94  for (unsigned int jvar_index = 0; jvar_index < _op_num; ++jvar_index)
95  if (jvar == _vals_var[jvar_index])
96  {
97  force_jacobian(0) =
98  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 0) * _total_dofs + dof_index];
99  force_jacobian(1) =
100  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 1) * _total_dofs + dof_index];
101  force_jacobian(2) =
102  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 2) * _total_dofs + dof_index];
103  torque_jacobian(0) =
104  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 3) * _total_dofs + dof_index];
105  torque_jacobian(1) =
106  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 4) * _total_dofs + dof_index];
107  torque_jacobian(2) =
108  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 5) * _total_dofs + dof_index];
109  }
110 
111  const auto force_jac = _mt / volume * force_jacobian;
112  const auto torque_jac =
113  _mr / volume * torque_jacobian.cross(_current_elem->centroid() - centroid);
114 
115  _velocity_advection_jacobian += (force_jac + torque_jac);
116  }
117  }
118 }
const unsigned int _op_num
no. of order parameters
virtual Point getGrainCentroid(unsigned int grain_id) const =0
Returns the centroid for the given grain number.
const Real _mr
constant value corresponding to grain rotation
std::vector< unsigned int > _grain_ids
obtain the active grain ids
const std::vector< std::vector< Real > > & _grain_force_eta_jacobians
const VectorPostprocessorValue & _grain_volumes
The grain volumes.
std::vector< unsigned int > _vals_var
static const unsigned int invalid_id
unsigned int _total_dofs
get the total no. of dofs in the system
const GrainTrackerInterface & _grain_tracker
grain tracker object
unsigned int _c_var
int label for the Concentration
const Real _mt
constant value corresponding to grain translation
const std::vector< Real > & _grain_force_c_jacobians
bool GrainRigidBodyMotionBase::globalDoFEnabled ( MooseVariable &  ,
dof_id_type   
)
protectedvirtualinherited

Definition at line 75 of file GrainRigidBodyMotionBase.C.

76 {
79  return false;
80 
81  return true;
82 }
void GrainRigidBodyMotionBase::precalculateJacobian ( )
protectedvirtualinherited

Definition at line 91 of file GrainRigidBodyMotionBase.C.

92 {
94 }
void GrainRigidBodyMotionBase::precalculateOffDiagJacobian ( unsigned int  jvar)
protectedvirtualinherited

Definition at line 97 of file GrainRigidBodyMotionBase.C.

98 {
100 }
void GrainRigidBodyMotionBase::precalculateResidual ( )
protectedvirtualinherited

Definition at line 85 of file GrainRigidBodyMotionBase.C.

86 {
88 }
void GrainRigidBodyMotionBase::timestepSetup ( )
virtualinherited

Definition at line 69 of file GrainRigidBodyMotionBase.C.

70 {
71  _total_dofs = _subproblem.es().n_dofs();
72 }
unsigned int _total_dofs
get the total no. of dofs in the system

Member Data Documentation

std::string GrainRigidBodyMotionBase::_base_name
protectedinherited

base name specifying type of force density material

Definition at line 57 of file GrainRigidBodyMotionBase.h.

const VariableValue& GrainRigidBodyMotionBase::_c
protectedinherited

Variable value for the concentration.

Definition at line 43 of file GrainRigidBodyMotionBase.h.

const std::vector<dof_id_type>& GrainRigidBodyMotionBase::_c_dofs
protectedinherited

local dof indices of variable c

Definition at line 47 of file GrainRigidBodyMotionBase.h.

unsigned int GrainRigidBodyMotionBase::_c_var
protectedinherited
const VariableGradient& GrainRigidBodyMotionBase::_grad_c
protectedinherited
std::vector<const VariableGradient *> GrainRigidBodyMotionBase::_grad_vals
protectedinherited
const std::vector<Real>& GrainRigidBodyMotionBase::_grain_force_c_jacobians
protectedinherited
const std::vector<std::vector<Real> >& GrainRigidBodyMotionBase::_grain_force_eta_jacobians
protectedinherited
const GrainForceAndTorqueInterface& GrainRigidBodyMotionBase::_grain_force_torque
protectedinherited

getting userobject for calculating grain forces and torques

Definition at line 60 of file GrainRigidBodyMotionBase.h.

const std::vector<RealGradient>& GrainRigidBodyMotionBase::_grain_forces
protectedinherited
std::vector<unsigned int> GrainRigidBodyMotionBase::_grain_ids
protectedinherited
const std::vector<RealGradient>& GrainRigidBodyMotionBase::_grain_torques
protectedinherited
const GrainTrackerInterface& GrainRigidBodyMotionBase::_grain_tracker
protectedinherited
const VectorPostprocessorValue& GrainRigidBodyMotionBase::_grain_volumes
protectedinherited
const Real GrainRigidBodyMotionBase::_mr
protectedinherited
const Real GrainRigidBodyMotionBase::_mt
protectedinherited
const unsigned int GrainRigidBodyMotionBase::_op_num
protectedinherited
unsigned int GrainRigidBodyMotionBase::_total_dofs
protectedinherited
std::vector<const VariableValue *> GrainRigidBodyMotionBase::_vals
protectedinherited

Variable value for the order parameters.

Definition at line 52 of file GrainRigidBodyMotionBase.h.

Referenced by GrainRigidBodyMotionBase::GrainRigidBodyMotionBase().

std::vector<unsigned int> GrainRigidBodyMotionBase::_vals_var
protectedinherited
const std::vector<dof_id_type>& GrainRigidBodyMotionBase::_var_dofs
protectedinherited

Variable's local dof indices.

Definition at line 38 of file GrainRigidBodyMotionBase.h.

RealGradient GrainRigidBodyMotionBase::_velocity_advection
protectedinherited
RealGradient GrainRigidBodyMotionBase::_velocity_advection_jacobian
protectedinherited

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