https://mooseframework.inl.gov
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | List of all members
HexagonalLatticeUtils Class Reference

Class providing various utility functions related to triangular lattices of pins enclosed in a hexagonal duct. More...

#include <HexagonalLatticeUtils.h>

Public Member Functions

 HexagonalLatticeUtils (const Real bundle_inner_flat_to_flat, const Real pin_pitch, const Real pin_diameter, const Real wire_diameter, const Real wire_pitch, const unsigned int n_rings, const unsigned int axis, const Real rotation_around_axis=0)
 
Real distanceFromGap (const Point &pt, const unsigned int gap_index) const
 Distance from a point and a gap. More...
 
unsigned int gapIndex (const Point &point) const
 Get the index for the gap closest to the point. More...
 
void gapIndexAndDistance (const Point &point, unsigned int &index, Real &distance) const
 Get the gap index and distance to that gap for a given point. More...
 
Real sideTranslationX (const unsigned int side) const
 Get the unit vector translation to move a center point to a duct wall. More...
 
Real sideTranslationY (const unsigned int side) const
 Get the unit vector translation to move a center point to a duct wall. More...
 
unsigned int firstPinInRing (const unsigned int ring) const
 Get the index of the "first" pin in a ring. More...
 
unsigned int lastPinInRing (const unsigned int ring) const
 Get the index of the "last" pin in a ring. More...
 
bool lastGapInRing (const unsigned int gap_index) const
 Whether this gap is the "last" in the ring, i.e. More...
 
unsigned int ringIndex (const unsigned int pin) const
 Get the index of the ring for a certain pin index. More...
 
const std::vector< Point > & gapUnitNormals () const
 Get the unit normals for all of the gaps. More...
 
unsigned int pins (const unsigned int n) const
 Get the number of pins in a given ring. More...
 
unsigned int totalPins (const unsigned int n) const
 Get the total number of pins for all rings. More...
 
unsigned int rings (const unsigned int n) const
 Get the number of rings for a specified number of pins. More...
 
unsigned int interiorChannels (const unsigned int ring)
 Get the number of interior channels between ring and ring - 1 (0 indexing) More...
 
unsigned int nInteriorGaps () const
 Get the number of gaps that touch an interior channel. More...
 
const std::vector< Point > & gapCenters () const
 Get the center coordinates of the gaps. More...
 
unsigned int nGaps () const
 Get the number of gaps. More...
 
Real pitchToDiameter () const
 Get the (pin) pitch-to-diameter ratio. More...
 
Real heightToDiameter () const
 Get the (wire) axial pitch-to-diameter ratio. More...
 
unsigned int axis () const
 Get the vertical axis of the bed along which pins are aligned. More...
 
Real pinDiameter () const
 Get the pin diameter. More...
 
Real wirePitch () const
 Get the wire pitch. More...
 
Real wireDiameter () const
 Get the wire diameter. More...
 
Real pinPitch () const
 Get the pin pitch. More...
 
Real bundlePitch () const
 Get the bundle pitch. More...
 
Real pinVolumePerPitch () const
 Get the pin volume per pitch. More...
 
Real wireVolumePerPitch () const
 Get the wire volume per pitch. More...
 
unsigned int nInteriorPins () const
 Get the number of interior pins. More...
 
unsigned int nEdgePins () const
 Get the number of edge pins. More...
 
unsigned int nCornerPins () const
 Get the number of corner pins. More...
 
unsigned int nPins () const
 Get the total number of pins for the lattice. More...
 
Real interiorHydraulicDiameter () const
 Get the hydraulic diameter of an interior channel. More...
 
Real edgeHydraulicDiameter () const
 Get the hydraulic diameter of an edge channel. More...
 
Real cornerHydraulicDiameter () const
 Get the hydraulic diameter of a corner channel. More...
 
Real hydraulicDiameter () const
 Get the overall bundle hydraulic diameter. More...
 
Real interiorWettedArea () const
 Get the wetted area of an interior channel per wire pitch. More...
 
Real edgeWettedArea () const
 Get the wetted area of an edge channel per wire pitch. More...
 
Real cornerWettedArea () const
 Get the wetted area of a corner channel per wire pitch. More...
 
Real wettedArea () const
 Get the wetted area of entire bundle per wire pitch. More...
 
Real interiorFlowVolume () const
 Get the flow volume of an interior channel per wire pitch. More...
 
Real edgeFlowVolume () const
 Get the flow volume of an edge channel per wire pitch. More...
 
Real cornerFlowVolume () const
 Get the flow volume of an corner channel per wire pitch. More...
 
Real interiorVolume () const
 Get the total volume of an interior channel per wire pitch. More...
 
Real edgeVolume () const
 Get the total volume of an edge channel per wire pitch. More...
 
Real cornerVolume () const
 Get the total volume of an corner channel per wire pitch. More...
 
Real flowVolume () const
 Get the flow volume of the bundle per wire pitch. More...
 
unsigned int nInteriorChannels () const
 Get the number of interior channels. More...
 
unsigned int nEdgeChannels () const
 Get the number of edge channels. More...
 
unsigned int nCornerChannels () const
 Get the number of corner channels. More...
 
unsigned int nChannels () const
 Get the total number of channels. More...
 
Real pinBundleSpacing () const
 Get the distance between the outermost pins and the duct walls. More...
 
const std::vector< Point > & pinCenters () const
 Get the center coordinates of the pins. More...
 
const std::vector< std::vector< Point > > & pinCenteredCornerCoordinates () const
 Get the corner coordinates of a hexagon surrounding each pin. More...
 
Real pinSurfaceAreaPerPitch () const
 Get the pin surface area per wire pitch. More...
 
Real cornerEdgeLength () const
 Get half the distance of the duct that a corner channel is in contact with. More...
 
Real minDuctWallDistance (const Point &p) const
 Get the minimum distance from a point to the duct inner surface. More...
 
Real minDuctCornerDistance (const Point &p) const
 Get the minimum distance from a point to the duct corners. More...
 
channel_type::ChannelTypeEnum channelType (const Point &p) const
 Get the channel type (interior, edge, corner) given a point. More...
 
Real channelSpecificSurfaceArea (const channel_type::ChannelTypeEnum &channel) const
 Get the specific surface area of a channel. More...
 
Real channelHydraulicDiameter (const channel_type::ChannelTypeEnum &channel) const
 Get the hydraulic diameter of a channel. More...
 
Real pinRadius () const
 Get the pin outer radius. More...
 
Real hexagonArea (const Real pitch) const
 Get the area of a hexagon with given flat-to-flat distance (pitch) More...
 
Real hexagonSide (const Real pitch) const
 Get the side length of a hexagon with given flat-to-flat distance (pitch) More...
 
Real hexagonVolume (const Real side) const
 Get the volume of a hexagonal prism per wire pitch. More...
 
Real hexagonPitch (const Real volume) const
 Get the pitch of a hexagonal prism based on its per-wire-pitch volume. More...
 
Real triangleArea (const Real side) const
 Get the area of an equilateral triangle with given side length. More...
 
Real triangleHeight (const Real side) const
 Get the height of an equilateral triangle with given side length. More...
 
Real triangleSide (const Real height) const
 Get the side of an equilateral triangle with given height. More...
 
Real triangleVolume (const Real side) const
 Get the volume of an equilateral triangle prism per wire pitch. More...
 
const std::vector< std::vector< unsigned int > > & interiorChannelPinIndices () const
 Get the pin indices forming the corners of all interior channels. More...
 
const std::vector< std::vector< unsigned int > > & edgeChannelPinIndices () const
 Get the pin indices forming two of the corners of all edge channels. More...
 
const std::vector< std::vector< unsigned int > > & cornerChannelPinIndices () const
 Get the pin indices forming one of the corners of all corner channels. More...
 
const std::vector< std::pair< int, int > > & gapIndices () const
 Get the pin and side indices on each gap. More...
 
const std::vector< std::vector< int > > & localToGlobalGaps () const
 For each subchannel, get the indices of the gaps that touch that subchannel. More...
 
const std::vector< Point > interiorChannelCornerCoordinates (const unsigned int interior_channel_id) const
 Get the corner coordinates of an interior channel given an ID (relative to the start of the interior channels) More...
 
const std::vector< Point > edgeChannelCornerCoordinates (const unsigned int edge_channel_id) const
 Get the corner coordinates of an edge channel given an ID (relative to the start of the edge channels) More...
 
const std::vector< Point > cornerChannelCornerCoordinates (const unsigned int corner_channel_id) const
 Get the corner coordinates of a corner channel given an ID (relative to the start of the corner channels) More...
 
Point channelCentroid (const std::vector< Point > &corners) const
 Get the centroid of a channel given the corner coordinates. More...
 
unsigned int pinIndex (const Point &point) const
 Get the pin index given a point. More...
 
unsigned int closestPinIndex (const Point &point) const
 Get the closest pin index given a point outside the lattice. More...
 
unsigned int channelIndex (const Point &point) const
 Get the channel index given a point. More...
 
bool insideLattice (const Point &point) const
 Whether the point is inside the lattice. More...
 
void get2DInputPatternIndex (const unsigned int pin_index, unsigned int &row_index, unsigned int &within_row_index) const
 Conversion from lattice pin indexing to the 2D input file index. More...
 

Protected Member Functions

unsigned int globalGapIndex (const std::pair< int, int > &local_gap) const
 Get the global gap index from the local gap index. More...
 

Protected Attributes

const Real _bundle_pitch
 Bundle pitch (distance across bundle measured flat-to-flat on the inside of the duct) More...
 
const Real _pin_pitch
 Pin pitch. More...
 
const Real _pin_diameter
 Pin diameter. More...
 
const Real _wire_diameter
 Wire diameter. More...
 
const Real _wire_pitch
 Wire pitch. More...
 
const unsigned int _n_rings
 Total number of rings of pins. More...
 
const unsigned int _axis
 Vertical axis of the bundle along which the pins are aligned. More...
 
const Real _rotation_around_axis
 Rotation around the axis to apply to the lattice. More...
 
const RealTensorValue _rotation_matrix
 Rotation matrix to apply the rotation why. More...
 
const Real _bundle_side_length
 Side length of duct. More...
 
const Real _pin_area
 Pin cross-sectional area. More...
 
const Real _pin_circumference
 Pin circumference. More...
 
const Real _wire_area
 Wire cross-sectional area. More...
 
const Real _wire_circumference
 Wire circumference. More...
 
const Real _pin_surface_area_per_pitch
 Pin surface area per wire pitch. More...
 
const Real _pin_volume_per_pitch
 Single-pin volume per wire pitch. More...
 
const Real _P_over_D
 Pitch-to-diameter ratio. More...
 
const Real _L_over_D
 Wire axial lead length to diameter ratio. More...
 
Real _wire_surface_area_per_pitch
 Wire surface area per wire pitch. More...
 
Real _pin_bundle_spacing
 Spacing between the duct inner wall and the pin surface. More...
 
Real _wire_volume_per_pitch
 Single-wire volume per wire pitch. More...
 
unsigned int _n_pins
 Total number of pins. More...
 
unsigned int _n_interior_pins
 Number of interior pins. More...
 
unsigned int _n_edge_pins
 Number of edge pins. More...
 
unsigned int _n_corner_pins
 Number of corner pins. More...
 
unsigned int _n_channels
 Total number of channels. More...
 
unsigned int _n_interior_channels
 Total number of interior channels. More...
 
unsigned int _n_edge_channels
 Total number of edge channels. More...
 
unsigned int _n_corner_channels
 Total number of corner channels. More...
 
Real _corner_edge_length
 Half the distance for which a corner channel is in contact with the duct. More...
 
Real _interior_Dh
 Hydraulic diameter of interior channel. More...
 
Real _edge_Dh
 Hydraulic diameter of edge channel. More...
 
Real _corner_Dh
 Hydraulic diameter of corner channel. More...
 
Real _Dh
 Bundle-wide hydraulic diameter. More...
 
Real _interior_flow_volume
 Flow volume of an interior channel per wire pitch. More...
 
Real _edge_flow_volume
 Flow volume of an edge channel per wire pitch. More...
 
Real _corner_flow_volume
 Flow volume of a corner channel per wire pitch. More...
 
Real _interior_volume
 Total volume of an interior channel per wire pitch. More...
 
Real _edge_volume
 Total volume of an edge channel per wire pitch. More...
 
Real _corner_volume
 Total volume of a corner channel per wire pitch. More...
 
Real _flow_volume
 Bundle-wide flow volume per wire pitch. More...
 
Real _interior_wetted_area
 Wetted area of an interior channel per wire pitch. More...
 
Real _edge_wetted_area
 Wetted area of an edge channel per wire pitch. More...
 
Real _corner_wetted_area
 Wetted area of a corner channel per wire pitch. More...
 
Real _wetted_area
 Wetted area of entire bundle per wire pitch. More...
 
std::vector< Point > _pin_centers
 Pin center coordinates. More...
 
std::vector< std::vector< Point > > _pin_centered_corner_coordinates
 Corner coordinates of a hexagon surrounding each pin. More...
 
std::vector< Point > _duct_corners
 Six corner coordinates for the ducts. More...
 
std::vector< std::vector< Real > > _duct_coeffs
 Coefficients in the line equations defining each duct wall. More...
 
std::vector< std::vector< unsigned int > > _interior_channel_pin_indices
 Pin indices forming the corner of each interior channel. More...
 
std::vector< std::vector< unsigned int > > _edge_channel_pin_indices
 Pin indices forming two of the corners of each edge channel. More...
 
std::vector< std::vector< unsigned int > > _corner_channel_pin_indices
 Pin indices forming one of the corners of each corner channel. More...
 
std::vector< std::pair< int, int > > _gap_indices
 Gap indices, connecting two pins or one pin and a side, ordered by global gap ID. More...
 
std::vector< std::vector< int > > _local_to_global_gaps
 Local-to-global gap indexing, ordered by channel ID. More...
 
std::vector< std::vector< Point > > _gap_points
 Two points on each gap, in order to compute distance-from-gap calculations. More...
 
std::vector< Point > _gap_unit_normals
 Unit normal vectors for each gap. More...
 
unsigned int _n_interior_gaps
 Number of gaps that touch an interior channel. More...
 
unsigned int _n_gaps
 Total number of gaps. More...
 
std::vector< Real_unit_translation_x
 (unitless) x-translations to apply to move from a center point to a side of a hexagon More...
 
std::vector< Real_unit_translation_y
 (unitless) y-translations to apply to move from a center point to a side of a hexagon More...
 
