diff --git a/include/openmc/settings.h b/include/openmc/settings.h index aa9f9c056..47ca0f078 100644 --- a/include/openmc/settings.h +++ b/include/openmc/settings.h @@ -61,7 +61,8 @@ extern std::string path_statepoint; //!< path to a statepoint file extern "C" int32_t index_entropy_mesh; //!< Index of entropy mesh in global mesh array extern "C" int32_t index_ufs_mesh; //!< Index of UFS mesh in global mesh array - +extern "C" int32_t index_cmfd_mesh; //!< Index of CMFD mesh in global mesh array + extern "C" int32_t n_batches; //!< number of (inactive+active) batches extern "C" int32_t n_inactive; //!< number of inactive batches extern "C" int32_t gen_per_batch; //!< number of generations per batch diff --git a/src/cmfd_execute.cpp b/src/cmfd_execute.cpp index aa9907a5b..415ddfaeb 100644 --- a/src/cmfd_execute.cpp +++ b/src/cmfd_execute.cpp @@ -9,10 +9,11 @@ #include "openmc/mesh.h" #include "openmc/message_passing.h" #include "openmc/simulation.h" +#include "openmc/settings.h" namespace openmc { -extern "C" int index_cmfd_mesh; + //extern "C" int index_cmfd_mesh; extern "C" void cmfd_populate_sourcecounts(int n_energy, const double* energies, @@ -24,7 +25,7 @@ cmfd_populate_sourcecounts(int n_energy, const double* energies, openmc_source_bank(&source_bank, &n); // Get source counts in each mesh bin / energy bin - auto& m = meshes.at(index_cmfd_mesh); + auto& m = meshes.at(settings::index_cmfd_mesh); xt::xarray counts = m->count_sites(simulation::work, source_bank, n_energy, energies, outside); // Copy data from the xarray into the source counts array diff --git a/src/plot.cpp b/src/plot.cpp index 2e55a575b..f271c47c3 100644 --- a/src/plot.cpp +++ b/src/plot.cpp @@ -560,14 +560,14 @@ ObjectPlot::set_meshlines() } else { index_meshlines_mesh = settings::index_ufs_mesh; } - // } else if ("cmfd" == meshtype) { - // if (!settings::cmfd_run) { - // std::stringstream err_msg; - // err_msg << "Need CMFD run to plot CMFD mesh for meshlines on plot " << id; - // fatal_error(err_msg); - // } else { - // index_meshlines_mesh = settings::index_cmfd_mesh; - // } + } else if ("cmfd" == meshtype) { + if (!settings::cmfd_run) { + std::stringstream err_msg; + err_msg << "Need CMFD run to plot CMFD mesh for meshlines on plot " << id; + fatal_error(err_msg); + } else { + index_meshlines_mesh = settings::index_cmfd_mesh; + } } else if ("entropy" == meshtype) { if (settings::index_entropy_mesh < 0) { std::stringstream err_msg; diff --git a/src/settings.cpp b/src/settings.cpp index ce0925978..2394597c7 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -72,7 +72,8 @@ std::string path_statepoint; int32_t index_entropy_mesh {-1}; int32_t index_ufs_mesh {-1}; - +int32_t index_cmfd_mesh {-1}; + int32_t n_batches; int32_t n_inactive {0}; int32_t gen_per_batch {1};