https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
SCMTriVisualizationAssemblyMeshGenerator Class Reference

Mesh generator that builds a 3D mesh representing triangular subchannels and pins. More...

#include <SCMTriVisualizationAssemblyMeshGenerator.h>

Inheritance diagram for SCMTriVisualizationAssemblyMeshGenerator:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 SCMTriVisualizationAssemblyMeshGenerator (const InputParameters &parameters)
 
virtual std::unique_ptr< MeshBase > generate () override
 
std::unique_ptr< CSG::CSGBase > generateInternalCSG ()
 
std::unique_ptr< MeshBase > generateInternal ()
 
const std::set< MeshGeneratorName > & getRequestedMeshGenerators () const
 
const std::set< MeshGeneratorName > & getRequestedMeshGeneratorsForSub () const
 
void addParentMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
void addChildMeshGenerator (const MeshGenerator &mg, const AddParentChildKey)
 
const std::set< const MeshGenerator *, Comparator > & getParentMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getChildMeshGenerators () const
 
const std::set< const MeshGenerator *, Comparator > & getSubMeshGenerators () const
 
bool isParentMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isChildMeshGenerator (const MeshGeneratorName &name, const bool direct=true) const
 
bool isNullMeshName (const MeshGeneratorName &name) const
 
bool hasSaveMesh () const
 
bool hasOutput () const
 
const std::string & getSavedMeshName () const
 
bool hasGenerateData () const
 
bool hasGenerateCSG () const
 
bool isDataOnly () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObject > getSharedPtr ()
 
std::shared_ptr< const MooseObject > getSharedPtr () const
 
bool isKokkosObject () const
 
MooseApp & getMooseApp () const
 
const std::string & type () const
 
const std::string & name () const
 
std::string typeAndName () const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
MooseObjectName uniqueName () const
 
const InputParameters & parameters () const
 
const hit::Node * getHitNode () const
 
bool hasBase () const
 
const std::string & getBase () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
T getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &name) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
std::string messagePrefix (const bool hit_prefix=true) const
 
std::string errorPrefix (const std::string &) const
 