std::vector< Point > _gap_centers
 Center points of all the gaps. More...
 
unsigned int _ix
 Index representing "first" coordinate of 2-D plane. More...
 
unsigned int _iy
 Index representing "second" coordinate of 2-D plane. More...
 

Static Protected Attributes

static const Real SIN60 = std::sqrt(3.0) / 2.0
 
static const Real COS60 = 0.5
 
static const unsigned int NUM_SIDES = 6
 Number of sides in a hexagon. More...
 

Private Member Functions

void computeGapIndices ()
 Determine the global gap indices, sorted first by lower pin ID and next by higher pin ID. More...
 
void computePinAndChannelTypes ()
 Compute the number of pins and channels and their types for the lattice. More...
 
void computePinBundleSpacing ()
 Compute the spacing between the outer pins and the duct inner walls. More...
 
void computeWireVolumeAndAreaPerPitch ()
 Compute the volume and surface area const occupied by the wire in one with pitch. More...
 
void computeFlowVolumes ()
 Compute the flow volumes for each channel type. More...
 
void computeWettedAreas ()
 Compute the wetted areas for each channel type. More...
 
void computeHydraulicDiameters ()
 Compute the hydraulic diameters for each channel type. More...
 
void computePinAndDuctCoordinates ()
 Compute the pin center coordinates and the duct corner coordinates. More...
 
void computeChannelPinIndices ()
 Get the pin indices that form the corners of each channel type. More...
 

Detailed Description

Class providing various utility functions related to triangular lattices of pins enclosed in a hexagonal duct.

Notes:

Definition at line 38 of file HexagonalLatticeUtils.h.

Constructor & Destructor Documentation

◆ HexagonalLatticeUtils()

HexagonalLatticeUtils::HexagonalLatticeUtils ( const Real  bundle_inner_flat_to_flat,
const Real  pin_pitch,
const Real  pin_diameter,
const Real  wire_diameter,
const Real  wire_pitch,
const unsigned int  n_rings,
const unsigned int  axis,
const Real  rotation_around_axis = 0 
)

Definition at line 19 of file HexagonalLatticeUtils.C.

27  : _bundle_pitch(bundle_inner_flat_to_flat),
28  _pin_pitch(pin_pitch),
29  _pin_diameter(pin_diameter),
30  _wire_diameter(wire_diameter),
31  _wire_pitch(wire_pitch),
32  _n_rings(n_rings),
33  _axis(axis),
34  _rotation_around_axis(rotation_around_axis),
37  -std::sin(_rotation_around_axis * libMesh::pi / 180),
38  0.))),
40  _pin_area(M_PI * _pin_diameter * _pin_diameter / 4.0),
48 {
50  _ix = idx.first;
51  _iy = idx.second;
52 
53  // object is not tested and probably won't work if axis != 2
54  if (_axis != 2)
55  mooseError("The HexagonalLatticeUtils is currently limited to 'axis = 2'!");
56 
58  mooseError("Pin pitch of " + std::to_string(_pin_pitch) + " cannot fit pins of diameter " +
59  std::to_string(_pin_diameter) + "!");
60 
62  mooseError("Wire diameter of " + std::to_string(_wire_diameter) +
63  " cannot fit between pin-pin space of " +
64  std::to_string(_pin_pitch - _pin_diameter) + "!");
65 
66  _unit_translation_x = {0.0, -SIN60, -SIN60, 0.0, SIN60, SIN60};
67  _unit_translation_y = {1.0, COS60, -COS60, -1.0, -COS60, COS60};
68 
69  // Use rotation matrix on unit translation vectors
70  if (rotation_around_axis != 0)
71  for (const auto i : make_range(6))
72  {
73  const Point rotated =
75  _unit_translation_x[i] = rotated(0);
76  _unit_translation_y[i] = rotated(1);
77  }
78 
79  // compute number of each pin and channel and channel type (interior, edge channel)
81 
83 
92 
94  mooseError("Specified bundle pitch " + std::to_string(_bundle_pitch) +
95  " is too small to fit the given pins and wire wrap!");
96 }
const Real _wire_diameter
Wire diameter.
void computeGapIndices()
Determine the global gap indices, sorted first by lower pin ID and next by higher pin ID...
const RealTensorValue _rotation_matrix
Rotation matrix to apply the rotation why.
const unsigned int _n_rings
Total number of rings of pins.
GenericRealTensorValue< is_ad > rotVec2DToX(const GenericRealVectorValue< is_ad > &vec)
void computeHydraulicDiameters()
Compute the hydraulic diameters for each channel type.
const Real _wire_area
Wire cross-sectional area.
const Real _pin_diameter
Pin diameter.
void mooseError(Args &&... args)
Real hexagonSide(const Real pitch) const
Get the side length of a hexagon with given flat-to-flat distance (pitch)
const Real _rotation_around_axis
Rotation around the axis to apply to the lattice.
const Real _P_over_D
Pitch-to-diameter ratio.
void computePinAndChannelTypes()
Compute the number of pins and channels and their types for the lattice.
const Real _pin_area
Pin cross-sectional area.
void computePinBundleSpacing()
Compute the spacing between the outer pins and the duct inner walls.
const Real _L_over_D
Wire axial lead length to diameter ratio.
const Real _wire_pitch
Wire pitch.
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.
Real _corner_edge_length
Half the distance for which a corner channel is in contact with the duct.
const Real _bundle_pitch
Bundle pitch (distance across bundle measured flat-to-flat on the inside of the duct) ...
void computeChannelPinIndices()
Get the pin indices that form the corners of each channel type.
const Real _pin_pitch
Pin pitch.
unsigned int _iy
Index representing "second" coordinate of 2-D plane.
std::pair< unsigned int, unsigned int > projectedIndices(const unsigned int axis)
unsigned int _ix
Index representing "first" coordinate of 2-D plane.
const Real _pin_circumference
Pin circumference.
Real _pin_bundle_spacing
Spacing between the duct inner wall and the pin surface.
const Real _pin_volume_per_pitch
Single-pin volume per wire pitch.
void computePinAndDuctCoordinates()
Compute the pin center coordinates and the duct corner coordinates.
const Real _bundle_side_length
Side length of duct.
void computeWettedAreas()
Compute the wetted areas for each channel type.
void computeWireVolumeAndAreaPerPitch()
Compute the volume and surface area const occupied by the wire in one with pitch. ...
IntRange< T > make_range(T beg, T end)
const Real _pin_surface_area_per_pitch
Pin surface area per wire pitch.
std::vector< Real > _unit_translation_y
(unitless) y-translations to apply to move from a center point to a side of a hexagon ...
void computeFlowVolumes()
Compute the flow volumes for each channel type.
unsigned int axis() const
Get the vertical axis of the bed along which pins are aligned.
unsigned int _n_edge_channels
Total number of edge channels.
std::vector< Real > _unit_translation_x
(unitless) x-translations to apply to move from a center point to a side of a hexagon ...
const Real _wire_circumference
Wire circumference.
unsigned int idx(const ElemType type, const unsigned int nx, const unsigned int i, const unsigned int j)
const Real pi
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

Member Function Documentation

◆ axis()

unsigned int HexagonalLatticeUtils::axis ( ) const
inline

Get the vertical axis of the bed along which pins are aligned.

Returns
vertical axis

Definition at line 183 of file HexagonalLatticeUtils.h.

183 { return _axis; }
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.

◆ bundlePitch()

Real HexagonalLatticeUtils::bundlePitch ( ) const
inline

Get the bundle pitch.

Returns
bundle pitch

Definition at line 213 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

213 { return _bundle_pitch; }
const Real _bundle_pitch
Bundle pitch (distance across bundle measured flat-to-flat on the inside of the duct) ...

◆ channelCentroid()

Point HexagonalLatticeUtils::channelCentroid ( const std::vector< Point > &  corners) const

Get the centroid of a channel given the corner coordinates.

Parameters
[in]cornerscorner coordinates
Returns
channel centroid

Definition at line 614 of file HexagonalLatticeUtils.C.

615 {
616  int n_pins = pins.size();
617  Point centroid(0.0, 0.0, 0.0);
618  for (const auto & p : pins)
619  centroid += p / n_pins;
620 
621  return centroid;
622 }
unsigned int pins(const unsigned int n) const
Get the number of pins in a given ring.

◆ channelHydraulicDiameter()

Real HexagonalLatticeUtils::channelHydraulicDiameter ( const channel_type::ChannelTypeEnum channel) const

Get the hydraulic diameter of a channel.

Parameters
[in]channelchannel type
Returns
hydraulic diameter

Definition at line 232 of file HexagonalLatticeUtils.C.

233 {
234  switch (channel)
235  {
237  return _interior_Dh;
238  case channel_type::edge:
239  return _edge_Dh;
241  return _corner_Dh;
242  default:
243  mooseError("Unhandled ChannelTypeEnum in HexagonalLattice!");
244  }
245 }
void mooseError(Args &&... args)
Real _corner_Dh
Hydraulic diameter of corner channel.
Real _interior_Dh
Hydraulic diameter of interior channel.
Real _edge_Dh
Hydraulic diameter of edge channel.

◆ channelIndex()

unsigned int HexagonalLatticeUtils::channelIndex ( const Point &  point) const

Get the channel index given a point.

Parameters
[in]pointpoint, must already be translated to lattice frame
Returns
channel index

Definition at line 679 of file HexagonalLatticeUtils.C.

Referenced by gapIndex(), gapIndexAndDistance(), and TEST_F().

