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

This class is here to get the force and torque acting on a grain from different userobjects and sum them all. More...

#include <MaskedGrainForceAndTorque.h>

Inheritance diagram for MaskedGrainForceAndTorque:
[legend]

Public Member Functions

 MaskedGrainForceAndTorque (const InputParameters &parameters)
 
virtual void initialize ()
 
virtual void execute ()
 
virtual void finalize ()
 
virtual const std::vector< RealGradient > & getForceValues () const
 
virtual const std::vector< RealGradient > & getTorqueValues () const
 
virtual const std::vector< Real > & getForceCJacobians () const
 
virtual const std::vector< std::vector< Real > > & getForceEtaJacobians () const
 

Protected Attributes

const GrainForceAndTorqueInterface_grain_force_torque_input
 
const std::vector< RealGradient > & _grain_forces_input
 
const std::vector< RealGradient > & _grain_torques_input
 
const std::vector< Real > & _grain_force_c_jacobians_input
 
const std::vector< std::vector< Real > > & _grain_force_eta_jacobians_input
 
std::vector< unsigned int > _pinned_grains
 
unsigned int _num_pinned_grains
 
unsigned int _grain_num
 
std::vector< RealGradient > _force_values
 providing grain forces, torques and their jacobians w. r. t c More...
 
std::vector< RealGradient > _torque_values
 
std::vector< Real > _c_jacobians
 
std::vector< std::vector< Real > > _eta_jacobians
 

Detailed Description

This class is here to get the force and torque acting on a grain from different userobjects and sum them all.

Definition at line 26 of file MaskedGrainForceAndTorque.h.

Constructor & Destructor Documentation

◆ MaskedGrainForceAndTorque()

MaskedGrainForceAndTorque::MaskedGrainForceAndTorque ( const InputParameters &  parameters)

Definition at line 27 of file MaskedGrainForceAndTorque.C.

29  GeneralUserObject(parameters),
30  _grain_force_torque_input(getUserObject<GrainForceAndTorqueInterface>("grain_force")),
35  _pinned_grains(getParam<std::vector<unsigned int>>("pinned_grains")),
40 {
41 }
virtual const std::vector< std::vector< Real > > & getForceEtaJacobians() const =0
const std::vector< RealGradient > & _grain_forces_input
This class provides interface for extracting the forces and torques computed in other UserObjects...
virtual const std::vector< RealGradient > & getTorqueValues() const =0
std::vector< RealGradient > _torque_values
const std::vector< RealGradient > & _grain_torques_input
const std::vector< Real > & _grain_force_c_jacobians_input
const GrainForceAndTorqueInterface & _grain_force_torque_input
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c
virtual const std::vector< RealGradient > & getForceValues() const =0
virtual const std::vector< Real > & getForceCJacobians() const =0
const std::vector< std::vector< Real > > & _grain_force_eta_jacobians_input
std::vector< unsigned int > _pinned_grains

Member Function Documentation

◆ execute()

virtual void MaskedGrainForceAndTorque::execute ( )
inlinevirtual

Definition at line 32 of file MaskedGrainForceAndTorque.h.

32 {};

◆ finalize()

virtual void MaskedGrainForceAndTorque::finalize ( )
inlinevirtual

Definition at line 33 of file MaskedGrainForceAndTorque.h.

33 {};

◆ getForceCJacobians()

const std::vector< Real > & MaskedGrainForceAndTorque::getForceCJacobians ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 146 of file MaskedGrainForceAndTorque.C.

147 {
148  return _c_jacobians;
149 }

◆ getForceEtaJacobians()

const std::vector< std::vector< Real > > & MaskedGrainForceAndTorque::getForceEtaJacobians ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 152 of file MaskedGrainForceAndTorque.C.

153 {
154  return _eta_jacobians;
155 }
std::vector< std::vector< Real > > _eta_jacobians

◆ getForceValues()

const std::vector< RealGradient > & MaskedGrainForceAndTorque::getForceValues ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 134 of file MaskedGrainForceAndTorque.C.

