diff --git a/README.md b/README.md index 6dcb280..6e34c78 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,7 @@ solver_parameters: max_power_iterations: 500 rays_per_face: 10 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "../examples/cube/output/flux.dat" diff --git a/examples/cow/cow.yaml b/examples/cow/cow.yaml index bd6a514..f7d7c4d 100644 --- a/examples/cow/cow.yaml +++ b/examples/cow/cow.yaml @@ -21,11 +21,11 @@ solver_parameters: max_power_iterations: 5000 rays_per_face: 10 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "../examples/cow/output/flux.txt" k_eff_output_file: "../examples/cow/output/k_eff.txt" logging: - level: "ERROR" - log_file: "logs/solver.log" \ No newline at end of file + level: "ERROR" \ No newline at end of file diff --git a/examples/cube/cube.yaml b/examples/cube/cube.yaml index f3861a3..292b5fc 100644 --- a/examples/cube/cube.yaml +++ b/examples/cube/cube.yaml @@ -21,11 +21,11 @@ solver_parameters: max_power_iterations: 300 rays_per_face: 10 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "../examples/cube/output/flux.txt" k_eff_output_file: "../examples/cube/output/k_eff.txt" logging: - level: "RUNNING" - log_file: "logs/solver.log" \ No newline at end of file + level: "RUNNING" \ No newline at end of file diff --git a/examples/cylinder/cylinder.yaml b/examples/cylinder/cylinder.yaml deleted file mode 100644 index 9c063d1..0000000 --- a/examples/cylinder/cylinder.yaml +++ /dev/null @@ -1,31 +0,0 @@ -mesh: - nodes: "../examples/cylinder/nodes.txt" - cells: "../examples/cylinder/cells.txt" - faces: "../examples/cylinder/faces.txt" - -cross_sections: - data_files: - - "../examples/cylinder/xs.txt" - -angular_quadrature: - ntheta: 4 - nphi: 4 - -solver_parameters: - multi_group_max_iterations: 1000 - multi_group_tolerance: 1e-5 - one_group_max_iterations: 500 - one_group_tolerance: 1e-5 - fission_source_tolerance: 1e-4 - keff_tolerance: 1e-6 - max_power_iterations: 1000 - rays_per_face: 8 - max_ray_length: 1000 - -output: - flux_output_file: "../examples/cylinder/output/flux.txt" - k_eff_output_file: "../examples/cylinder/output/k_eff.txt" - -logging: - level: "ERROR" - log_file: "logs/solver.log" \ No newline at end of file diff --git a/examples/sphere/sphere.yaml b/examples/sphere/sphere.yaml index 22e6ee2..df84580 100644 --- a/examples/sphere/sphere.yaml +++ b/examples/sphere/sphere.yaml @@ -21,11 +21,11 @@ solver_parameters: max_power_iterations: 500 rays_per_face: 8 max_ray_length: 5000 + use_half_hemisphere: false output: flux_output_file: "../examples/sphere/output/flux.txt" k_eff_output_file: "../examples/sphere/output/k_eff.txt" logging: - level: "ERROR" - log_file: "logs/solver.log" \ No newline at end of file + level: "ERROR" \ No newline at end of file diff --git a/include/InputDeck.hpp b/include/InputDeck.hpp index 49a5370..288eccf 100644 --- a/include/InputDeck.hpp +++ b/include/InputDeck.hpp @@ -34,6 +34,7 @@ struct SolverParameters { int max_power_iterations; int rays_per_face; int max_ray_length; + bool use_half_hemisphere; // use only the upper hemisphere for ray tracing and symmetrize afterwards }; // Structure to hold output settings @@ -45,7 +46,6 @@ struct OutputSettings { // Structure to hold logging settings struct LoggingSettings { std::string level; - std::string log_file; }; // Main structure to hold the entire input deck diff --git a/src/InputDeck.cpp b/src/InputDeck.cpp index 7f62348..b45b2f2 100644 --- a/src/InputDeck.cpp +++ b/src/InputDeck.cpp @@ -43,6 +43,7 @@ InputDeck InputDeckParser::parse(const std::string& filename) { deck.solver_parameters.max_power_iterations = sp_node["max_power_iterations"].as(); deck.solver_parameters.rays_per_face = sp_node["rays_per_face"].as(); deck.solver_parameters.max_ray_length = sp_node["max_ray_length"].as(); + deck.solver_parameters.use_half_hemisphere = sp_node["use_half_hemisphere"].as(); // Parse output settings YAML::Node out_node = config["output"]; @@ -57,7 +58,6 @@ InputDeck InputDeckParser::parse(const std::string& filename) { YAML::Node log_node = config["logging"]; if (!log_node) throw std::runtime_error("Missing 'logging' section in YAML."); deck.logging.level = log_node["level"].as(); - deck.logging.log_file = log_node["log_file"].as(); } catch (const YAML::Exception& e) { std::cerr << "YAML Parsing Error: " << e.what() << std::endl; diff --git a/src/main.cpp b/src/main.cpp index a25e2bb..4e62bd9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -67,7 +67,7 @@ int main(int argc, char* argv[]) { Field field; bool constant_dir_bool = true; - bool use_half_quadrature_for_constant = false; + bool use_half_quadrature_for_constant = input_deck.solver_parameters.use_half_hemisphere; // Initialize RayTracerManager and generate tracking data RayTracerManager ray_tracer_manager(mesh_handler, field, angular_quadrature, constant_dir_bool, @@ -76,6 +76,10 @@ int main(int argc, char* argv[]) { int rays_per_face = input_deck.solver_parameters.rays_per_face; int max_ray_length = input_deck.solver_parameters.max_ray_length; ray_tracer_manager.generateTrackingData(rays_per_face, max_ray_length); + if (use_half_quadrature_for_constant) { + Logger::info("Using only the upper hemisphere for ray tracing, symmetrizing afterwards."); + ray_tracer_manager.doubleTrackingDataByReversing(); + } Logger::running("Tracking data generated."); diff --git a/tests/test_InputDeck.cpp b/tests/test_InputDeck.cpp index 9ea0b70..081a909 100644 --- a/tests/test_InputDeck.cpp +++ b/tests/test_InputDeck.cpp @@ -44,6 +44,7 @@ TEST(InputDeckTest, ParseValidInputDeck) { max_power_iterations: 100 rays_per_face: 8 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "output/flux.dat" @@ -51,7 +52,6 @@ TEST(InputDeckTest, ParseValidInputDeck) { logging: level: "INFO" - log_file: "logs/solver.log" )"; ASSERT_TRUE(createTempYAML(filename, yaml_content)) << "Failed to create temporary YAML file."; @@ -88,7 +88,6 @@ TEST(InputDeckTest, ParseValidInputDeck) { // Verify logging settings EXPECT_EQ(deck.logging.level, "INFO"); - EXPECT_EQ(deck.logging.log_file, "logs/solver.log"); // Clean up std::remove(filename.c_str()); @@ -116,6 +115,7 @@ TEST(InputDeckTest, ParseMissingMeshSection) { max_power_iterations: 100 rays_per_face: 8 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "output/flux.dat" @@ -123,7 +123,6 @@ TEST(InputDeckTest, ParseMissingMeshSection) { logging: level: "INFO" - log_file: "logs/solver.log" )"; ASSERT_TRUE(createTempYAML(filename, yaml_content)) << "Failed to create temporary YAML file."; @@ -158,6 +157,7 @@ TEST(InputDeckTest, ParseMissingCrossSectionsSection) { max_power_iterations: 100 rays_per_face: 8 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "output/flux.dat" @@ -165,7 +165,6 @@ TEST(InputDeckTest, ParseMissingCrossSectionsSection) { logging: level: "INFO" - log_file: "logs/solver.log" )"; ASSERT_TRUE(createTempYAML(filename, yaml_content)) << "Failed to create temporary YAML file."; @@ -204,6 +203,7 @@ TEST(InputDeckTest, ParseInvalidAngularQuadratureData) { max_power_iterations: 100 rays_per_face: 8 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "output/flux.dat" @@ -211,7 +211,6 @@ TEST(InputDeckTest, ParseInvalidAngularQuadratureData) { logging: level: "INFO" - log_file: "logs/solver.log" )"; ASSERT_TRUE(createTempYAML(filename, yaml_content)) << "Failed to create temporary YAML file."; @@ -246,7 +245,6 @@ TEST(InputDeckTest, ParseMissingSolverParametersSection) { logging: level: "INFO" - log_file: "logs/solver.log" )"; ASSERT_TRUE(createTempYAML(filename, yaml_content)) << "Failed to create temporary YAML file."; @@ -285,6 +283,7 @@ TEST(InputDeckTest, ParseInvalidSolverParametersValues) { max_power_iterations: 100 rays_per_face: 8 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "output/flux.dat" @@ -292,7 +291,6 @@ TEST(InputDeckTest, ParseInvalidSolverParametersValues) { logging: level: "INFO" - log_file: "logs/solver.log" )"; ASSERT_TRUE(createTempYAML(filename, yaml_content)) << "Failed to create temporary YAML file."; @@ -331,10 +329,10 @@ TEST(InputDeckTest, ParseMissingOutputSection) { max_power_iterations: 100 rays_per_face: 8 max_ray_length: 1000 + use_half_hemisphere: false logging: level: "INFO" - log_file: "logs/solver.log" )"; ASSERT_TRUE(createTempYAML(filename, yaml_content)) << "Failed to create temporary YAML file."; @@ -373,6 +371,7 @@ TEST(InputDeckTest, ParseMissingLoggingSection) { max_power_iterations: 100 rays_per_face: 8 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "output/flux.dat" @@ -458,6 +457,7 @@ TEST(InputDeckTest, ParseWithExtraSections) { max_power_iterations: 100 rays_per_face: 8 max_ray_length: 1000 + use_half_hemisphere: false output: flux_output_file: "output/flux.dat" @@ -465,7 +465,6 @@ TEST(InputDeckTest, ParseWithExtraSections) { logging: level: "INFO" - log_file: "logs/solver.log" extra_section: key: "value"