680 {
681  auto channel = channelType(point);
682 
683  switch (channel)
684  {
686  {
687  for (const auto i : make_range(_n_interior_channels))
688  {
689  auto corners = interiorChannelCornerCoordinates(i);
690  if (geom_utils::pointInPolygon(point, corners, _axis))
691  return i;
692  }
693  break;
694  }
695  case channel_type::edge:
696  {
697  for (const auto i : make_range(_n_edge_channels))
698  {
699  auto corners = edgeChannelCornerCoordinates(i);
700  if (geom_utils::pointInPolygon(point, corners, _axis))
701  return i + _n_interior_channels;
702  }
703  break;
704  }
706  {
707  for (const auto i : make_range(_n_corner_channels))
708  {
709  auto corners = cornerChannelCornerCoordinates(i);
710  if (geom_utils::pointInPolygon(point, corners, _axis))
712  }
713  break;
714  }
715  default:
716  mooseError("Unhandled ChannelTypeEnum!");
717  }
718 
719  mooseError(
720  "Point (" + std::to_string(point(0)) + ", " + std::to_string(point(1)) + ", " +
721  std::to_string(point(2)) +
722  ") is not in any channel! This can sometimes happen "
723  "due to:\n\n a) Points in the mesh actually being outside the domain specified with the "
724  "HexagonalLatticeUtils.\n b) Small floating point errors - we recommend using a CONSTANT "
725  "MONOMIAL variable with all related objects.\nYou can also try slightly decreasing the pin "
726  "diameter and/or "
727  "increasing the bundle pitch.");
728 }
void mooseError(Args &&... args)
channel_type::ChannelTypeEnum channelType(const Point &p) const
Get the channel type (interior, edge, corner) given a point.
const std::vector< Point > cornerChannelCornerCoordinates(const unsigned int corner_channel_id) const
Get the corner coordinates of a corner channel given an ID (relative to the start of the corner chann...
unsigned int _n_interior_channels
Total number of interior channels.
const std::vector< Point > edgeChannelCornerCoordinates(const unsigned int edge_channel_id) const
Get the corner coordinates of an edge channel given an ID (relative to the start of the edge channels...
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.
bool pointInPolygon(const libMesh::Point &point, const std::vector< libMesh::Point > &corners, const unsigned int axis)
const std::vector< Point > interiorChannelCornerCoordinates(const unsigned int interior_channel_id) const
Get the corner coordinates of an interior channel given an ID (relative to the start of the interior ...
IntRange< T > make_range(T beg, T end)
unsigned int _n_corner_channels
Total number of corner channels.
unsigned int _n_edge_channels
Total number of edge channels.

◆ channelSpecificSurfaceArea()

Real HexagonalLatticeUtils::channelSpecificSurfaceArea ( const channel_type::ChannelTypeEnum channel) const

Get the specific surface area of a channel.

Parameters
[in]channelchannel type
Returns
flow volume per wire pitch

Definition at line 215 of file HexagonalLatticeUtils.C.

217 {
218  switch (channel)
219  {
222  case channel_type::edge:
226  default:
227  mooseError("Unhandled ChannelTypeEnum in HexagonalLattice!");
228  }
229 }
void mooseError(Args &&... args)
Real _corner_volume
Total volume of a corner channel per wire pitch.
Real _interior_wetted_area
Wetted area of an interior channel per wire pitch.
Real _interior_volume
Total volume of an interior channel per wire pitch.
Real _edge_wetted_area
Wetted area of an edge channel per wire pitch.
Real _corner_wetted_area
Wetted area of a corner channel per wire pitch.
Real _edge_volume
Total volume of an edge channel per wire pitch.

◆ channelType()

channel_type::ChannelTypeEnum HexagonalLatticeUtils::channelType ( const Point &  p) const

Get the channel type (interior, edge, corner) given a point.

Parameters
[in]ppoint, must already be translated to lattice frame
Returns
channel type

Definition at line 195 of file HexagonalLatticeUtils.C.

Referenced by channelIndex(), and TEST_F().

196 {
197  const Real distance_to_wall = minDuctWallDistance(p);
198 
199  if (distance_to_wall > _pin_bundle_spacing + pinRadius())
200  return channel_type::interior;
201 
202  // the point is in a corner channel if the right triangle formed by the point,
203  // the corner, and the duct wall has a wall length less than the wall length
204  // of a corner channel
205  const Real distance_to_corner = minDuctCornerDistance(p);
206  Real l = std::sqrt(distance_to_corner * distance_to_corner - distance_to_wall * distance_to_wall);
207 
208  if (l < _corner_edge_length)
209  return channel_type::corner;
210  else
211  return channel_type::edge;
212 }
Real minDuctWallDistance(const Point &p) const
Get the minimum distance from a point to the duct inner surface.
Real _corner_edge_length
Half the distance for which a corner channel is in contact with the duct.
Real _pin_bundle_spacing
Spacing between the duct inner wall and the pin surface.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real pinRadius() const
Get the pin outer radius.
Real minDuctCornerDistance(const Point &p) const
Get the minimum distance from a point to the duct corners.

◆ closestPinIndex()

unsigned int HexagonalLatticeUtils::closestPinIndex ( const Point &  point) const

Get the closest pin index given a point outside the lattice.

Parameters
[in]pointpoint, must already be translated to lattice frame
Returns
pin index

Definition at line 650 of file HexagonalLatticeUtils.C.

651 {
652  // If within the lattice, you must consider all pins. If outside, outer ring suffices
653  unsigned int start_index = 0;
654  if (!insideLattice(point))
655  start_index = firstPinInRing(_n_rings);
656 
657  // Classic minimum search. If more performance is required for a large lattice we may consider
658  // using a KD-Tree instead or checking which ring the point is part of before examining each pin
659  auto min_distance = std::numeric_limits<Real>::max();
660  unsigned int index_min = 0;
661  for (unsigned int i = start_index; i < _n_pins; ++i)
662  {
663  const auto & center = _pin_centers[i];
664  Real dx = center(_ix) - point(_ix);
665  Real dy = center(_iy) - point(_iy);
666  Real distance_from_pin = std::sqrt(dx * dx + dy * dy);
667 
668  if (distance_from_pin < min_distance)
669  {
670  min_distance = distance_from_pin;
671  index_min = i;
672  }
673  }
674 
675  return index_min;
676 }
const unsigned int _n_rings
Total number of rings of pins.
std::vector< Point > _pin_centers
Pin center coordinates.
unsigned int _iy
Index representing "second" coordinate of 2-D plane.
unsigned int _ix
Index representing "first" coordinate of 2-D plane.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
unsigned int _n_pins
Total number of pins.
unsigned int firstPinInRing(const unsigned int ring) const
Get the index of the "first" pin in a ring.
static const std::string center
Definition: NS.h:28
bool insideLattice(const Point &point) const
Whether the point is inside the lattice.

◆ computeChannelPinIndices()

void HexagonalLatticeUtils::computeChannelPinIndices ( )
private

Get the pin indices that form the corners of each channel type.

Definition at line 465 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

466 {
470 
471  // 3 pins per interior channel
472  for (auto & i : _interior_channel_pin_indices)
473  i.resize(3);
474 
475  // 2 pins per edge channel
476  for (auto & i : _edge_channel_pin_indices)
477  i.resize(2);
478 
479  // 1 pin per corner channel
480  for (auto & i : _corner_channel_pin_indices)
481  i.resize(1);
482 
483  // for each ring of pins, and for each sector, get the "first" pin index in that ring
484  std::vector<std::vector<unsigned int>> starts;
485  starts.resize(_n_rings);
486  for (const auto i : make_range(_n_rings))
487  {
488  starts[i].resize(NUM_SIDES);
489  starts[i][0] = (i == 0) ? 0 : totalPins(i);
490 
491  for (unsigned int j = 1; j < NUM_SIDES; ++j)
492  starts[i][j] = starts[i][j - 1] + i;
493  }
494 
495  unsigned int c = 0;
496  for (const auto i : make_range(_n_rings - 1))
497  {
498  auto channels = interiorChannels(i + 1);
499  unsigned int channels_per_sector = channels / NUM_SIDES;
500 
501  for (const auto j : make_range(NUM_SIDES))
502  {
503  auto prev_inner = starts[i][j];
504  auto prev_outer = starts[i + 1][j];
505 
506  for (const auto k : make_range(channels_per_sector))
507  {
508  bool downward = k % 2 == 0;
509 
510  if (downward)
511  {
512  _interior_channel_pin_indices[c][0] = prev_inner;
513  _interior_channel_pin_indices[c][1] = prev_outer;
514  _interior_channel_pin_indices[c][2] = ++prev_outer;
515  }
516  else
517  {
518  _interior_channel_pin_indices[c][0] = prev_outer;
519  _interior_channel_pin_indices[c][1] = ++prev_inner;
520  _interior_channel_pin_indices[c][2] = prev_inner - 1;
521  }
522 
523  if (j == 5) // last sector
524  {
525  if (k == channels_per_sector - 1)
526  {
527  _interior_channel_pin_indices[c][2] = starts[i + 1][0];
528  _interior_channel_pin_indices[c][0] = starts[i][0];
529  }
530 
531  if (k == channels_per_sector - 2 && i > 0)
532  _interior_channel_pin_indices[c][1] = starts[i][0];
533  }
534 
535  c++;
536  }
537  }
538  }
539 
540  for (const auto i : make_range(_n_edge_channels))
541  {
542  _edge_channel_pin_indices[i][0] = starts[_n_rings - 1][0] + i;
544 
545  if (i == _n_edge_channels - 1)
547  }
548 
549  for (const auto i : make_range(_n_corner_channels))
552 }
const unsigned int _n_rings
Total number of rings of pins.
unsigned int totalPins(const unsigned int n) const
Get the total number of pins for all rings.
unsigned int _n_interior_channels
Total number of interior channels.
std::vector< std::vector< unsigned int > > _edge_channel_pin_indices
Pin indices forming two of the corners of each edge channel.
unsigned int interiorChannels(const unsigned int ring)
Get the number of interior channels between ring and ring - 1 (0 indexing)
std::vector< std::vector< unsigned int > > _corner_channel_pin_indices
Pin indices forming one of the corners of each corner channel.
std::vector< std::vector< unsigned int > > _interior_channel_pin_indices
Pin indices forming the corner of each interior channel.
IntRange< T > make_range(T beg, T end)
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
unsigned int _n_corner_channels
Total number of corner channels.
static const std::string k
Definition: NS.h:130
unsigned int _n_edge_channels
Total number of edge channels.
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ computeFlowVolumes()

void HexagonalLatticeUtils::computeFlowVolumes ( )
private

Compute the flow volumes for each channel type.

Definition at line 386 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

387 {
388  // It is assumed that in the interior and edge channels, that a wire is present half
389  // of the time (because those channels contain half a pin), while in the corner channels
390  // that a wire is present one sixth of the time (because those channels contain one sixth
391  // of a pin).
392  Real rod_volume_per_pitch = _pin_volume_per_pitch + _wire_volume_per_pitch;
393 
395 
399 
400  _interior_flow_volume = _interior_volume - 0.5 * rod_volume_per_pitch;
401  _edge_flow_volume = _edge_volume - 0.5 * rod_volume_per_pitch;
402  _corner_flow_volume = _corner_volume - rod_volume_per_pitch / 6.0;
403 
404  _flow_volume = hexagonVolume(_bundle_pitch) - _n_pins * rod_volume_per_pitch;
405 }
Real _corner_flow_volume
Flow volume of a corner channel per wire pitch.
Real _wire_volume_per_pitch
Single-wire volume per wire pitch.
Real _flow_volume
Bundle-wide flow volume per wire pitch.
Real _corner_volume
Total volume of a corner channel per wire pitch.
const Real _wire_pitch
Wire pitch.
Real triangleVolume(const Real side) const
Get the volume of an equilateral triangle prism per wire pitch.
Real _corner_edge_length
Half the distance for which a corner channel is in contact with the duct.
const Real _bundle_pitch
Bundle pitch (distance across bundle measured flat-to-flat on the inside of the duct) ...
const Real _pin_pitch
Pin pitch.
Real _interior_volume
Total volume of an interior channel per wire pitch.
Real _interior_flow_volume
Flow volume of an interior channel per wire pitch.
Real _pin_bundle_spacing
Spacing between the duct inner wall and the pin surface.
const Real _pin_volume_per_pitch
Single-pin volume per wire pitch.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real pinRadius() const
Get the pin outer radius.
unsigned int _n_pins
Total number of pins.
Real _edge_flow_volume
Flow volume of an edge channel per wire pitch.
Real hexagonVolume(const Real side) const
Get the volume of a hexagonal prism per wire pitch.
Real _edge_volume
Total volume of an edge channel per wire pitch.

◆ computeGapIndices()

void HexagonalLatticeUtils::computeGapIndices ( )
private

Determine the global gap indices, sorted first by lower pin ID and next by higher pin ID.

Definition at line 785 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

786 {
787  std::set<std::pair<int, int>> indices;
788  for (const auto & pins : _interior_channel_pin_indices)
789  {
790  std::pair<int, int> gap0 = {std::min(pins[0], pins[1]), std::max(pins[0], pins[1])};
791  std::pair<int, int> gap1 = {std::min(pins[0], pins[2]), std::max(pins[0], pins[2])};
792  std::pair<int, int> gap2 = {std::min(pins[2], pins[1]), std::max(pins[2], pins[1])};
793 
794  indices.insert(gap0);
795  indices.insert(gap1);
796  indices.insert(gap2);
797  }
798 
799  for (const auto & it : indices)
800  _gap_indices.push_back({it.first, it.second});
801 
803 
804  // add the gaps along the peripheral channels; -1 indicates side 1, -2 indicates side 2,
805  // and so on
806  int n_edge_gaps = _n_rings;
807  int pin = totalPins(_n_rings - 1);
808  for (const auto i : make_range(NUM_SIDES))
809  {
810  for (const auto j : make_range(_n_rings))
811  _gap_indices.push_back({pin + j, -(i + 1)});
812 
813  pin += n_edge_gaps - 1;
814  }
815 
816  // fix the last gap to use the first pin
817  _gap_indices.back() = {totalPins(_n_rings - 1), -int(NUM_SIDES)};
818  _n_gaps = _gap_indices.size();
819 
820  // for each channel, determine which gaps are on that channel to find the local-to-global
821  // indexing
822  for (const auto & pins : _interior_channel_pin_indices)
823  {
824  std::pair<int, int> gap0 = {std::min(pins[0], pins[1]), std::max(pins[0], pins[1])};
825  std::pair<int, int> gap1 = {std::min(pins[1], pins[2]), std::max(pins[1], pins[2])};
826  std::pair<int, int> gap2 = {std::min(pins[2], pins[0]), std::max(pins[2], pins[0])};
827 
828  int loc_gap0 = globalGapIndex(gap0);
829  int loc_gap1 = globalGapIndex(gap1);
830  int loc_gap2 = globalGapIndex(gap2);
831  _local_to_global_gaps.push_back({loc_gap0, loc_gap1, loc_gap2});
832  }
833 
834  int gap = _gap_indices.size() - _n_rings * NUM_SIDES;
835  for (const auto i : make_range(_n_edge_channels))
836  {
837  const auto & pins = _edge_channel_pin_indices[i];
838  std::pair<int, int> gap0 = {std::min(pins[0], pins[1]), std::max(pins[0], pins[1])};
839  int loc_gap0 = globalGapIndex(gap0);
840  _local_to_global_gaps.push_back({loc_gap0, gap + 1, gap});
841 
842  if ((i + 1) % (_n_rings - 1) == 0)
843  gap += 2;
844  else
845  gap += 1;
846  }
847 
848  int n_interior_gaps = _gap_indices.size() - _n_rings * NUM_SIDES - 1;
849  n_edge_gaps = _n_rings * NUM_SIDES;
850  _local_to_global_gaps.push_back({n_interior_gaps + n_edge_gaps, n_interior_gaps + 1});
851  gap = n_interior_gaps + _n_rings;
852  for (unsigned int i = 1; i < _n_corner_channels; ++i)
853  {
854  _local_to_global_gaps.push_back({gap, gap + 1});
855  gap += _n_rings;
856  }
857 
858  _gap_points.resize(_n_gaps);
859 
860  // For each gap, get two points on the gap
861  for (const auto i : make_range(_n_interior_gaps))
862  {
863  const auto & pins = _gap_indices[i];
864  Point pt1(_pin_centers[pins.first]);
865  Point pt2(_pin_centers[pins.second]);
866  _gap_centers.push_back(0.5 * (pt2 + pt1));
867 
868  _gap_points[i] = {pt1, pt2};
869 
870  // for the last gap in the ring, we need to swap the ordering of pins
871  if (lastGapInRing(i))
872  {
873  Point tmp = pt1;
874  pt1 = pt2;
875  pt2 = tmp;
876  }
877 
879  }
880 
882  for (unsigned int i = _n_interior_gaps; i < _n_gaps; ++i)
883  {
884  const auto & pins = _gap_indices[i];
885  int side = std::abs(pins.second) - 1;
886 
887  const auto & pt1 = _pin_centers[pins.first];
888  const Point pt2 =
889  pt1 + Point(d * _unit_translation_x[side], d * _unit_translation_y[side], 0.0);
890  _gap_centers.push_back(0.5 * (pt2 + pt1));
891 
892  _gap_points[i] = {pt1, pt2};
893 
895  }
896 }
std::vector< Point > _gap_unit_normals
Unit normal vectors for each gap.
unsigned int _n_interior_gaps
Number of gaps that touch an interior channel.
const unsigned int _n_rings
Total number of rings of pins.
unsigned int totalPins(const unsigned int n) const
Get the total number of pins for all rings.
libMesh::Point projectedUnitNormal(libMesh::Point pt1, libMesh::Point pt2, const unsigned int axis)
std::vector< Point > _gap_centers
Center points of all the gaps.
std::vector< std::vector< unsigned int > > _edge_channel_pin_indices
Pin indices forming two of the corners of each edge channel.
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.
std::vector< Point > _pin_centers
Pin center coordinates.
unsigned int globalGapIndex(const std::pair< int, int > &local_gap) const
Get the global gap index from the local gap index.
unsigned int pins(const unsigned int n) const
Get the number of pins in a given ring.
Real _pin_bundle_spacing
Spacing between the duct inner wall and the pin surface.
std::vector< std::pair< int, int > > _gap_indices
Gap indices, connecting two pins or one pin and a side, ordered by global gap ID. ...
std::vector< std::vector< unsigned int > > _interior_channel_pin_indices
Pin indices forming the corner of each interior channel.
std::vector< std::vector< int > > _local_to_global_gaps
Local-to-global gap indexing, ordered by channel ID.
bool lastGapInRing(const unsigned int gap_index) const
Whether this gap is the "last" in the ring, i.e.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real pinRadius() const
Get the pin outer radius.
unsigned int _n_gaps
Total number of gaps.
std::vector< std::vector< Point > > _gap_points
Two points on each gap, in order to compute distance-from-gap calculations.
IntRange< T > make_range(T beg, T end)
std::vector< Real > _unit_translation_y
(unitless) y-translations to apply to move from a center point to a side of a hexagon ...
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
unsigned int _n_corner_channels
Total number of corner channels.
unsigned int _n_edge_channels
Total number of edge channels.
void ErrorVector unsigned int
std::vector< Real > _unit_translation_x
(unitless) x-translations to apply to move from a center point to a side of a hexagon ...
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ computeHydraulicDiameters()

void HexagonalLatticeUtils::computeHydraulicDiameters ( )
private

Compute the hydraulic diameters for each channel type.

Definition at line 374 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

375 {
376  // Because the hydraulic diameter should be different for a bundle with an
377  // infinite wire pitch vs. a finite wire pitch (because finite = more wire spooled in),
378  // we compute hydraulic diameters based on volumes and areas.
382  _Dh = 4 * _flow_volume / _wetted_area;
383 }
Real _corner_flow_volume
Flow volume of a corner channel per wire pitch.
Real _flow_volume
Bundle-wide flow volume per wire pitch.
Real _interior_wetted_area
Wetted area of an interior channel per wire pitch.
Real _corner_Dh
Hydraulic diameter of corner channel.
Real _interior_Dh
Hydraulic diameter of interior channel.
Real _interior_flow_volume
Flow volume of an interior channel per wire pitch.
Real _wetted_area
Wetted area of entire bundle per wire pitch.
Real _edge_Dh
Hydraulic diameter of edge channel.
Real _edge_wetted_area
Wetted area of an edge channel per wire pitch.
Real _Dh
Bundle-wide hydraulic diameter.
Real _corner_wetted_area
Wetted area of a corner channel per wire pitch.
Real _edge_flow_volume
Flow volume of an edge channel per wire pitch.

◆ computePinAndChannelTypes()

void HexagonalLatticeUtils::computePinAndChannelTypes ( )
private

Compute the number of pins and channels and their types for the lattice.

Definition at line 414 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

415 {
416  _n_pins = 0;
417  for (unsigned int i = _n_rings; i > 0; --i)
418  _n_pins += pins(i);
419 
420  // the one-ring case
422  _n_edge_pins = 0;
423  _n_corner_pins = 0;
424 
426  _n_edge_channels = 0;
428 
429  if (_n_rings > 1)
430  {
432  _n_edge_pins = (_n_rings - 2) * NUM_SIDES;
434 
436 
437  for (unsigned int i = 1; i < _n_rings; ++i)
439  }
440 
442 }
unsigned int _n_interior_pins
Number of interior pins.
const unsigned int _n_rings
Total number of rings of pins.
unsigned int _n_interior_channels
Total number of interior channels.
unsigned int interiorChannels(const unsigned int ring)
Get the number of interior channels between ring and ring - 1 (0 indexing)
unsigned int pins(const unsigned int n) const
Get the number of pins in a given ring.
unsigned int _n_corner_pins
Number of corner pins.
unsigned int _n_edge_pins
Number of edge pins.
unsigned int _n_channels
Total number of channels.
unsigned int _n_corner_channels
Total number of corner channels.
unsigned int _n_pins
Total number of pins.
unsigned int _n_edge_channels
Total number of edge channels.
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ computePinAndDuctCoordinates()

void HexagonalLatticeUtils::computePinAndDuctCoordinates ( )
private

Compute the pin center coordinates and the duct corner coordinates.

Compute the x, y, z coordinates of the pincells based on a bundle centered on (0, 0, 0) and with pins aligned in the z direction. Also compute the corner coordinates of the ducts

Definition at line 271 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

272 {
273  Real corner_shiftx[] = {COS60, -COS60, -1, -COS60, COS60, 1};
274  Real corner_shifty[] = {SIN60, SIN60, 0, -SIN60, -SIN60, 0};
275 
276  Real edge_shiftx[] = {-1, -COS60, COS60, 1, COS60, -COS60};
277  Real edge_shifty[] = {0, -SIN60, -SIN60, 0, SIN60, SIN60};
278 
279  // Use rotation matrix on shift vectors
280  if (_rotation_around_axis != 0)
281  for (const auto i : make_range(6))
282  {
283  Point rotated = _rotation_matrix * Point(corner_shiftx[i], corner_shifty[i], 0);
284  corner_shiftx[i] = rotated(0);
285  corner_shifty[i] = rotated(1);
286  rotated = _rotation_matrix * Point(edge_shiftx[i], edge_shifty[i], 0);
287  edge_shiftx[i] = rotated(0);
288  edge_shifty[i] = rotated(1);
289  }
290 
291  // compute coordinates of the pin centers relative to the bundle's center
292  Point center(0, 0, 0);
293  _pin_centers.push_back(center);
294 
295  for (unsigned int i = 2; i <= _n_rings; ++i)
296  {
297  auto n_total_in_ring = pins(i);
298  auto increment = i - 1;
299 
300  unsigned int d = 0;
301 
302  for (const auto j : make_range(n_total_in_ring))
303  {
304  unsigned int side = j / increment;
305 
306  if (d == increment)
307  d = 0;
308 
309  Point center = geom_utils::projectPoint(corner_shiftx[side] * _pin_pitch * (i - 1),
310  corner_shifty[side] * _pin_pitch * (i - 1),
311  _axis);
312 
313  // additional shift for the edge sides
314  if (d != 0)
315  {
316  center(_ix) += edge_shiftx[side] * _pin_pitch * d;
317  center(_iy) += edge_shifty[side] * _pin_pitch * d;
318  }
319 
320  _pin_centers.push_back(center);
321 
322  d += 1;
323  }
324  }
325 
326  // compute corners of the hexagonal prisms that enclose each pin
328  auto side = hexagonSide(_pin_pitch);
329  for (const auto pin : make_range(_n_pins))
330  {
331  for (const auto i : make_range(NUM_SIDES))
332  {
333  Point translation = geom_utils::projectPoint(
334  _unit_translation_x[i] * side, _unit_translation_y[i] * side, _axis);
335 
336  _pin_centered_corner_coordinates[pin].push_back(translation + _pin_centers[pin]);
337  }
338  }
339 
340  // compute coordinates of duct corners relative to the bundle's center
342  for (const auto i : make_range(NUM_SIDES))
343  {
344  Point corner = geom_utils::projectPoint(corner_shiftx[i] * l, corner_shifty[i] * l, _axis);
345  _duct_corners.push_back(corner);
346  }
347 
348  // compute the equations (a*x + b*y + c) defining each duct wall
349  for (const auto i : make_range(NUM_SIDES))
350  {
351  auto c = i;
352  unsigned int n = i == 5 ? 0 : i + 1;
353  Real slope = (_duct_corners[n](_iy) - _duct_corners[c](_iy)) /
354  (_duct_corners[n](_ix) - _duct_corners[c](_ix));
355  std::vector<Real> coeffs = {-slope, 1.0, slope * _duct_corners[c](_ix) - _duct_corners[c](_iy)};
356  _duct_coeffs.push_back(coeffs);
357  }
358 }
const RealTensorValue _rotation_matrix
Rotation matrix to apply the rotation why.
const unsigned int _n_rings
Total number of rings of pins.
constexpr auto increment(std::index_sequence< first, tail... >)
std::vector< std::vector< Point > > _pin_centered_corner_coordinates
Corner coordinates of a hexagon surrounding each pin.
libMesh::Point projectPoint(const libMesh::Real x0, const libMesh::Real x1, const unsigned int axis)
Real hexagonSide(const Real pitch) const
Get the side length of a hexagon with given flat-to-flat distance (pitch)
const Real _rotation_around_axis
Rotation around the axis to apply to the lattice.
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.
std::vector< Point > _pin_centers
Pin center coordinates.
const Real _pin_pitch
Pin pitch.
unsigned int _iy
Index representing "second" coordinate of 2-D plane.
unsigned int _ix
Index representing "first" coordinate of 2-D plane.
unsigned int pins(const unsigned int n) const
Get the number of pins in a given ring.
const Real _bundle_side_length
Side length of duct.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
std::vector< Real > _unit_translation_y
(unitless) y-translations to apply to move from a center point to a side of a hexagon ...
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
unsigned int _n_pins
Total number of pins.
std::vector< std::vector< Real > > _duct_coeffs
Coefficients in the line equations defining each duct wall.
std::vector< Point > _duct_corners
Six corner coordinates for the ducts.
std::vector< Real > _unit_translation_x
(unitless) x-translations to apply to move from a center point to a side of a hexagon ...
static const std::string center
Definition: NS.h:28
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ computePinBundleSpacing()

void HexagonalLatticeUtils::computePinBundleSpacing ( )
private

Compute the spacing between the outer pins and the duct inner walls.

Definition at line 445 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

446 {
447  // hexagonal flat-to-flat that *just* encloses the pins (NOT including the wire)
448  Real pin_h = 2.0 * (_n_rings - 1) * triangleHeight(_pin_pitch) + _pin_diameter;
449 
450  _pin_bundle_spacing = (_bundle_pitch - pin_h) / 2.0;
451 }
const unsigned int _n_rings
Total number of rings of pins.
const Real _pin_diameter
Pin diameter.
const Real _bundle_pitch
Bundle pitch (distance across bundle measured flat-to-flat on the inside of the duct) ...
const Real _pin_pitch
Pin pitch.
Real _pin_bundle_spacing
Spacing between the duct inner wall and the pin surface.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real triangleHeight(const Real side) const
Get the height of an equilateral triangle with given side length.

◆ computeWettedAreas()

void HexagonalLatticeUtils::computeWettedAreas ( )
private

Compute the wetted areas for each channel type.

Definition at line 361 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

362 {
364 
365  _interior_wetted_area = 0.5 * rod_area_per_pitch;
366  _edge_wetted_area = 0.5 * rod_area_per_pitch + _pin_pitch * _wire_pitch;
367 
369  _corner_wetted_area = rod_area_per_pitch / 6.0 + 2 * h * _wire_pitch;
370  _wetted_area = _n_pins * rod_area_per_pitch + 6.0 * _bundle_side_length * _wire_pitch;
371 }
const Real _wire_pitch
Wire pitch.
Real _interior_wetted_area
Wetted area of an interior channel per wire pitch.
const Real _pin_pitch
Pin pitch.
Real _wetted_area
Wetted area of entire bundle per wire pitch.
const Real _bundle_side_length
Side length of duct.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real _edge_wetted_area
Wetted area of an edge channel per wire pitch.
const Real _pin_surface_area_per_pitch
Pin surface area per wire pitch.
Real _corner_wetted_area
Wetted area of a corner channel per wire pitch.
unsigned int _n_pins
Total number of pins.
unsigned int _n_edge_channels
Total number of edge channels.
static const unsigned int NUM_SIDES
Number of sides in a hexagon.
Real _wire_surface_area_per_pitch
Wire surface area per wire pitch.

◆ computeWireVolumeAndAreaPerPitch()

void HexagonalLatticeUtils::computeWireVolumeAndAreaPerPitch ( )
private

Compute the volume and surface area const occupied by the wire in one with pitch.

Definition at line 454 of file HexagonalLatticeUtils.C.

Referenced by HexagonalLatticeUtils().

455 {
456  unsigned int n_wire_coils = 1;
457  Real wire_length_per_coil =
458  std::sqrt(_wire_pitch * _wire_pitch + std::pow(M_PI * (_pin_diameter + _wire_diameter), 2.0));
459  Real wire_length = wire_length_per_coil * n_wire_coils;
460  _wire_volume_per_pitch = _wire_area * wire_length;
462 }
const Real _wire_diameter
Wire diameter.
Real _wire_volume_per_pitch
Single-wire volume per wire pitch.
const Real _wire_area
Wire cross-sectional area.
const Real _pin_diameter
Pin diameter.
const Real _wire_pitch
Wire pitch.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
MooseUnits pow(const MooseUnits &, int)
const Real _wire_circumference
Wire circumference.
Real _wire_surface_area_per_pitch
Wire surface area per wire pitch.

◆ cornerChannelCornerCoordinates()

const std::vector< Point > HexagonalLatticeUtils::cornerChannelCornerCoordinates ( const unsigned int  corner_channel_id) const

Get the corner coordinates of a corner channel given an ID (relative to the start of the corner channels)

Parameters
[in]corner_channel_idID of corner channel
Returns
corner coordinates of channel

Definition at line 591 of file HexagonalLatticeUtils.C.

Referenced by channelIndex().

592 {
593  std::vector<Point> corners;
594 
595  auto pin_indices = _corner_channel_pin_indices[corner_channel_id];
596  const Point & pin = _pin_centers[pin_indices[0]];
597  corners.push_back(pin);
598 
600 
601  unsigned int side1 = corner_channel_id == 0 ? NUM_SIDES - 1 : corner_channel_id - 1;
602  unsigned int side2 = corner_channel_id;
603 
604  corners.push_back(pin +
605  Point(d * _unit_translation_x[side1], d * _unit_translation_y[side1], 0.0));
606  corners.push_back(_duct_corners[corner_channel_id]);
607  corners.push_back(pin +
608  Point(d * _unit_translation_x[side2], d * _unit_translation_y[side2], 0.0));
609 
610  return corners;
611 }
Real pinBundleSpacing() const
Get the distance between the outermost pins and the duct walls.
std::vector< Point > _pin_centers
Pin center coordinates.
std::vector< std::vector< unsigned int > > _corner_channel_pin_indices
Pin indices forming one of the corners of each corner channel.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real pinRadius() const
Get the pin outer radius.
std::vector< Real > _unit_translation_y
(unitless) y-translations to apply to move from a center point to a side of a hexagon ...
std::vector< Point > _duct_corners
Six corner coordinates for the ducts.
std::vector< Real > _unit_translation_x
(unitless) x-translations to apply to move from a center point to a side of a hexagon ...
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ cornerChannelPinIndices()

const std::vector<std::vector<unsigned int> >& HexagonalLatticeUtils::cornerChannelPinIndices ( ) const
inline

Get the pin indices forming one of the corners of all corner channels.

Returns
pin indices forming one of the corners of all corner channels

Definition at line 517 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

518  {
520  }
std::vector< std::vector< unsigned int > > _corner_channel_pin_indices
Pin indices forming one of the corners of each corner channel.

◆ cornerEdgeLength()

Real HexagonalLatticeUtils::cornerEdgeLength ( ) const
inline

Get half the distance of the duct that a corner channel is in contact with.

Returns
half the duct length that a corner channel is in contact with

Definition at line 396 of file HexagonalLatticeUtils.h.

396 { return _corner_edge_length; }
Real _corner_edge_length
Half the distance for which a corner channel is in contact with the duct.

◆ cornerFlowVolume()

Real HexagonalLatticeUtils::cornerFlowVolume ( ) const
inline

Get the flow volume of an corner channel per wire pitch.

Returns
flow volume of corner channel

Definition at line 315 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

315 { return _corner_flow_volume; }
Real _corner_flow_volume
Flow volume of a corner channel per wire pitch.

◆ cornerHydraulicDiameter()

Real HexagonalLatticeUtils::cornerHydraulicDiameter ( ) const
inline

Get the hydraulic diameter of a corner channel.

Returns
hydraulic diameter of a corner channel

Definition at line 267 of file HexagonalLatticeUtils.h.

267 { return _corner_Dh; }
Real _corner_Dh
Hydraulic diameter of corner channel.

◆ cornerVolume()

Real HexagonalLatticeUtils::cornerVolume ( ) const
inline

Get the total volume of an corner channel per wire pitch.

Returns
total volume of corner channel

Definition at line 333 of file HexagonalLatticeUtils.h.

333 { return _corner_volume; }
Real _corner_volume
Total volume of a corner channel per wire pitch.

◆ cornerWettedArea()

Real HexagonalLatticeUtils::cornerWettedArea ( ) const
inline

Get the wetted area of a corner channel per wire pitch.

Returns
wetted area of corner channel

Definition at line 291 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

291 { return _corner_wetted_area; }
Real _corner_wetted_area
Wetted area of a corner channel per wire pitch.

◆ distanceFromGap()

Real HexagonalLatticeUtils::distanceFromGap ( const Point &  pt,
const unsigned int  gap_index 
) const

Distance from a point and a gap.

Parameters
[in]ptpoint, must already be translated to lattice frame
[in]gap_indexgap index @ return distance from gap

Definition at line 912 of file HexagonalLatticeUtils.C.

Referenced by gapIndex(), and gapIndexAndDistance().

913 {
914  auto p = _gap_points[gap_index];
915  return geom_utils::projectedDistanceFromLine(pt, p[0], p[1], _axis);
916 }
libMesh::Real projectedDistanceFromLine(libMesh::Point pt, libMesh::Point line0, libMesh::Point line1, const unsigned int axis)
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.
std::vector< std::vector< Point > > _gap_points
Two points on each gap, in order to compute distance-from-gap calculations.

◆ edgeChannelCornerCoordinates()

const std::vector< Point > HexagonalLatticeUtils::edgeChannelCornerCoordinates ( const unsigned int  edge_channel_id) const

Get the corner coordinates of an edge channel given an ID (relative to the start of the edge channels)

Parameters
[in]edge_channel_idID of edge channel
Returns
corner coordinates of channel

Definition at line 567 of file HexagonalLatticeUtils.C.

Referenced by channelIndex().

568 {
569  std::vector<Point> corners;
570 
571  auto pin_indices = _edge_channel_pin_indices[edge_channel_id];
572 
573  const Point & pin1 = _pin_centers[pin_indices[0]];
574  const Point & pin2 = _pin_centers[pin_indices[1]];
575 
577 
578  corners.push_back(pin1);
579  corners.push_back(pin2);
580 
581  unsigned int sector = edge_channel_id / (_n_rings - 1);
582  corners.push_back(pin2 +
583  Point(d * _unit_translation_x[sector], d * _unit_translation_y[sector], 0.0));
584  corners.push_back(pin1 +
585  Point(d * _unit_translation_x[sector], d * _unit_translation_y[sector], 0.0));
586 
587  return corners;
588 }
const unsigned int _n_rings
Total number of rings of pins.
Real pinBundleSpacing() const
Get the distance between the outermost pins and the duct walls.
std::vector< std::vector< unsigned int > > _edge_channel_pin_indices
Pin indices forming two of the corners of each edge channel.
std::vector< Point > _pin_centers
Pin center coordinates.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real pinRadius() const
Get the pin outer radius.
std::vector< Real > _unit_translation_y
(unitless) y-translations to apply to move from a center point to a side of a hexagon ...
std::vector< Real > _unit_translation_x
(unitless) x-translations to apply to move from a center point to a side of a hexagon ...

◆ edgeChannelPinIndices()

const std::vector<std::vector<unsigned int> >& HexagonalLatticeUtils::edgeChannelPinIndices ( ) const
inline

Get the pin indices forming two of the corners of all edge channels.

Returns
pin indices forming two of the corners of all edge channels

Definition at line 508 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

509  {
511  }
std::vector< std::vector< unsigned int > > _edge_channel_pin_indices
Pin indices forming two of the corners of each edge channel.

◆ edgeFlowVolume()

Real HexagonalLatticeUtils::edgeFlowVolume ( ) const
inline

Get the flow volume of an edge channel per wire pitch.

Returns
flow volume of edge channel

Definition at line 309 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

309 { return _edge_flow_volume; }
Real _edge_flow_volume
Flow volume of an edge channel per wire pitch.

◆ edgeHydraulicDiameter()

Real HexagonalLatticeUtils::edgeHydraulicDiameter ( ) const
inline

Get the hydraulic diameter of an edge channel.

Returns
hydraulic diameter of an edge channel

Definition at line 261 of file HexagonalLatticeUtils.h.

261 { return _edge_Dh; }
Real _edge_Dh
Hydraulic diameter of edge channel.

◆ edgeVolume()

Real HexagonalLatticeUtils::edgeVolume ( ) const
inline

Get the total volume of an edge channel per wire pitch.

Returns
total volume of edge channel

Definition at line 327 of file HexagonalLatticeUtils.h.

327 { return _edge_volume; }
Real _edge_volume
Total volume of an edge channel per wire pitch.

◆ edgeWettedArea()

Real HexagonalLatticeUtils::edgeWettedArea ( ) const
inline

Get the wetted area of an edge channel per wire pitch.

Returns
wetted area of edge channel

Definition at line 285 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

285 { return _edge_wetted_area; }
Real _edge_wetted_area
Wetted area of an edge channel per wire pitch.

◆ firstPinInRing()

unsigned int HexagonalLatticeUtils::firstPinInRing ( const unsigned int  ring) const

Get the index of the "first" pin in a ring.

Parameters
[in]ringring index
Returns
first pin

Definition at line 962 of file HexagonalLatticeUtils.C.

Referenced by closestPinIndex(), get2DInputPatternIndex(), lastGapInRing(), and TEST_F().

963 {
964  mooseAssert(ring > 0, "Ring indexing starts at 1");
965  if (ring == 1)
966  return 0;
967  else
968  return totalPins(ring - 1);
969 }
unsigned int totalPins(const unsigned int n) const
Get the total number of pins for all rings.

◆ flowVolume()

Real HexagonalLatticeUtils::flowVolume ( ) const
inline

Get the flow volume of the bundle per wire pitch.

Returns
flow volume of bundle

Definition at line 339 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

339 { return _flow_volume; }
Real _flow_volume
Bundle-wide flow volume per wire pitch.

◆ gapCenters()

const std::vector<Point>& HexagonalLatticeUtils::gapCenters ( ) const
inline

Get the center coordinates of the gaps.

Returns
gap center coordinates

Definition at line 159 of file HexagonalLatticeUtils.h.

159 { return _gap_centers; }
std::vector< Point > _gap_centers
Center points of all the gaps.

◆ gapIndex()

unsigned int HexagonalLatticeUtils::gapIndex ( const Point &  point) const

Get the index for the gap closest to the point.

Parameters
[in]pointpoint, must already be translated to lattice frame
Returns
index of closest gap

Definition at line 919 of file HexagonalLatticeUtils.C.

Referenced by TEST_F().

920 {
921  const auto & channel_index = channelIndex(point);
922  const auto & gap_indices = _local_to_global_gaps[channel_index];
923 
924  Real distance = std::numeric_limits<Real>::max();
925  unsigned int index = 0;
926  for (const auto i : index_range(gap_indices))
927  {
928  Real distance_from_gap = distanceFromGap(point, gap_indices[i]);
929 
930  if (distance_from_gap < distance)
931  {
932  distance = distance_from_gap;
933  index = gap_indices[i];
934  }
935  }
936 
937  return index;
938 }
Real distanceFromGap(const Point &pt, const unsigned int gap_index) const
Distance from a point and a gap.
unsigned int channelIndex(const Point &point) const
Get the channel index given a point.
Real distance(const Point &p)
std::vector< std::vector< int > > _local_to_global_gaps
Local-to-global gap indexing, ordered by channel ID.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
auto index_range(const T &sizable)

◆ gapIndexAndDistance()

void HexagonalLatticeUtils::gapIndexAndDistance ( const Point &  point,
unsigned int index,
Real distance 
) const

Get the gap index and distance to that gap for a given point.

Parameters
[in]pointpoint, must already be translated to lattice frame
[out]indexindex of closest gap
[out]distancedistance to closest gap

Definition at line 941 of file HexagonalLatticeUtils.C.

944 {
945  const auto & channel_index = channelIndex(point);
946  const auto & gap_indices = _local_to_global_gaps[channel_index];
947 
948  distance = std::numeric_limits<Real>::max();
949  for (const auto i : index_range(gap_indices))
950  {
951  Real distance_from_gap = distanceFromGap(point, gap_indices[i]);
952 
953  if (distance_from_gap < distance)
954  {
955  distance = distance_from_gap;
956  index = gap_indices[i];
957  }
958  }
959 }
Real distanceFromGap(const Point &pt, const unsigned int gap_index) const
Distance from a point and a gap.
unsigned int channelIndex(const Point &point) const
Get the channel index given a point.
Real distance(const Point &p)
std::vector< std::vector< int > > _local_to_global_gaps
Local-to-global gap indexing, ordered by channel ID.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
auto index_range(const T &sizable)

◆ gapIndices()

const std::vector<std::pair<int, int> >& HexagonalLatticeUtils::gapIndices ( ) const
inline

Get the pin and side indices on each gap.

Returns
pin and side indices on each gap

Definition at line 526 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

526 { return _gap_indices; }
std::vector< std::pair< int, int > > _gap_indices
Gap indices, connecting two pins or one pin and a side, ordered by global gap ID. ...

◆ gapUnitNormals()

const std::vector<Point>& HexagonalLatticeUtils::gapUnitNormals ( ) const
inline

Get the unit normals for all of the gaps.

Returns
gap unit normals

Definition at line 119 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

119 { return _gap_unit_normals; }
std::vector< Point > _gap_unit_normals
Unit normal vectors for each gap.

◆ get2DInputPatternIndex()

void HexagonalLatticeUtils::get2DInputPatternIndex ( const unsigned int  pin_index,
unsigned int row_index,
unsigned int within_row_index 
) const

Conversion from lattice pin indexing to the 2D input file index.

The indexing matches like this. Note that you have a 30 degree rotation between the 2D input and the positions output 2 1 3 0 6 4 5

Parameters
pin_indexindex of the pin in the utility ring-wise indexing
row_indexrow index (from the top) in the 2D input
within_row_indexindex within the row

Definition at line 745 of file HexagonalLatticeUtils.C.

748 {
749 
750  // First compute the ring on which the pin is
751  const auto ring_index = ringIndex(pin_index);
752  row_index = _n_rings - ring_index;
753  within_row_index = _n_rings - 1;
754 
755  const auto n_pin_sectors = pins(ring_index) / 6;
756  // Loop around the center until we reach the pin_index
757  // We start on the diagonal at the top
758 
759  for (const auto local_i : make_range(pin_index - firstPinInRing(ring_index)))
760  {
761  if (local_i < n_pin_sectors)
762  within_row_index--;
763  else if (local_i < 3 * n_pin_sectors)
764  row_index++;
765  else if (local_i < 4 * n_pin_sectors)
766  within_row_index++;
767  else if (local_i < 5 * n_pin_sectors)
768  {
769  row_index--;
770  within_row_index++;
771  }
772  else
773  {
774  row_index--;
775  within_row_index--;
776  }
777  }
778 
779  // Underflow (row_index is invalid_uint) will also fail this assert
780  mooseAssert(row_index < 2 * _n_rings - 1, "Inverse indexing failed");
781  mooseAssert(within_row_index < 2 * _n_rings - 1, "Inverse indexing failed");
782 }
const unsigned int _n_rings
Total number of rings of pins.
unsigned int pins(const unsigned int n) const
Get the number of pins in a given ring.
IntRange< T > make_range(T beg, T end)
unsigned int ringIndex(const unsigned int pin) const
Get the index of the ring for a certain pin index.
unsigned int firstPinInRing(const unsigned int ring) const
Get the index of the "first" pin in a ring.

◆ globalGapIndex()

unsigned int HexagonalLatticeUtils::globalGapIndex ( const std::pair< int, int > &  local_gap) const
protected

Get the global gap index from the local gap index.

Parameters
[in]local_gaplocal gap for a channel
Returns
global gap index

Definition at line 899 of file HexagonalLatticeUtils.C.

Referenced by computeGapIndices().

900 {
901  for (const auto i : index_range(_gap_indices))
902  {
903  const auto gap = _gap_indices[i];
904  if (gap.first == local_gap.first && gap.second == local_gap.second)
905  return i;
906  }
907 
908  mooseError("Failed to find local gap in global gap array!");
909 }
void mooseError(Args &&... args)
std::vector< std::pair< int, int > > _gap_indices
Gap indices, connecting two pins or one pin and a side, ordered by global gap ID. ...
auto index_range(const T &sizable)

◆ heightToDiameter()

Real HexagonalLatticeUtils::heightToDiameter ( ) const
inline

Get the (wire) axial pitch-to-diameter ratio.

Returns
wire axial pitch-to-diameter ratio

Definition at line 177 of file HexagonalLatticeUtils.h.

177 { return _L_over_D; }
const Real _L_over_D
Wire axial lead length to diameter ratio.

◆ hexagonArea()

Real HexagonalLatticeUtils::hexagonArea ( const Real  pitch) const

Get the area of a hexagon with given flat-to-flat distance (pitch)

Parameters
[in]pitchflat-to-flat distance
Returns
hexagon area

Definition at line 145 of file HexagonalLatticeUtils.C.

Referenced by hexagonVolume().

146 {
147  Real side = hexagonSide(pitch);
148  return 3 * SIN60 * side * side;
149 }
Real hexagonSide(const Real pitch) const
Get the side length of a hexagon with given flat-to-flat distance (pitch)
static const std::string pitch
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ hexagonPitch()

Real HexagonalLatticeUtils::hexagonPitch ( const Real  volume) const

Get the pitch of a hexagonal prism based on its per-wire-pitch volume.

Parameters
[in]volumevolume
Returns
pitch

Definition at line 158 of file HexagonalLatticeUtils.C.

159 {
160  Real area = volume / _wire_pitch;
161  return std::sqrt(area / SIN60);
162 }
const Real _wire_pitch
Wire pitch.
Real volume(const MeshBase &mesh, unsigned int dim=libMesh::invalid_uint)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

◆ hexagonSide()

Real HexagonalLatticeUtils::hexagonSide ( const Real  pitch) const

Get the side length of a hexagon with given flat-to-flat distance (pitch)

Parameters
[in]pitchhexagon flat-to-flat distance, or pitch
Returns
side length of hexagon, to give 1/6 of the hexagon's perimeter

Definition at line 139 of file HexagonalLatticeUtils.C.

Referenced by computePinAndDuctCoordinates(), hexagonArea(), insideLattice(), and pinIndex().

140 {
141  return pitch / std::sqrt(3.0);
142 }
static const std::string pitch

◆ hexagonVolume()

Real HexagonalLatticeUtils::hexagonVolume ( const Real  side) const

Get the volume of a hexagonal prism per wire pitch.

Parameters
[in]sideside length
Returns
hexagonal prism volume

Definition at line 152 of file HexagonalLatticeUtils.C.

Referenced by computeFlowVolumes().

153 {
154  return hexagonArea(pitch) * _wire_pitch;
155 }
Real hexagonArea(const Real pitch) const
Get the area of a hexagon with given flat-to-flat distance (pitch)
const Real _wire_pitch
Wire pitch.
static const std::string pitch

◆ hydraulicDiameter()

Real HexagonalLatticeUtils::hydraulicDiameter ( ) const
inline

Get the overall bundle hydraulic diameter.

Returns
hydraulic diameter

Definition at line 273 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

273 { return _Dh; }
Real _Dh
Bundle-wide hydraulic diameter.

◆ insideLattice()

bool HexagonalLatticeUtils::insideLattice ( const Point &  point) const

Whether the point is inside the lattice.

Parameters
pointpoint being examined, must already be translated to lattice frame

Definition at line 731 of file HexagonalLatticeUtils.C.

Referenced by closestPinIndex().

732 {
733  std::vector<Point> lattice_corners(6);
734  auto side = hexagonSide(_bundle_pitch);
735  for (const auto i : make_range(NUM_SIDES))
736  {
737  Point translation = geom_utils::projectPoint(
738  _unit_translation_x[i] * side, _unit_translation_y[i] * side, _axis);
739  lattice_corners[i] = translation;
740  }
741  return geom_utils::pointInPolygon(point, lattice_corners, _axis);
742 }
libMesh::Point projectPoint(const libMesh::Real x0, const libMesh::Real x1, const unsigned int axis)
Real hexagonSide(const Real pitch) const
Get the side length of a hexagon with given flat-to-flat distance (pitch)
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.
const Real _bundle_pitch
Bundle pitch (distance across bundle measured flat-to-flat on the inside of the duct) ...
bool pointInPolygon(const libMesh::Point &point, const std::vector< libMesh::Point > &corners, const unsigned int axis)
IntRange< T > make_range(T beg, T end)
std::vector< Real > _unit_translation_y
(unitless) y-translations to apply to move from a center point to a side of a hexagon ...
std::vector< Real > _unit_translation_x
(unitless) x-translations to apply to move from a center point to a side of a hexagon ...
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ interiorChannelCornerCoordinates()

const std::vector< Point > HexagonalLatticeUtils::interiorChannelCornerCoordinates ( const unsigned int  interior_channel_id) const

Get the corner coordinates of an interior channel given an ID (relative to the start of the interior channels)

Parameters
[in]interior_channel_idID of interior channel
Returns
corner coordinates of channel

Definition at line 555 of file HexagonalLatticeUtils.C.

Referenced by channelIndex().

557 {
558  std::vector<Point> corners;
559  auto pin_indices = _interior_channel_pin_indices[interior_channel_id];
560  for (const auto & pin : pin_indices)
561  corners.push_back(_pin_centers[pin]);
562 
563  return corners;
564 }
std::vector< Point > _pin_centers
Pin center coordinates.
std::vector< std::vector< unsigned int > > _interior_channel_pin_indices
Pin indices forming the corner of each interior channel.

◆ interiorChannelPinIndices()

const std::vector<std::vector<unsigned int> >& HexagonalLatticeUtils::interiorChannelPinIndices ( ) const
inline

Get the pin indices forming the corners of all interior channels.

Returns
pin indices forming the corners of all interior channels

Definition at line 499 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

500  {
502  }
std::vector< std::vector< unsigned int > > _interior_channel_pin_indices
Pin indices forming the corner of each interior channel.

◆ interiorChannels()

unsigned int HexagonalLatticeUtils::interiorChannels ( const unsigned int  ring)

Get the number of interior channels between ring and ring - 1 (0 indexing)

Parameters
[in]ringring number (relative to 0 indexing)
Returns
number of interior channels

Definition at line 408 of file HexagonalLatticeUtils.C.

Referenced by computeChannelPinIndices(), and computePinAndChannelTypes().

409 {
410  return (ring * 2 - 1) * NUM_SIDES;
411 }
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ interiorFlowVolume()

Real HexagonalLatticeUtils::interiorFlowVolume ( ) const
inline

Get the flow volume of an interior channel per wire pitch.

Returns
flow volume of interior channel

Definition at line 303 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

303 { return _interior_flow_volume; }
Real _interior_flow_volume
Flow volume of an interior channel per wire pitch.

◆ interiorHydraulicDiameter()

Real HexagonalLatticeUtils::interiorHydraulicDiameter ( ) const
inline

Get the hydraulic diameter of an interior channel.

Returns
hydraulic diameter of an interior channel

Definition at line 255 of file HexagonalLatticeUtils.h.

255 { return _interior_Dh; }
Real _interior_Dh
Hydraulic diameter of interior channel.

◆ interiorVolume()

Real HexagonalLatticeUtils::interiorVolume ( ) const
inline

Get the total volume of an interior channel per wire pitch.

Returns
total volume of interior channel

Definition at line 321 of file HexagonalLatticeUtils.h.

321 { return _interior_volume; }
Real _interior_volume
Total volume of an interior channel per wire pitch.

◆ interiorWettedArea()

Real HexagonalLatticeUtils::interiorWettedArea ( ) const
inline

Get the wetted area of an interior channel per wire pitch.

Returns
wetted area of interior channel

Definition at line 279 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

279 { return _interior_wetted_area; }
Real _interior_wetted_area
Wetted area of an interior channel per wire pitch.

◆ lastGapInRing()

bool HexagonalLatticeUtils::lastGapInRing ( const unsigned int  gap_index) const

Whether this gap is the "last" in the ring, i.e.

connecting the first and last pins of the ring

Parameters
[in]gap_indexgap index
Returns
whether this gap is the last in the ring

Definition at line 993 of file HexagonalLatticeUtils.C.

Referenced by computeGapIndices(), and TEST_F().

994 {
995  if (gap_index >= _n_interior_gaps)
996  return false;
997 
998  const auto & pins = _gap_indices[gap_index];
999 
1000  for (unsigned int i = 2; i <= _n_rings; ++i)
1001  {
1002  bool one_is_first_pin = false;
1003  bool one_is_last_pin = false;
1004 
1005  int first_pin = firstPinInRing(i);
1006  int last_pin = lastPinInRing(i);
1007 
1008  if (pins.first == first_pin || pins.second == first_pin)
1009  one_is_first_pin = true;
1010 
1011  if (pins.first == last_pin || pins.second == last_pin)
1012  one_is_last_pin = true;
1013 
1014  if (one_is_first_pin && one_is_last_pin)
1015  return true;
1016  }
1017 
1018  return false;
1019 }
unsigned int _n_interior_gaps
Number of gaps that touch an interior channel.
const unsigned int _n_rings
Total number of rings of pins.
unsigned int pins(const unsigned int n) const
Get the number of pins in a given ring.
std::vector< std::pair< int, int > > _gap_indices
Gap indices, connecting two pins or one pin and a side, ordered by global gap ID. ...
unsigned int firstPinInRing(const unsigned int ring) const
Get the index of the "first" pin in a ring.
unsigned int lastPinInRing(const unsigned int ring) const
Get the index of the "last" pin in a ring.

◆ lastPinInRing()

unsigned int HexagonalLatticeUtils::lastPinInRing ( const unsigned int  ring) const

Get the index of the "last" pin in a ring.

Parameters
[in]ringring index
Returns
last pin

Definition at line 972 of file HexagonalLatticeUtils.C.

Referenced by lastGapInRing(), ringIndex(), and TEST_F().

973 {
974  mooseAssert(ring > 0, "Ring indexing starts at 1");
975  if (ring == 1)
976  return 0;
977  else
978  return totalPins(ring) - 1;
979 }
unsigned int totalPins(const unsigned int n) const
Get the total number of pins for all rings.

◆ localToGlobalGaps()

const std::vector<std::vector<int> >& HexagonalLatticeUtils::localToGlobalGaps ( ) const
inline

For each subchannel, get the indices of the gaps that touch that subchannel.

Returns
indices of gaps touch each channel

Definition at line 532 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

532 { return _local_to_global_gaps; }
std::vector< std::vector< int > > _local_to_global_gaps
Local-to-global gap indexing, ordered by channel ID.

◆ minDuctCornerDistance()

Real HexagonalLatticeUtils::minDuctCornerDistance ( const Point &  p) const

Get the minimum distance from a point to the duct corners.

Parameters
[in]ppoint, must already be translated to lattice frame
Returns
distance to duct corner

Definition at line 265 of file HexagonalLatticeUtils.C.

Referenced by channelType().

266 {
268 }
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.
libMesh::Real minDistanceToPoints(const libMesh::Point &pt, const std::vector< libMesh::Point > &candidates, const unsigned int axis)
std::vector< Point > _duct_corners
Six corner coordinates for the ducts.

◆ minDuctWallDistance()

Real HexagonalLatticeUtils::minDuctWallDistance ( const Point &  p) const

Get the minimum distance from a point to the duct inner surface.

Parameters
[in]ppoint, must already be translated to lattice frame
Returns
distance to duct

Definition at line 248 of file HexagonalLatticeUtils.C.

Referenced by channelType().

249 {
250  Real distance = std::numeric_limits<Real>::max();
251  for (const auto i : make_range(NUM_SIDES))
252  {
253  Real a = _duct_coeffs[i][0];
254  Real b = _duct_coeffs[i][1];
255  Real c = _duct_coeffs[i][2];
256 
257  Real d = std::abs(a * p(_ix) + b * p(_iy) + c) / std::sqrt(a * a + b * b);
258  distance = std::min(d, distance);
259  }
260 
261  return distance;
262 }
Real distance(const Point &p)
unsigned int _iy
Index representing "second" coordinate of 2-D plane.
unsigned int _ix
Index representing "first" coordinate of 2-D plane.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
IntRange< T > make_range(T beg, T end)
std::vector< std::vector< Real > > _duct_coeffs
Coefficients in the line equations defining each duct wall.
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ nChannels()

unsigned int HexagonalLatticeUtils::nChannels ( ) const
inline

Get the total number of channels.

Returns
number of channels

Definition at line 363 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

363 { return _n_channels; }
unsigned int _n_channels
Total number of channels.

◆ nCornerChannels()

unsigned int HexagonalLatticeUtils::nCornerChannels ( ) const
inline

Get the number of corner channels.

Returns
number of corner channels

Definition at line 357 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

357 { return _n_corner_channels; }
unsigned int _n_corner_channels
Total number of corner channels.

◆ nCornerPins()

unsigned int HexagonalLatticeUtils::nCornerPins ( ) const
inline

Get the number of corner pins.

Returns
number of corner pins

Definition at line 243 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

243 { return _n_corner_pins; }
unsigned int _n_corner_pins
Number of corner pins.

◆ nEdgeChannels()

unsigned int HexagonalLatticeUtils::nEdgeChannels ( ) const
inline

Get the number of edge channels.

Returns
number of edge channels

Definition at line 351 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

351 { return _n_edge_channels; }
unsigned int _n_edge_channels
Total number of edge channels.

◆ nEdgePins()

unsigned int HexagonalLatticeUtils::nEdgePins ( ) const
inline

Get the number of edge pins.

Returns
number of edge pins

Definition at line 237 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

237 { return _n_edge_pins; }
unsigned int _n_edge_pins
Number of edge pins.

◆ nGaps()

unsigned int HexagonalLatticeUtils::nGaps ( ) const
inline

Get the number of gaps.

Returns
number of gaps

Definition at line 165 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

165 { return _n_gaps; }
unsigned int _n_gaps
Total number of gaps.

◆ nInteriorChannels()

unsigned int HexagonalLatticeUtils::nInteriorChannels ( ) const
inline

Get the number of interior channels.

Returns
number of interior channels

Definition at line 345 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

345 { return _n_interior_channels; }
unsigned int _n_interior_channels
Total number of interior channels.

◆ nInteriorGaps()

unsigned int HexagonalLatticeUtils::nInteriorGaps ( ) const
inline

Get the number of gaps that touch an interior channel.

Returns
number of gaps touching an interior channel

Definition at line 153 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

153 { return _n_interior_gaps; }
unsigned int _n_interior_gaps
Number of gaps that touch an interior channel.

◆ nInteriorPins()

unsigned int HexagonalLatticeUtils::nInteriorPins ( ) const
inline

Get the number of interior pins.

Returns
number of interior pins

Definition at line 231 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

231 { return _n_interior_pins; }
unsigned int _n_interior_pins
Number of interior pins.

◆ nPins()

unsigned int HexagonalLatticeUtils::nPins ( ) const
inline

Get the total number of pins for the lattice.

Returns
total number of pins

Definition at line 249 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

249 { return _n_pins; }
unsigned int _n_pins
Total number of pins.

◆ pinBundleSpacing()

Real HexagonalLatticeUtils::pinBundleSpacing ( ) const
inline

Get the distance between the outermost pins and the duct walls.

Returns
pin-bundle spacing

Definition at line 369 of file HexagonalLatticeUtils.h.

Referenced by cornerChannelCornerCoordinates(), edgeChannelCornerCoordinates(), and TEST_F().

369 { return _pin_bundle_spacing; }
Real _pin_bundle_spacing
Spacing between the duct inner wall and the pin surface.

◆ pinCenteredCornerCoordinates()

const std::vector<std::vector<Point> >& HexagonalLatticeUtils::pinCenteredCornerCoordinates ( ) const
inline

Get the corner coordinates of a hexagon surrounding each pin.

Returns
pin center coordinates

Definition at line 381 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

382  {
384  }
std::vector< std::vector< Point > > _pin_centered_corner_coordinates
Corner coordinates of a hexagon surrounding each pin.

◆ pinCenters()

const std::vector<Point>& HexagonalLatticeUtils::pinCenters ( ) const
inline

Get the center coordinates of the pins.

Returns
pin center coordinates

Definition at line 375 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

375 { return _pin_centers; }
std::vector< Point > _pin_centers
Pin center coordinates.

◆ pinDiameter()

Real HexagonalLatticeUtils::pinDiameter ( ) const
inline

Get the pin diameter.

Returns
pin diameter

Definition at line 189 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

189 { return _pin_diameter; }
const Real _pin_diameter
Pin diameter.

◆ pinIndex()

unsigned int HexagonalLatticeUtils::pinIndex ( const Point &  point) const

Get the pin index given a point.

The pin index is for the entire hexagon around the pin

Parameters
[in]pointpoint, must already be translated to lattice frame
Returns
pin index

Definition at line 625 of file HexagonalLatticeUtils.C.

Referenced by TEST_F().

626 {
627  auto side = hexagonSide(_pin_pitch);
628 
629  for (const auto i : make_range(_n_pins))
630  {
631  const auto & center = _pin_centers[i];
632  Real dx = center(_ix) - point(_ix);
633  Real dy = center(_iy) - point(_iy);
634  Real distance_from_pin = std::sqrt(dx * dx + dy * dy);
635 
636  // if we're outside the circumference of the hexagon, we're certain not
637  // within the hexagon for this pin
638  if (distance_from_pin > side)
639  continue;
640 
641  auto corners = _pin_centered_corner_coordinates[i];
642  if (geom_utils::pointInPolygon(point, corners, _axis))
643  return i;
644  }
645 
646  return _n_pins;
647 }
std::vector< std::vector< Point > > _pin_centered_corner_coordinates
Corner coordinates of a hexagon surrounding each pin.
Real hexagonSide(const Real pitch) const
Get the side length of a hexagon with given flat-to-flat distance (pitch)
const unsigned int _axis
Vertical axis of the bundle along which the pins are aligned.
std::vector< Point > _pin_centers
Pin center coordinates.
const Real _pin_pitch
Pin pitch.
unsigned int _iy
Index representing "second" coordinate of 2-D plane.
unsigned int _ix
Index representing "first" coordinate of 2-D plane.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
bool pointInPolygon(const libMesh::Point &point, const std::vector< libMesh::Point > &corners, const unsigned int axis)
IntRange< T > make_range(T beg, T end)
unsigned int _n_pins
Total number of pins.
static const std::string center
Definition: NS.h:28

◆ pinPitch()

Real HexagonalLatticeUtils::pinPitch ( ) const
inline

Get the pin pitch.

Returns
pin pitch

Definition at line 207 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

207 { return _pin_pitch; }
const Real _pin_pitch
Pin pitch.

◆ pinRadius()

Real HexagonalLatticeUtils::pinRadius ( ) const

Get the pin outer radius.

Returns
pin outer radius

Definition at line 189 of file HexagonalLatticeUtils.C.

Referenced by channelType(), computeFlowVolumes(), computeGapIndices(), cornerChannelCornerCoordinates(), edgeChannelCornerCoordinates(), and TEST_F().

190 {
191  return _pin_diameter / 2.0;
192 }
const Real _pin_diameter
Pin diameter.

◆ pins()

unsigned int HexagonalLatticeUtils::pins ( const unsigned int  n) const

Get the number of pins in a given ring.

Parameters
[in]nring number, beginning from 1
Returns
number of pins in the specified ring

Definition at line 99 of file HexagonalLatticeUtils.C.

Referenced by channelCentroid(), computeGapIndices(), computePinAndChannelTypes(), computePinAndDuctCoordinates(), get2DInputPatternIndex(), lastGapInRing(), rings(), TEST_F(), and totalPins().

100 {
101  if (n <= 0)
102  return 0;
103  else if (n == 1)
104  return 1;
105  else
106  return NUM_SIDES * (n - 1);
107 }
static const unsigned int NUM_SIDES
Number of sides in a hexagon.

◆ pinSurfaceAreaPerPitch()

Real HexagonalLatticeUtils::pinSurfaceAreaPerPitch ( ) const
inline

Get the pin surface area per wire pitch.

Returns
pin surface area per wire pitch

Definition at line 390 of file HexagonalLatticeUtils.h.

390 { return _pin_surface_area_per_pitch; }
const Real _pin_surface_area_per_pitch
Pin surface area per wire pitch.

◆ pinVolumePerPitch()

Real HexagonalLatticeUtils::pinVolumePerPitch ( ) const
inline

Get the pin volume per pitch.

Returns
pin volume per pitch

Definition at line 219 of file HexagonalLatticeUtils.h.

219 { return _pin_volume_per_pitch; }
const Real _pin_volume_per_pitch
Single-pin volume per wire pitch.

◆ pitchToDiameter()

Real HexagonalLatticeUtils::pitchToDiameter ( ) const
inline

Get the (pin) pitch-to-diameter ratio.

Returns
pin pitch-to-diameter ratio

Definition at line 171 of file HexagonalLatticeUtils.h.

171 { return _P_over_D; }
const Real _P_over_D
Pitch-to-diameter ratio.

◆ ringIndex()

unsigned int HexagonalLatticeUtils::ringIndex ( const unsigned int  pin) const

Get the index of the ring for a certain pin index.

Parameters
[in]pinpin index
Returns
ring index

Definition at line 982 of file HexagonalLatticeUtils.C.

Referenced by get2DInputPatternIndex().

983 {
984  for (const auto i : make_range(_n_rings))
985  {
986  if (pin <= lastPinInRing(i + 1))
987  return i + 1;
988  }
989  mooseError("Should not reach here. Pin index: ", pin, " for ", _n_rings, " rings.");
990 }
const unsigned int _n_rings
Total number of rings of pins.
void mooseError(Args &&... args)
IntRange< T > make_range(T beg, T end)
unsigned int lastPinInRing(const unsigned int ring) const
Get the index of the "last" pin in a ring.

◆ rings()

unsigned int HexagonalLatticeUtils::rings ( const unsigned int  n) const

Get the number of rings for a specified number of pins.

Parameters
[in]nnumber of pins
Returns
number of hexagonal rings

Definition at line 120 of file HexagonalLatticeUtils.C.

Referenced by TEST_F().

121 {
122  auto remaining = n;
123  unsigned int i = 0;
124 
125  while (remaining > 0)
126  {
127  i += 1;
128  remaining -= pins(i);
129  }
130 
131  if (n != totalPins(i))
132  mooseError("Number of pins " + std::to_string(n) +
133  " not evenly divisible in a hexagonal lattice!");
134 
135  return i;
136 }
void mooseError(Args &&... args)
unsigned int totalPins(const unsigned int n) const
Get the total number of pins for all rings.
unsigned int pins(const unsigned int n) const
Get the number of pins in a given ring.

◆ sideTranslationX()

Real HexagonalLatticeUtils::sideTranslationX ( const unsigned int  side) const
inline

Get the unit vector translation to move a center point to a duct wall.

Parameters
[in]sideduct side
Returns
x-component translation

Definition at line 78 of file HexagonalLatticeUtils.h.

78 { return _unit_translation_x[side]; }
std::vector< Real > _unit_translation_x
(unitless) x-translations to apply to move from a center point to a side of a hexagon ...

◆ sideTranslationY()

Real HexagonalLatticeUtils::sideTranslationY ( const unsigned int  side) const
inline

Get the unit vector translation to move a center point to a duct wall.

Parameters
[in]sideduct side
Returns
y-component translation

Definition at line 85 of file HexagonalLatticeUtils.h.

85 { return _unit_translation_y[side]; }
std::vector< Real > _unit_translation_y
(unitless) y-translations to apply to move from a center point to a side of a hexagon ...

◆ totalPins()

unsigned int HexagonalLatticeUtils::totalPins ( const unsigned int  n) const

Get the total number of pins for all rings.

Parameters
[in]nnumber of total rings, beginning from 1
Returns
total number of pins

Definition at line 110 of file HexagonalLatticeUtils.C.

Referenced by computeChannelPinIndices(), computeGapIndices(), firstPinInRing(), lastPinInRing(), and rings().

111 {
112  unsigned int total = 0;
113  for (unsigned int i = 1; i <= n; ++i)
114  total += pins(i);
115 
116  return total;
117 }
unsigned int pins(const unsigned int n) const
Get the number of pins in a given ring.

◆ triangleArea()

Real HexagonalLatticeUtils::triangleArea ( const Real  side) const

Get the area of an equilateral triangle with given side length.

Parameters
[in]sideside length
Returns
triangle area

Definition at line 165 of file HexagonalLatticeUtils.C.

Referenced by triangleVolume().

166 {
167  return 0.5 * triangleHeight(side) * side;
168 }
Real triangleHeight(const Real side) const
Get the height of an equilateral triangle with given side length.

◆ triangleHeight()

Real HexagonalLatticeUtils::triangleHeight ( const Real  side) const

Get the height of an equilateral triangle with given side length.

Parameters
[in]sideside length
Returns
triangle height

Definition at line 171 of file HexagonalLatticeUtils.C.

Referenced by computePinBundleSpacing(), and triangleArea().

172 {
173  return SIN60 * side;
174 }

◆ triangleSide()

Real HexagonalLatticeUtils::triangleSide ( const Real  height) const

Get the side of an equilateral triangle with given height.

Parameters
[in]heighttriangle height
Returns
triangle side

Definition at line 177 of file HexagonalLatticeUtils.C.

178 {
179  return height / SIN60;
180 }

◆ triangleVolume()

Real HexagonalLatticeUtils::triangleVolume ( const Real  side) const

Get the volume of an equilateral triangle prism per wire pitch.

Parameters
[in]sideside length
Returns
triangle prism volume

Definition at line 183 of file HexagonalLatticeUtils.C.

Referenced by computeFlowVolumes().

184 {
185  return triangleArea(side) * _wire_pitch;
186 }
const Real _wire_pitch
Wire pitch.
Real triangleArea(const Real side) const
Get the area of an equilateral triangle with given side length.

◆ wettedArea()

Real HexagonalLatticeUtils::wettedArea ( ) const
inline

Get the wetted area of entire bundle per wire pitch.

Returns
wetted area of bundle

Definition at line 297 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

297 { return _wetted_area; }
Real _wetted_area
Wetted area of entire bundle per wire pitch.

◆ wireDiameter()

Real HexagonalLatticeUtils::wireDiameter ( ) const
inline

Get the wire diameter.

Returns
wire diameter

Definition at line 201 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

201 { return _wire_diameter; }
const Real _wire_diameter
Wire diameter.

◆ wirePitch()

Real HexagonalLatticeUtils::wirePitch ( ) const
inline

Get the wire pitch.

Returns
wire pitch

Definition at line 195 of file HexagonalLatticeUtils.h.

Referenced by TEST_F().

195 { return _wire_pitch; }
const Real _wire_pitch
Wire pitch.

◆ wireVolumePerPitch()

Real HexagonalLatticeUtils::wireVolumePerPitch ( ) const
inline

Get the wire volume per pitch.

Returns
wire volume per pitch

Definition at line 225 of file HexagonalLatticeUtils.h.

225 { return _wire_volume_per_pitch; }
Real _wire_volume_per_pitch
Single-wire volume per wire pitch.

Member Data Documentation

◆ _axis

const unsigned int HexagonalLatticeUtils::_axis
protected

Vertical axis of the bundle along which the pins are aligned.

Definition at line 635 of file HexagonalLatticeUtils.h.

Referenced by axis(), channelIndex(), computeGapIndices(), computePinAndDuctCoordinates(), distanceFromGap(), HexagonalLatticeUtils(), insideLattice(), minDuctCornerDistance(), and pinIndex().

◆ _bundle_pitch

const Real HexagonalLatticeUtils::_bundle_pitch
protected

Bundle pitch (distance across bundle measured flat-to-flat on the inside of the duct)

Definition at line 617 of file HexagonalLatticeUtils.h.

Referenced by bundlePitch(), computeFlowVolumes(), computePinBundleSpacing(), HexagonalLatticeUtils(), and insideLattice().

◆ _bundle_side_length

const Real HexagonalLatticeUtils::_bundle_side_length
protected

Side length of duct.

Definition at line 644 of file HexagonalLatticeUtils.h.

Referenced by computePinAndDuctCoordinates(), computeWettedAreas(), and HexagonalLatticeUtils().

◆ _corner_channel_pin_indices

std::vector<std::vector<unsigned int> > HexagonalLatticeUtils::_corner_channel_pin_indices
protected

Pin indices forming one of the corners of each corner channel.

Definition at line 775 of file HexagonalLatticeUtils.h.

Referenced by computeChannelPinIndices(), cornerChannelCornerCoordinates(), and cornerChannelPinIndices().

◆ _corner_Dh

Real HexagonalLatticeUtils::_corner_Dh
protected

Hydraulic diameter of corner channel.

Definition at line 713 of file HexagonalLatticeUtils.h.

Referenced by channelHydraulicDiameter(), computeHydraulicDiameters(), and cornerHydraulicDiameter().

◆ _corner_edge_length

Real HexagonalLatticeUtils::_corner_edge_length
protected

Half the distance for which a corner channel is in contact with the duct.

Definition at line 704 of file HexagonalLatticeUtils.h.

Referenced by channelType(), computeFlowVolumes(), cornerEdgeLength(), and HexagonalLatticeUtils().

◆ _corner_flow_volume

Real HexagonalLatticeUtils::_corner_flow_volume
protected

Flow volume of a corner channel per wire pitch.

Definition at line 725 of file HexagonalLatticeUtils.h.

Referenced by computeFlowVolumes(), computeHydraulicDiameters(), and cornerFlowVolume().

◆ _corner_volume

Real HexagonalLatticeUtils::_corner_volume
protected

Total volume of a corner channel per wire pitch.

Definition at line 734 of file HexagonalLatticeUtils.h.

Referenced by channelSpecificSurfaceArea(), computeFlowVolumes(), and cornerVolume().

◆ _corner_wetted_area

Real HexagonalLatticeUtils::_corner_wetted_area
protected

Wetted area of a corner channel per wire pitch.

Definition at line 746 of file HexagonalLatticeUtils.h.

Referenced by channelSpecificSurfaceArea(), computeHydraulicDiameters(), computeWettedAreas(), and cornerWettedArea().

◆ _Dh

Real HexagonalLatticeUtils::_Dh
protected

Bundle-wide hydraulic diameter.

Definition at line 716 of file HexagonalLatticeUtils.h.

Referenced by computeHydraulicDiameters(), and hydraulicDiameter().

◆ _duct_coeffs

std::vector<std::vector<Real> > HexagonalLatticeUtils::_duct_coeffs
protected

Coefficients in the line equations defining each duct wall.

Coefficients \(a\), \(b\), and \(c\) in equation \(ax+by+c=0\) that defines each wall of the duct.

Definition at line 766 of file HexagonalLatticeUtils.h.

Referenced by computePinAndDuctCoordinates(), and minDuctWallDistance().

◆ _duct_corners

std::vector<Point> HexagonalLatticeUtils::_duct_corners
protected

Six corner coordinates for the ducts.

Definition at line 758 of file HexagonalLatticeUtils.h.

Referenced by computePinAndDuctCoordinates(), cornerChannelCornerCoordinates(), and minDuctCornerDistance().

◆ _edge_channel_pin_indices

std::vector<std::vector<unsigned int> > HexagonalLatticeUtils::_edge_channel_pin_indices
protected

Pin indices forming two of the corners of each edge channel.

Definition at line 772 of file HexagonalLatticeUtils.h.

Referenced by computeChannelPinIndices(), computeGapIndices(), edgeChannelCornerCoordinates(), and edgeChannelPinIndices().

◆ _edge_Dh

Real HexagonalLatticeUtils::_edge_Dh
protected

Hydraulic diameter of edge channel.

Definition at line 710 of file HexagonalLatticeUtils.h.

Referenced by channelHydraulicDiameter(), computeHydraulicDiameters(), and edgeHydraulicDiameter().

◆ _edge_flow_volume

Real HexagonalLatticeUtils::_edge_flow_volume
protected

Flow volume of an edge channel per wire pitch.

Definition at line 722 of file HexagonalLatticeUtils.h.

Referenced by computeFlowVolumes(), computeHydraulicDiameters(), and edgeFlowVolume().

◆ _edge_volume

Real HexagonalLatticeUtils::_edge_volume
protected

Total volume of an edge channel per wire pitch.

Definition at line 731 of file HexagonalLatticeUtils.h.

Referenced by channelSpecificSurfaceArea(), computeFlowVolumes(), and edgeVolume().

◆ _edge_wetted_area

Real HexagonalLatticeUtils::_edge_wetted_area
protected

Wetted area of an edge channel per wire pitch.

Definition at line 743 of file HexagonalLatticeUtils.h.

Referenced by channelSpecificSurfaceArea(), computeHydraulicDiameters(), computeWettedAreas(), and edgeWettedArea().

◆ _flow_volume

Real HexagonalLatticeUtils::_flow_volume
protected

Bundle-wide flow volume per wire pitch.

Definition at line 737 of file HexagonalLatticeUtils.h.

Referenced by computeFlowVolumes(), computeHydraulicDiameters(), and flowVolume().

◆ _gap_centers

std::vector<Point> HexagonalLatticeUtils::_gap_centers
protected

Center points of all the gaps.

Definition at line 809 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), and gapCenters().

◆ _gap_indices

std::vector<std::pair<int, int> > HexagonalLatticeUtils::_gap_indices
protected

Gap indices, connecting two pins or one pin and a side, ordered by global gap ID.

Definition at line 778 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), gapIndices(), globalGapIndex(), and lastGapInRing().

◆ _gap_points

std::vector<std::vector<Point> > HexagonalLatticeUtils::_gap_points
protected

Two points on each gap, in order to compute distance-from-gap calculations.

Definition at line 784 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), and distanceFromGap().

