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 (MooseVariableFEBase &, 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 21 of file SingleGrainRigidBodyMotion.h.

Constructor & Destructor Documentation

◆ SingleGrainRigidBodyMotion()

SingleGrainRigidBodyMotion::SingleGrainRigidBodyMotion ( const InputParameters &  parameters)

Definition at line 25 of file SingleGrainRigidBodyMotion.C.

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

Member Function Documentation

◆ calculateAdvectionVelocity()

void SingleGrainRigidBodyMotion::calculateAdvectionVelocity ( )
protectedvirtual

Reimplemented from GrainRigidBodyMotionBase.

Definition at line 111 of file SingleGrainRigidBodyMotion.C.

112 {
113  _velocity_advection = 0.0;
114  _grain_ids = _grain_tracker.getVarToFeatureVector(_current_elem->id());
115 
116  auto grain_id = _grain_ids[_op_index];
117  if (grain_id != FeatureFloodCount::invalid_id)
118  {
119  mooseAssert(grain_id < _grain_volumes.size(), "grain_id out of bounds");
120  const auto volume = _grain_volumes[grain_id];
121  const auto centroid = _grain_tracker.getGrainCentroid(grain_id);
122  const auto force = _mt / volume * _grain_forces[grain_id];
123  const auto torque =
124  _mr / volume * (_grain_torques[grain_id].cross(_current_elem->centroid() - centroid));
125 
126  _velocity_advection = (force + torque);
127  }
128 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...
const Real _mr
constant value corresponding to grain rotation
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.
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 Point getGrainCentroid(unsigned int grain_id) const =0
Returns the centroid for the given grain number.
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

◆ computeQpJacobian()

Real SingleGrainRigidBodyMotion::computeQpJacobian ( )
protectedvirtual

Definition at line 37 of file SingleGrainRigidBodyMotion.C.

38 {
39  return _velocity_advection * _grad_phi[_j][_qp] * _test[_i][_qp] +
40  _velocity_advection_jacobian * _grad_u[_qp] * _test[_i][_qp];
41 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...

◆ computeQpNonlocalJacobian()

Real SingleGrainRigidBodyMotion::computeQpNonlocalJacobian ( dof_id_type  )
protectedvirtual

Definition at line 49 of file SingleGrainRigidBodyMotion.C.

50 {
51  return _velocity_advection_jacobian * _grad_u[_qp] * _test[_i][_qp];
52 }

◆ computeQpNonlocalOffDiagJacobian()

Real SingleGrainRigidBodyMotion::computeQpNonlocalOffDiagJacobian ( unsigned  int,
dof_id_type   
)
protectedvirtual

Definition at line 55 of file SingleGrainRigidBodyMotion.C.

57 {
58  return _velocity_advection_jacobian * _grad_u[_qp] * _test[_i][_qp];
59 }

◆ computeQpOffDiagJacobian()

Real SingleGrainRigidBodyMotion::computeQpOffDiagJacobian ( unsigned  int)
protectedvirtual

Definition at line 44 of file SingleGrainRigidBodyMotion.C.

45 {
46  return _velocity_advection_jacobian * _grad_u[_qp] * _test[_i][_qp];
47 }

◆ computeQpResidual()

Real SingleGrainRigidBodyMotion::computeQpResidual ( )
protectedvirtual

Definition at line 31 of file SingleGrainRigidBodyMotion.C.

32 {
33  return _velocity_advection * _grad_u[_qp] * _test[_i][_qp];
34 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...

◆ getUserObjectJacobian()

void SingleGrainRigidBodyMotion::getUserObjectJacobian ( unsigned int  jvar,
dof_id_type  dof_index 
)
protectedvirtual

Definition at line 62 of file SingleGrainRigidBodyMotion.C.

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

◆ globalDoFEnabled()

bool GrainRigidBodyMotionBase::globalDoFEnabled ( MooseVariableFEBase &  ,
dof_id_type   
)
protectedvirtualinherited

Definition at line 78 of file GrainRigidBodyMotionBase.C.

79 {
82  return false;
83 
84  return true;
85 }

◆ precalculateJacobian()

void GrainRigidBodyMotionBase::precalculateJacobian ( )
protectedvirtualinherited

Definition at line 94 of file GrainRigidBodyMotionBase.C.

95 {
97 }

◆ precalculateOffDiagJacobian()

void GrainRigidBodyMotionBase::precalculateOffDiagJacobian ( unsigned int  jvar)
protectedvirtualinherited

Definition at line 100 of file GrainRigidBodyMotionBase.C.

101 {
103 }

◆ precalculateResidual()

void GrainRigidBodyMotionBase::precalculateResidual ( )
protectedvirtualinherited

Definition at line 88 of file GrainRigidBodyMotionBase.C.

89 {
91 }

◆ timestepSetup()

void GrainRigidBodyMotionBase::timestepSetup ( )
virtualinherited

Definition at line 72 of file GrainRigidBodyMotionBase.C.

73 {
74  _total_dofs = _subproblem.es().n_dofs();
75 }
unsigned int _total_dofs
get the total no. of dofs in the system

Member Data Documentation

◆ _base_name

std::string GrainRigidBodyMotionBase::_base_name
protectedinherited

base name specifying type of force density material

Definition at line 60 of file GrainRigidBodyMotionBase.h.

◆ _c

const VariableValue& GrainRigidBodyMotionBase::_c
protectedinherited

Variable value for the concentration.

Definition at line 46 of file GrainRigidBodyMotionBase.h.

◆ _c_dofs

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

local dof indices of variable c

Definition at line 50 of file GrainRigidBodyMotionBase.h.

◆ _c_var

unsigned int GrainRigidBodyMotionBase::_c_var
protectedinherited

◆ _grad_c

const VariableGradient& GrainRigidBodyMotionBase::_grad_c
protectedinherited

◆ _grad_vals

std::vector<const VariableGradient *> GrainRigidBodyMotionBase::_grad_vals
protectedinherited

◆ _grain_force_c_jacobians

const std::vector<Real>& GrainRigidBodyMotionBase::_grain_force_c_jacobians
protectedinherited

◆ _grain_force_eta_jacobians

const std::vector<std::vector<Real> >& GrainRigidBodyMotionBase::_grain_force_eta_jacobians
protectedinherited

◆ _grain_force_torque

const GrainForceAndTorqueInterface& GrainRigidBodyMotionBase::_grain_force_torque
protectedinherited

getting userobject for calculating grain forces and torques

Definition at line 63 of file GrainRigidBodyMotionBase.h.

◆ _grain_forces

const std::vector<RealGradient>& GrainRigidBodyMotionBase::_grain_forces
protectedinherited

◆ _grain_ids

std::vector<unsigned int> GrainRigidBodyMotionBase::_grain_ids
protectedinherited

◆ _grain_torques

const std::vector<RealGradient>& GrainRigidBodyMotionBase::_grain_torques
protectedinherited

◆ _grain_tracker

const GrainTrackerInterface& GrainRigidBodyMotionBase::_grain_tracker
protectedinherited

◆ _grain_volumes

const VectorPostprocessorValue& GrainRigidBodyMotionBase::_grain_volumes
protectedinherited

◆ _mr

const Real GrainRigidBodyMotionBase::_mr
protectedinherited

◆ _mt

const Real GrainRigidBodyMotionBase::_mt
protectedinherited

◆ _op_index

unsigned int SingleGrainRigidBodyMotion::_op_index
protected

Grain number for the kernel to be applied.

Definition at line 38 of file SingleGrainRigidBodyMotion.h.

Referenced by calculateAdvectionVelocity(), and getUserObjectJacobian().

◆ _op_num

const unsigned int GrainRigidBodyMotionBase::_op_num
protectedinherited

◆ _total_dofs

unsigned int GrainRigidBodyMotionBase::_total_dofs
protectedinherited

get the total no. of dofs in the system

Definition at line 81 of file GrainRigidBodyMotionBase.h.

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

◆ _vals

std::vector<const VariableValue *> GrainRigidBodyMotionBase::_vals
protectedinherited

Variable value for the order parameters.

Definition at line 55 of file GrainRigidBodyMotionBase.h.

Referenced by GrainRigidBodyMotionBase::GrainRigidBodyMotionBase().

◆ _vals_var

std::vector<unsigned int> GrainRigidBodyMotionBase::_vals_var
protectedinherited

◆ _var_dofs

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

Variable's local dof indices.

Definition at line 41 of file GrainRigidBodyMotionBase.h.

◆ _velocity_advection

RealGradient GrainRigidBodyMotionBase::_velocity_advection
protectedinherited

◆ _velocity_advection_jacobian

RealGradient GrainRigidBodyMotionBase::_velocity_advection_jacobian
protectedinherited

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