Skip to content

Commit

Permalink
Index continuously when using distributed divisions over positions
Browse files Browse the repository at this point in the history
changing: spherical, cylindrical, cartesian, hexagonal divisions
refs idaholab#26223

Also only output a warning for positions being too close, it's not always
relevant as cell centroids can still be well within the uniquely defined divisions
refs idaholab#25901
  • Loading branch information
GiudGiud committed Mar 4, 2024
1 parent b477121 commit 1f40024
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions framework/src/meshdivisions/CartesianGridDivision.C
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ CartesianGridDivision::initialize()
// Note that if the positions are not co-planar, the distance reported would be bigger but there
// could still be an overlap. Looking at min_center_dist is not enough
if (MooseUtils::absoluteFuzzyGreaterThan(min_dist, min_center_dist))
mooseError(
mooseWarning(
"Cartesian grids centered on the positions are too close to each other (min distance: ",
min_center_dist,
"), closer than the extent of each grid. Mesh division is ill-defined");
Expand Down Expand Up @@ -148,7 +148,7 @@ CartesianGridDivision::divisionIndex(const Point & pt) const
// look at the relative position of the point compared to that position
const bool initial = _fe_problem->getCurrentExecuteOnFlag() == EXEC_INITIAL;
const auto nearest_grid_center_index = _center_positions->getNearestPositionIndex(pt, initial);
offset = nearest_grid_center_index * getNumDivisions();
offset = nearest_grid_center_index * _nx * _ny * _nz;
const auto nearest_grid_center =
_center_positions->getPosition(nearest_grid_center_index, initial);
bottom_left = -_widths / 2;
Expand Down
4 changes: 2 additions & 2 deletions framework/src/meshdivisions/CylindricalGridDivision.C
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ CylindricalGridDivision::initialize()
// Note that if the positions are not co-planar, the distance reported would be bigger but there
// could still be an overlap. Looking at min_center_dist is not enough
if (MooseUtils::absoluteFuzzyGreaterThan(min_dist, min_center_dist))
mooseError(
mooseWarning(
"Cylindrical grids centered on the positions are too close to each other (min distance: ",
min_center_dist,
"), closer than the radial extent of each grid. Mesh division is ill-defined");
Expand Down Expand Up @@ -167,7 +167,7 @@ CylindricalGridDivision::divisionIndex(const Point & pt) const
// If dividing using positions, find the closest position
const bool initial = _fe_problem->getCurrentExecuteOnFlag() == EXEC_INITIAL;
const auto nearest_center_index = _center_positions->getNearestPositionIndex(pt, initial);
offset = nearest_center_index * getNumDivisions();
offset = nearest_center_index * _n_radial * _n_azim * _n_axial;
const auto new_center = _center_positions->getPosition(nearest_center_index, initial);
pc(2) = (pt - new_center) * _direction;
in_plane = (pt - new_center) - pc(2) * _direction;
Expand Down
4 changes: 2 additions & 2 deletions framework/src/meshdivisions/SphericalGridDivision.C
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ SphericalGridDivision::initialize()
// Note that if the positions are not co-planar, the distance reported would be bigger but there
// could still be an overlap. Looking at min_center_dist is not enough
if (MooseUtils::absoluteFuzzyGreaterThan(min_dist, min_center_dist))
mooseError(
mooseWarning(
"Spherical grids centered on the positions are too close to each other (min distance: ",
min_center_dist,
"), closer than the radial extent of each grid. Mesh division is ill-defined");
Expand Down Expand Up @@ -120,7 +120,7 @@ SphericalGridDivision::divisionIndex(const Point & pt) const
// If distributing using positions, find the closest position
const bool initial = _fe_problem->getCurrentExecuteOnFlag() == EXEC_INITIAL;
const auto nearest_center_index = _center_positions->getNearestPositionIndex(pt, initial);
offset = nearest_center_index * getNumDivisions();
offset = nearest_center_index * _n_radial;
pc(0) = (pt - _center_positions->getPosition(nearest_center_index, initial)).norm();
}

Expand Down
2 changes: 1 addition & 1 deletion modules/reactor/src/meshdivisions/HexagonalGridDivision.C
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ HexagonalGridDivision::initialize()
// this bound is not sufficiently strict. The simplest example would be non-coplanar
// points, which can be a great distance away axially but be on the same axis
if (MooseUtils::absoluteFuzzyGreaterThan(_lattice_flat_to_flat, min_center_dist))
mooseError(
mooseWarning(
"Hexagonal grids centered on the positions are too close to each other (min distance: ",
min_center_dist,
"), closer than the extent of each grid (",
Expand Down

0 comments on commit 1f40024

Please sign in to comment.