◆ _gap_unit_normals

std::vector<Point> HexagonalLatticeUtils::_gap_unit_normals
protected

Unit normal vectors for each gap.

Definition at line 787 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), and gapUnitNormals().

◆ _interior_channel_pin_indices

std::vector<std::vector<unsigned int> > HexagonalLatticeUtils::_interior_channel_pin_indices
protected

Pin indices forming the corner of each interior channel.

Definition at line 769 of file HexagonalLatticeUtils.h.

Referenced by computeChannelPinIndices(), computeGapIndices(), interiorChannelCornerCoordinates(), and interiorChannelPinIndices().

◆ _interior_Dh

Real HexagonalLatticeUtils::_interior_Dh
protected

Hydraulic diameter of interior channel.

Definition at line 707 of file HexagonalLatticeUtils.h.

Referenced by channelHydraulicDiameter(), computeHydraulicDiameters(), and interiorHydraulicDiameter().

◆ _interior_flow_volume

Real HexagonalLatticeUtils::_interior_flow_volume
protected

Flow volume of an interior channel per wire pitch.

Definition at line 719 of file HexagonalLatticeUtils.h.

Referenced by computeFlowVolumes(), computeHydraulicDiameters(), and interiorFlowVolume().

◆ _interior_volume

Real HexagonalLatticeUtils::_interior_volume
protected

Total volume of an interior channel per wire pitch.

Definition at line 728 of file HexagonalLatticeUtils.h.

Referenced by channelSpecificSurfaceArea(), computeFlowVolumes(), and interiorVolume().

◆ _interior_wetted_area

Real HexagonalLatticeUtils::_interior_wetted_area
protected

Wetted area of an interior channel per wire pitch.

Definition at line 740 of file HexagonalLatticeUtils.h.

Referenced by channelSpecificSurfaceArea(), computeHydraulicDiameters(), computeWettedAreas(), and interiorWettedArea().

◆ _ix

unsigned int HexagonalLatticeUtils::_ix
protected

Index representing "first" coordinate of 2-D plane.

Definition at line 812 of file HexagonalLatticeUtils.h.

Referenced by closestPinIndex(), computePinAndDuctCoordinates(), HexagonalLatticeUtils(), minDuctWallDistance(), and pinIndex().

◆ _iy

unsigned int HexagonalLatticeUtils::_iy
protected

Index representing "second" coordinate of 2-D plane.

Definition at line 815 of file HexagonalLatticeUtils.h.

Referenced by closestPinIndex(), computePinAndDuctCoordinates(), HexagonalLatticeUtils(), minDuctWallDistance(), and pinIndex().

◆ _L_over_D

