https://mooseframework.inl.gov
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  : MeshGenerator(params),
25  _input(getParam<MeshGeneratorName>("input")),
26  _input_mesh(&getMesh("input"))
27 {
28  // Assumes input has been generated by CoreMeshGenerator and contains valid metadata for generation
29  const auto reactor_params_name = getMeshProperty<std::string>(RGMB::reactor_params_name, _input);
30 
31  // Get assembly pitch from metadata and define a circular mesh that preserves volume of assembly structure
32  const auto assembly_pitch = getMeshProperty<double>(RGMB::assembly_pitch, reactor_params_name);
33  const auto mesh_geometry = getMeshProperty<std::string>(RGMB::mesh_geometry, reactor_params_name);
34  double vol_multiplier = (mesh_geometry == "Square") ? 1.0 : std::sqrt(3) / 2;
35  double equivalent_volume = vol_multiplier * assembly_pitch * assembly_pitch;
36  double equivalent_radius = std::sqrt(equivalent_volume / M_PI);
37 
38  {
39  auto mesh_params = _app.getFactory().getValidParams("AdvancedConcentricCircleGenerator");
40  mesh_params.set<std::vector<double>>("ring_radii") = {equivalent_radius};
41  mesh_params.set<std::vector<unsigned int>>("ring_intervals") = {1};
42  mesh_params.set<unsigned int>("num_sectors") = 8;
43  addMeshSubgenerator("AdvancedConcentricCircleGenerator", "eqv_core_circle", mesh_params);
44 
45  _build_mesh = &getMeshByName("eqv_core_circle");
46  }
47 }
48 
49 std::unique_ptr<MeshBase>
51 {
52  // Input mesh is essentially a data store to build the equivalent core, so we reset it as it is no
53  // longer needed. The mesh we care about is the one created by the subgenerator
54  _input_mesh->reset();
55  return std::move(*_build_mesh);
56 }
std::unique_ptr< MeshBase > & getMeshByName(const MeshGeneratorName &mesh_generator_name)
T & getMesh(MooseMesh &mesh)
function to cast mesh
Definition: SCM.h:35
T & set(const std::string &name, bool quiet_mode=false)
static const std::string reactor_params_name
static const std::string mesh_geometry
InputParameters getValidParams(const std::string &name) const
static const std::string assembly_pitch
void addRequiredParam(const std::string &name, const std::string &doc_string)
Factory & getFactory()
void addMeshSubgenerator(const std::string &type, const std::string &name, Ts... extra_input_parameters)
std::unique_ptr< MeshBase > * _input_mesh
The final mesh that is generated by the subgenerators; This mesh is pointed to by the input...
static InputParameters validParams()
MooseApp & _app
registerMooseObject("ReactorTestApp", TestReactorGeometryMeshBuilderMeshGenerator)
std::unique_ptr< MeshBase > * _build_mesh
The final mesh that is generated by the subgenerators;.