www.mooseframework.org
ThumbIC.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 "ThumbIC.h"
11 
12 registerMooseObject("PhaseFieldApp", ThumbIC);
13 
16 {
18  params.addClassDescription("Thumb shaped bicrystal for grain boundary mobility tests");
19  params.addRequiredParam<Real>("xcoord", "The x coordinate of the circle center");
20  params.addRequiredParam<Real>("width", "The y coordinate of the circle center");
21  params.addRequiredParam<Real>("height", "The z coordinate of the circle center");
22  params.addRequiredParam<Real>("invalue", "The variable value inside the circle");
23  params.addRequiredParam<Real>("outvalue", "The variable value outside the circle");
24  return params;
25 }
26 
27 ThumbIC::ThumbIC(const InputParameters & parameters)
28  : InitialCondition(parameters),
29  _xcoord(parameters.get<Real>("xcoord")),
30  _width(parameters.get<Real>("width")),
31  _height(parameters.get<Real>("height")),
32  _invalue(parameters.get<Real>("invalue")),
33  _outvalue(parameters.get<Real>("outvalue"))
34 {
35 }
36 
37 Real
38 ThumbIC::value(const Point & p)
39 {
40  Real value = 0.0;
41 
42  if (p(1) > _height)
43  {
44  Real rad = 0.0;
45  Point center(_xcoord, _height, 0.0);
46  for (unsigned int i = 0; i < 2; ++i)
47  rad += (p(i) - center(i)) * (p(i) - center(i));
48 
49  rad = sqrt(rad);
50 
51  if (rad <= _width / 2.0)
52  value = _invalue;
53  else
54  value = _outvalue;
55  }
56  else
57  {
58  if (p(0) > _xcoord - _width / 2.0 && p(0) < _xcoord + _width / 2.0)
59  value = _invalue;
60  else
61  value = _outvalue;
62  }
63 
64  return value;
65 }
const Real _height
Definition: ThumbIC.h:29
const Real _invalue
Definition: ThumbIC.h:30
static InputParameters validParams()
ADRealEigenVector< T, D, asd > sqrt(const ADRealEigenVector< T, D, asd > &)
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual Real value(const Point &p)
Definition: ThumbIC.C:38
const Real _width
Definition: ThumbIC.h:28
registerMooseObject("PhaseFieldApp", ThumbIC)
const Real _outvalue
Definition: ThumbIC.h:31
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const Real _xcoord
Definition: ThumbIC.h:27
ThumbIC creates a rectangle with a half circle on top.
Definition: ThumbIC.h:17
void addClassDescription(const std::string &doc_string)
static InputParameters validParams()
Definition: ThumbIC.C:15
const Elem & get(const ElemType type_in)
static const std::string center
Definition: NS.h:28
ThumbIC(const InputParameters &parameters)
Definition: ThumbIC.C:27