const Real HexagonalLatticeUtils::_L_over_D
protected

Wire axial lead length to diameter ratio.

Definition at line 668 of file HexagonalLatticeUtils.h.

Referenced by heightToDiameter().

◆ _local_to_global_gaps

std::vector<std::vector<int> > HexagonalLatticeUtils::_local_to_global_gaps
protected

Local-to-global gap indexing, ordered by channel ID.

Definition at line 781 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), gapIndex(), gapIndexAndDistance(), and localToGlobalGaps().

◆ _n_channels

unsigned int HexagonalLatticeUtils::_n_channels
protected

Total number of channels.

Definition at line 692 of file HexagonalLatticeUtils.h.

Referenced by computePinAndChannelTypes(), and nChannels().

◆ _n_corner_channels

unsigned int HexagonalLatticeUtils::_n_corner_channels
protected

Total number of corner channels.

Definition at line 701 of file HexagonalLatticeUtils.h.

Referenced by channelIndex(), computeChannelPinIndices(), computeGapIndices(), computePinAndChannelTypes(), and nCornerChannels().

◆ _n_corner_pins

unsigned int HexagonalLatticeUtils::_n_corner_pins
protected

Number of corner pins.

Definition at line 689 of file HexagonalLatticeUtils.h.

Referenced by computePinAndChannelTypes(), and nCornerPins().

