11 #include "MooseRandom.h"
19 InputParameters params = validParams<RandomICBase>();
20 params.addRequiredParam<Real>(
"x1",
21 "The x coordinate of the lower left-hand corner of the frozen box");
22 params.addRequiredParam<Real>(
"y1",
23 "The y coordinate of the lower left-hand corner of the frozen box");
24 params.addParam<Real>(
"z1", 0.0,
"The z coordinate of the lower left-hand corner of the box");
26 params.addRequiredParam<Real>(
"x2",
"The x coordinate of the upper right-hand corner of the box");
27 params.addRequiredParam<Real>(
"y2",
"The y coordinate of the upper right-hand corner of the box");
28 params.addParam<Real>(
"z2", 0.0,
"The z coordinate of the upper right-hand corner of the box");
30 params.addParam<Real>(
"min", 0.0,
"Lower bound of the randomly generated values");
31 params.addParam<Real>(
"max", 1.0,
"Upper bound of the randomly generated values");
32 params.addParam<Real>(
"inside", 1.0,
"Value inside sinusoids");
33 params.addParam<Real>(
"outside", 0.0,
"Value outside sinusoids");
35 params.addRequiredParam<Real>(
"lc",
"The lattice constant off the crystal structure");
37 MooseEnum crystal_structures(
"FCC BCC");
38 params.addParam<MooseEnum>(
39 "crystal_structure", crystal_structures,
"The type of crystal structure");
45 : RandomICBase(parameters),
46 _x1(getParam<Real>(
"x1")),
47 _y1(getParam<Real>(
"y1")),
48 _z1(getParam<Real>(
"z1")),
49 _x2(getParam<Real>(
"x2")),
50 _y2(getParam<Real>(
"y2")),
51 _z2(getParam<Real>(
"z2")),
52 _lc(getParam<Real>(
"lc")),
53 _crystal_structure(getParam<MooseEnum>(
"crystal_structure")),
54 _bottom_left(_x1, _y1, _z1),
55 _top_right(_x2, _y2, _z2),
56 _range(_top_right - _bottom_left),
57 _min(getParam<Real>(
"min")),
58 _max(getParam<Real>(
"max")),
59 _val_range(_max - _min),
60 _inside(getParam<Real>(
"inside")),
61 _outside(getParam<Real>(
"outside"))
65 for (
unsigned int i = 0; i < LIBMESH_DIM; i++)
66 mooseAssert(
_range(i) >= 0.0,
"x1, y1 or z1 is not less than x2, y2 or z2");
80 for (
unsigned int i = 0; i < LIBMESH_DIM; i++)
91 for (
unsigned int i = 0; i <
_icdim; i++)
92 val += std::cos((2.0 /
_lc * p(i)) * libMesh::pi);
98 for (
unsigned int i = 0; i <
_icdim; i++)
100 val += (std::cos((2.0 /
_lc * p(i % 3)) * libMesh::pi) *
101 std::cos((2.0 /
_lc * p((i + 1) % 3)) * libMesh::pi)) /
106 for (
unsigned int i = 0; i <
_icdim; i++)
107 val *= std::cos((2.0 /
_lc * p(i)) * libMesh::pi);
109 val = val / 2.0 + 0.5;