135 {
136  return _force_values;
137 }
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c

◆ getTorqueValues()

const std::vector< RealGradient > & MaskedGrainForceAndTorque::getTorqueValues ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 140 of file MaskedGrainForceAndTorque.C.

141 {
142  return _torque_values;
143 }
std::vector< RealGradient > _torque_values

◆ initialize()

void MaskedGrainForceAndTorque::initialize ( )
virtual

Definition at line 44 of file MaskedGrainForceAndTorque.C.

45 {
46  for (unsigned int i = 0; i < _grain_num; ++i)
47  {
50 
51  if (_num_pinned_grains != 0)
52  {
53  for (unsigned int j = 0; j < _num_pinned_grains; ++j)
54  {
55  if (i == _pinned_grains[j])
56  {
57  _force_values[i] = 0.0;
58  _torque_values[i] = 0.0;
59  }
60  }
61  }
62  }
63 
64  if (_fe_problem.currentlyComputingJacobian())
65  {
66  unsigned int total_dofs = _subproblem.es().n_dofs();
67  _c_jacobians.resize(6 * _grain_num * total_dofs, 0.0);
68  _eta_jacobians.resize(_grain_num);
69  for (unsigned int i = 0; i < _grain_num; ++i)
70  for (unsigned int j = 0; j < total_dofs; ++j)
71  {
72  _c_jacobians[(6 * i + 0) * total_dofs + j] =
73  _grain_force_c_jacobians_input[(6 * i + 0) * total_dofs + j];
74  _c_jacobians[(6 * i + 1) * total_dofs + j] =
75  _grain_force_c_jacobians_input[(6 * i + 1) * total_dofs + j];
76  _c_jacobians[(6 * i + 2) * total_dofs + j] =
77  _grain_force_c_jacobians_input[(6 * i + 2) * total_dofs + j];
78  _c_jacobians[(6 * i + 3) * total_dofs + j] =
79  _grain_force_c_jacobians_input[(6 * i + 3) * total_dofs + j];
80  _c_jacobians[(6 * i + 4) * total_dofs + j] =
81  _grain_force_c_jacobians_input[(6 * i + 4) * total_dofs + j];
82  _c_jacobians[(6 * i + 5) * total_dofs + j] =
83  _grain_force_c_jacobians_input[(6 * i + 5) * total_dofs + j];
84 
85  if (_num_pinned_grains != 0)
86  for (unsigned int k = 0; k < _num_pinned_grains; ++k)
87  if (i == _pinned_grains[k])
88  {
89  _c_jacobians[(6 * i + 0) * total_dofs + j] = 0.0;
90  _c_jacobians[(6 * i + 1) * total_dofs + j] = 0.0;
91  _c_jacobians[(6 * i + 2) * total_dofs + j] = 0.0;
92  _c_jacobians[(6 * i + 3) * total_dofs + j] = 0.0;
93  _c_jacobians[(6 * i + 4) * total_dofs + j] = 0.0;
94  _c_jacobians[(6 * i + 5) * total_dofs + j] = 0.0;
95  }
96  }
97 
98  for (unsigned int i = 0; i < _grain_num; ++i)
99  {
100  _eta_jacobians[i].resize(6 * _grain_num * total_dofs);
101  for (unsigned int j = 0; j < _grain_num; ++j)
102  for (unsigned int k = 0; k < total_dofs; ++k)
103  {
104  _eta_jacobians[i][(6 * j + 0) * total_dofs + k] =
105  _grain_force_eta_jacobians_input[i][(6 * j + 0) * total_dofs + k];
106  _eta_jacobians[i][(6 * j + 1) * total_dofs + k] =
107  _grain_force_eta_jacobians_input[i][(6 * j + 1) * total_dofs + k];
108  _eta_jacobians[i][(6 * j + 2) * total_dofs + k] =
109  _grain_force_eta_jacobians_input[i][(6 * j + 2) * total_dofs + k];
110  _eta_jacobians[i][(6 * j + 3) * total_dofs + k] =
111  _grain_force_eta_jacobians_input[i][(6 * j + 3) * total_dofs + k];
112  _eta_jacobians[i][(6 * j + 4) * total_dofs + k] =
113  _grain_force_eta_jacobians_input[i][(6 * j + 4) * total_dofs + k];
114  _eta_jacobians[i][(6 * j + 5) * total_dofs + k] =
115  _grain_force_eta_jacobians_input[i][(6 * j + 5) * total_dofs + k];
116 
117  if (_num_pinned_grains != 0)
118  for (unsigned int l = 0; l < _num_pinned_grains; ++l)
119  if (j == _pinned_grains[l])
120  {
121  _eta_jacobians[i][(6 * j + 0) * total_dofs + k] = 0.0;
122  _eta_jacobians[i][(6 * j + 1) * total_dofs + k] = 0.0;
123  _eta_jacobians[i][(6 * j + 2) * total_dofs + k] = 0.0;
124  _eta_jacobians[i][(6 * j + 3) * total_dofs + k] = 0.0;
125  _eta_jacobians[i][(6 * j + 4) * total_dofs + k] = 0.0;
126  _eta_jacobians[i][(6 * j + 5) * total_dofs + k] = 0.0;
127  }
128  }
129  }
130  }
131 }
const std::vector< RealGradient > & _grain_forces_input
std::vector< RealGradient > _torque_values
const std::vector< RealGradient > & _grain_torques_input
const std::vector< Real > & _grain_force_c_jacobians_input
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c
const std::vector< std::vector< Real > > & _grain_force_eta_jacobians_input
std::vector< unsigned int > _pinned_grains
std::vector< std::vector< Real > > _eta_jacobians

