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 26 of file GrainForceAndTorqueSum.h.

Constructor & Destructor Documentation

◆ GrainForceAndTorqueSum()

GrainForceAndTorqueSum::GrainForceAndTorqueSum ( const InputParameters &  parameters)

Definition at line 27 of file GrainForceAndTorqueSum.C.

29  GeneralUserObject(parameters),
30  _sum_objects(getParam<std::vector<UserObjectName>>("grain_forces")),
31  _num_forces(_sum_objects.size()),
32  _grain_num(getParam<unsigned int>("grain_num")),
36 {
37  for (unsigned int i = 0; i < _num_forces; ++i)
38  _sum_forces[i] = &getUserObjectByName<GrainForceAndTorqueInterface>(_sum_objects[i]);
39 }
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

◆ execute()

virtual void GrainForceAndTorqueSum::execute ( )
inlinevirtual

Definition at line 32 of file GrainForceAndTorqueSum.h.

32 {};

◆ finalize()

virtual void GrainForceAndTorqueSum::finalize ( )
inlinevirtual

Definition at line 33 of file GrainForceAndTorqueSum.h.

33 {};

◆ getForceCJacobians()

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

Implements GrainForceAndTorqueInterface.

Definition at line 88 of file GrainForceAndTorqueSum.C.

Referenced by initialize().

89 {
90  return _c_jacobians;
91 }
std::vector< Real > _c_jacobians

◆ getForceEtaJacobians()

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

Implements GrainForceAndTorqueInterface.

Definition at line 94 of file GrainForceAndTorqueSum.C.

Referenced by initialize().

95 {
96  return _eta_jacobians;
97 }
std::vector< std::vector< Real > > _eta_jacobians

◆ getForceValues()

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

Implements GrainForceAndTorqueInterface.

Definition at line 76 of file GrainForceAndTorqueSum.C.

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

◆ getTorqueValues()

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

Implements GrainForceAndTorqueInterface.

Definition at line 82 of file GrainForceAndTorqueSum.C.

83 {
84  return _torque_values;
85 }
std::vector< RealGradient > _torque_values

◆ initialize()

void GrainForceAndTorqueSum::initialize ( )
virtual

Definition at line 42 of file GrainForceAndTorqueSum.C.

43 {
44  for (unsigned int i = 0; i < _grain_num; ++i)
45  {
46  _force_values[i] = 0.0;
47  _torque_values[i] = 0.0;
48  for (unsigned int j = 0; j < _num_forces; ++j)
49  {
50  _force_values[i] += (_sum_forces[j]->getForceValues())[i];
51  _torque_values[i] += (_sum_forces[j]->getTorqueValues())[i];
52  }
53  }
54 
55  if (_fe_problem.currentlyComputingJacobian())
56  {
57  unsigned int total_dofs = _subproblem.es().n_dofs();
58  _c_jacobians.resize(6 * _grain_num * total_dofs, 0.0);
59  _eta_jacobians.resize(_grain_num);
60 
61  for (unsigned int i = 0; i < _c_jacobians.size(); ++i)
62  for (unsigned int j = 0; j < _num_forces; ++j)
64 
65  for (unsigned int i = 0; i < _grain_num; ++i)
66  {
67  _eta_jacobians[i].resize(6 * _grain_num * total_dofs, 0.0);
68  for (unsigned int j = 0; j < _eta_jacobians[i].size(); ++j)
69  for (unsigned int k = 0; k < _num_forces; ++k)
70  _eta_jacobians[i][j] += (_sum_forces[k]->getForceEtaJacobians())[i][j];
71  }
72  }
73 }
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
virtual const std::vector< Real > & getForceCJacobians() const
virtual const std::vector< std::vector< Real > > & getForceEtaJacobians() const
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

Member Data Documentation

◆ _c_jacobians

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

Definition at line 52 of file GrainForceAndTorqueSum.h.

Referenced by getForceCJacobians(), and initialize().

◆ _eta_jacobians

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

Definition at line 53 of file GrainForceAndTorqueSum.h.

Referenced by getForceEtaJacobians(), and initialize().

◆ _force_values

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

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

Definition at line 50 of file GrainForceAndTorqueSum.h.

Referenced by getForceValues(), and initialize().

◆ _grain_num

unsigned int GrainForceAndTorqueSum::_grain_num
protected

Definition at line 45 of file GrainForceAndTorqueSum.h.

Referenced by initialize().

◆ _num_forces

unsigned int GrainForceAndTorqueSum::_num_forces
protected

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

Definition at line 44 of file GrainForceAndTorqueSum.h.

Referenced by GrainForceAndTorqueSum(), and initialize().

◆ _sum_forces

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

Definition at line 47 of file GrainForceAndTorqueSum.h.

Referenced by GrainForceAndTorqueSum(), and initialize().

◆ _sum_objects

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

Vector of userobjects providing forces and torques acting on grains.

Definition at line 42 of file GrainForceAndTorqueSum.h.

Referenced by GrainForceAndTorqueSum().

◆ _torque_values

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

Definition at line 51 of file GrainForceAndTorqueSum.h.

Referenced by getTorqueValues(), and initialize().


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