22 params.
addParam<Real>(
"x_offset", 0.5,
"Specifies offset of hexagon grid in x-direction");
24 "perturbation_percent",
26 "perturbation_percent >= 0.0 & perturbation_percent <= 1.0",
27 "The percent to randomly perturb centers of grains relative to the size of the grain");
33 _x_offset(getParam<Real>(
"x_offset")),
34 _perturbation_percent(getParam<Real>(
"perturbation_percent"))
38 "PolycrystalHex is supported on 2D domains or 3D domains with the columnar_3D option");
40 mooseError(
"PolycrystalHex requires an even square number for 2D or columnar 3D");
48 unsigned int d =
_dim;
54 for (
unsigned int j = 0; j <
d; ++j)
56 for (
unsigned int i = 0; i <
_vars.size(); ++i)
58 mooseError(
"PolycrystalHex works only with periodic BCs");
64 unsigned int grain_pow = root;
65 for (
unsigned int i = 1; i <
d; ++i)
70 "PolycrystalHex requires a square number for 2D or columnar 3D and a cubic number for 3D");
85 const Real ndist = 1.0 / root;
89 unsigned int count = 0;
91 for (
unsigned int k = 0; k < (
d == 3 ? root : 1); ++k)
92 for (
unsigned int j = 0; j < (
d >= 2 ? root : 1); ++j)
93 for (
unsigned int i = 0; i < root; ++i)
96 holder[
count](0) = i * ndist + (0.5 * ndist * (j % 2)) +
_x_offset * ndist;
99 holder[
count](1) = j * ndist + (0.5 * ndist * (k % 2));
102 holder[
count](2) = k * ndist;
109 for (
unsigned int grain = 0; grain <
_grain_num; ++grain)
registerMooseObject("PhaseFieldApp", PolycrystalHex)
std::vector< MooseVariable * > _vars
The vector of coupled in variables cast to MooseVariable.
MooseMesh & _mesh
A reference to the mesh.
void mooseError(Args &&... args) const
virtual Real getMaxInDimension(unsigned int component) const
bool isTranslatedPeriodic(const unsigned int sys_num, const unsigned int var_num, const unsigned int component) const
virtual Real getMinInDimension(unsigned int component) const
void seed(std::size_t i, unsigned int seed)
PolycrystalHex creates a hexagonal polycrystal initial condition.
PolycrystalHex(const InputParameters ¶meters)
virtual void precomputeGrainStructure()
This callback is triggered after the object is initialized and may be optionally overridden to do pre...
const Real _perturbation_percent
static InputParameters validParams()
const unsigned int _dim
mesh dimension
unsigned int _grain_num
The number of grains to create.
static InputParameters validParams()
std::vector< Point > _centerpoints
static constexpr std::size_t dim