mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
formatting sweep
This commit is contained in:
parent
1f3bc2c4d3
commit
63ef983f19
16 changed files with 37 additions and 53 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ void zero_flux_derivs(std::vector<double> 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<openmc::TallyDerivative>;
|
||||
|
||||
namespace openmc {
|
||||
|
||||
namespace model {
|
||||
|
|
|
|||
|
|
@ -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<FilterMatch> * particle_filter_matches);
|
||||
FilterBinIter(const Tally& tally, const Particle* p, std::vector<FilterMatch>* 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<FilterMatch> * particle_filter_matches);
|
||||
FilterBinIter(const Tally& tally, bool end, std::vector<FilterMatch>* 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<FilterMatch> & filter_matches_;
|
||||
std::vector<FilterMatch>& filter_matches_;
|
||||
|
||||
private:
|
||||
void compute_index_weight();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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_;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#include "openmc/random_lcg.h"
|
||||
|
||||
#include <cmath>
|
||||
//#include <iostream>
|
||||
|
||||
|
||||
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<uint64_t>(id) * prn_stride, master_seed + i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace openmc {
|
|||
// FilterBinIter implementation
|
||||
//==============================================================================
|
||||
|
||||
FilterBinIter::FilterBinIter(const Tally& tally, const Particle* p, std::vector<FilterMatch> * particle_filter_matches)
|
||||
FilterBinIter::FilterBinIter(const Tally& tally, const Particle* p, std::vector<FilterMatch>* 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<FilterMatch> * particle_filter_matches)
|
||||
FilterBinIter::FilterBinIter(const Tally& tally, bool end, std::vector<FilterMatch>* 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<FilterMatch> & filter_matches)
|
||||
score_fission_delayed_dg(int i_tally, int d_bin, double score, int score_index, std::vector<FilterMatch>& 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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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])
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue