www.mooseframework.org
GrainTrackerElasticity.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://www.mooseframework.org
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "GrainTrackerElasticity.h"
11 #include "EulerAngleProvider.h"
12 #include "RotationTensor.h"
13 
15 
18 {
20  params.addParam<bool>("random_rotations",
21  true,
22  "Generate random rotations when the Euler Angle "
23  "provider runs out of data (otherwise error "
24  "out)");
25  params.addRequiredParam<std::vector<Real>>("C_ijkl", "Unrotated stiffness tensor");
26  params.addParam<MooseEnum>(
27  "fill_method", RankFourTensor::fillMethodEnum() = "symmetric9", "The fill method");
28  params.addRequiredParam<UserObjectName>("euler_angle_provider",
29  "Name of Euler angle provider user object");
30  return params;
31 }
32 
34  : GrainDataTracker<RankFourTensor>(parameters),
35  _random_rotations(getParam<bool>("random_rotations")),
36  _C_ijkl(getParam<std::vector<Real>>("C_ijkl"),
37  getParam<MooseEnum>("fill_method").getEnum<RankFourTensor::FillMethod>()),
38  _euler(getUserObject<EulerAngleProvider>("euler_angle_provider"))
39 {
40 }
41 
43 GrainTrackerElasticity::newGrain(unsigned int new_grain_id)
44 {
45  EulerAngles angles;
46 
47  if (new_grain_id < _euler.getGrainNum())
48  angles = _euler.getEulerAngles(new_grain_id);
49  else
50  {
52  angles.random();
53  else
54  mooseError("GrainTrackerElasticity has run out of grain rotation data.");
55  }
56 
57  RankFourTensor C_ijkl = _C_ijkl;
58  C_ijkl.rotate(RotationTensor(RealVectorValue(angles)));
59 
60  return C_ijkl;
61 }
virtual unsigned int getGrainNum() const =0
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addRequiredParam(const std::string &name, const std::string &doc_string)
static InputParameters validParams()
const bool _random_rotations
generate random rotations when the Euler Angle provider runs out of data (otherwise error out) ...
void random()
Definition: EulerAngles.C:73
registerMooseObject("PhaseFieldApp", GrainTrackerElasticity)
Manage a list of elasticity tensors for the grains.
RankFourTensor newGrain(unsigned int new_grain_id)
implement this method to initialize the data for the new grain
void rotate(const TypeTensor< T > &R)
This is a RealTensor version of a rotation matrix It is instantiated with the Euler angles...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual const EulerAngles & getEulerAngles(unsigned int) const =0
RankFourTensor _C_ijkl
unrotated elasticity tensor
Euler angle triplet.
Definition: EulerAngles.h:24
static InputParameters validParams()
Definition: GrainTracker.C:49
GrainTrackerElasticity(const InputParameters &parameters)
void mooseError(Args &&... args) const
const EulerAngleProvider & _euler
object providing the Euler angles
static MooseEnum fillMethodEnum()
Abstract base class for user objects that implement the Euler Angle provider interface.
GrainTracker derived class template to base objects on which maintain physical parameters for individ...