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 23 of file MaskedGrainForceAndTorque.h.

Constructor & Destructor Documentation

MaskedGrainForceAndTorque::MaskedGrainForceAndTorque ( const InputParameters &  parameters)

Definition at line 23 of file MaskedGrainForceAndTorque.C.

25  GeneralUserObject(parameters),
26  _grain_force_torque_input(getUserObject<GrainForceAndTorqueInterface>("grain_force")),
31  _pinned_grains(getParam<std::vector<unsigned int>>("pinned_grains")),
36 {
37 }
const std::vector< RealGradient > & _grain_forces_input
virtual const std::vector< std::vector< Real > > & getForceEtaJacobians() const =0
This class provides interface for extracting the forces and torques computed in other UserObjects...
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
const std::vector< std::vector< Real > > & _grain_force_eta_jacobians_input
virtual const std::vector< Real > & getForceCJacobians() const =0
virtual const std::vector< RealGradient > & getTorqueValues() const =0
std::vector< unsigned int > _pinned_grains
virtual const std::vector< RealGradient > & getForceValues() const =0

Member Function Documentation

virtual void MaskedGrainForceAndTorque::execute ( )
inlinevirtual

Definition at line 29 of file MaskedGrainForceAndTorque.h.

29 {};
virtual void MaskedGrainForceAndTorque::finalize ( )
inlinevirtual

Definition at line 30 of file MaskedGrainForceAndTorque.h.

30 {};
const std::vector< Real > & MaskedGrainForceAndTorque::getForceCJacobians ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 142 of file MaskedGrainForceAndTorque.C.

Referenced by finalize().

143 {
144  return _c_jacobians;
145 }
const std::vector< std::vector< Real > > & MaskedGrainForceAndTorque::getForceEtaJacobians ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 148 of file MaskedGrainForceAndTorque.C.

Referenced by finalize().

149 {
150  return _eta_jacobians;
151 }
std::vector< std::vector< Real > > _eta_jacobians
const std::vector< RealGradient > & MaskedGrainForceAndTorque::getForceValues ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 130 of file MaskedGrainForceAndTorque.C.

Referenced by finalize().

131 {
132  return _force_values;
133 }
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c
const std::vector< RealGradient > & MaskedGrainForceAndTorque::getTorqueValues ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 136 of file MaskedGrainForceAndTorque.C.

Referenced by finalize().

137 {
138  return _torque_values;
139 }
std::vector< RealGradient > _torque_values
void MaskedGrainForceAndTorque::initialize ( )
virtual

Definition at line 40 of file MaskedGrainForceAndTorque.C.

41 {
42  for (unsigned int i = 0; i < _grain_num; ++i)
43  {
46 
47  if (_num_pinned_grains != 0)
48  {
49  for (unsigned int j = 0; j < _num_pinned_grains; ++j)
50  {
51  if (i == _pinned_grains[j])
52  {
53  _force_values[i] = 0.0;
54  _torque_values[i] = 0.0;
55  }
56  }
57  }
58  }
59 
60  if (_fe_problem.currentlyComputingJacobian())
61  {
62  unsigned int total_dofs = _subproblem.es().n_dofs();
63  _c_jacobians.resize(6 * _grain_num * total_dofs, 0.0);
64  _eta_jacobians.resize(_grain_num);
65  for (unsigned int i = 0; i < _grain_num; ++i)
66  for (unsigned int j = 0; j < total_dofs; ++j)
67  {
68  _c_jacobians[(6 * i + 0) * total_dofs + j] =
69  _grain_force_c_jacobians_input[(6 * i + 0) * total_dofs + j];
70  _c_jacobians[(6 * i + 1) * total_dofs + j] =
71  _grain_force_c_jacobians_input[(6 * i + 1) * total_dofs + j];
72  _c_jacobians[(6 * i + 2) * total_dofs + j] =
73  _grain_force_c_jacobians_input[(6 * i + 2) * total_dofs + j];
74  _c_jacobians[(6 * i + 3) * total_dofs + j] =
75  _grain_force_c_jacobians_input[(6 * i + 3) * total_dofs + j];
76  _c_jacobians[(6 * i + 4) * total_dofs + j] =
77  _grain_force_c_jacobians_input[(6 * i + 4) * total_dofs + j];
78  _c_jacobians[(6 * i + 5) * total_dofs + j] =
79  _grain_force_c_jacobians_input[(6 * i + 5) * total_dofs + j];
80 
81  if (_num_pinned_grains != 0)
82  for (unsigned int k = 0; k < _num_pinned_grains; ++k)
83  if (i == _pinned_grains[k])
84  {
85  _c_jacobians[(6 * i + 0) * total_dofs + j] = 0.0;
86  _c_jacobians[(6 * i + 1) * total_dofs + j] = 0.0;
87  _c_jacobians[(6 * i + 2) * total_dofs + j] = 0.0;
88  _c_jacobians[(6 * i + 3) * total_dofs + j] = 0.0;
89  _c_jacobians[(6 * i + 4) * total_dofs + j] = 0.0;
90  _c_jacobians[(6 * i + 5) * total_dofs + j] = 0.0;
91  }
92  }
93 
94  for (unsigned int i = 0; i < _grain_num; ++i)
95  {
96  _eta_jacobians[i].resize(6 * _grain_num * total_dofs);
97  for (unsigned int j = 0; j < _grain_num; ++j)
98  for (unsigned int k = 0; k < total_dofs; ++k)
99  {
100  _eta_jacobians[i][(6 * j + 0) * total_dofs + k] =
101  _grain_force_eta_jacobians_input[i][(6 * j + 0) * total_dofs + k];
102  _eta_jacobians[i][(6 * j + 1) * total_dofs + k] =
103  _grain_force_eta_jacobians_input[i][(6 * j + 1) * total_dofs + k];
104  _eta_jacobians[i][(6 * j + 2) * total_dofs + k] =
105  _grain_force_eta_jacobians_input[i][(6 * j + 2) * total_dofs + k];
106  _eta_jacobians[i][(6 * j + 3) * total_dofs + k] =
107  _grain_force_eta_jacobians_input[i][(6 * j + 3) * total_dofs + k];
108  _eta_jacobians[i][(6 * j + 4) * total_dofs + k] =
109  _grain_force_eta_jacobians_input[i][(6 * j + 4) * total_dofs + k];
110  _eta_jacobians[i][(6 * j + 5) * total_dofs + k] =
111  _grain_force_eta_jacobians_input[i][(6 * j + 5) * total_dofs + k];
112 
113  if (_num_pinned_grains != 0)
114  for (unsigned int l = 0; l < _num_pinned_grains; ++l)
115  if (j == _pinned_grains[l])
116  {
117  _eta_jacobians[i][(6 * j + 0) * total_dofs + k] = 0.0;
118  _eta_jacobians[i][(6 * j + 1) * total_dofs + k] = 0.0;
119  _eta_jacobians[i][(6 * j + 2) * total_dofs + k] = 0.0;
120  _eta_jacobians[i][(6 * j + 3) * total_dofs + k] = 0.0;
121  _eta_jacobians[i][(6 * j + 4) * total_dofs + k] = 0.0;
122  _eta_jacobians[i][(6 * j + 5) * total_dofs + k] = 0.0;
123  }
124  }
125  }
126  }
127 }
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

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

Definition at line 51 of file MaskedGrainForceAndTorque.h.

Referenced by getForceCJacobians(), and initialize().

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

Definition at line 52 of file MaskedGrainForceAndTorque.h.

Referenced by getForceEtaJacobians(), and initialize().

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

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

Definition at line 49 of file MaskedGrainForceAndTorque.h.

Referenced by getForceValues(), and initialize().

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

Definition at line 41 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

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

Definition at line 42 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

const GrainForceAndTorqueInterface& MaskedGrainForceAndTorque::_grain_force_torque_input
protected

Definition at line 38 of file MaskedGrainForceAndTorque.h.

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

Definition at line 39 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

unsigned int MaskedGrainForceAndTorque::_grain_num
protected

Definition at line 46 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

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

Definition at line 40 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

unsigned int MaskedGrainForceAndTorque::_num_pinned_grains
protected

Definition at line 45 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

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

Definition at line 44 of file MaskedGrainForceAndTorque.h.

Referenced by initialize().

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

Definition at line 50 of file MaskedGrainForceAndTorque.h.

Referenced by getTorqueValues(), and initialize().


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