www.mooseframework.org
Public Member Functions | Protected Attributes | List of all members
GrainForceAndTorqueSum 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 <GrainForceAndTorqueSum.h>

Inheritance diagram for GrainForceAndTorqueSum:
[legend]

Public Member Functions

 GrainForceAndTorqueSum (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

std::vector< UserObjectName > _sum_objects
 Vector of userobjects providing forces and torques acting on grains. More...
 
unsigned int _num_forces
 Total no. of userobjects that provides forces and torques acting on grains. More...
 
unsigned int _grain_num
 
std::vector< const GrainForceAndTorqueInterface * > _sum_forces
 
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 GrainForceAndTorqueSum.h.

Constructor & Destructor Documentation

GrainForceAndTorqueSum::GrainForceAndTorqueSum ( const InputParameters &  parameters)

Definition at line 23 of file GrainForceAndTorqueSum.C.

25  GeneralUserObject(parameters),
26  _sum_objects(getParam<std::vector<UserObjectName>>("grain_forces")),
27  _num_forces(_sum_objects.size()),
28  _grain_num(getParam<unsigned int>("grain_num")),
32 {
33  for (unsigned int i = 0; i < _num_forces; ++i)
34  _sum_forces[i] = &getUserObjectByName<GrainForceAndTorqueInterface>(_sum_objects[i]);
35 }
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c
std::vector< const GrainForceAndTorqueInterface * > _sum_forces
This class provides interface for extracting the forces and torques computed in other UserObjects...
std::vector< UserObjectName > _sum_objects
Vector of userobjects providing forces and torques acting on grains.
unsigned int _num_forces
Total no. of userobjects that provides forces and torques acting on grains.
std::vector< RealGradient > _torque_values

Member Function Documentation

virtual void GrainForceAndTorqueSum::execute ( )
inlinevirtual

Definition at line 29 of file GrainForceAndTorqueSum.h.

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

Definition at line 30 of file GrainForceAndTorqueSum.h.

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

Implements GrainForceAndTorqueInterface.

Definition at line 84 of file GrainForceAndTorqueSum.C.

Referenced by finalize(), and initialize().

85 {
86  return _c_jacobians;
87 }
std::vector< Real > _c_jacobians
const std::vector< std::vector< Real > > & GrainForceAndTorqueSum::getForceEtaJacobians ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 90 of file GrainForceAndTorqueSum.C.

Referenced by finalize(), and initialize().

91 {
92  return _eta_jacobians;
93 }
std::vector< std::vector< Real > > _eta_jacobians
const std::vector< RealGradient > & GrainForceAndTorqueSum::getForceValues ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 72 of file GrainForceAndTorqueSum.C.

Referenced by finalize().

73 {
74  return _force_values;
75 }
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c
const std::vector< RealGradient > & GrainForceAndTorqueSum::getTorqueValues ( ) const
virtual

Implements GrainForceAndTorqueInterface.

Definition at line 78 of file GrainForceAndTorqueSum.C.

Referenced by finalize().

79 {
80  return _torque_values;
81 }
std::vector< RealGradient > _torque_values
void GrainForceAndTorqueSum::initialize ( )
virtual

Definition at line 38 of file GrainForceAndTorqueSum.C.

39 {
40  for (unsigned int i = 0; i < _grain_num; ++i)
41  {
42  _force_values[i] = 0.0;
43  _torque_values[i] = 0.0;
44  for (unsigned int j = 0; j < _num_forces; ++j)
45  {
46  _force_values[i] += (_sum_forces[j]->getForceValues())[i];
47  _torque_values[i] += (_sum_forces[j]->getTorqueValues())[i];
48  }
49  }
50 
51  if (_fe_problem.currentlyComputingJacobian())
52  {
53  unsigned int total_dofs = _subproblem.es().n_dofs();
54  _c_jacobians.resize(6 * _grain_num * total_dofs, 0.0);
55  _eta_jacobians.resize(_grain_num);
56 
57  for (unsigned int i = 0; i < _c_jacobians.size(); ++i)
58  for (unsigned int j = 0; j < _num_forces; ++j)
60 
61  for (unsigned int i = 0; i < _grain_num; ++i)
62  {
63  _eta_jacobians[i].resize(6 * _grain_num * total_dofs, 0.0);
64  for (unsigned int j = 0; j < _eta_jacobians[i].size(); ++j)
65  for (unsigned int k = 0; k < _num_forces; ++k)
66  _eta_jacobians[i][j] += (_sum_forces[k]->getForceEtaJacobians())[i][j];
67  }
68  }
69 }
virtual const std::vector< std::vector< Real > > & getForceEtaJacobians() const
std::vector< RealGradient > _force_values
providing grain forces, torques and their jacobians w. r. t c
std::vector< Real > _c_jacobians
std::vector< const GrainForceAndTorqueInterface * > _sum_forces
std::vector< std::vector< Real > > _eta_jacobians
unsigned int _num_forces
Total no. of userobjects that provides forces and torques acting on grains.
std::vector< RealGradient > _torque_values
virtual const std::vector< Real > & getForceCJacobians() const

Member Data Documentation

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

Definition at line 49 of file GrainForceAndTorqueSum.h.

Referenced by getForceCJacobians(), and initialize().

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

Definition at line 50 of file GrainForceAndTorqueSum.h.

Referenced by getForceEtaJacobians(), and initialize().

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

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

Definition at line 47 of file GrainForceAndTorqueSum.h.

Referenced by getForceValues(), and initialize().

unsigned int GrainForceAndTorqueSum::_grain_num
protected

Definition at line 42 of file GrainForceAndTorqueSum.h.

Referenced by initialize().

unsigned int GrainForceAndTorqueSum::_num_forces
protected

Total no. of userobjects that provides forces and torques acting on grains.

Definition at line 41 of file GrainForceAndTorqueSum.h.

Referenced by GrainForceAndTorqueSum(), and initialize().

std::vector<const GrainForceAndTorqueInterface *> GrainForceAndTorqueSum::_sum_forces
protected

Definition at line 44 of file GrainForceAndTorqueSum.h.

Referenced by GrainForceAndTorqueSum(), and initialize().

std::vector<UserObjectName> GrainForceAndTorqueSum::_sum_objects
protected

Vector of userobjects providing forces and torques acting on grains.

Definition at line 39 of file GrainForceAndTorqueSum.h.

Referenced by GrainForceAndTorqueSum().

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

Definition at line 48 of file GrainForceAndTorqueSum.h.

Referenced by getTorqueValues(), and initialize().


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