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

#include <SingleGrainRigidBodyMotion.h>

Inheritance diagram for SingleGrainRigidBodyMotion:
[legend]

Public Member Functions

 SingleGrainRigidBodyMotion (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

unsigned int _op_index
 Grain number for the kernel to be applied. More...
 
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 SingleGrainRigidBodyMotion.h.

Constructor & Destructor Documentation

SingleGrainRigidBodyMotion::SingleGrainRigidBodyMotion ( const InputParameters &  parameters)

Definition at line 20 of file SingleGrainRigidBodyMotion.C.

21  : GrainRigidBodyMotionBase(parameters), _op_index(getParam<unsigned int>("op_index"))
22 {
23 }
GrainRigidBodyMotionBase(const InputParameters &parameters)
unsigned int _op_index
Grain number for the kernel to be applied.

Member Function Documentation

void SingleGrainRigidBodyMotion::calculateAdvectionVelocity ( )
protectedvirtual

Reimplemented from GrainRigidBodyMotionBase.

Definition at line 106 of file SingleGrainRigidBodyMotion.C.

107 {
108  _velocity_advection = 0.0;
109  _grain_ids = _grain_tracker.getVarToFeatureVector(_current_elem->id());
110 
111  auto grain_id = _grain_ids[_op_index];
112  if (grain_id != FeatureFloodCount::invalid_id)
113  {
114  mooseAssert(grain_id < _grain_volumes.size(), "grain_id out of bounds");
115  const auto volume = _grain_volumes[grain_id];
116  const auto centroid = _grain_tracker.getGrainCentroid(grain_id);
117  const auto force = _mt / volume * _grain_forces[grain_id];
118  const auto torque =
119  _mr / volume * (_grain_torques[grain_id].cross(_current_elem->centroid() - centroid));
120 
121  _velocity_advection = (force + torque);
122  }
123 }
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
unsigned int _op_index
Grain number for the kernel to be applied.
const Real _mt
constant value corresponding to grain translation
Real SingleGrainRigidBodyMotion::computeQpJacobian ( )
protectedvirtual

Definition at line 32 of file SingleGrainRigidBodyMotion.C.

33 {
34  return _velocity_advection * _grad_phi[_j][_qp] * _test[_i][_qp] +
35  _velocity_advection_jacobian * _grad_u[_qp] * _test[_i][_qp];
36 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...
Real SingleGrainRigidBodyMotion::computeQpNonlocalJacobian ( dof_id_type  )
protectedvirtual

Definition at line 44 of file SingleGrainRigidBodyMotion.C.

45 {
46  return _velocity_advection_jacobian * _grad_u[_qp] * _test[_i][_qp];
47 }
Real SingleGrainRigidBodyMotion::computeQpNonlocalOffDiagJacobian ( unsigned  int,
dof_id_type   
)
protectedvirtual

Definition at line 50 of file SingleGrainRigidBodyMotion.C.

52 {
53  return _velocity_advection_jacobian * _grad_u[_qp] * _test[_i][_qp];
54 }
Real SingleGrainRigidBodyMotion::computeQpOffDiagJacobian ( unsigned  int)
protectedvirtual

Definition at line 39 of file SingleGrainRigidBodyMotion.C.

40 {
41  return _velocity_advection_jacobian * _grad_u[_qp] * _test[_i][_qp];
42 }
Real SingleGrainRigidBodyMotion::computeQpResidual ( )
protectedvirtual

Definition at line 26 of file SingleGrainRigidBodyMotion.C.

27 {
28  return _velocity_advection * _grad_u[_qp] * _test[_i][_qp];
29 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...
void SingleGrainRigidBodyMotion::getUserObjectJacobian ( unsigned int  jvar,
dof_id_type  dof_index 
)
protectedvirtual

Definition at line 57 of file SingleGrainRigidBodyMotion.C.

58 {
60 
61  auto grain_id = _grain_ids[_op_index];
62  if (grain_id != FeatureFloodCount::invalid_id)
63  {
64  mooseAssert(grain_id < _grain_volumes.size(), "grain_id out of bounds");
65  const auto volume = _grain_volumes[grain_id];
66  const auto centroid = _grain_tracker.getGrainCentroid(grain_id);
67  RealGradient force_jacobian;
68  RealGradient torque_jacobian;
69 
70  if (jvar == _c_var)
71  {
72  force_jacobian(0) = _grain_force_c_jacobians[(6 * grain_id + 0) * _total_dofs + dof_index];
73  force_jacobian(1) = _grain_force_c_jacobians[(6 * grain_id + 1) * _total_dofs + dof_index];
74  force_jacobian(2) = _grain_force_c_jacobians[(6 * grain_id + 2) * _total_dofs + dof_index];
75  torque_jacobian(0) = _grain_force_c_jacobians[(6 * grain_id + 3) * _total_dofs + dof_index];
76  torque_jacobian(1) = _grain_force_c_jacobians[(6 * grain_id + 4) * _total_dofs + dof_index];
77  torque_jacobian(2) = _grain_force_c_jacobians[(6 * grain_id + 5) * _total_dofs + dof_index];
78  }
79 
80  for (unsigned int jvar_index = 0; jvar_index < _op_num; ++jvar_index)
81  if (jvar == _vals_var[jvar_index])
82  {
83  force_jacobian(0) =
84  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 0) * _total_dofs + dof_index];
85  force_jacobian(1) =
86  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 1) * _total_dofs + dof_index];
87  force_jacobian(2) =
88  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 2) * _total_dofs + dof_index];
89  torque_jacobian(0) =
90  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 3) * _total_dofs + dof_index];
91  torque_jacobian(1) =
92  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 4) * _total_dofs + dof_index];
93  torque_jacobian(2) =
94  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 5) * _total_dofs + dof_index];
95  }
96 
97  const auto force_jac = _mt / volume * force_jacobian;
98  const auto torque_jac =
99  _mr / volume * torque_jacobian.cross(_current_elem->centroid() - centroid);
100 
101  _velocity_advection_jacobian = (force_jac + torque_jac);
102  }
103 }
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 _op_index
Grain number for the kernel to be applied.
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
unsigned int SingleGrainRigidBodyMotion::_op_index
protected

Grain number for the kernel to be applied.

Definition at line 35 of file SingleGrainRigidBodyMotion.h.

Referenced by calculateAdvectionVelocity(), and getUserObjectJacobian().

const unsigned int GrainRigidBodyMotionBase::_op_num
protectedinherited
unsigned int GrainRigidBodyMotionBase::_total_dofs
protectedinherited

get the total no. of dofs in the system

Definition at line 78 of file GrainRigidBodyMotionBase.h.

Referenced by MultiGrainRigidBodyMotion::getUserObjectJacobian(), getUserObjectJacobian(), and GrainRigidBodyMotionBase::timestepSetup().

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: