https://mooseframework.inl.gov
Loading...
Searching...
No Matches
GrainTrackerElasticity.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
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
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
43GrainTrackerElasticity::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}
registerMooseObject("PhaseFieldApp", GrainTrackerElasticity)
Abstract base class for user objects that implement the Euler Angle provider interface.
virtual const EulerAngles & getEulerAngles(unsigned int i) const
virtual unsigned int getGrainNum() const
Euler angle triplet.
Definition EulerAngles.h:25
void random()
Definition EulerAngles.C:84
GrainTracker derived class template to base objects on which maintain physical parameters for individ...
Manage a list of elasticity tensors for the grains.
GrainTrackerElasticity(const InputParameters &parameters)
const bool _random_rotations
generate random rotations when the Euler Angle provider runs out of data (otherwise error out)
const EulerAngleProvider & _euler
object providing the Euler angles
static InputParameters validParams()
RankFourTensor _C_ijkl
unrotated elasticity tensor
RankFourTensor newGrain(unsigned int new_grain_id)
implement this method to initialize the data for the new grain
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void mooseError(Args &&... args) const
void rotate(const TypeTensor< T > &R)
static MooseEnum fillMethodEnum()
This is a RealTensor version of a rotation matrix It is instantiated with the Euler angles,...