mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Move run_mode and verbosity out of C API
This commit is contained in:
parent
a2345891b9
commit
bb69f52311
8 changed files with 16 additions and 13 deletions
|
|
@ -152,9 +152,7 @@ extern "C" {
|
|||
extern int32_t n_surfaces;
|
||||
extern int32_t n_tallies;
|
||||
extern int32_t n_universes;
|
||||
extern int openmc_run_mode;
|
||||
extern bool openmc_simulation_initialized;
|
||||
extern int openmc_verbosity;
|
||||
|
||||
// Variables that are shared by necessity (can be removed from public header
|
||||
// later)
|
||||
|
|
|
|||
|
|
@ -67,9 +67,11 @@ extern "C" int temperature_method; //!< method for choosing temperatures
|
|||
extern "C" int res_scat_method; //!< resonance upscattering method
|
||||
extern "C" double res_scat_energy_min; //!< Min energy in [eV] for res. upscattering
|
||||
extern "C" double res_scat_energy_max; //!< Max energy in [eV] for res. upscattering
|
||||
extern "C" int run_mode; //!< Run mode (eigenvalue, fixed src, etc.)
|
||||
extern "C" double temperature_tolerance; //!< Tolerance in [K] on choosing temperatures
|
||||
extern "C" double temperature_default; //!< Default T in [K]
|
||||
extern "C" double temperature_range[2]; //!< Min/max T in [K] over which to load xs
|
||||
extern "C" int verbosity; //!< How verbose to make output
|
||||
extern "C" double weight_cutoff; //!< Weight cutoff for Russian roulette
|
||||
extern "C" double weight_survive; //!< Survival weight after Russian roulette
|
||||
|
||||
|
|
|
|||
|
|
@ -20,11 +20,11 @@ class _Settings(object):
|
|||
generations_per_batch = _DLLGlobal(c_int32, 'gen_per_batch')
|
||||
inactive = _DLLGlobal(c_int32, 'n_inactive')
|
||||
particles = _DLLGlobal(c_int64, 'n_particles')
|
||||
verbosity = _DLLGlobal(c_int, 'openmc_verbosity')
|
||||
verbosity = _DLLGlobal(c_int, 'verbosity')
|
||||
|
||||
@property
|
||||
def run_mode(self):
|
||||
i = c_int.in_dll(_dll, 'openmc_run_mode').value
|
||||
i = c_int.in_dll(_dll, 'run_mode').value
|
||||
try:
|
||||
return _RUN_MODES[i]
|
||||
except KeyError:
|
||||
|
|
@ -32,7 +32,7 @@ class _Settings(object):
|
|||
|
||||
@run_mode.setter
|
||||
def run_mode(self, mode):
|
||||
current_idx = c_int.in_dll(_dll, 'openmc_run_mode')
|
||||
current_idx = c_int.in_dll(_dll, 'run_mode')
|
||||
for idx, mode_value in _RUN_MODES.items():
|
||||
if mode_value == mode:
|
||||
current_idx.value = idx
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ parse_command_line(int argc, char* argv[])
|
|||
std::string arg {argv[i]};
|
||||
if (arg[0] == '-') {
|
||||
if (arg == "-p" || arg == "--plot") {
|
||||
openmc_run_mode = RUN_MODE_PLOTTING;
|
||||
settings::run_mode = RUN_MODE_PLOTTING;
|
||||
settings::check_overlaps = true;
|
||||
|
||||
} else if (arg == "-n" || arg == "--particles") {
|
||||
|
|
@ -172,7 +172,7 @@ parse_command_line(int argc, char* argv[])
|
|||
} else if (arg == "-g" || arg == "--geometry-debug") {
|
||||
settings::check_overlaps = true;
|
||||
} else if (arg == "-c" || arg == "--volume") {
|
||||
openmc_run_mode = RUN_MODE_VOLUME;
|
||||
settings::run_mode = RUN_MODE_VOLUME;
|
||||
} else if (arg == "-s" || arg == "--threads") {
|
||||
// Read number of threads
|
||||
i += 1;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#endif
|
||||
#include "openmc/capi.h"
|
||||
#include "openmc/error.h"
|
||||
#include "openmc/settings.h"
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
|
|
@ -23,7 +24,7 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
// start problem based on mode
|
||||
switch (openmc_run_mode) {
|
||||
switch (openmc::settings::run_mode) {
|
||||
case RUN_MODE_FIXEDSOURCE:
|
||||
case RUN_MODE_EIGENVALUE:
|
||||
err = openmc_run();
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ void
|
|||
Particle::write_restart()
|
||||
{
|
||||
// Dont write another restart file if in particle restart mode
|
||||
if (openmc_run_mode == RUN_MODE_PARTICLE) return;
|
||||
if (settings::run_mode == RUN_MODE_PARTICLE) return;
|
||||
|
||||
// Set up file name
|
||||
std::stringstream filename;
|
||||
|
|
@ -169,7 +169,7 @@ Particle::write_restart()
|
|||
write_dataset(file_id, "generations_per_batch", gen_per_batch);
|
||||
write_dataset(file_id, "current_generation", openmc_current_gen);
|
||||
write_dataset(file_id, "n_particles", n_particles);
|
||||
switch (openmc_run_mode) {
|
||||
switch (settings::run_mode) {
|
||||
case RUN_MODE_FIXEDSOURCE:
|
||||
write_dataset(file_id, "run_mode", "fixed source");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -78,14 +78,14 @@ module settings
|
|||
real(C_DOUBLE) :: weight_survive
|
||||
|
||||
! Mode to run in (fixed source, eigenvalue, plotting, etc)
|
||||
integer(C_INT), bind(C, name='openmc_run_mode') :: run_mode = NONE
|
||||
integer(C_INT), bind(C) :: run_mode
|
||||
|
||||
! Restart run
|
||||
logical(C_BOOL), bind(C) :: restart_run
|
||||
|
||||
! The verbosity controls how much information will be printed to the screen
|
||||
! and in logs
|
||||
integer(C_INT), bind(C, name='openmc_verbosity') :: verbosity = 7
|
||||
integer(C_INT), bind(C) :: verbosity
|
||||
|
||||
logical(C_BOOL), bind(C) :: check_overlaps
|
||||
|
||||
|
|
|
|||
|
|
@ -64,10 +64,12 @@ int legendre_to_tabular_points {C_NONE};
|
|||
int res_scat_method {RES_SCAT_ARES};
|
||||
double res_scat_energy_min {0.01};
|
||||
double res_scat_energy_max {1000.0};
|
||||
int run_mode;
|
||||
int temperature_method {TEMPERATURE_NEAREST};
|
||||
double temperature_tolerance {10.0};
|
||||
double temperature_default {293.6};
|
||||
double temperature_range[2] {0.0, 0.0};
|
||||
int verbosity {7};
|
||||
double weight_cutoff {0.25};
|
||||
double weight_survive {1.0};
|
||||
|
||||
|
|
@ -92,7 +94,7 @@ void read_settings(pugi::xml_node* root)
|
|||
}
|
||||
|
||||
// Look for deprecated windowed_multipole file in settings.xml
|
||||
if (openmc_run_mode != RUN_MODE_PLOTTING) {
|
||||
if (run_mode != RUN_MODE_PLOTTING) {
|
||||
if (check_for_node(*root, "multipole_library")) {
|
||||
warning("Setting multipole_library in settings.xml has been "
|
||||
"deprecated. The multipole_library is now set in materials.xml and"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue