12 #include "libmesh/node.h" 21 "lattice arrangement");
26 :
SubChannelMesh(params), _pin_mesh_exist(false), _duct_mesh_exist(false)
32 _n_rings(other_mesh._n_rings),
33 _n_channels(other_mesh._n_channels),
34 _flat_to_flat(other_mesh._flat_to_flat),
35 _dwire(other_mesh._dwire),
36 _hwire(other_mesh._hwire),
37 _duct_to_pin_gap(other_mesh._duct_to_pin_gap),
38 _nodes(other_mesh._nodes),
39 _duct_nodes(other_mesh._duct_nodes),
40 _chan_to_duct_node_map(other_mesh._chan_to_duct_node_map),
41 _duct_node_to_chan_map(other_mesh._duct_node_to_chan_map),
42 _gap_to_chan_map(other_mesh._gap_to_chan_map),
43 _gap_to_pin_map(other_mesh._gap_to_pin_map),
44 _chan_to_gap_map(other_mesh._chan_to_gap_map),
45 _sign_id_crossflow_map(other_mesh._sign_id_crossflow_map),
46 _gij_map(other_mesh._gij_map),
47 _pin_position(other_mesh._pin_position),
48 _pins_in_rings(other_mesh._pins_in_rings),
49 _chan_to_pin_map(other_mesh._chan_to_pin_map),
50 _npins(other_mesh._npins),
51 _n_gaps(other_mesh._n_gaps),
52 _subch_type(other_mesh._subch_type),
53 _gap_type(other_mesh._gap_type),
54 _gap_pairs_sf(other_mesh._gap_pairs_sf),
55 _chan_pairs_sf(other_mesh._chan_pairs_sf),
56 _pin_to_chan_map(other_mesh._pin_to_chan_map),
57 _pin_mesh_exist(other_mesh._pin_mesh_exist),
58 _duct_mesh_exist(other_mesh._duct_mesh_exist)
63 std::unique_ptr<MooseMesh>
85 Real distance0 = 1.0e+8;
93 Real angle = std::abs(std::atan(p(1) / p(0)));
94 Real projection_angle =
96 channel_distance = channel_distance * std::cos(projection_angle);
100 Real loc_angle = std::atan(p(1) / p(0));
103 else if (p(0) >= 0 && p(1) <= 0)
106 Real x_coord_new = (std::cos(-rem_ang) * p(0) - std::sin(-rem_ang) * p(1));
115 Real angle = std::atan(p(1) / p(0));
126 if (channel_distance < distance_outer_ring)
131 distance0 = distance1;
137 if ((distance1 < distance0) &&
140 if (((x_coord_new > x_lim) || (x_coord_new < -x_lim)) &&
144 distance0 = distance1;
146 else if (((x_coord_new > x_lim) || (x_coord_new > -x_lim)) &&
150 distance0 = distance1;
180 unsigned int current_rod = 0;
182 std::vector<Point> positions;
185 for (
unsigned int i = 0; i <
_npins; i++)
187 Real x_dist = positions[i](0) - p(0);
188 Real y_dist = positions[i](1) - p(1);
190 if (distance_rod < d0)
213 Real theta_corrected = 0.0;
216 positions.emplace_back(0.0, 0.0);
217 for (
unsigned int i = 1; i < nrings; i++)
219 dtheta = 2.0 *
pi / (i * 6);
221 for (
unsigned int j = 0;
j < i * 6;
j++)
224 theta1 = fmod(theta + 1.0e-10,
pi / 3.0);
226 2.0 * i *
pitch * (theta1 / dtheta *
pitch) * std::cos(
pi / 3.0)));
231 if (argument >= -1.0 && argument <= 1.0)
233 theta_corrected = std::acos(argument);
235 else if (argument > 1.0)
237 theta_corrected = 0.0;
241 theta_corrected =
pi;
245 theta_corrected = theta;
249 if (theta >
pi / 3.0 && theta <= 2.0 / 3.0 *
pi)
250 theta_corrected = theta_corrected +
pi / 3.0;
251 else if (theta > 2.0 / 3.0 *
pi && theta <=
pi)
252 theta_corrected = theta_corrected + 2.0 / 3.0 *
pi;
253 else if (theta >
pi && theta <= 4.0 / 3.0 *
pi)
254 theta_corrected = theta_corrected +
pi;
255 else if (theta > 4.0 / 3.0 *
pi && theta <= 5.0 / 3.0 *
pi)
256 theta_corrected = theta_corrected + 4.0 / 3.0 *
pi;
257 else if (theta > 5.0 / 3.0 *
pi && theta <= 2.0 *
pi)
258 theta_corrected = theta_corrected + 5.0 / 3.0 *
pi;
260 positions.emplace_back(
center(0) +
distance * std::cos(theta_corrected),
262 theta = theta + dtheta;
271 for (
size_t i = 0; i < duct_nodes.size(); i++)
274 Real min_dist = std::numeric_limits<double>::max();
275 Point ductpos((*duct_nodes[i])(0), (*duct_nodes[i])(1), 0);
279 auto dist = (chanpos - ductpos).
norm();
287 Node * chan_node =
nullptr;
288 for (
auto cn :
_nodes[min_chan])
290 if (std::abs((*cn)(2) - (*duct_nodes[i])(2)) <
tol)
297 if (chan_node ==
nullptr)
298 mooseError(
"failed to find matching channel node for duct node");
std::vector< EChannelType > _subch_type
subchannel type
std::vector< Node * > _duct_nodes
A list of all mesh nodes that form the (elements of) the hexagonal duct mesh that surrounds the pins/...
static InputParameters validParams()
virtual std::unique_ptr< MooseMesh > safeClone() const override
virtual unsigned int getSubchannelIndexFromPoint(const Point &p) const override
Return a subchannel index for a given physical point p
TriSubChannelMesh(const InputParameters ¶meters)
void setChannelToDuctMaps(const std::vector< Node *> &duct_nodes)
Function that gets the channel node from the duct node.
Real _duct_to_pin_gap
the gap thickness between the duct and peripheral fuel pins
Real distance(const Point &p)
std::vector< std::vector< Real > > _subchannel_position
x,y coordinates of the subchannel centroids
std::unique_ptr< T > copyConstruct(const T &object)
registerMooseObject("SubChannelApp", TriSubChannelMesh)
virtual void buildMesh() override
unsigned int _n_rings
number of rings of fuel pins
virtual unsigned int channelIndex(const Point &point) const override
static const std::string pitch
Real _flat_to_flat
the distance between flat surfaces of the duct facing each other
unsigned int _npins
number of fuel pins
Real _pin_diameter
fuel Pin diameter
virtual unsigned int getPinIndexFromPoint(const Point &p) const override
Return a pin index for a given physical point p
Mesh class for triangular, edge and corner subchannels for hexagonal lattice fuel assemblies...
Real _pitch
Distance between the neighbor fuel pins, pitch.
static void rodPositions(std::vector< Point > &positions, unsigned int nrings, Real pitch, Point center)
Calculates and stores the pin positions/centers for a hexagonal assembly containing the given number ...
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::vector< std::vector< Node * > > _nodes
nodes
virtual unsigned int pinIndex(const Point &p) const override
void mooseError(Args &&... args) const
static const std::complex< double > j(0, 1)
Complex number "j" (also known as "i")
Base class for subchannel meshes.
std::map< Node *, Node * > _chan_to_duct_node_map
A map for providing the closest/corresponding duct node associated with each subchannel node...
MooseUnits pow(const MooseUnits &, int)
unsigned int _n_channels
number of subchannels
static const std::string k
static InputParameters validParams()
static const std::string center
std::map< Node *, Node * > _duct_node_to_chan_map
A map for providing the closest/corresponding subchannel node associated with each duct node...