www.mooseframework.org
GrainTrackerElasticity.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 
9 #include "EulerAngleProvider.h"
10 #include "RotationTensor.h"
11 
12 template <>
13 InputParameters
15 {
16  InputParameters params = validParams<GrainTracker>();
17  params.addParam<bool>("random_rotations",
18  true,
19  "Generate random rotations when the Euler Angle "
20  "provider runs out of data (otherwise error "
21  "out)");
22  params.addRequiredParam<std::vector<Real>>("C_ijkl", "Unrotated stiffness tensor");
23  params.addParam<MooseEnum>(
24  "fill_method", RankFourTensor::fillMethodEnum() = "symmetric9", "The fill method");
25  params.addRequiredParam<UserObjectName>("euler_angle_provider",
26  "Name of Euler angle provider user object");
27  return params;
28 }
29 
30 GrainTrackerElasticity::GrainTrackerElasticity(const InputParameters & parameters)
31  : GrainDataTracker<RankFourTensor>(parameters),
32  _random_rotations(getParam<bool>("random_rotations")),
33  _C_ijkl(getParam<std::vector<Real>>("C_ijkl"),
34  getParam<MooseEnum>("fill_method").getEnum<RankFourTensor::FillMethod>()),
35  _euler(getUserObject<EulerAngleProvider>("euler_angle_provider"))
36 {
37 }
38 
39 RankFourTensor
40 GrainTrackerElasticity::newGrain(unsigned int new_grain_id)
41 {
42  EulerAngles angles;
43 
44  if (new_grain_id < _euler.getGrainNum())
45  angles = _euler.getEulerAngles(new_grain_id);
46  else
47  {
49  angles.random();
50  else
51  mooseError("GrainTrackerElasticity has run out of grain rotation data.");
52  }
53 
54  RankFourTensor C_ijkl = _C_ijkl;
55  C_ijkl.rotate(RotationTensor(RealVectorValue(angles)));
56 
57  return C_ijkl;
58 }
virtual unsigned int getGrainNum() const =0
const bool _random_rotations
generate random rotations when the Euler Angle provider runs out of data (otherwise error out) ...
void random()
Definition: EulerAngles.C:12
RankFourTensor newGrain(unsigned int new_grain_id)
implement this method to initialize the data for the new grain
This is a RealTensor version of a rotation matrix It is instantiated with the Euler angles...
RankFourTensor _C_ijkl
unrotated elasticity tensor
InputParameters validParams< GrainTrackerElasticity >()
InputParameters validParams< GrainTracker >()
Definition: GrainTracker.C:46
Euler angle triplet.
Definition: EulerAngles.h:20
GrainTrackerElasticity(const InputParameters &parameters)
const EulerAngleProvider & _euler
object providing the Euler angles
Abstract base class for user objects that implement the Euler Angle provider interface.
virtual const EulerAngles & getEulerAngles(unsigned int) const =0
GrainTracker derived class template to base objects on which maintain physical parameters for individ...