◆ _n_edge_channels

unsigned int HexagonalLatticeUtils::_n_edge_channels
protected

◆ _n_edge_pins

unsigned int HexagonalLatticeUtils::_n_edge_pins
protected

Number of edge pins.

Definition at line 686 of file HexagonalLatticeUtils.h.

Referenced by computePinAndChannelTypes(), and nEdgePins().

◆ _n_gaps

unsigned int HexagonalLatticeUtils::_n_gaps
protected

Total number of gaps.

Definition at line 793 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), and nGaps().

◆ _n_interior_channels

unsigned int HexagonalLatticeUtils::_n_interior_channels
protected

Total number of interior channels.

Definition at line 695 of file HexagonalLatticeUtils.h.

Referenced by channelIndex(), computeChannelPinIndices(), computePinAndChannelTypes(), and nInteriorChannels().

◆ _n_interior_gaps

unsigned int HexagonalLatticeUtils::_n_interior_gaps
protected

Number of gaps that touch an interior channel.

Definition at line 790 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), lastGapInRing(), and nInteriorGaps().

◆ _n_interior_pins

unsigned int HexagonalLatticeUtils::_n_interior_pins
protected

Number of interior pins.

Definition at line 683 of file HexagonalLatticeUtils.h.

Referenced by computePinAndChannelTypes(), and nInteriorPins().