Member Data Documentation

◆ _c_jacobians

std::vector<Real> MaskedGrainForceAndTorque::_c_jacobians
protected

Definition at line 54 of file MaskedGrainForceAndTorque.h.

Referenced by getForceCJacobians(), and initialize().

◆ _eta_jacobians

std::vector<std::vector<Real> > MaskedGrainForceAndTorque::_eta_jacobians
protected

Definition at line 55 of file MaskedGrainForceAndTorque.h.

Referenced by getForceEtaJacobians(), and initialize().

◆ _force_values

std::vector<RealGradient> MaskedGrainForceAndTorque::_force_values
protected

providing grain forces, torques and their jacobians w. r. t c

Definition at line 52 of file MaskedGrainForceAndTorque.h.

Referenced by getForceValues(), and initialize().

◆ _grain_force_c_jacobians_input

const std::vector<Real>& MaskedGrainForceAndTorque::_grain_force_c_jacobians_input
protected

Definition at line 44 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

◆ _grain_force_eta_jacobians_input

const std::vector<std::vector<Real> >& MaskedGrainForceAndTorque::_grain_force_eta_jacobians_input
protected

Definition at line 45 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

◆ _grain_force_torque_input

const GrainForceAndTorqueInterface& MaskedGrainForceAndTorque::_grain_force_torque_input
protected

Definition at line 41 of file MaskedGrainForceAndTorque.h.

◆ _grain_forces_input

const std::vector<RealGradient>& MaskedGrainForceAndTorque::_grain_forces_input
protected

Definition at line 42 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

◆ _grain_num

unsigned int MaskedGrainForceAndTorque::_grain_num
protected

Definition at line 49 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

◆ _grain_torques_input

const std::vector<RealGradient>& MaskedGrainForceAndTorque::_grain_torques_input
protected

Definition at line 43 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

◆ _num_pinned_grains

unsigned int MaskedGrainForceAndTorque::_num_pinned_grains
protected

Definition at line 48 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

◆ _pinned_grains

std::vector<unsigned int> MaskedGrainForceAndTorque::_pinned_grains
protected

Definition at line 47 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

◆ _torque_values

std::vector<RealGradient> MaskedGrainForceAndTorque::_torque_values
protected

Definition at line 53 of file MaskedGrainForceAndTorque.h.

Referenced by getTorqueValues(), and initialize().


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