www.mooseframework.org
GrainTextureVectorPostprocessor.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 /****************************************************************/
8 #include "EulerAngleProvider.h"
9 #include "Assembly.h"
10 
11 template <>
12 InputParameters
14 {
15  InputParameters params = validParams<ElementVectorPostprocessor>();
16  params += validParams<SamplerBase>();
17  params.addClassDescription("Gives out info on the grain boundary properties");
18  params.addRequiredParam<UserObjectName>("euler_angle_provider",
19  "The EulerAngleProvider User object");
20  params.addRequiredCoupledVar("unique_grains", "The grain number");
21  params.addRequiredParam<unsigned int>("grain_num", "the number of grains");
22  return params;
23 }
24 
26  : ElementVectorPostprocessor(parameters),
27  SamplerBase(parameters, this, _communicator),
28  _euler(getUserObject<EulerAngleProvider>("euler_angle_provider")),
29  _unique_grains(coupledValue("unique_grains")),
30  _grain_num(getParam<unsigned int>("grain_num")),
31  _sample(4)
32 {
34  mooseError("Euler angle provider has too few angles.");
35 
36  std::vector<std::string> output_variables(4);
37  output_variables[0] = "unique_grain";
38  output_variables[1] = "euler_angle_z";
39  output_variables[2] = "euler_angle_x\'";
40  output_variables[3] = "euler_angle_z\"";
41  SamplerBase::setupVariables(output_variables);
42 }
43 
44 void
46 {
47  SamplerBase::initialize();
48 }
49 
50 void
52 {
53  _sample[0] =
54  _unique_grains[0] + 1; // Index starts at 0, but we want to display first grain as grain 1.
55 
56  const EulerAngles & angle = _euler.getEulerAngles(_unique_grains[0]);
57  _sample[1] = angle.phi1; // Get the Z rotation
58  _sample[2] = angle.Phi; // Get the X' rotation
59  _sample[3] = angle.phi2; // Get the Z'' rotation
60  SamplerBase::addSample(_current_elem->centroid() /* x,y,z coordinates of elem centroid */,
61  _current_elem->id(),
62  _sample);
63 }
64 
65 void
67 {
69  static_cast<const GrainTextureVectorPostprocessor &>(y);
70  SamplerBase::threadJoin(vpp);
71 }
72 
73 void
75 {
76  SamplerBase::finalize();
77 }
virtual unsigned int getGrainNum() const =0
InputParameters validParams< GrainTextureVectorPostprocessor >()
GrainTextureVectorPostprocessor is a VectorPostprocessor that outputs the the coordinates, grain number, and Euler Angles associated with each element.
virtual void threadJoin(const UserObject &uo)
Euler angle triplet.
Definition: EulerAngles.h:20
GrainTextureVectorPostprocessor(const InputParameters &parameters)
Abstract base class for user objects that implement the Euler Angle provider interface.
virtual const EulerAngles & getEulerAngles(unsigned int) const =0