Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "NonlocalKernel.h" 13 : #include "GrainForceAndTorqueInterface.h" 14 : 15 : // Forward Declarations 16 : class GrainTrackerInterface; 17 : 18 : class GrainRigidBodyMotionBase : public NonlocalKernel 19 : 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : GrainRigidBodyMotionBase(const InputParameters & parameters); 25 : 26 : virtual void timestepSetup(); 27 : 28 : protected: 29 : virtual bool globalDoFEnabled(MooseVariableFEBase & /*var*/, dof_id_type /*dof_index*/); 30 : 31 : virtual void precalculateResidual(); 32 : virtual void precalculateJacobian(); 33 : virtual void precalculateOffDiagJacobian(unsigned int jvar); 34 : 35 0 : virtual void calculateAdvectionVelocity() {} 36 : 37 : /// Variable's local dof indices 38 : const std::vector<dof_id_type> & _var_dofs; 39 : 40 : /// int label for the Concentration 41 : unsigned int _c_var; 42 : /// Variable value for the concentration 43 : const VariableValue & _c; 44 : /// Variable gradient for the concentration 45 : const VariableGradient & _grad_c; 46 : /// local dof indices of variable c 47 : const std::vector<dof_id_type> & _c_dofs; 48 : 49 : /// no. of order parameters 50 : const unsigned int _op_num; 51 : /// Variable value for the order parameters 52 : const std::vector<const VariableValue *> _vals; 53 : const std::vector<unsigned int> _vals_var; 54 : const std::vector<const VariableGradient *> _grad_vals; 55 : 56 : /// base name specifying type of force density material 57 : const std::string _base_name; 58 : 59 : /// getting userobject for calculating grain forces and torques 60 : const GrainForceAndTorqueInterface & _grain_force_torque; 61 : const std::vector<RealGradient> & _grain_forces; 62 : const std::vector<RealGradient> & _grain_torques; 63 : const std::vector<Real> & _grain_force_c_jacobians; 64 : const std::vector<std::vector<Real>> & _grain_force_eta_jacobians; 65 : 66 : /// constant value corresponding to grain translation 67 : const Real _mt; 68 : /// constant value corresponding to grain rotation 69 : const Real _mr; 70 : 71 : /// grain tracker object 72 : const GrainTrackerInterface & _grain_tracker; 73 : 74 : /// The grain volumes 75 : const VectorPostprocessorValue & _grain_volumes; 76 : 77 : /// get the total no. of dofs in the system 78 : unsigned int _total_dofs; 79 : 80 : /// storing the advection velocity and corresponding jacobian entries calculated in userobjects 81 : RealGradient _velocity_advection; 82 : RealGradient _velocity_advection_jacobian; 83 : /// obtain the active grain ids 84 : std::vector<unsigned int> _grain_ids; 85 : };