https://mooseframework.inl.gov
Loading...
Searching...
No Matches
TestReactorGeometryMeshBuilderMeshGenerator.C
Go to the documentation of this file.
1//* This file is part of the MOOSE framework
2//* https://mooseframework.inl.gov
3//*
4//* All rights reserved, see COPYRIGHT for full restrictions
5//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6//*
7//* Licensed under LGPL 2.1, please see LICENSE for details
8//* https://www.gnu.org/licenses/lgpl-2.1.html
9
12
14
17{
19 params.addRequiredParam<MeshGeneratorName>("input", "Input core mesh");
20 return params;
21}
22
24 const InputParameters & params)
25 : MeshGenerator(params),
26 _input(getParam<MeshGeneratorName>("input")),
27 _input_mesh(&getMesh("input"))
28{
29 // Assumes input has been generated by CoreMeshGenerator and contains valid metadata for
30 // generation
31 const auto reactor_params_name = getMeshProperty<std::string>(RGMB::reactor_params_name, _input);
32
33 // Get assembly pitch from metadata and define a circular mesh that preserves volume of assembly
34 // structure
35 const auto assembly_pitch = getMeshProperty<double>(RGMB::assembly_pitch, reactor_params_name);
36 const auto mesh_geometry = getMeshProperty<std::string>(RGMB::mesh_geometry, reactor_params_name);
37 double vol_multiplier = (mesh_geometry == "Square") ? 1.0 : std::sqrt(3) / 2;
38 double equivalent_volume = vol_multiplier * assembly_pitch * assembly_pitch;
39 double equivalent_radius = std::sqrt(equivalent_volume / M_PI);
40
41 {
42 auto mesh_params = _app.getFactory().getValidParams("AdvancedConcentricCircleGenerator");
43 mesh_params.set<std::vector<double>>("ring_radii") = {equivalent_radius};
44 mesh_params.set<std::vector<unsigned int>>("ring_intervals") = {1};
45 mesh_params.set<unsigned int>("num_sectors") = 8;
46 addMeshSubgenerator("AdvancedConcentricCircleGenerator", "eqv_core_circle", mesh_params);
47
48 _build_mesh = &getMeshByName("eqv_core_circle");
49 }
50}
51
52std::unique_ptr<MeshBase>
54{
55 // Input mesh is essentially a data store to build the equivalent core, so we reset it as it is no
56 // longer needed. The mesh we care about is the one created by the subgenerator
57 _input_mesh->reset();
58 return std::move(*_build_mesh);
59}
registerMooseObject("ReactorTestApp", TestReactorGeometryMeshBuilderMeshGenerator)
InputParameters getValidParams(const std::string &name) const
void addRequiredParam(const std::string &name, const std::string &doc_string)
T & set(const std::string &name, bool quiet_mode=false)
void addMeshSubgenerator(const std::string &type, const std::string &name, Ts... extra_input_parameters)
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
static InputParameters validParams()
Factory & getFactory()
MooseApp & _app
std::unique_ptr< MeshBase > * _build_mesh
The final mesh that is generated by the subgenerators;.
std::unique_ptr< MeshBase > * _input_mesh
The final mesh that is generated by the subgenerators; This mesh is pointed to by the input.
static const std::string assembly_pitch
static const std::string reactor_params_name
static const std::string mesh_geometry