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

Constructor & Destructor Documentation

◆ MultiGrainRigidBodyMotion()

MultiGrainRigidBodyMotion::MultiGrainRigidBodyMotion ( const InputParameters &  parameters)

Definition at line 27 of file MultiGrainRigidBodyMotion.C.

28  : GrainRigidBodyMotionBase(parameters)
29 {
30 }
GrainRigidBodyMotionBase(const InputParameters &parameters)

Member Function Documentation

◆ calculateAdvectionVelocity()

void MultiGrainRigidBodyMotion::calculateAdvectionVelocity ( )
protectedvirtual

Reimplemented from GrainRigidBodyMotionBase.

Definition at line 126 of file MultiGrainRigidBodyMotion.C.

127 {
128  _velocity_advection = 0.0;
129  _grain_ids = _grain_tracker.getVarToFeatureVector(_current_elem->id());
130 
131  for (auto i = beginIndex(_grain_ids); i < _grain_ids.size(); ++i)
132  {
133  auto grain_id = _grain_ids[i];
134  if (grain_id != FeatureFloodCount::invalid_id)
135  {
136  mooseAssert(grain_id < _grain_volumes.size(), "grain_id out of bounds");
137  const auto volume = _grain_volumes[grain_id];
138  const auto centroid = _grain_tracker.getGrainCentroid(grain_id);
139  const auto force = _mt / volume * _grain_forces[grain_id];
140  const auto torque =
141  _mr / volume * (_grain_torques[grain_id].cross(_current_elem->centroid() - centroid));
142 
143  _velocity_advection += (force + torque);
144  }
145  }
146 }
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
const Real _mt
constant value corresponding to grain translation

◆ computeQpJacobian()

Real MultiGrainRigidBodyMotion::computeQpJacobian ( )
protectedvirtual

Definition at line 39 of file MultiGrainRigidBodyMotion.C.

40 {
41  if (_var.number() == _c_var) // Requires c jacobian
42  return _velocity_advection * _grad_phi[_j][_qp] * _test[_i][_qp] +
43  _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
44 
45  return 0.0;
46 }
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

◆ computeQpNonlocalJacobian()

Real MultiGrainRigidBodyMotion::computeQpNonlocalJacobian ( dof_id_type  )
protectedvirtual

Definition at line 58 of file MultiGrainRigidBodyMotion.C.

59 {
60  if (_var.number() == _c_var) // Requires c jacobian
61  return _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
62 
63  return 0.0;
64 }
const VariableGradient & _grad_c
Variable gradient for the concentration.
unsigned int _c_var
int label for the Concentration

◆ computeQpNonlocalOffDiagJacobian()

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

Definition at line 67 of file MultiGrainRigidBodyMotion.C.

69 {
70  return _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
71 }
const VariableGradient & _grad_c
Variable gradient for the concentration.

◆ computeQpOffDiagJacobian()

Real MultiGrainRigidBodyMotion::computeQpOffDiagJacobian ( unsigned int  jvar)
protectedvirtual

Definition at line 49 of file MultiGrainRigidBodyMotion.C.

50 {
51  if (jvar == _c_var) // Requires c jacobian
52  return _velocity_advection * _grad_phi[_j][_qp] * _test[_i][_qp] +
53  _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
54  else
55  return _velocity_advection_jacobian * _grad_c[_qp] * _test[_i][_qp];
56 }
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

◆ computeQpResidual()

Real MultiGrainRigidBodyMotion::computeQpResidual ( )
protectedvirtual

Definition at line 33 of file MultiGrainRigidBodyMotion.C.

34 {
35  return _velocity_advection * _grad_c[_qp] * _test[_i][_qp];
36 }
RealGradient _velocity_advection
storing the advection velocity and corresponding jacobian entries calculated in userobjects ...
const VariableGradient & _grad_c
Variable gradient for the concentration.

◆ getUserObjectJacobian()

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

Definition at line 74 of file MultiGrainRigidBodyMotion.C.

75 {
77 
78  for (auto i = beginIndex(_grain_ids); i < _grain_ids.size(); ++i)
79  {
80  auto grain_id = _grain_ids[i];
81  if (grain_id != FeatureFloodCount::invalid_id)
82  {
83  mooseAssert(grain_id < _grain_volumes.size(), "grain_id out of bounds");
84  const auto volume = _grain_volumes[grain_id];
85  const auto centroid = _grain_tracker.getGrainCentroid(grain_id);
86  RealGradient force_jacobian;
87  RealGradient torque_jacobian;
88 
89  if (jvar == _c_var)
90  {
91  force_jacobian(0) = _grain_force_c_jacobians[(6 * grain_id + 0) * _total_dofs + dof_index];
92  force_jacobian(1) = _grain_force_c_jacobians[(6 * grain_id + 1) * _total_dofs + dof_index];
93  force_jacobian(2) = _grain_force_c_jacobians[(6 * grain_id + 2) * _total_dofs + dof_index];
94  torque_jacobian(0) = _grain_force_c_jacobians[(6 * grain_id + 3) * _total_dofs + dof_index];
95  torque_jacobian(1) = _grain_force_c_jacobians[(6 * grain_id + 4) * _total_dofs + dof_index];
96  torque_jacobian(2) = _grain_force_c_jacobians[(6 * grain_id + 5) * _total_dofs + dof_index];
97  }
98 
99  for (unsigned int jvar_index = 0; jvar_index < _op_num; ++jvar_index)
100  if (jvar == _vals_var[jvar_index])
101  {
102  force_jacobian(0) =
103  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 0) * _total_dofs + dof_index];
104  force_jacobian(1) =
105  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 1) * _total_dofs + dof_index];
106  force_jacobian(2) =
107  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 2) * _total_dofs + dof_index];
108  torque_jacobian(0) =
109  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 3) * _total_dofs + dof_index];
110  torque_jacobian(1) =
111  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 4) * _total_dofs + dof_index];
112  torque_jacobian(2) =
113  _grain_force_eta_jacobians[jvar_index][(6 * grain_id + 5) * _total_dofs + dof_index];
114  }
115 
116  const auto force_jac = _mt / volume * force_jacobian;
117  const auto torque_jac =
118  _mr / volume * torque_jacobian.cross(_current_elem->centroid() - centroid);
119 
120  _velocity_advection_jacobian += (force_jac + torque_jac);
121  }
122  }
123 }
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 _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_num

const unsigned int GrainRigidBodyMotionBase::_op_num
protectedinherited

◆ _total_dofs

unsigned int GrainRigidBodyMotionBase::_total_dofs
protectedinherited

◆ _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: