www.mooseframework.org
ThumbIC.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 #include "ThumbIC.h"
8 
9 template <>
10 InputParameters
12 {
13  InputParameters params = validParams<InitialCondition>();
14  params.addClassDescription("Thumb shaped bicrystal for grain boundary mobility tests");
15  params.addRequiredParam<Real>("xcoord", "The x coordinate of the circle center");
16  params.addRequiredParam<Real>("width", "The y coordinate of the circle center");
17  params.addRequiredParam<Real>("height", "The z coordinate of the circle center");
18  params.addRequiredParam<Real>("invalue", "The variable value inside the circle");
19  params.addRequiredParam<Real>("outvalue", "The variable value outside the circle");
20  return params;
21 }
22 
23 ThumbIC::ThumbIC(const InputParameters & parameters)
24  : InitialCondition(parameters),
25  _xcoord(parameters.get<Real>("xcoord")),
26  _width(parameters.get<Real>("width")),
27  _height(parameters.get<Real>("height")),
28  _invalue(parameters.get<Real>("invalue")),
29  _outvalue(parameters.get<Real>("outvalue"))
30 {
31 }
32 
33 Real
34 ThumbIC::value(const Point & p)
35 {
36  Real value = 0.0;
37 
38  if (p(1) > _height)
39  {
40  Real rad = 0.0;
41  Point center(_xcoord, _height, 0.0);
42  for (unsigned int i = 0; i < 2; ++i)
43  rad += (p(i) - center(i)) * (p(i) - center(i));
44 
45  rad = sqrt(rad);
46 
47  if (rad <= _width / 2.0)
48  value = _invalue;
49  else
50  value = _outvalue;
51  }
52  else
53  {
54  if (p(0) > _xcoord - _width / 2.0 && p(0) < _xcoord + _width / 2.0)
55  value = _invalue;
56  else
57  value = _outvalue;
58  }
59 
60  return value;
61 }
const Real _height
Definition: ThumbIC.h:31
const Real _invalue
Definition: ThumbIC.h:32
virtual Real value(const Point &p)
Definition: ThumbIC.C:34
const Real _width
Definition: ThumbIC.h:30
InputParameters validParams< ThumbIC >()
Definition: ThumbIC.C:11
const Real _outvalue
Definition: ThumbIC.h:33
const Real _xcoord
Definition: ThumbIC.h:29
ThumbIC(const InputParameters &parameters)
Definition: ThumbIC.C:23