void mooseError (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseDeprecatedNoTrace (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
void callMooseError (std::string msg, const bool with_prefix, const hit::Node *node=nullptr, const bool show_trace=true) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static bool hasGenerateData (const InputParameters &params)
 
static bool hasGenerateCSG (const InputParameters &params)
 
static void callMooseError (MooseApp *const app, const InputParameters &params, std::string msg, const bool with_prefix, const hit::Node *node, const bool show_trace=true)
 
static void setHasGenerateData (InputParameters &params)
 
static void setHasGenerateCSG (InputParameters &params)
 

Public Attributes

 usingCombinedWarningSolutionWarnings
 
const ConsoleStream _console
 

Static Public Attributes

static const std::string data_only_param
 
static const std::string type_param
 
static const std::string name_param
 
static const std::string unique_name_param
 
static const std::string app_param
 
static const std::string moose_base_param
 
static const std::string kokkos_object_param
 
static constexpr auto SYSTEM
 
static constexpr auto NAME
 

Protected Member Functions

EChannelType getSubchannelType (unsigned int index) const
 returns the type of the subchannel given the index
 
Point rotatePoint (Point b, Real theta)
 rotate a point by theta radians about the origin
 
void generatePin (std::unique_ptr< MeshBase > &mesh_base, const Point &center)
 Generate one detailed fuel pin volume centered at the supplied point.
 
Point getPinPosition (unsigned int i)
 returns the position of pin given pin index
 
std::vector< Real > getSubchannelPosition (unsigned int i)
 returns the position of subchannel given pin index
 
std::vector< unsigned int > getSubChannelPins (unsigned int i)
 returns the index of neighboring pins given subchannel index
 
virtual void generateData ()
 
virtual std::unique_ptr< CSG::CSGBase > generateCSG ()
 
T & copyMeshProperty (const std::string &target_data_name, const std::string &source_data_name, const std::string &source_mesh)
 
T & copyMeshProperty (const std::string &source_data_name, const std::string &source_mesh)
 
std::unique_ptr< MeshBase > & getMesh (const std::string &param_name, const bool allow_invalid=false)
 
std::vector< std::unique_ptr< MeshBase > * > getMeshes (const std::string &param_name)
 
std::unique_ptr< MeshBase > & getMeshByName (const MeshGeneratorName &mesh_generator_name)
 
std::vector< std::unique_ptr< MeshBase > * > getMeshesByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
std::unique_ptr< CSG::CSGBase > & getCSGBase (const std::string &param_name)
 
std::unique_ptr< CSG::CSGBase > & getCSGBaseByName (const MeshGeneratorName &mesh_generator_name)
 
std::vector< std::unique_ptr< CSG::CSGBase > * > getCSGBases (const std::string &param_name)
 
std::vector< std::unique_ptr< CSG::CSGBase > * > getCSGBasesByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
void declareMeshForSub (const std::string &param_name)
 
void declareMeshesForSub (const std::string &param_name)
 
void declareMeshForSubByName (const MeshGeneratorName &mesh_generator_name)
 
void declareMeshesForSubByName (const std::vector< MeshGeneratorName > &mesh_generator_names)
 
std::unique_ptr< MeshBase > buildMeshBaseObject (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< ReplicatedMesh > buildReplicatedMesh (unsigned int dim=libMesh::invalid_uint)
 
std::unique_ptr< DistributedMesh > buildDistributedMesh (unsigned int dim=libMesh::invalid_uint)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, Ts... extra_input_parameters)
 
void addMeshSubgenerator (const std::string &type, const std::string &name, InputParameters params)
 
void declareNullMeshName (const MeshGeneratorName &name)
 
void flagInvalidSolutionInternal (const InvalidSolutionID invalid_solution_id) const
 
InvalidSolutionID registerInvalidSolutionInternal (const std::string &message, const bool warning) const
 
const T & getMeshProperty (const std::string &data_name, const std::string &prefix)
 
const T & getMeshProperty (const std::string &data_name)
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name, const std::string &prefix) const
 
bool hasMeshProperty (const std::string &data_name) const
 
bool hasMeshProperty (const std::string &data_name) const
 
std::string meshPropertyName (const std::string &data_name) const
 
T & declareMeshProperty (const std::string &data_name, Args &&... args)
 
T & declareMeshProperty (const std::string &data_name, const T &data_value)
 
T & declareMeshProperty (const std::string &data_name, Args &&... args)
 
T & declareMeshProperty (const std::string &data_name, const T &data_value)
 
T & setMeshProperty (const std::string &data_name, Args &&... args)
 
T & setMeshProperty (const std::string &data_name, const T &data_value)
 
T & setMeshProperty (const std::string &data_name, Args &&... args)
 
T & setMeshProperty (const std::string &data_name, const T &data_value)
 

Static Protected Member Functions

static std::string meshPropertyName (const std::string &data_name, const std::string &prefix)
 

Protected Attributes

const Real _unheated_length_entry
 unheated length of the fuel Pin at the entry of the assembly
 
const Real _heated_length
 heated length of the fuel Pin
 
const Real _unheated_length_exit
 unheated length of the fuel Pin at the exit of the assembly
 
std::vector< Real > _z_grid
 axial location of nodes
 
const Real _pitch
 Distance between the neighbor fuel pins, pitch.
 
const Real _pin_diameter
 fuel Pin diameter
 
const unsigned int _n_rings
 Number of rings in the geometry.
 
const Real _flat_to_flat
 Half of gap between adjacent assemblies.
 
const unsigned int _num_sectors
 Number of azimuthal sectors used to discretize each circular pin cross section.
 
std::vector< EChannelType > _subch_type
 Subchannel type.
 
std::vector< Point > _pin_position
 x,y coordinates of the fuel pins
 
std::vector< std::vector< Real > > _subchannel_position
 x,y coordinates of the subchannels
 
const unsigned int _subchannel_block_id
 Subchannel subdomain ID.
 
const unsigned int _pin_block_id
 Pin subdomain ID.
 
const unsigned int _n_cells
 Number of cells in the axial direction.
 
unsigned int _nrods
 Number of pins.
 
std::vector< std::vector< unsigned int > > _pins_in_rings
 fuel pins that are belonging to each ring
 
std::map< unsigned int, Real > _orientation_map
 map inner and outer rings
 
unsigned int _n_channels
 number of subchannels
 
std::vector< std::vector< unsigned int > > _chan_to_pin_map
 stores the fuel pins belonging to each subchannel
 
const bool _verbose
 Flag to print out the detailed mesh assembly and coordinates.
 
dof_id_type _elem_id
 counter for element numbering
 
MooseMesh *const _mesh
 
const bool & _enabled
 
MooseApp & _app
 
Factory & _factory
 
ActionFactory & _action_factory
 
const std::string & _type
 
const std::string & _name
 
const InputParameters & _pars
 
const Parallel::Communicator & _communicator
 

Private Member Functions

virtual std::string meshPropertyPrefix (const std::string &) const override final
 
void checkGetMesh (const MeshGeneratorName &mesh_generator_name, const std::string &param_name) const
 
const MeshGeneratorName * getMeshGeneratorNameFromParam (const std::string &param_name, const bool allow_invalid) const
 
const std::vector< MeshGeneratorName > & getMeshGeneratorNamesFromParam (const std::string &param_name) const
 
RestartableDataValue & setMeshPropertyHelper (const std::string &data_name)
 
bool suppressInfo () const
 
const RestartableDataValue & getMeshPropertyInternal (const std::string &data_name, const std::string &prefix) const
 
void mooseErrorInternal (Args &&... args) const
 

Static Private Member Functions

static const hit::Node * getHitNode (const InputParameters &params)
 
static std::string messagePrefix (const InputParameters &params, const bool hit_prefix)
 

Private Attributes

std::set< MeshGeneratorName > _requested_mesh_generators
 
std::set< MeshGeneratorName > _requested_mesh_generators_for_sub
 
std::vector< std::pair< std::string, std::unique_ptr< MeshBase > * > > _requested_meshes
 
std::vector< std::pair< std::string, std::unique_ptr< CSG::CSGBase > * > > _requested_csg_bases
 
std::unique_ptr< MeshBase > _null_mesh
 
std::unique_ptr< CSG::CSGBase > _null_csg_base
 
std::set< const MeshGenerator *, Comparator > _parent_mesh_generators
 
std::set< const MeshGenerator *, Comparator > _child_mesh_generators
 
std::set< const MeshGenerator *, Comparator > _sub_mesh_generators
 
std::set< std::string > _null_mesh_names
 
const std::string & _save_with_name
 
const bool _data_only
 
const ParallelParamObject & _parent
 
const MooseBase & _si_moose_base
 
const FEProblemBase * _si_problem
 
MooseApp & _meta_data_app
 
const MooseObject *const _meta_data_object
 

Detailed Description

Mesh generator that builds a 3D mesh representing triangular subchannels and pins.

Definition at line 18 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Constructor & Destructor Documentation

◆ SCMTriVisualizationAssemblyMeshGenerator()

SCMTriVisualizationAssemblyMeshGenerator::SCMTriVisualizationAssemblyMeshGenerator ( const InputParameters &  parameters)

Definition at line 70 of file SCMTriVisualizationAssemblyMeshGenerator.C.

73 _unheated_length_entry(getParam<Real>("unheated_length_entry")),
74 _heated_length(getParam<Real>("heated_length")),
75 _unheated_length_exit(getParam<Real>("unheated_length_exit")),
76 _pitch(getParam<Real>("pitch")),
77 _pin_diameter(getParam<Real>("pin_diameter")),
78 _n_rings(getParam<unsigned int>("nrings")),
79 _flat_to_flat(getParam<Real>("flat_to_flat")),
80 _num_sectors(getParam<unsigned int>("num_sectors")),
81 _subchannel_block_id(getParam<unsigned int>("subchannel_block_id")),
82 _pin_block_id(getParam<unsigned int>("pin_block_id")),
83 _n_cells(getParam<unsigned int>("n_cells")),
84 _nrods(0),
85 _n_channels(0),
86 _verbose(getParam<bool>("verbose_flag")),
87 _elem_id(0)
88{
89 // Read by SCMTriCoreMeshGenerator to check that assemblies placed in a core do not overlap
90 declareMeshProperty<Real>("flat_to_flat", _flat_to_flat);
91
93
94 if (_n_rings < 2)
95 paramError("nrings",
96 "'nrings' must be at least 2. In this mesh generator, the center pin counts as "
97 "the first ring, so a 7-pin bundle uses nrings = 2.");
98
99 if (_n_cells == 0)
100 paramError("n_cells", "The number of axial cells must be greater than zero");
101
102 if (L <= 0.0)
103 mooseError("Total bundle length must be greater than zero");
104
105 Real dz = L / _n_cells;
106 for (unsigned int i = 0; i < _n_cells + 1; i++)
107 _z_grid.push_back(dz * i);
108
109 // x coordinate for the first position
110 Real x0 = 0.0;
111 // y coordinate for the first position
112 Real y0 = 0.0;
113 // x coordinate for the second position
114 Real x1 = 0.0;
115 // y coordinate for the second position dummy variable
116 Real y1 = 0.0;
117 // dummy variable
118 Real a1 = 0.0;
119 // dummy variable
120 Real a2 = 0.0;
121 // average x coordinate
122 Real avg_coor_x = 0.0;
123 // average y coordinate
124 Real avg_coor_y = 0.0;
125 // distance between two points
126 Real dist = 0.0;
127 // distance between two points
128 Real dist0 = 0.0;
129 // the indicator used while setting _gap_to_chan_map array
130 std::vector<std::pair<unsigned int, unsigned int>> gap_fill;
132 _nrods = _pin_position.size();
133 // assign the pins to the corresponding rings
134 unsigned int k = 0; // initialize the fuel Pin counter index
135 _pins_in_rings.resize(_n_rings);
136 _pins_in_rings[0].push_back(k++);
137 for (unsigned int i = 1; i < _n_rings; i++)
138 for (unsigned int j = 0; j < i * 6; j++)
139 _pins_in_rings[i].push_back(k++);
140 // Given the number of pins and number of fuel Pin rings, the number of subchannels can be
141 // computed as follows:
142 unsigned int chancount = 0;
143 // Summing internal channels
144 for (unsigned int j = 0; j < _n_rings - 1; j++)
145 chancount += j * 6;
146 // Adding external channels to the total count
147 _n_channels = chancount + _nrods - 1 + (_n_rings - 1) * 6 + 6;
148
149 // Utils for building the mesh
151 _subch_type.resize(_n_channels);
153
154 for (unsigned int i = 0; i < _n_channels; i++)
155 {
156 _subchannel_position[i].reserve(3);
157 for (unsigned int j = 0; j < 3; j++)
158 {
159 _subchannel_position.at(i).push_back(0.0);
160 }
161 }
162
163 // create the subchannels
164 k = 0; // initialize the subchannel counter index
165 for (unsigned int i = 1; i < _n_rings; i++)
166 {
167 // find the closest Pin at back ring
168 for (unsigned int j = 0; j < _pins_in_rings[i].size(); j++)
169 {
170 if (j == _pins_in_rings[i].size() - 1)
171 {
172 _chan_to_pin_map[k].push_back(_pins_in_rings[i][j]);
173 _chan_to_pin_map[k].push_back(_pins_in_rings[i][0]);
174 avg_coor_x =
175 0.5 * (_pin_position[_pins_in_rings[i][j]](0) + _pin_position[_pins_in_rings[i][0]](0));
176 avg_coor_y =
177 0.5 * (_pin_position[_pins_in_rings[i][j]](1) + _pin_position[_pins_in_rings[i][0]](1));
178 }
179 else
180 {
181 _chan_to_pin_map[k].push_back(_pins_in_rings[i][j]);
182 _chan_to_pin_map[k].push_back(_pins_in_rings[i][j + 1]);
183 avg_coor_x = 0.5 * (_pin_position[_pins_in_rings[i][j]](0) +
184 _pin_position[_pins_in_rings[i][j + 1]](0));
185 avg_coor_y = 0.5 * (_pin_position[_pins_in_rings[i][j]](1) +
186 _pin_position[_pins_in_rings[i][j + 1]](1));
187 }
188 dist0 = 1.0e+5;
189 _chan_to_pin_map[k].push_back(_pins_in_rings[i - 1][0]);
190 for (unsigned int l = 0; l < _pins_in_rings[i - 1].size(); l++)
191 {
192 dist = std::sqrt(pow(_pin_position[_pins_in_rings[i - 1][l]](0) - avg_coor_x, 2) +
193 pow(_pin_position[_pins_in_rings[i - 1][l]](1) - avg_coor_y, 2));
194
195 if (dist < dist0)
196 {
197 _chan_to_pin_map[k][2] = _pins_in_rings[i - 1][l];
198 dist0 = dist;
199 }
200 }
202 _orientation_map.insert(std::make_pair(k, 0.0));
203 k = k + 1;
204 }
205
206 // find the closest Pin at front ring
207 for (unsigned int j = 0; j < _pins_in_rings[i].size(); j++)
208 {
209 if (j == _pins_in_rings[i].size() - 1)
210 {
211 _chan_to_pin_map[k].push_back(_pins_in_rings[i][j]);
212 _chan_to_pin_map[k].push_back(_pins_in_rings[i][0]);
213 avg_coor_x =
214 0.5 * (_pin_position[_pins_in_rings[i][j]](0) + _pin_position[_pins_in_rings[i][0]](0));
215 avg_coor_y =
216 0.5 * (_pin_position[_pins_in_rings[i][j]](1) + _pin_position[_pins_in_rings[i][0]](1));
217 }
218 else
219 {
220 _chan_to_pin_map[k].push_back(_pins_in_rings[i][j]);
221 _chan_to_pin_map[k].push_back(_pins_in_rings[i][j + 1]);
222 avg_coor_x = 0.5 * (_pin_position[_pins_in_rings[i][j]](0) +
223 _pin_position[_pins_in_rings[i][j + 1]](0));
224 avg_coor_y = 0.5 * (_pin_position[_pins_in_rings[i][j]](1) +
225 _pin_position[_pins_in_rings[i][j + 1]](1));
226 }
227 // if the outermost ring, set the edge subchannels first... then the corner subchannels
228 if (i == _n_rings - 1)
229 {
230 // add edges
231 _subch_type[k] = EChannelType::EDGE; // an edge subchannel is created
232 k = k + 1;
233 if (j % i == 0)
234 {
235 // corner subchannel
236 _chan_to_pin_map[k].push_back(_pins_in_rings[i][j]);
238 k = k + 1;
239 }
240 // if not the outer most ring
241 }
242 else
243 {
244 dist0 = 1.0e+5;
245 _chan_to_pin_map[k].push_back(_pins_in_rings[i + 1][0]);
246 for (unsigned int l = 0; l < _pins_in_rings[i + 1].size(); l++)
247 {
248 dist = std::sqrt(pow(_pin_position[_pins_in_rings[i + 1][l]](0) - avg_coor_x, 2) +
249 pow(_pin_position[_pins_in_rings[i + 1][l]](1) - avg_coor_y, 2));
250 if (dist < dist0)
251 {
252 _chan_to_pin_map[k][2] = _pins_in_rings[i + 1][l];
253 dist0 = dist;
254 }
255 }
257 _orientation_map.insert(std::make_pair(k, libMesh::pi));
258 k = k + 1;
259 }
260 }
261 }
262
263 for (auto & pin : _chan_to_pin_map)
264 pin.shrink_to_fit();
265
266 // set the subchannel positions
267 Real _duct_to_pin_gap =
268 0.5 * (_flat_to_flat - (_n_rings - 1) * _pitch * std::sqrt(3.0) - _pin_diameter);
269 for (unsigned int i = 0; i < _n_channels; i++)
270 {
272 {
276 3.0;
280 3.0;
281 }
282 else if (_subch_type[i] == EChannelType::EDGE)
283 {
284 for (unsigned int j = 0; j < _n_channels; j++)
285 {
287 ((_chan_to_pin_map[i][0] == _chan_to_pin_map[j][0] &&
288 _chan_to_pin_map[i][1] == _chan_to_pin_map[j][1]) ||
289 (_chan_to_pin_map[i][0] == _chan_to_pin_map[j][1] &&
290 _chan_to_pin_map[i][1] == _chan_to_pin_map[j][0])))
291 {
292 x0 = _pin_position[_chan_to_pin_map[j][2]](0);
293 y0 = _pin_position[_chan_to_pin_map[j][2]](1);
294 }
295 else if (_subch_type[j] == EChannelType::CENTER &&
296 ((_chan_to_pin_map[i][0] == _chan_to_pin_map[j][0] &&
297 _chan_to_pin_map[i][1] == _chan_to_pin_map[j][2]) ||
298 (_chan_to_pin_map[i][0] == _chan_to_pin_map[j][2] &&
299 _chan_to_pin_map[i][1] == _chan_to_pin_map[j][0])))
300 {
301 x0 = _pin_position[_chan_to_pin_map[j][1]](0);
302 y0 = _pin_position[_chan_to_pin_map[j][1]](1);
303 }
304 else if (_subch_type[j] == EChannelType::CENTER &&
305 ((_chan_to_pin_map[i][0] == _chan_to_pin_map[j][1] &&
306 _chan_to_pin_map[i][1] == _chan_to_pin_map[j][2]) ||
307 (_chan_to_pin_map[i][0] == _chan_to_pin_map[j][2] &&
308 _chan_to_pin_map[i][1] == _chan_to_pin_map[j][1])))
309 {
310 x0 = _pin_position[_chan_to_pin_map[j][0]](0);
311 y0 = _pin_position[_chan_to_pin_map[j][0]](1);
312 }
313 x1 = 0.5 *
315 y1 = 0.5 *
317 a1 = _pin_diameter / 2.0 + _duct_to_pin_gap / 2.0;
318 a2 = std::sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) + a1;
319 _subchannel_position[i][0] = (a2 * x1 - a1 * x0) / (a2 - a1);
320 _subchannel_position[i][1] = (a2 * y1 - a1 * y0) / (a2 - a1);
321 } // j
322 }
323 else if (_subch_type[i] == EChannelType::CORNER)
324 {
325 x0 = _pin_position[0](0);
326 y0 = _pin_position[0](1);
327 x1 = _pin_position[_chan_to_pin_map[i][0]](0);
328 y1 = _pin_position[_chan_to_pin_map[i][0]](1);
329 a1 = _pin_diameter / 2.0 + _duct_to_pin_gap / 2.0;
330 a2 = std::sqrt((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0)) + a1;
331 _subchannel_position[i][0] = (a2 * x1 - a1 * x0) / (a2 - a1);
332 _subchannel_position[i][1] = (a2 * y1 - a1 * y0) / (a2 - a1);
333 }
334 }
335}
ExpressionBuilder::EBTerm pow(const ExpressionBuilder::EBTerm &left, T exponent)
const InputParameters & parameters() const
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
const unsigned int _num_sectors
Number of azimuthal sectors used to discretize each circular pin cross section.
const unsigned int _n_rings
Number of rings in the geometry.
std::map< unsigned int, Real > _orientation_map
map inner and outer rings
const unsigned int _n_cells
Number of cells in the axial direction.
const unsigned int _subchannel_block_id
Subchannel subdomain ID.
std::vector< EChannelType > _subch_type
Subchannel type.
const bool _verbose
Flag to print out the detailed mesh assembly and coordinates.
const Real _unheated_length_entry
unheated length of the fuel Pin at the entry of the assembly
std::vector< std::vector< Real > > _subchannel_position
x,y coordinates of the subchannels
const Real _unheated_length_exit
unheated length of the fuel Pin at the exit of the assembly
std::vector< std::vector< unsigned int > > _pins_in_rings
fuel pins that are belonging to each ring
std::vector< std::vector< unsigned int > > _chan_to_pin_map
stores the fuel pins belonging to each subchannel
const Real _flat_to_flat
Half of gap between adjacent assemblies.
std::vector< Point > _pin_position
x,y coordinates of the fuel pins
const Real _pitch
Distance between the neighbor fuel pins, pitch.
static void pinPositions(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 ...
const Real pi
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Member Function Documentation

◆ generate()

std::unique_ptr< MeshBase > SCMTriVisualizationAssemblyMeshGenerator::generate ( )
overridevirtual

Implements MeshGenerator.

Definition at line 381 of file SCMTriVisualizationAssemblyMeshGenerator.C.

382{
383 auto mesh_base = buildMeshBaseObject();
384 BoundaryInfo & boundary_info = mesh_base->get_boundary_info();
385 mesh_base->set_spatial_dimension(3);
386 // Define the resolution (the number of points used to represent a circle).
387 // This must be divisible by 4.
388 const unsigned int theta_res_triangle = 24; // TODO: parameterize
389 const unsigned int theta_res_square = 24; // TODO: parameterize
390 // Compute the number of points needed to represent one sixth and quadrant of a circle.
391 const unsigned int points_per_sixth = theta_res_triangle / 6 + 1;
392 const unsigned int points_per_quadrant = theta_res_square / 4 + 1;
393
394 // Compute the points needed to represent one axial cross-flow of a subchannel.
395 // For the center subchannel (sc) there is one center point plus the points from 3 side
396 // circles.
397 const unsigned int points_per_center = points_per_sixth * 3 + 1;
398 // For the corner sc there is one center point plus the points from 1 side circle plus 3
399 // corners
400 const unsigned int points_per_corner = points_per_sixth * 1 + 1 + 3;
401 // For the side sc there is one center point plus the points from 2 intersecting circles plus 2
402 // corners
403 const unsigned int points_per_side = points_per_quadrant * 2 + 1 + 2;
404
405 if (_verbose)
406 {
407 _console << "Points per center: " << points_per_center << std::endl;
408 _console << "Points per side: " << points_per_side << std::endl;
409 _console << "Points per corner: " << points_per_corner << std::endl;
410 }
411
412 // Compute the number of elements (Prism6) which combined base creates the sub-channel
413 // cross-section
414 const unsigned int elems_per_center = theta_res_triangle * 3 / 6 + 3; // TODO: check
415 const unsigned int elems_per_corner = theta_res_triangle / 6 + 4;
416 const unsigned int elems_per_side = 2 * theta_res_square / 4 + 4;
417 if (_verbose)
418 {
419 _console << "Elems per center: " << elems_per_center << std::endl;
420 _console << "Elems per side: " << elems_per_side << std::endl;
421 _console << "Elems per corner: " << elems_per_corner << std::endl;
422 }
423
424 // specify number and type of sub-channel
425 unsigned int n_corner = 6;
426 unsigned int n_side = (_n_rings - 1) * 6;
427 unsigned int n_center = _n_channels - n_side - n_corner;
428 if (_verbose)
429 {
430 _console << "Centers: " << n_center << std::endl;
431 _console << "Sides: " << n_side << std::endl;
432 _console << "Corners: " << n_corner << std::endl;
433 }
434
435 // Compute the total number of points and elements.
436 const unsigned int points_per_level =
437 n_corner * points_per_corner + n_side * points_per_side + n_center * points_per_center;
438 const unsigned int elems_per_level =
439 n_corner * elems_per_corner + n_side * elems_per_side + n_center * elems_per_center;
440 if (_verbose)
441 {
442 _console << "Points per level: " << points_per_level << std::endl;
443 _console << "Elements per level: " << elems_per_level << std::endl;
444 }
445 const unsigned int n_points = points_per_level * (_n_cells + 1);
446 const unsigned int n_elems = elems_per_level * _n_cells;
447 const unsigned int n_pins = _pin_position.size();
448 const unsigned int pin_points = n_pins > 0 ? (_n_cells + 1) * (_num_sectors + 1) * n_pins : 0;
449 const unsigned int pin_elems = n_pins > 0 ? _n_cells * _num_sectors * n_pins : 0;
450 if (_verbose)
451 {
452 _console << "Number of points: " << n_points << std::endl;
453 _console << "Number of elements: " << n_elems << std::endl;
454 }
455 mesh_base->reserve_nodes(n_points + pin_points);
456 mesh_base->reserve_elem(n_elems + pin_elems);
457 // Build an array of points arranged in a circle on the xy-plane. (last and first node overlap)
458 // We build for both the square discretization in the edges and the triangular discretization
459 // within the mesh
460 const Real radius = _pin_diameter / 2.0;
461 std::array<Point, theta_res_square + 1> circle_points_square;
462 {
463 Real theta = 0;
464 for (unsigned int i = 0; i < theta_res_square + 1; i++)
465 {
466 circle_points_square[i](0) = radius * std::cos(theta);
467 circle_points_square[i](1) = radius * std::sin(theta);
468 theta += 2.0 * libMesh::pi / theta_res_square;
469 }
470 }
471 std::array<Point, theta_res_triangle + 1> circle_points_triangle;
472 {
473 Real theta = 0;
474 for (unsigned int i = 0; i < theta_res_triangle + 1; i++)
475 {
476 circle_points_triangle[i](0) = radius * std::cos(theta);
477 circle_points_triangle[i](1) = radius * std::sin(theta);
478 theta += 2.0 * libMesh::pi / theta_res_triangle;
479 }
480 }
481 // Define "quadrant center" reference points. These will be the centers of
482 // the 3 circles that represent the fuel pins. These centers are
483 // offset a little bit so that in the final mesh, there is a tiny gap between
484 // neighboring subchannel cells. That allows us to easily map a solution to
485 // this detailed mesh with a nearest-neighbor search.
486 const Real shrink_factor = 0.99999;
487 // Quadrants are used only for the side and corner subchannels
488 Real _duct_to_pin_gap =
489 0.5 * (_flat_to_flat - (_n_rings - 1) * _pitch * std::sqrt(3.0) - _pin_diameter);
490 std::array<Point, 2> quadrant_centers_sides;
491 quadrant_centers_sides[0] = Point(
492 -_pitch * 0.5 * shrink_factor, -(_duct_to_pin_gap + _pin_diameter) * 0.5 * shrink_factor, 0);
493 quadrant_centers_sides[1] = Point(
494 _pitch * 0.5 * shrink_factor, -(_duct_to_pin_gap + _pin_diameter) * 0.5 * shrink_factor, 0);
495 std::array<Point, 1> quadrant_centers_corner;
496 quadrant_centers_corner[0] =
497 Point(-(_duct_to_pin_gap + _pin_diameter) * 0.5 * std::sin(libMesh::pi / 6) * shrink_factor,
498 -(_duct_to_pin_gap + _pin_diameter) * 0.5 * std::cos(libMesh::pi / 6) * shrink_factor,
499 0);
500 // Triangles are used for all center subchannels
501 std::array<Point, 3> triangle_centers;
502 triangle_centers[0] = Point(0, _pitch * std::cos(libMesh::pi / 6) * 2 / 3 * shrink_factor, 0);
503 triangle_centers[1] = Point(-_pitch * 0.5 * shrink_factor,
504 -_pitch * std::cos(libMesh::pi / 6) * 1 / 3 * shrink_factor,
505 0);
506 triangle_centers[2] = Point(
507 _pitch * 0.5 * shrink_factor, -_pitch * std::cos(libMesh::pi / 6) * 1 / 3 * shrink_factor, 0);
508
509 const unsigned int m_sixth = theta_res_triangle / 6;
510 const unsigned int m_quarter = theta_res_square / 4;
511 // Build an array of points that represent a cross section of a center subchannel
512 // cell. The points are ordered in this fashion:
513 // 3 1
514 // 2
515 // 0
516 // 4 5 8 9
517 // 6 7
518 std::array<Point, points_per_center> center_points{};
519 center_points[0] = Point(0, 0, 0);
520 {
521 unsigned int start;
522 for (unsigned int i = 0; i < 3; i++)
523 {
524 if (i == 0)
525 start = 5 * (m_sixth);
526 if (i == 1)
527 start = 1 * (m_sixth);
528 if (i == 2)
529 start = 3 * (m_sixth);
530 for (unsigned int ii = 0; ii < points_per_sixth; ii++)
531 {
532 auto c_pt = circle_points_triangle[start - ii];
533 center_points[i * points_per_sixth + ii + 1] = triangle_centers[i] + c_pt;
534 }
535 }
536 }
537
538 // Build an array of points that represent a cross section of a top left corner subchannel
539 // cell. The points are ordered in this fashion (x direction towards point 4, y direction towards
540 // point 6):
541 // 5 6
542 //
543 // 0
544 // 4 2 3
545 // 1
546 std::array<Point, points_per_corner> corner_points{};
547 corner_points[0] = Point(0, 0, 0);
548 {
549 for (unsigned int ii = 0; ii < points_per_sixth; ii++)
550 {
551 auto c_pt = circle_points_triangle[1 * m_quarter - ii];
552 corner_points[ii + 1] = quadrant_centers_corner[0] + c_pt;
553 }
554 Real side_short = (_duct_to_pin_gap + _pin_diameter) * 0.5;
555 Real side_long = (2.0 * _duct_to_pin_gap + _pin_diameter) * 0.5;
556 Real side_length = std::sqrt(std::pow(side_short, 2) + std::pow(side_long, 2) -
557 2 * side_short * side_long * std::cos(libMesh::pi / 6));
558 Real angle =
560 std::acos((-std::pow(side_long, 2) + std::pow(side_short, 2) + std::pow(side_length, 2)) /
561 (2 * side_short * side_length));
562 corner_points[points_per_sixth + 1] = Point(side_length * std::cos(angle) * shrink_factor,
563 -side_length * std::sin(angle) * shrink_factor,
564 0);
565 corner_points[points_per_sixth + 2] =
566 Point(side_length * std::sin(libMesh::pi / 2 - angle - libMesh::pi / 6) * shrink_factor *
567 std::tan(libMesh::pi / 6),
568 side_length * std::sin(libMesh::pi / 2 - angle - libMesh::pi / 6) * shrink_factor,
569 0);
570 corner_points[points_per_sixth + 3] =
571 Point(-side_length * std::cos(libMesh::pi / 2 - angle - libMesh::pi / 6) * shrink_factor,
572 side_length * std::sin(libMesh::pi / 2 - angle - libMesh::pi / 6) * shrink_factor,
573 0);
574 }
575
576 // Build an array of points that represent a cross-section of a top side subchannel
577 // cell. The points are ordered in this fashion:
578 // 8 7
579 //
580 // 0
581 // 1 2 5 6
582 // 3 4
583 std::array<Point, points_per_side> side_points{};
584 side_points[0] = Point(0, 0, 0);
585 {
586 for (unsigned int ii = 0; ii < points_per_quadrant; ii++)
587 {
588 auto c_pt = circle_points_square[m_quarter - ii];
589 side_points[ii + 1] = quadrant_centers_sides[0] + c_pt;
590 }
591 for (unsigned int ii = 0; ii < points_per_quadrant; ii++)
592 {
593 auto c_pt = circle_points_square[2 * m_quarter - ii];
594 side_points[points_per_quadrant + ii + 1] = quadrant_centers_sides[1] + c_pt;
595 }
596 side_points[2 * points_per_quadrant + 1] =
597 Point(_pitch * 0.5 * shrink_factor, 0.5 * _duct_to_pin_gap * shrink_factor, 0);
598 side_points[2 * points_per_quadrant + 2] =
599 Point(-_pitch * 0.5 * shrink_factor, 0.5 * _duct_to_pin_gap * shrink_factor, 0);
600 }
601
602 int point_counter = 0;
603 unsigned int node_id = 0;
604 for (unsigned int i = 0; i < _n_channels; i++)
605 {
606 // Real offset_x = _flat_to_flat / 2.0;
607 // Real offset_y = _flat_to_flat / 2.0;
608
610 {
611 for (auto z : _z_grid)
612 {
613 // Get height
614 Point z0{0, 0, z};
615
616 // Get suchannel position and assign to point
617 auto loc_position = getSubchannelPosition(i);
618 Point p0{loc_position[0], loc_position[1], 0};
619
620 // Determine orientation of current subchannel
621 auto subchannel_pins = getSubChannelPins(i);
622 Point subchannel_side =
623 getPinPosition(subchannel_pins[0]) + getPinPosition(subchannel_pins[1]);
624 Point base_center_orientation = {0, -1};
625
626 // Get rotation angle for current subchannel
627 Real dot_prod = 0;
628 for (unsigned int lp = 0; lp < 2; lp++)
629 dot_prod += base_center_orientation(lp) * subchannel_side(lp);
630 auto theta =
631 std::acos(dot_prod / (base_center_orientation.norm() * subchannel_side.norm()));
632 if (subchannel_side(0) < 0)
633 theta = 2.0 * libMesh::pi - theta;
634
635 // Real distance_side = subchannel_side.norm();
636 // Real distance_top = getPinPosition(subchannel_pins[2]).norm();
637 // if (distance_top > distance_side)
638 // theta += libMesh::pi * 0.0;
639
640 theta += _orientation_map[i];
641
642 theta = trunc((theta + (libMesh::pi / 6.0)) / (libMesh::pi / 3.0)) * libMesh::pi / 3.0;
643
644 if (_verbose)
645 {
646 if (z == 0)
647 {
648 _console << "Subchannel Position: " << p0 << std::endl;
649 auto pins = getSubChannelPins(i);
650 for (auto r : pins)
651 _console << r << " ";
652 _console << std::endl;
653 _console << "Theta: " << theta / libMesh::pi * 180. << std::endl;
654 }
655 }
656
657 // Assigning points for center channels
658 for (unsigned int i = 0; i < points_per_center; i++)
659 {
660 auto new_point = rotatePoint(center_points[i], theta) + p0 + z0;
661 if (_verbose)
662 {
663 if (z == 0)
664 _console << i << " - " << new_point << std::endl;
665 }
666 mesh_base->add_point(new_point, node_id++);
667 point_counter += 1;
668 }
669 }
670 }
672 {
673 for (auto z : _z_grid)
674 {
675 // Get height
676 Point z0{0, 0, z};
677
678 // Get suchannel position and assign to point
679 auto loc_position = getSubchannelPosition(i);
680 Point p0{loc_position[0], loc_position[1], 0};
681
682 // Determine orientation of current subchannel
683 auto subchannel_pins = getSubChannelPins(i);
684 Point subchannel_side =
685 getPinPosition(subchannel_pins[0]) + getPinPosition(subchannel_pins[1]);
686 Point base_center_orientation = {0, 1};
687
688 // Get rotation angle for current subchannel
689 Real dot_prod = 0;
690 for (unsigned int lp = 0; lp < 2; lp++)
691 dot_prod += base_center_orientation(lp) * subchannel_side(lp);
692 auto theta =
693 std::acos(dot_prod / (base_center_orientation.norm() * subchannel_side.norm()));
694 if (subchannel_side(0) > 0)
695 theta = 2. * libMesh::pi - theta;
696 theta = trunc((theta + (libMesh::pi / 6.0)) / (libMesh::pi / 3.0)) * libMesh::pi / 3.0;
697
698 if (_verbose)
699 {
700 if (z == 0)
701 {
702 _console << "Subchannel Position: " << p0 << std::endl;
703 auto pins = getSubChannelPins(i);
704 for (auto r : pins)
705 _console << r << " ";
706 _console << std::endl;
707 _console << "Theta: " << theta * 180 / libMesh::pi << std::endl;
708 }
709 }
710
711 // Assigning points for center channels
712 for (unsigned int i = 0; i < points_per_side; i++)
713 {
714 auto new_point = rotatePoint(side_points[i], theta) + p0 + z0;
715 if (_verbose)
716 {
717 if (z == 0)
718 _console << i << " - " << new_point << std::endl;
719 }
720 mesh_base->add_point(new_point, node_id++);
721 point_counter += 1;
722 }
723 }
724 }
725 else // getSubchannelType(i) == EChannelType::CORNER
726 {
727 for (auto z : _z_grid)
728 {
729 // Get height
730 Point z0{0, 0, z};
731
732 // Get suchannel position and assign to point
733 auto loc_position = getSubchannelPosition(i);
734 Point p0{loc_position[0], loc_position[1], 0};
735
736 // Determine orientation of current subchannel
737 auto subchannel_pins = getSubChannelPins(i);
738 Point subchannel_side = getPinPosition(subchannel_pins[0]);
739 Point base_center_orientation = {1, 1};
740
741 // Get rotation angle for current subchannel
742 Real dot_prod = 0;
743 for (unsigned int lp = 0; lp < 2; lp++)
744 dot_prod += base_center_orientation(lp) * subchannel_side(lp);
745 auto theta =
746 std::acos(dot_prod / (base_center_orientation.norm() * subchannel_side.norm()));
747 if (subchannel_side(0) > 0)
748 theta = 2. * libMesh::pi - theta;
749 theta = trunc((theta + (libMesh::pi / 6.0)) / (libMesh::pi / 3.0)) * libMesh::pi / 3.0;
750
751 if (_verbose)
752 {
753 if (z == 0)
754 {
755 _console << "Subchannel Position: " << p0 << std::endl;
756 auto pins = getSubChannelPins(i);
757 for (auto r : pins)
758 _console << r << " ";
759 _console << std::endl;
760 _console << "Theta: " << theta * 180 / libMesh::pi << std::endl;
761 }
762 }
763
764 // Assigning points for center channels
765 for (unsigned int i = 0; i < points_per_corner; i++)
766 {
767 auto new_point = rotatePoint(corner_points[i], theta) + p0 + z0;
768 if (_verbose)
769 {
770 if (z == 0)
771 _console << i << " - " << new_point << std::endl;
772 }
773 mesh_base->add_point(new_point, node_id++);
774 point_counter += 1;
775 }
776 }
777 }
778 } // i
779 if (_verbose)
780 _console << "Point counter: " << point_counter << std::endl;
781
782 int element_counter = 0;
783 unsigned int elem_id = 0;
784 unsigned int number_of_corner = 0;
785 unsigned int number_of_side = 0;
786 unsigned int number_of_center = 0;
787 unsigned int elems_per_channel = 0;
788 unsigned int points_per_channel = 0;
789 for (unsigned int i = 0; i < _n_channels; i++)
790 {
791 auto subch_type = getSubchannelType(i);
792 if (subch_type == EChannelType::CORNER)
793 {
794 number_of_corner++;
795 elems_per_channel = elems_per_corner;
796 points_per_channel = points_per_corner;
797 if (_verbose)
798 _console << "Corner" << std::endl;
799 }
800 else if (subch_type == EChannelType::EDGE)
801 {
802 number_of_side++;
803 elems_per_channel = elems_per_side;
804 points_per_channel = points_per_side;
805 if (_verbose)
806 _console << "Edge" << std::endl;
807 }
808 else if (subch_type == EChannelType::CENTER)
809 {
810 number_of_center++;
811 elems_per_channel = elems_per_center;
812 points_per_channel = points_per_center;
813 if (_verbose)
814 _console << "Center" << std::endl;
815 }
816 for (unsigned int iz = 0; iz < _n_cells; iz++)
817 {
818 unsigned int elapsed_points = number_of_corner * points_per_corner * (_n_cells + 1) +
819 number_of_side * points_per_side * (_n_cells + 1) +
820 number_of_center * points_per_center * (_n_cells + 1) -
821 points_per_channel * (_n_cells + 1);
822 // index of the central node at base of cell
823 unsigned int indx1 = iz * points_per_channel + elapsed_points;
824 // index of the central node at top of cell
825 unsigned int indx2 = (iz + 1) * points_per_channel + elapsed_points;
826
827 for (unsigned int i = 0; i < elems_per_channel; i++)
828 {
829 Elem * elem = mesh_base->add_elem(std::make_unique<Prism6>());
830 elem->subdomain_id() = _subchannel_block_id;
831 elem->set_id(elem_id++);
832
833 if (_verbose)
834 _console << "Node 0: " << *mesh_base->node_ptr(indx1) << std::endl;
835
836 elem->set_node(0, mesh_base->node_ptr(indx1));
837 elem->set_node(1, mesh_base->node_ptr(indx1 + i + 1));
838 if (i != elems_per_channel - 1)
839 elem->set_node(2, mesh_base->node_ptr(indx1 + i + 2));
840 else
841 elem->set_node(2, mesh_base->node_ptr(indx1 + 1));
842
843 elem->set_node(3, mesh_base->node_ptr(indx2));
844 elem->set_node(4, mesh_base->node_ptr(indx2 + i + 1));
845 if (i != elems_per_channel - 1)
846 elem->set_node(5, mesh_base->node_ptr(indx2 + i + 2));
847 else
848 elem->set_node(5, mesh_base->node_ptr(indx2 + 1));
849
850 if (iz == 0)
851 boundary_info.add_side(elem, 0, 0);
852 if (iz == _n_cells - 1)
853 boundary_info.add_side(elem, 4, 1);
854
855 element_counter += 1;
856 }
857 }
858 }
859 if (_verbose)
860 _console << "Element counter: " << element_counter << std::endl;
861 boundary_info.sideset_name(0) = "inlet";
862 boundary_info.sideset_name(1) = "outlet";
863 mesh_base->set_subdomain_name(_subchannel_block_id, "subchannel", true);
864 if (n_pins > 0)
865 {
866 _elem_id = mesh_base->n_elem();
867 for (auto & ctr : _pin_position)
868 generatePin(mesh_base, ctr);
869 }
870 if (n_pins > 0)
871 mesh_base->set_subdomain_name(_pin_block_id, "fuel_pins", true);
872 if (_verbose)
873 _console << "Mesh assembly done" << std::endl;
874 mesh_base->prepare_for_use();
875
876 return mesh_base;
877}
const ConsoleStream _console
std::unique_ptr< MeshBase > buildMeshBaseObject(unsigned int dim=libMesh::invalid_uint)
Point rotatePoint(Point b, Real theta)
rotate a point by theta radians about the origin
EChannelType getSubchannelType(unsigned int index) const
returns the type of the subchannel given the index
Point getPinPosition(unsigned int i)
returns the position of pin given pin index
std::vector< unsigned int > getSubChannelPins(unsigned int i)
returns the index of neighboring pins given subchannel index
void generatePin(std::unique_ptr< MeshBase > &mesh_base, const Point &center)
Generate one detailed fuel pin volume centered at the supplied point.
std::vector< Real > getSubchannelPosition(unsigned int i)
returns the position of subchannel given pin index
const Real radius

◆ generatePin()

void SCMTriVisualizationAssemblyMeshGenerator::generatePin ( std::unique_ptr< MeshBase > &  mesh_base,
const Point &  center 
)
protected

Generate one detailed fuel pin volume centered at the supplied point.

Definition at line 338 of file SCMTriVisualizationAssemblyMeshGenerator.C.

340{
341 const Real dalpha = 360. / _num_sectors;
342 const Real radius = _pin_diameter / 2.;
343
344 // Add a center node and radial boundary nodes on each axial level so each pin is discretized into
345 // triangular prism sectors.
346 std::vector<std::vector<Node *>> nodes;
347 nodes.resize(_n_cells + 1);
348 for (unsigned int k = 0; k < _n_cells + 1; k++)
349 {
350 const Real elev = _z_grid[k];
351 nodes[k].push_back(mesh_base->add_point(Point(center(0), center(1), elev)));
352 Real alpha = 0.;
353 for (unsigned int i = 0; i < _num_sectors; i++, alpha += dalpha)
354 {
355 const Real dx = radius * std::cos(alpha * M_PI / 180.);
356 const Real dy = radius * std::sin(alpha * M_PI / 180.);
357 nodes[k].push_back(mesh_base->add_point(Point(center(0) + dx, center(1) + dy, elev)));
358 }
359 }
360
361 // Add the pin volume elements, linking matching radial sectors between adjacent axial levels.
362 for (unsigned int k = 0; k < _n_cells; k++)
363 for (unsigned int i = 0; i < _num_sectors; i++)
364 {
365 Elem * elem = mesh_base->add_elem(std::make_unique<Prism6>());
366 elem->subdomain_id() = _pin_block_id;
367 elem->set_id(_elem_id++);
368 const unsigned int ctr_idx = 0;
369 const unsigned int idx1 = (i % _num_sectors) + 1;
370 const unsigned int idx2 = ((i + 1) % _num_sectors) + 1;
371 elem->set_node(0, nodes[k][ctr_idx]);
372 elem->set_node(1, nodes[k][idx1]);
373 elem->set_node(2, nodes[k][idx2]);
374 elem->set_node(3, nodes[k + 1][ctr_idx]);
375 elem->set_node(4, nodes[k + 1][idx1]);
376 elem->set_node(5, nodes[k + 1][idx2]);
377 }
378}
Point center

Referenced by generate().

◆ getPinPosition()

Point SCMTriVisualizationAssemblyMeshGenerator::getPinPosition ( unsigned int  i)
inlineprotected

returns the position of pin given pin index

Definition at line 32 of file SCMTriVisualizationAssemblyMeshGenerator.h.

32{ return _pin_position[i]; }

Referenced by generate().

◆ getSubChannelPins()

std::vector< unsigned int > SCMTriVisualizationAssemblyMeshGenerator::getSubChannelPins ( unsigned int  i)
inlineprotected

returns the index of neighboring pins given subchannel index

Definition at line 36 of file SCMTriVisualizationAssemblyMeshGenerator.h.

36{ return _chan_to_pin_map[i]; }

Referenced by generate().

◆ getSubchannelPosition()

std::vector< Real > SCMTriVisualizationAssemblyMeshGenerator::getSubchannelPosition ( unsigned int  i)
inlineprotected

returns the position of subchannel given pin index

Definition at line 34 of file SCMTriVisualizationAssemblyMeshGenerator.h.

34{ return _subchannel_position[i]; }

Referenced by generate().

◆ getSubchannelType()

EChannelType SCMTriVisualizationAssemblyMeshGenerator::getSubchannelType ( unsigned int  index) const
inlineprotected

returns the type of the subchannel given the index

Definition at line 26 of file SCMTriVisualizationAssemblyMeshGenerator.h.

26{ return _subch_type[index]; }

Referenced by generate().

◆ rotatePoint()

Point SCMTriVisualizationAssemblyMeshGenerator::rotatePoint ( Point  b,
Real  theta 
)
protected

rotate a point by theta radians about the origin

Definition at line 880 of file SCMTriVisualizationAssemblyMeshGenerator.C.

881{
882 std::vector<std::vector<Real>> A(3, std::vector<Real>(3));
883
884 A[0] = {std::cos(theta), -std::sin(theta), 0.0};
885 A[1] = {std::sin(theta), std::cos(theta), 0.0};
886 A[2] = {0.0, 0.0, 1.0};
887
888 Point rotated_vector = Point(0.0, 0.0, 0.0);
889 for (unsigned int i = 0; i < 3; i++)
890 for (unsigned int j = 0; j < 3; j++)
891 rotated_vector(i) += A[i][j] * b(j);
892
893 return rotated_vector;
894}

Referenced by generate().

◆ validParams()

InputParameters SCMTriVisualizationAssemblyMeshGenerator::validParams ( )
static

Definition at line 41 of file SCMTriVisualizationAssemblyMeshGenerator.C.

42{
45 "Creates a 3D visualization mesh of subchannels and pins in a triangular lattice "
46 "arrangement");
47 params.addRequiredParam<Real>("pitch", "Pitch [m]");
48 params.addRequiredParam<Real>("pin_diameter", "Rod diameter [m]");
49 params.addParam<Real>("unheated_length_entry", 0.0, "Unheated length at entry [m]");
50 params.addRequiredParam<Real>("heated_length", "Heated length [m]");
51 params.addParam<Real>("unheated_length_exit", 0.0, "Unheated length at exit [m]");
52 params.addRequiredParam<unsigned int>(
53 "nrings",
54 "Number of fuel-pin rings per assembly, counting the center pin as the first ring [-]");
55 params.addRequiredParam<Real>("flat_to_flat",
56 "Flat to flat distance for the hexagonal assembly [m]");
57 params.addRequiredParam<unsigned int>("n_cells", "The number of cells in the axial direction");
58 params.addRangeCheckedParam<unsigned int>("num_sectors",
59 16,
60 "num_sectors>=4",
61 "Number of azimuthal sectors used to discretize each "
62 "circular pin cross section.");
63 params.addParam<unsigned int>("block_id", 0, "Subchannel block id.");
64 params.deprecateParam("block_id", "subchannel_block_id", "07/01/2027");
65 params.addParam<unsigned int>("pin_block_id", 1, "Fuel pin block id.");
66 params.addParam<bool>("verbose_flag", false, "Flag to print out the mesh coordinates.");
67 return params;
68}
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addParam(const std::string &name, const std::initializer_list< typename T::value_type > &value, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
void deprecateParam(const std::string &old_name, const std::string &new_name, const std::string &removal_date)
void addRangeCheckedParam(const std::string &name, const T &value, const std::string &parsed_function, const std::string &doc_string)
static InputParameters validParams()

Member Data Documentation

◆ _chan_to_pin_map

std::vector<std::vector<unsigned int> > SCMTriVisualizationAssemblyMeshGenerator::_chan_to_pin_map
protected

stores the fuel pins belonging to each subchannel

Definition at line 77 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by getSubChannelPins(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _elem_id

dof_id_type SCMTriVisualizationAssemblyMeshGenerator::_elem_id
protected

counter for element numbering

Definition at line 81 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), and generatePin().

◆ _flat_to_flat

const Real SCMTriVisualizationAssemblyMeshGenerator::_flat_to_flat
protected

Half of gap between adjacent assemblies.

Definition at line 53 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _heated_length

const Real SCMTriVisualizationAssemblyMeshGenerator::_heated_length
protected

heated length of the fuel Pin

Definition at line 41 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by SCMTriVisualizationAssemblyMeshGenerator().

◆ _n_cells

const unsigned int SCMTriVisualizationAssemblyMeshGenerator::_n_cells
protected

Number of cells in the axial direction.

Definition at line 67 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), generatePin(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _n_channels

unsigned int SCMTriVisualizationAssemblyMeshGenerator::_n_channels
protected

number of subchannels

Definition at line 75 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _n_rings

const unsigned int SCMTriVisualizationAssemblyMeshGenerator::_n_rings
protected

Number of rings in the geometry.

Definition at line 51 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _nrods

unsigned int SCMTriVisualizationAssemblyMeshGenerator::_nrods
protected

Number of pins.

Definition at line 69 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by SCMTriVisualizationAssemblyMeshGenerator().

◆ _num_sectors

const unsigned int SCMTriVisualizationAssemblyMeshGenerator::_num_sectors
protected

Number of azimuthal sectors used to discretize each circular pin cross section.

Definition at line 55 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), and generatePin().

◆ _orientation_map

std::map<unsigned int, Real> SCMTriVisualizationAssemblyMeshGenerator::_orientation_map
protected

map inner and outer rings

Definition at line 73 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _pin_block_id

const unsigned int SCMTriVisualizationAssemblyMeshGenerator::_pin_block_id
protected

Pin subdomain ID.

Definition at line 65 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), and generatePin().

◆ _pin_diameter

const Real SCMTriVisualizationAssemblyMeshGenerator::_pin_diameter
protected

fuel Pin diameter

Definition at line 49 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), generatePin(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _pin_position

std::vector<Point> SCMTriVisualizationAssemblyMeshGenerator::_pin_position
protected

x,y coordinates of the fuel pins

Definition at line 59 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), getPinPosition(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _pins_in_rings

std::vector<std::vector<unsigned int> > SCMTriVisualizationAssemblyMeshGenerator::_pins_in_rings
protected

fuel pins that are belonging to each ring

Definition at line 71 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by SCMTriVisualizationAssemblyMeshGenerator().

◆ _pitch

const Real SCMTriVisualizationAssemblyMeshGenerator::_pitch
protected

Distance between the neighbor fuel pins, pitch.

Definition at line 47 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _subch_type

std::vector<EChannelType> SCMTriVisualizationAssemblyMeshGenerator::_subch_type
protected

Subchannel type.

Definition at line 57 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by getSubchannelType(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _subchannel_block_id

const unsigned int SCMTriVisualizationAssemblyMeshGenerator::_subchannel_block_id
protected

Subchannel subdomain ID.

Definition at line 63 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate().

◆ _subchannel_position

std::vector<std::vector<Real> > SCMTriVisualizationAssemblyMeshGenerator::_subchannel_position
protected

x,y coordinates of the subchannels

Definition at line 61 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by getSubchannelPosition(), and SCMTriVisualizationAssemblyMeshGenerator().

◆ _unheated_length_entry

const Real SCMTriVisualizationAssemblyMeshGenerator::_unheated_length_entry
protected

unheated length of the fuel Pin at the entry of the assembly

Definition at line 39 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by SCMTriVisualizationAssemblyMeshGenerator().

◆ _unheated_length_exit

const Real SCMTriVisualizationAssemblyMeshGenerator::_unheated_length_exit
protected

unheated length of the fuel Pin at the exit of the assembly

Definition at line 43 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by SCMTriVisualizationAssemblyMeshGenerator().

◆ _verbose

const bool SCMTriVisualizationAssemblyMeshGenerator::_verbose
protected

Flag to print out the detailed mesh assembly and coordinates.

Definition at line 79 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate().

◆ _z_grid

std::vector<Real> SCMTriVisualizationAssemblyMeshGenerator::_z_grid
protected

axial location of nodes

Definition at line 45 of file SCMTriVisualizationAssemblyMeshGenerator.h.

Referenced by generate(), generatePin(), and SCMTriVisualizationAssemblyMeshGenerator().


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