https://mooseframework.inl.gov
Tricrystal2CircleGrainsIC.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 "MooseRandom.h"
12 #include "MooseMesh.h"
13 #include "FEProblemBase.h"
14 
16 
19 {
21  params.addClassDescription("Tricrystal with two circles/bubbles");
22  params.addRequiredParam<unsigned int>("op_num", "Number of grain order parameters");
23  params.addRequiredParam<unsigned int>("op_index", "Index for the current grain order parameter");
24  return params;
25 }
26 
28  : InitialCondition(parameters),
29  _mesh(_fe_problem.mesh()),
30  _op_num(getParam<unsigned int>("op_num")),
31  _op_index(getParam<unsigned int>("op_index"))
32 {
33  if (_op_num != 3)
34  paramError("op_num", "Tricrystal ICs must have op_num = 3");
35 
36  // Set up domain bounds with mesh tools
37  for (const auto i : make_range(Moose::dim))
38  {
41  }
43 }
44 
45 Real
47 {
48  Point grain_center_left;
49  grain_center_left(0) = _bottom_left(0) + _range(0) / 4.0;
50  grain_center_left(1) = _bottom_left(1) + _range(1) / 2.0;
51  grain_center_left(2) = _bottom_left(2) + _range(2) / 2.0;
52 
53  Point grain_center_right;
54  grain_center_right(0) = _bottom_left(0) + _range(0) * 3.0 / 4.0;
55  grain_center_right(1) = _bottom_left(1) + _range(1) / 2.0;
56  grain_center_right(2) = _bottom_left(2) + _range(2) / 2.0;
57 
58  Real radius = _range(0) / 5.0;
59  Real dist_left = (p - grain_center_left).norm();
60  Real dist_right = (p - grain_center_right).norm();
61 
62  if ((dist_left <= radius && _op_index == 1) || (dist_right <= radius && _op_index == 2) ||
63  (dist_left > radius && dist_right > radius && _op_index == 0))
64  return 1.0;
65  else
66  return 0.0;
67 }
virtual Real getMaxInDimension(unsigned int component) const
virtual Real getMinInDimension(unsigned int component) const
const Real radius
Tricrystal2CircleGrainsIC creates a 3 grain structure with 2 circle grains and one matrix grain...
static InputParameters validParams()
MeshBase & mesh
static constexpr std::size_t dim
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real value(const Point &p)
registerMooseObject("PhaseFieldApp", Tricrystal2CircleGrainsIC)
void paramError(const std::string &param, Args... args) const
auto norm(const T &a) -> decltype(std::abs(a))
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
void addClassDescription(const std::string &doc_string)
void ErrorVector unsigned int
Tricrystal2CircleGrainsIC(const InputParameters &parameters)