◆ _n_pins

unsigned int HexagonalLatticeUtils::_n_pins
protected

◆ _n_rings

const unsigned int HexagonalLatticeUtils::_n_rings
protected

◆ _P_over_D

const Real HexagonalLatticeUtils::_P_over_D
protected

Pitch-to-diameter ratio.

Definition at line 665 of file HexagonalLatticeUtils.h.

Referenced by pitchToDiameter().

◆ _pin_area

const Real HexagonalLatticeUtils::_pin_area
protected

Pin cross-sectional area.

Definition at line 647 of file HexagonalLatticeUtils.h.

◆ _pin_bundle_spacing

Real HexagonalLatticeUtils::_pin_bundle_spacing
protected

Spacing between the duct inner wall and the pin surface.

Definition at line 674 of file HexagonalLatticeUtils.h.

Referenced by channelType(), computeFlowVolumes(), computeGapIndices(), computePinBundleSpacing(), HexagonalLatticeUtils(), and pinBundleSpacing().

◆ _pin_centered_corner_coordinates

std::vector<std::vector<Point> > HexagonalLatticeUtils::_pin_centered_corner_coordinates
protected

Corner coordinates of a hexagon surrounding each pin.

Definition at line 755 of file HexagonalLatticeUtils.h.

Referenced by computePinAndDuctCoordinates(), pinCenteredCornerCoordinates(), and pinIndex().

◆ _pin_centers

std::vector<Point> HexagonalLatticeUtils::_pin_centers
protected

◆ _pin_circumference

const Real HexagonalLatticeUtils::_pin_circumference
protected

Pin circumference.

Definition at line 650 of file HexagonalLatticeUtils.h.

◆ _pin_diameter

const Real HexagonalLatticeUtils::_pin_diameter
protected

◆ _pin_pitch

const Real HexagonalLatticeUtils::_pin_pitch
protected

◆ _pin_surface_area_per_pitch

const Real HexagonalLatticeUtils::_pin_surface_area_per_pitch
protected

Pin surface area per wire pitch.

Definition at line 659 of file HexagonalLatticeUtils.h.

Referenced by computeWettedAreas(), and pinSurfaceAreaPerPitch().

◆ _pin_volume_per_pitch

const Real HexagonalLatticeUtils::_pin_volume_per_pitch
protected

Single-pin volume per wire pitch.

Definition at line 662 of file HexagonalLatticeUtils.h.

Referenced by computeFlowVolumes(), and pinVolumePerPitch().

◆ _rotation_around_axis

const Real HexagonalLatticeUtils::_rotation_around_axis
protected

Rotation around the axis to apply to the lattice.

Definition at line 638 of file HexagonalLatticeUtils.h.

Referenced by computePinAndDuctCoordinates().

◆ _rotation_matrix

const RealTensorValue HexagonalLatticeUtils::_rotation_matrix
protected

Rotation matrix to apply the rotation why.

Definition at line 641 of file HexagonalLatticeUtils.h.

Referenced by computePinAndDuctCoordinates(), and HexagonalLatticeUtils().

◆ _unit_translation_x

std::vector<Real> HexagonalLatticeUtils::_unit_translation_x
protected

(unitless) x-translations to apply to move from a center point to a side of a hexagon

Definition at line 803 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), computePinAndDuctCoordinates(), cornerChannelCornerCoordinates(), edgeChannelCornerCoordinates(), HexagonalLatticeUtils(), insideLattice(), and sideTranslationX().

◆ _unit_translation_y

std::vector<Real> HexagonalLatticeUtils::_unit_translation_y
protected

(unitless) y-translations to apply to move from a center point to a side of a hexagon

Definition at line 806 of file HexagonalLatticeUtils.h.

Referenced by computeGapIndices(), computePinAndDuctCoordinates(), cornerChannelCornerCoordinates(), edgeChannelCornerCoordinates(), HexagonalLatticeUtils(), insideLattice(), and sideTranslationY().

◆ _wetted_area

Real HexagonalLatticeUtils::_wetted_area
protected

Wetted area of entire bundle per wire pitch.

Definition at line 749 of file HexagonalLatticeUtils.h.

Referenced by computeHydraulicDiameters(), computeWettedAreas(), and wettedArea().

◆ _wire_area

const Real HexagonalLatticeUtils::_wire_area
protected

Wire cross-sectional area.

Definition at line 653 of file HexagonalLatticeUtils.h.

Referenced by computeWireVolumeAndAreaPerPitch().

◆ _wire_circumference

const Real HexagonalLatticeUtils::_wire_circumference
protected

Wire circumference.

Definition at line 656 of file HexagonalLatticeUtils.h.

Referenced by computeWireVolumeAndAreaPerPitch().

◆ _wire_diameter

const Real HexagonalLatticeUtils::_wire_diameter
protected

Wire diameter.

Definition at line 626 of file HexagonalLatticeUtils.h.

Referenced by computeWireVolumeAndAreaPerPitch(), HexagonalLatticeUtils(), and wireDiameter().

◆ _wire_pitch

const Real HexagonalLatticeUtils::_wire_pitch
protected

◆ _wire_surface_area_per_pitch

Real HexagonalLatticeUtils::_wire_surface_area_per_pitch
protected

Wire surface area per wire pitch.

Definition at line 671 of file HexagonalLatticeUtils.h.

Referenced by computeWettedAreas(), and computeWireVolumeAndAreaPerPitch().

◆ _wire_volume_per_pitch

Real HexagonalLatticeUtils::_wire_volume_per_pitch
protected

Single-wire volume per wire pitch.

Definition at line 677 of file HexagonalLatticeUtils.h.

Referenced by computeFlowVolumes(), computeWireVolumeAndAreaPerPitch(), and wireVolumePerPitch().

◆ COS60

const Real HexagonalLatticeUtils::COS60 = 0.5
staticprotected

Definition at line 797 of file HexagonalLatticeUtils.h.

Referenced by computePinAndDuctCoordinates(), and HexagonalLatticeUtils().

◆ NUM_SIDES

const unsigned int HexagonalLatticeUtils::NUM_SIDES = 6
staticprotected

◆ SIN60

const Real HexagonalLatticeUtils::SIN60 = std::sqrt(3.0) / 2.0
staticprotected

The documentation for this class was generated from the following files: