15 #include "libmesh/elem.h" 24 "Divide the mesh along a hexagonal grid. Numbering of pin divisions increases first " 25 "counterclockwise, then expanding outwards from the inner ring, then axially. " 26 "Inner-numbering is within a radial ring, outer-numbering is axial divisions");
28 params.
addParam<Point>(
"center",
"Center of the hexagonal grid");
29 params.
addParam<PositionsName>(
"center_positions",
"Centers of the hexagonal grids");
32 "lattice_flat_to_flat",
33 "lattice_flat_to_flat>0",
34 "Distance between two (inner) opposite sides of a lattice. Also known as bundle pitch or " 35 "inner flat-to-flat distance");
43 "assign_domain_outside_grid_to_border",
45 "Whether to map the domain outside the grid back to the border of the grid");
52 _center(isParamValid(
"center") ? getParam<Point>(
"center") : Point(0, 0, 0)),
54 isParamValid(
"center_positions")
55 ? &_fe_problem->getPositionsObject(getParam<PositionsName>(
"center_positions"))
57 _lattice_flat_to_flat(getParam<
Real>(
"lattice_flat_to_flat")),
58 _pin_pitch(getParam<
Real>(
"pin_pitch")),
60 _min_z(getParam<
Real>(
"z_min")),
61 _max_z(getParam<
Real>(
"z_max")),
62 _nr(getParam<unsigned
int>(
"nr")),
63 _nz(getParam<unsigned
int>(
"nz")),
64 _outside_grid_counts_as_border(getParam<bool>(
"assign_domain_outside_grid_to_border"))
69 paramError(
"center",
"A center must be provided, or a Positions object for the centers");
71 mooseError(
"lattice_flat_to_flat",
"Pin pitch should be smaller than bundle pitch");
73 paramError(
"nz",
"Subdivision number must be 1 if width is 0 in Z direction");
80 _hex_latt = std::make_unique<HexagonalLatticeUtils>(
97 "Hexagonal grids centered on the positions are too close to each other (min distance: ",
99 "), closer than the extent of each grid (",
101 "). Mesh division is ill-defined ");
114 unsigned int offset = 0;
127 const auto nearest_grid_center =
131 pc = pt - nearest_grid_center;
162 "Querying the division index for a point of a boundary between two regions in Z: " +
164 ", in local hex grid frame: ",
168 iz = (jz > 0) ? jz - 1 : 0;
180 mooseAssert(ir != not_found,
"We should have found a mesh division bin radially");
181 mooseAssert(iz != not_found,
"We should have found a mesh division bin in Z");
184 return offset + ir + iz * n_radial;
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
const Point _center
Center of the lattice (single lattice)
const ExecFlagType & getCurrentExecuteOnFlag() const
const unsigned int _nr
Number of rings in the radial direction.
const Positions * _center_positions
Centers of the lattices (lattices centered around positions)
registerMooseObject("ReactorApp", HexagonalGridDivision)
virtual unsigned int divisionIndex(const Point &pt) const override
Divides the mesh based on a hexagonal grid.
const Real _pin_pitch
Pitch between fuel pins.
const Point & getPosition(unsigned int index, bool initial) const
const unsigned int _nz
Number of divisions in the Z direction.
void mooseWarning(Args &&... args) const
const MooseEnum _z_axis_index
Axial component for the Z axis.
bool isParamValid(const std::string &name) const
virtual void initialize() override
unsigned int getNearestPositionIndex(const Point &target, bool initial) const
const Real _min_z
Minimal axial coordinate.
HexagonalGridDivision(const InputParameters ¶meters)
const bool _outside_grid_counts_as_border
Whether to map outside the grid onto the corner.
bool absoluteFuzzyLessThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
unsigned int getNumPositions(bool initial=false) const
void paramError(const std::string ¶m, Args... args) const
const Real _max_z
Maximal axial coordinate.
static InputParameters validParams()
std::string stringify(const T &t)
unsigned int INVALID_DIVISION_INDEX
std::unique_ptr< HexagonalLatticeUtils > _hex_latt
Hexagonal lattice utility object.
void setNumDivisions(const unsigned int ndivs)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
const FEProblemBase *const _fe_problem
IntRange< T > make_range(T beg, T end)
bool absoluteFuzzyGreaterEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
void mooseError(Args &&... args) const
Real getMinDistanceBetweenPositions() const
static InputParameters validParams()
void ErrorVector unsigned int
bool absoluteFuzzyGreaterThan(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
const Real _lattice_flat_to_flat
Distance from one side to the one facing it of the lattice.
const ExecFlagType EXEC_INITIAL