www.mooseframework.org
OutputEulerAngles.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 /****************************************************************/
7 #include "OutputEulerAngles.h"
8 #include "GrainTracker.h"
9 #include "EulerAngleProvider.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<AuxKernel>();
16  params.addClassDescription("Output euler angles from user object to an AuxVariable.");
17  params.addRequiredParam<UserObjectName>("euler_angle_provider",
18  "Name of Euler angle provider user object");
19  params.addRequiredParam<UserObjectName>("grain_tracker",
20  "The GrainTracker UserObject to get values from.");
21  MooseEnum euler_angles("phi1 Phi phi2");
22  params.addRequiredParam<MooseEnum>("output_euler_angle", euler_angles, "Euler angle to output");
23  return params;
24 }
25 
26 OutputEulerAngles::OutputEulerAngles(const InputParameters & parameters)
27  : AuxKernel(parameters),
28  _euler(getUserObject<EulerAngleProvider>("euler_angle_provider")),
29  _grain_tracker(getUserObject<GrainTracker>("grain_tracker")),
30  _output_euler_angle(getParam<MooseEnum>("output_euler_angle"))
31 {
32 }
33 
34 void
36 {
37  // ID of unique grain at current point
38  const auto grain_id =
39  _grain_tracker.getEntityValue((isNodal() ? _current_node->id() : _current_elem->id()),
41  0);
42 
43  // Recover euler angles for current grain
44  RealVectorValue angles;
45  if (grain_id >= 0)
46  angles = _euler.getEulerAngles(grain_id);
47 
48  // Return specific euler angle
49  _value = angles(_output_euler_angle);
50 }
51 
52 Real
54 {
55  return _value;
56 }
virtual Real computeValue()
const EulerAngleProvider & _euler
Object providing the Euler angles.
InputParameters validParams< OutputEulerAngles >()
virtual void precalculateValue()
MooseEnum _output_euler_angle
Number of grains.
Real _value
precalculated element value
OutputEulerAngles(const InputParameters &parameters)
virtual Real getEntityValue(dof_id_type node_id, FieldType field_type, std::size_t var_index=0) const override
Definition: GrainTracker.C:84
Abstract base class for user objects that implement the Euler Angle provider interface.
const GrainTracker & _grain_tracker
Grain tracker object.
virtual const EulerAngles & getEulerAngles(unsigned int) const =0