www.mooseframework.org
GrainForcesPostprocessor.C
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
9 
10 template <>
11 InputParameters
13 {
14  InputParameters params = validParams<VectorPostprocessor>();
15  params.addClassDescription("Outputs the values from GrainForcesPostprocessor");
16  params.addParam<UserObjectName>(
17  "grain_force", "Specify userobject that gives center of mass and volume of grains");
18  return params;
19 }
20 
21 GrainForcesPostprocessor::GrainForcesPostprocessor(const InputParameters & parameters)
22  : GeneralVectorPostprocessor(parameters),
23  _grain_force_torque_vector(declareVector("grain_force_torque_vector")),
24  _grain_force_torque(getUserObject<GrainForceAndTorqueInterface>("grain_force")),
25  _grain_forces(_grain_force_torque.getForceValues()),
26  _grain_torques(_grain_force_torque.getTorqueValues()),
27  _grain_num(0)
28 {
29 }
30 
31 void
33 {
34  _grain_num = _grain_forces.size();
35 
36  // for each grain a force and a torque vector with 3 components each are serialized into the
37  // output vector
38  _grain_force_torque_vector.resize(_grain_num * 2 * 3);
39 }
40 
41 void
43 {
44  for (unsigned int i = 0; i < _grain_num; ++i)
45  {
46  _grain_force_torque_vector[6 * i + 0] = _grain_forces[i](0);
47  _grain_force_torque_vector[6 * i + 1] = _grain_forces[i](1);
48  _grain_force_torque_vector[6 * i + 2] = _grain_forces[i](2);
49  _grain_force_torque_vector[6 * i + 3] = _grain_torques[i](0);
50  _grain_force_torque_vector[6 * i + 4] = _grain_torques[i](1);
51  _grain_force_torque_vector[6 * i + 5] = _grain_torques[i](2);
52  }
53 }
InputParameters validParams< GrainForcesPostprocessor >()
This class provides interface for extracting the forces and torques computed in other UserObjects...
const std::vector< RealGradient > & _grain_forces
Extracting forces from Userobject.
const std::vector< RealGradient > & _grain_torques
Extracting torques from Userobject.
unsigned int _grain_num
total no. of grains
VectorPostprocessorValue & _grain_force_torque_vector
The VectorPostprocessorValue object where the results are stored.
GrainForcesPostprocessor(const InputParameters &parameters)