https://mooseframework.inl.gov
Loading...
Searching...
No Matches
ThumbIC.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
10#include "ThumbIC.h"
11
12registerMooseObject("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
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
37Real
38ThumbIC::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 p
Point center
registerMooseObject("PhaseFieldApp", ThumbIC)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
ThumbIC creates a rectangle with a half circle on top.
Definition ThumbIC.h:18
const Real _width
Definition ThumbIC.h:28
ThumbIC(const InputParameters &parameters)
Definition ThumbIC.C:27
const Real _xcoord
Definition ThumbIC.h:27
const Real _outvalue
Definition ThumbIC.h:31
const Real _invalue
Definition ThumbIC.h:30
const Real _height
Definition ThumbIC.h:29
virtual Real value(const Point &p)
Definition ThumbIC.C:38
static InputParameters validParams()
Definition ThumbIC.C:15