diff --git a/CMakeLists.txt b/CMakeLists.txt index 2e606f8d6..2ccc457f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,12 +13,12 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules) # Command line options #=============================================================================== -option(openmp "Enable shared-memory parallelism with OpenMP" ON) -option(profile "Compile with profiling flags" OFF) -option(debug "Compile with debug flags" OFF) -option(optimize "Turn on all compiler optimization flags" OFF) -option(coverage "Compile with coverage analysis flags" OFF) -option(dagmc "Enable support for DAGMC (CAD) geometry" OFF) +option(openmp "Enable shared-memory parallelism with OpenMP" ON) +option(profile "Compile with profiling flags" OFF) +option(debug "Compile with debug flags" OFF) +option(optimize "Turn on all compiler optimization flags" OFF) +option(coverage "Compile with coverage analysis flags" OFF) +option(dagmc "Enable support for DAGMC (CAD) geometry" OFF) #=============================================================================== # MPI for distributed-memory parallelism diff --git a/include/openmc/physics_mg.h b/include/openmc/physics_mg.h index 8d38abbde..5cb7226d9 100644 --- a/include/openmc/physics_mg.h +++ b/include/openmc/physics_mg.h @@ -33,8 +33,6 @@ scatter(Particle* p); //! \brief Determines the average total, prompt and delayed neutrons produced //! from fission and creates the appropriate bank sites. //! \param p Particle to operate on -//! \param bank The particle bank to populate -//! \param use_fission_bank Indicates if shared global fission bank should be used void create_fission_sites(Particle* p); diff --git a/include/openmc/tallies/derivative.h b/include/openmc/tallies/derivative.h index a0db07da2..65650356d 100644 --- a/include/openmc/tallies/derivative.h +++ b/include/openmc/tallies/derivative.h @@ -62,6 +62,10 @@ void zero_flux_derivs(std::vector v); // Global variables //============================================================================== +// Explicit vector template specialization declaration of threadprivate variable +// outside of the openmc namespace for the picky Intel compiler. +extern template class std::vector; + namespace openmc { namespace model { diff --git a/include/openmc/tallies/tally_scoring.h b/include/openmc/tallies/tally_scoring.h index c73b22e7b..940bad488 100644 --- a/include/openmc/tallies/tally_scoring.h +++ b/include/openmc/tallies/tally_scoring.h @@ -23,12 +23,12 @@ class FilterBinIter public: //! Construct an iterator over bins that match a given particle's state. - FilterBinIter(const Tally& tally, const Particle* p, std::vector * particle_filter_matches); + FilterBinIter(const Tally& tally, const Particle* p, std::vector* particle_filter_matches); //! Construct an iterator over all filter bin combinations. // //! \param end if true, the returned iterator indicates the end of a loop. - FilterBinIter(const Tally& tally, bool end, std::vector * particle_filter_matches); + FilterBinIter(const Tally& tally, bool end, std::vector* particle_filter_matches); bool operator==(const FilterBinIter& other) const {return index_ == other.index_;} @@ -41,7 +41,7 @@ public: int index_ {1}; double weight_ {1.}; - std::vector & filter_matches_; + std::vector& filter_matches_; private: void compute_index_weight(); diff --git a/src/bank.cpp b/src/bank.cpp index 27766b5fe..0576ea2ec 100644 --- a/src/bank.cpp +++ b/src/bank.cpp @@ -34,7 +34,7 @@ void free_memory_bank() simulation::source_bank.clear(); simulation::fission_bank.clear(); if( simulation::shared_fission_bank != nullptr ) - delete[] simulation::shared_fission_bank; + delete[] simulation::shared_fission_bank; simulation::shared_fission_bank = nullptr; simulation::shared_fission_bank_length = 0; } diff --git a/src/geometry.cpp b/src/geometry.cpp index 3fd1a5b26..f5aeb7e42 100644 --- a/src/geometry.cpp +++ b/src/geometry.cpp @@ -121,9 +121,9 @@ find_cell_inner(Particle* p, const NeighborList* neighbor_list) // Announce the cell that the particle is entering. if( p->trace_ ) { - std::stringstream msg; - msg << "p->trace = " << p->trace_; - write_message(msg, 1); + std::stringstream msg; + msg << "p->trace = " << p->trace_; + write_message(msg, 1); } if (found && (settings::verbosity >= 10 || p->trace_)) { std::stringstream msg; diff --git a/src/particle.cpp b/src/particle.cpp index 7a9e20deb..8417a9184 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -84,10 +84,8 @@ Particle::clear() void Particle::create_secondary(Direction u, double E, Type type) { - //simulation::secondary_bank.emplace_back(); secondary_bank_.emplace_back(); - //auto& bank {simulation::secondary_bank.back()}; auto& bank {secondary_bank_.back()}; bank.particle = type; bank.wgt = wgt_; diff --git a/src/physics_mg.cpp b/src/physics_mg.cpp index 541aa8d14..18bbbe6df 100644 --- a/src/physics_mg.cpp +++ b/src/physics_mg.cpp @@ -47,10 +47,9 @@ sample_reaction(Particle* p) // absorption (including fission) if (model::materials[p->material_]->fissionable_) { - if (settings::run_mode == RUN_MODE_EIGENVALUE) { - create_fission_sites(p); - } else if ((settings::run_mode == RUN_MODE_FIXEDSOURCE) && - (settings::create_fission_neutrons)) { + if (settings::run_mode == RUN_MODE_EIGENVALUE || + (settings::run_mode == RUN_MODE_FIXEDSOURCE && + settings::create_fission_neutrons)) { create_fission_sites(p); } } diff --git a/src/random_lcg.cpp b/src/random_lcg.cpp index 227b5a1b7..48c6b5a61 100644 --- a/src/random_lcg.cpp +++ b/src/random_lcg.cpp @@ -1,7 +1,6 @@ #include "openmc/random_lcg.h" #include -//#include namespace openmc { @@ -58,7 +57,6 @@ uint64_t init_seed(int64_t id, int offset) void init_particle_seeds(int64_t id, uint64_t* seeds) { - //std::cout << "Master seed = " << master_seed << " id = " << id << std::endl; for (int i = 0; i < N_STREAMS; i++) { seeds[i] = future_seed(static_cast(id) * prn_stride, master_seed + i); } diff --git a/src/simulation.cpp b/src/simulation.cpp index 5bccdd060..66ec9ed5f 100644 --- a/src/simulation.cpp +++ b/src/simulation.cpp @@ -2,30 +2,30 @@ #include "openmc/bank.h" #include "openmc/capi.h" -#include "openmc/cell.h" +//#include "openmc/cell.h" #include "openmc/container_util.h" #include "openmc/eigenvalue.h" #include "openmc/error.h" -#include "openmc/geometry.h" +//#include "openmc/geometry.h" #include "openmc/material.h" #include "openmc/message_passing.h" -#include "openmc/mgxs_interface.h" +//#include "openmc/mgxs_interface.h" #include "openmc/nuclide.h" #include "openmc/output.h" #include "openmc/particle.h" #include "openmc/photon.h" -#include "openmc/physics.h" -#include "openmc/physics_mg.h" +//#include "openmc/physics.h" +//#include "openmc/physics_mg.h" #include "openmc/random_lcg.h" #include "openmc/settings.h" #include "openmc/source.h" #include "openmc/state_point.h" -#include "openmc/thermal.h" +//#include "openmc/thermal.h" #include "openmc/timer.h" #include "openmc/tallies/derivative.h" #include "openmc/tallies/filter.h" #include "openmc/tallies/tally.h" -#include "openmc/tallies/tally_scoring.h" +//#include "openmc/tallies/tally_scoring.h" #include "openmc/tallies/trigger.h" #include "openmc/track_output.h" @@ -435,9 +435,9 @@ void finalize_generation() if (settings::run_mode == RUN_MODE_EIGENVALUE) { // Copy shared fission bank into regular bank for use in MPI synchronization - for( int i = 0; i < simulation::shared_fission_bank_length; i++ ) - simulation::fission_bank.push_back(simulation::shared_fission_bank[i]); - simulation::shared_fission_bank_length = 0; + for( int i = 0; i < simulation::shared_fission_bank_length; i++ ) + simulation::fission_bank.push_back(simulation::shared_fission_bank[i]); + simulation::shared_fission_bank_length = 0; // Sorts the fission bank so as to allow for reproducibility std::stable_sort(simulation::fission_bank.begin(), simulation::fission_bank.end()); diff --git a/src/tallies/tally_scoring.cpp b/src/tallies/tally_scoring.cpp index 58f7c43dc..a284ab033 100644 --- a/src/tallies/tally_scoring.cpp +++ b/src/tallies/tally_scoring.cpp @@ -26,7 +26,7 @@ namespace openmc { // FilterBinIter implementation //============================================================================== -FilterBinIter::FilterBinIter(const Tally& tally, const Particle* p, std::vector * particle_filter_matches) +FilterBinIter::FilterBinIter(const Tally& tally, const Particle* p, std::vector* particle_filter_matches) : tally_{tally}, filter_matches_{*particle_filter_matches} { // Find all valid bins in each relevant filter if they have not already been @@ -55,7 +55,7 @@ FilterBinIter::FilterBinIter(const Tally& tally, const Particle* p, std::vector< this->compute_index_weight(); } -FilterBinIter::FilterBinIter(const Tally& tally, bool end, std::vector * particle_filter_matches) +FilterBinIter::FilterBinIter(const Tally& tally, bool end, std::vector* particle_filter_matches) : tally_{tally}, filter_matches_{*particle_filter_matches} { // Handle the special case for an iterator that points to the end. @@ -144,7 +144,7 @@ FilterBinIter::compute_index_weight() //! Helper function used to increment tallies with a delayed group filter. void -score_fission_delayed_dg(int i_tally, int d_bin, double score, int score_index, std::vector & filter_matches) +score_fission_delayed_dg(int i_tally, int d_bin, double score, int score_index, std::vector& filter_matches) { // Save the original delayed group bin auto& tally {*model::tallies[i_tally]}; @@ -951,10 +951,7 @@ score_general_ce(Particle* p, int i_tally, int start_index, // ones are delayed. If a delayed neutron is encountered, add its // contribution to the fission bank to the score. score = 0.; - // TODO: This breaks event-based for (auto i = 0; i < p->n_bank_; ++i) { - //auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i; - //const auto& bank = simulation::fission_bank[i_bank]; const auto& bank = p->nu_bank_[i]; auto g = bank.delayed_group; if (g != 0) { @@ -1226,9 +1223,7 @@ score_general_ce(Particle* p, int i_tally, int start_index, // We need to substract the energy of the secondary particles since // they will be transported individually later for (auto i = 0; i < p->n_bank_second_; ++i) { - //auto i_bank = simulation::secondary_bank.size() - p->n_bank_second_ + i; auto i_bank = p->secondary_bank_.size() - p->n_bank_second_ + i; - //const auto& bank = simulation::secondary_bank[i_bank]; const auto& bank = p->secondary_bank_[i_bank]; if (bank.particle == Particle::Type::photon || bank.particle == Particle::Type::neutron) { @@ -1872,14 +1867,7 @@ score_general_mg(Particle* p, int i_tally, int start_index, // ones are delayed. If a delayed neutron is encountered, add its // contribution to the fission bank to the score. score = 0.; - // TODO: This breaks event-based - // Needs: - // delayed_group - // wgt - // for (auto i = 0; i < p->n_bank_; ++i) { - //auto i_bank = simulation::fission_bank.size() - p->n_bank_ + i; - //const auto& bank = simulation::fission_bank[i_bank]; const auto& bank = p->nu_bank_[i]; auto d = bank.delayed_group - 1; if (d != -1) { diff --git a/src/track_output.cpp b/src/track_output.cpp index 10e249820..748492a96 100644 --- a/src/track_output.cpp +++ b/src/track_output.cpp @@ -23,7 +23,7 @@ namespace openmc { // Non-member functions //============================================================================== -void add_particle_track(Particle & p) +void add_particle_track(Particle& p) { p.tracks_.emplace_back(); } diff --git a/tests/regression_tests/cmfd_feed_2g/test.py b/tests/regression_tests/cmfd_feed_2g/test.py index bc5ca2081..ba4d21609 100644 --- a/tests/regression_tests/cmfd_feed_2g/test.py +++ b/tests/regression_tests/cmfd_feed_2g/test.py @@ -2,6 +2,7 @@ from tests.testing_harness import CMFDTestHarness from openmc import cmfd import numpy as np + def test_cmfd_feed_2g(): """Test 2 group CMFD solver results with CMFD feedback""" # Initialize and set CMFD mesh diff --git a/tests/regression_tests/cmfd_feed_ng/test.py b/tests/regression_tests/cmfd_feed_ng/test.py index 9c17735d9..dce674f90 100644 --- a/tests/regression_tests/cmfd_feed_ng/test.py +++ b/tests/regression_tests/cmfd_feed_ng/test.py @@ -2,6 +2,7 @@ from tests.testing_harness import CMFDTestHarness from openmc import cmfd import numpy as np + def test_cmfd_feed_ng(): """Test n group CMFD solver with CMFD feedback""" # Initialize and set CMFD mesh diff --git a/tests/regression_tests/mg_basic_delayed/test.py b/tests/regression_tests/mg_basic_delayed/test.py index 5ac460034..f0474a567 100644 --- a/tests/regression_tests/mg_basic_delayed/test.py +++ b/tests/regression_tests/mg_basic_delayed/test.py @@ -7,6 +7,7 @@ from openmc.examples import slab_mg from tests.testing_harness import PyAPITestHarness + def create_library(): # Instantiate the energy group data and file object groups = openmc.mgxs.EnergyGroups(group_edges=[0.0, 0.625, 20.0e6]) diff --git a/tests/regression_tests/photon_production/test.py b/tests/regression_tests/photon_production/test.py index 72fdafb41..1f645ebb9 100644 --- a/tests/regression_tests/photon_production/test.py +++ b/tests/regression_tests/photon_production/test.py @@ -75,10 +75,6 @@ class SourceTestHarness(PyAPITestHarness): outstr = '' for i, tally_ind in enumerate(sp.tallies): tally = sp.tallies[tally_ind] - print(tally) - print(tally.num_bins) - print(tally.shape) - print(tally.sum) results = np.zeros((tally.sum.size * 2, )) results[0::2] = tally.sum.ravel() results[1::2] = tally.sum_sq.ravel()