Skip to content

Adding variance of variance and normality tests for tally statistics #3454

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 32 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
dddb144
Implementation of VOV
Greg-biot Nov 21, 2024
0bed61c
Delete src/tallies/tally (1).cpp:Zone.Identifier
Grego01-biot Nov 21, 2024
0406fa5
Delete src/tallies/tally_scoring (1).cpp:Zone.Identifier
Grego01-biot Nov 21, 2024
4aea85e
Modification on VOV formula
Greg-biot Nov 21, 2024
e046bac
Merge between origin and origin/stat_testing
Greg-biot Nov 21, 2024
5a44b61
Modifications of VOV + implementation of FOM
Greg-biot Dec 6, 2024
44763f5
Settings setup + FOM implementation
Greg-biot Dec 11, 2024
7708c4a
VOV for each tally bin implemented without error, ready for testing
Greg-biot Dec 11, 2024
6cc8b0d
Settings modifications + VOV modifications
Greg-biot Dec 18, 2024
bb56602
Merge remote-tracking branch 'upstream/develop' into stat_testing
Greg-biot Dec 18, 2024
66b3c4e
Tally optional VOV attribute
Greg-biot Dec 18, 2024
10d484c
New implementation of VOV + FOM
Greg-biot Jan 16, 2025
bc77d69
To stay up to date
Greg-biot Jan 16, 2025
fb4cdb0
Latest update of VOV and FOM
Greg-biot Feb 4, 2025
ec3eedd
Merge branch 'openmc-dev:develop' into stat_testing
Grego01-biot Feb 4, 2025
7cbf0a9
Missing files for FOM
Greg-biot Feb 4, 2025
dd5b6ae
New FOM and VOV
Feb 14, 2025
f905f0e
VOV implemented in Python API and C++
Feb 15, 2025
980961b
Merge remote-tracking branch 'upstream/develop' into vov_testing
Feb 19, 2025
8cd609d
Merging conflicts
Mar 27, 2025
6c9a608
VOV modifications
Mar 27, 2025
fbd173f
Removal of unnecessary elements for VOV implementation
Mar 27, 2025
4e236bc
test_tallies modified for VOV
Mar 28, 2025
5a6de69
Merge remote-tracking branch 'upstream/develop' into vov_testing
Apr 10, 2025
c94a83e
Python API modifications + addition of VOV flag
Apr 10, 2025
31c4bba
Deleting spaces
Apr 10, 2025
b1ecb55
Normality test and VOV test
Apr 12, 2025
9029b76
Merge remote-tracking branch 'upstream/develop' into vov_testing
Apr 15, 2025
3802484
new modifications for VOV and higher moments tests
Jun 11, 2025
af592d2
solving merging conflicts
Jun 11, 2025
58bf576
New tests for VOV and normality tests
Jun 17, 2025
96be75c
Merge remote-tracking branch 'upstream/develop' into vov_testing
Jun 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/openmc/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ enum class MgxsType {
// ============================================================================
// TALLY-RELATED CONSTANTS

enum class TallyResult { VALUE, SUM, SUM_SQ, SIZE };
enum class TallyResult { VALUE, SUM, SUM_SQ, SUM_THIRD, SUM_FOURTH, SIZE };

enum class TallyType { VOLUME, MESH_SURFACE, SURFACE, PULSE_HEIGHT };

Expand Down
10 changes: 5 additions & 5 deletions include/openmc/hdf5_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ void read_llong(hid_t obj_id, const char* name, long long* buffer, bool indep);
void read_string(
hid_t obj_id, const char* name, size_t slen, char* buffer, bool indep);

void read_tally_results(
hid_t group_id, hsize_t n_filter, hsize_t n_score, double* results);
void read_tally_results(hid_t group_id, hsize_t n_filter, hsize_t n_score,
double* results, bool vov_results);
void write_attr_double(hid_t obj_id, int ndim, const hsize_t* dims,
const char* name, const double* buffer);
void write_attr_int(hid_t obj_id, int ndim, const hsize_t* dims,
Expand All @@ -114,9 +114,9 @@ void write_int(hid_t group_id, int ndim, const hsize_t* dims, const char* name,
void write_llong(hid_t group_id, int ndim, const hsize_t* dims,
const char* name, const long long* buffer, bool indep);
void write_string(hid_t group_id, int ndim, const hsize_t* dims, size_t slen,
const char* name, char const* buffer, bool indep);
void write_tally_results(
hid_t group_id, hsize_t n_filter, hsize_t n_score, const double* results);
const char* name, const char* buffer, bool indep);
void write_tally_results(hid_t group_id, hsize_t n_filter, hsize_t n_score,
const double* results, bool vov_results);
} // extern "C"

//==============================================================================
Expand Down
6 changes: 6 additions & 0 deletions include/openmc/tallies/tally.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ class Tally {

bool writable() const { return writable_; }

bool vov_results() const { return vov_; }

//----------------------------------------------------------------------------
// Other methods.

Expand All @@ -119,6 +121,8 @@ class Tally {

void accumulate();

void accumulate_vov();

//! return the index of a score specified by name
int score_index(const std::string& score) const;

Expand Down Expand Up @@ -192,6 +196,8 @@ class Tally {
//! Whether to multiply by atom density for reaction rates
bool multiply_density_ {true};

bool vov_ = {false};

int64_t index_;
};

Expand Down
8 changes: 4 additions & 4 deletions include/openmc/urr.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ class UrrData {
double heating;
};

Interpolation interp_; //!< interpolation type
int inelastic_flag_; //!< inelastic competition flag
int absorption_flag_; //!< other absorption flag
bool multiply_smooth_; //!< multiply by smooth cross section?
Interpolation interp_; //!< interpolation type
int inelastic_flag_; //!< inelastic competition flag
int absorption_flag_; //!< other absorption flag
bool multiply_smooth_; //!< multiply by smooth cross section?

vector<double> energy_; //!< incident energies
auto n_energy() const { return energy_.size(); }
Expand Down
2 changes: 1 addition & 1 deletion include/openmc/volume_calc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#ifndef OPENMC_VOLUME_CALC_H
#define OPENMC_VOLUME_CALC_H

Expand Down Expand Up @@ -34,7 +34,7 @@
vector<double> atoms; //!< Number of atoms for each nuclide
vector<double> uncertainty; //!< Uncertainty on number of atoms
int iterations; //!< Number of iterations needed to obtain the results
}; // Results for a single domain
}; // Results for a single domain

// Constructors
VolumeCalculation(pugi::xml_node node);
Expand Down
1 change: 1 addition & 0 deletions openmc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from openmc.trigger import *
from openmc.tally_derivative import *
from openmc.tallies import *
from openmc.tally_stats import *
from openmc.mgxs_library import *
from openmc.executor import *
from openmc.statepoint import *
Expand Down
2 changes: 1 addition & 1 deletion openmc/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ def _max_tracks_from_xml_element(self, root):
text = get_text(root, 'max_tracks')
if text is not None:
self.max_tracks = int(text)

def _random_ray_from_xml_element(self, root):
elem = root.find('random_ray')
if elem is not None:
Expand Down
6 changes: 6 additions & 0 deletions openmc/statepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ def tallies(self):
if "multiply_density" in group.attrs:
tally.multiply_density = group.attrs["multiply_density"].item() > 0

# Check if tally has vov attribute
if "vov_results" in group.attrs:
print("VOV results found", group.attrs["vov_results"].item())
tally._vov = group.attrs["vov_results"].item()

# Read the number of realizations
n_realizations = group['n_realizations'][()]

Expand Down Expand Up @@ -460,6 +465,7 @@ def tallies(self):
# Add the scores to the Tally
scores = group['score_bins'][()]
tally.scores = [score.decode() for score in scores]
print(scores.shape)

# Add Tally to the global dictionary of all Tallies
tally.sparse = self.sparse
Expand Down
Loading
Loading