Repository navigation
Random Ray Transport #2823
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
Merged
Merged
Random Ray Transport #2823
Changes from 1 commit
Commits
Show all changes
188 commits
Select commit
Hold shift + click to select a range
d76033a
first commit. File layout, classes, source region init.
jtramm c2fa6aa
added source update function
jtramm dc30912
added high level control function
jtramm 31609b0
added cell normalization routine
jtramm 0e2dcec
added add source to flux function
jtramm 7db4a7d
added k-eff update function
jtramm a782fa4
basic iteration code is in.
jtramm 785c4d6
adding ray methods.
jtramm 2ccc838
adding more ray methods.
jtramm 168ca04
whitespace fixes
jtramm 2c45008
working on debugging the compile. All basic pieces in place though, s…
jtramm 003c646
continued debugging
jtramm f232980
Compile-time bug fixes and refactoring to use particle_data accessors.
jtramm 04e7e12
assed basic printout. Results look decent.
jtramm d66cdbb
removed tallying (besides basic things like k-eff)
jtramm 588f1ce
added clean timing/result output function.
jtramm 442153c
added the basics of clean tally-based output
jtramm baf1f5a
fixed first tally init issue that was causing seg fault. Getting 0 va…
jtramm 2c2770b
ensured that all active tallies are used, not just analog
jtramm e785b26
generic tally solution working. A little slow
jtramm 9566890
added energy integrated version. About 2x fast, but still too slow. W…
jtramm 7646594
added tally mapper, but now there is a problem where what if we did n…
jtramm 7b46663
Added ability for tally conversion to run multiple times if not all F…
jtramm f28d655
minor cleanup of tally task conversion code
jtramm 2b43008
moved tallying and tally conversion functions into separate file
jtramm 5548628
added some comments
jtramm 7503eb6
moved initialization of tally task array to where other cell-wise arr…
jtramm 1eb5eec
parallelized flux/volume zeroing routines. Streamlined instability an…
jtramm 958a73a
added more output metrics
jtramm ec78527
changed parallelization scheme for normalization routines. Removed ta…
jtramm eeda6ab
first commit. File layout, classes, source region init.
jtramm 6a6d100
added source update function
jtramm 34c35db
added high level control function
jtramm e19e3e3
added cell normalization routine
jtramm 68af51e
added add source to flux function
jtramm 7673afb
added k-eff update function
jtramm cfab02a
basic iteration code is in.
jtramm f40f807
adding ray methods.
jtramm c373560
adding more ray methods.
jtramm ebee0ef
whitespace fixes
jtramm 25f1fcc
working on debugging the compile. All basic pieces in place though, s…
jtramm aa9b732
continued debugging
jtramm a3ed5dd
Compile-time bug fixes and refactoring to use particle_data accessors.
jtramm e9708d6
assed basic printout. Results look decent.
jtramm 8d22e78
removed tallying (besides basic things like k-eff)
jtramm 247e8df
added clean timing/result output function.
jtramm 9610a2d
added the basics of clean tally-based output
jtramm 84cfdaa
fixed first tally init issue that was causing seg fault. Getting 0 va…
jtramm d74781e
ensured that all active tallies are used, not just analog
jtramm 68bee19
generic tally solution working. A little slow
jtramm a3c9804
added energy integrated version. About 2x fast, but still too slow. W…
jtramm 0c5200b
added tally mapper, but now there is a problem where what if we did n…
jtramm 4b60bd5
Added ability for tally conversion to run multiple times if not all F…
jtramm 64a6d6e
minor cleanup of tally task conversion code
jtramm b1167d9
moved tallying and tally conversion functions into separate file
jtramm 6566cdc
added some comments
jtramm 738910a
moved initialization of tally task array to where other cell-wise arr…
jtramm 1d9254e
parallelized flux/volume zeroing routines. Streamlined instability an…
jtramm d998d06
added more output metrics
jtramm 58d516b
changed parallelization scheme for normalization routines. Removed ta…
jtramm 7ffb30d
allowed for different cell instances to be given different material t…
jtramm 5ff2be8
fixed fast forward issue
jtramm 69abd98
updated to use zero temp and angle indices when accessing XS data. Ad…
jtramm 2cb971c
used OpenMC init sim
jtramm 504cb54
using init and finalize batch
jtramm a6a00b3
using generations now as well
jtramm ecc0087
using integrated keff tally
jtramm f363645
commented out unneeded init statements
jtramm c5fbb4c
set weight to 1.0
jtramm 56e84f7
Switched random ray enum check to use a new solver type variable inst…
jtramm bbd325d
removed duplicate timer
jtramm 2854d51
figured out bug -- was due to actual bug in openmc where it is revert…
jtramm 8e91d50
input validation is well along -- maybe complete?
jtramm 94705ef
added fixed source checking
jtramm 54f39de
refactor from Ray to RandomRay
jtramm b3ea0f6
added source validation
jtramm 2d90cd4
refactored to use settings/globals directly rather than passing as ar…
jtramm 872ff56
adding comments, and switched to setting to previous source instead o…
jtramm 39cdd66
moved validation code to end of file
jtramm 43df38a
partial addition of docs and python interface
jtramm 6cf75a6
finished up python interface?
jtramm dad86a0
fixed issue with int vs real in python interface, and added check for…
jtramm f7e0400
partial domain replication. Need to not print double, and need to red…
jtramm 6eb99bd
fixed issue with tallies in mpi mode. Issue was solely with the cell …
jtramm b4fffb8
added more comments
jtramm ed34ab2
added reduction of intersection counts
jtramm fe4194d
added timer for source reductions, and added warning about slow reduc…
jtramm bec2b82
removed extra comment
jtramm 1fbd373
added lots of comments
jtramm 027653b
fixed comment issue
jtramm 1789d41
removed assert statements and replaced with errors
jtramm fefe9aa
added vtk plotter
jtramm 3bf3134
added FSR and material plots, but FSR plot is weird.
jtramm 811c399
FSRs appear much better as floats rather than modulused ints, for som…
jtramm 95ebeed
simplified plotting routine a bit
jtramm b3a38e0
parallelized plotter
jtramm 00f0e4c
using plot.xml inputs for plots
jtramm 4939ceb
plotter is using xml input fname
jtramm bce3b70
added nice output before plotting, and enforcement of acceptable plot…
jtramm 8704ee7
only plot if there is a plotting xml file
jtramm 98f0696
added storage of accumulated final flux and plotting at the end
jtramm 3254e3b
added first try at tolerant testing harness
jtramm a7d90df
tweaks to tolerant testing. Report k-eff simulation for k-eff combine…
jtramm 54d0a71
added random ray pincell example
jtramm 8a49e5d
removed unneeded headers
jtramm 1419f39
added endianness flipping function, ability to output multiple plots …
jtramm dd90d63
adjusted comment
jtramm 1818989
fixed merge issue
jtramm cf0f69b
improved pincell example
jtramm 2248ec4
ran git clang-format develop
jtramm 8216a6c
Added a loop before plotting to change filenames first, so the plot s…
jtramm 735fcfd
ran git clang-format develop
jtramm 33c333b
updated test to use RectangularPrism instead of rectangular_prism`
jtramm 0b0dc42
Revert "fixed fast forward issue"
jtramm 12f24f0
ran clang-format on settings.h
jtramm 69ae4f4
added back in comment
jtramm 99a34cc
removed comments/debugging code
jtramm a07c534
ran git clang-format develop
jtramm e0b62a7
Update src/random_ray/iteration.cpp
jtramm 63857aa
incorporation of @gridley review comments
jtramm 57dad69
Merge branch 'random_ray_merge' of github.com:jtramm/openmc into rand…
jtramm d3cfd4b
Merge branch 'develop' of github.com:openmc-dev/openmc into random_ra…
jtramm ead8cfa
added random_ray.rst methods file and updated index
jtramm 561d8fa
fixed over/underbars
jtramm bb24326
added random ray user guide
jtramm a060d4e
added lots more documentation to theory section
jtramm a42e0eb
added compressed image files to random ray documentation
jtramm 53d3a5e
continued work on docs
jtramm 74d7ac7
continued work on docs
jtramm 2893ecf
continued updated to docs
jtramm 872bcfe
continued work on docs
jtramm 32c65d8
updating random ray docs
jtramm 66387b4
More random ray docs. Fixed equation notation, added more references,…
jtramm 2ec33be
Added random_ray_source option to IndependentSource to flag source as…
jtramm 5c63a31
ran git clang-format HEAD~1
jtramm 4a0500f
Refactored random ray source indicator to use particle type rather th…
jtramm 4727569
ran git clang-format HEAD~1
jtramm f20bc1e
removed the rest of old random_ray_source source field.
jtramm 98b65d1
removed unneeded lines throughout
jtramm 916b2bd
updated docs to account for new random ray source specification inter…
jtramm 524f2b4
added accessors for cell material/temperature fields to abstract logi…
jtramm f122ef0
ran git clang-format HEAD~1
jtramm 4a92297
Merge branch 'develop' into random_ray_merge
jtramm 3821eb2
fixed bug in Cell::sqrtkT accessor return type
jtramm 00d07dc
incorporation of review comments
jtramm 14faa19
refactor into classes mostly complete. Just some cleanup remaining.
jtramm 5555dd9
refactor into classes complete and working (still needs cleanup)
jtramm 28942b9
refactor of random ray filenames
jtramm 383bd31
code cleanup, comments, formatting
jtramm e3bc76a
ran git clang-format develop
jtramm e5cdc3e
changed include guard names
jtramm eb66a04
ran git clang-format develop
jtramm b715f03
added comment for TolerantPyAPITestHarness class
jtramm b4ad777
enabled tracklength and collision tallies. Fixed vacuum BC bug where …
jtramm 2d7eec3
updated documents and example to remove the requirement of analog tal…
jtramm ef0fdca
Remove docs for random_ray_source option that was removed from python…
jtramm 30d0d1d
added TODO item on inheriting from GeometryState instead of Particle.
jtramm 7de305b
Changed random ray interface on python side.
jtramm 007a935
refactor C++ random ray interface to use random_ray object
jtramm 15e6bec
updated docs, examples, and tests to use new interface. Also added va…
jtramm 591d0e2
updated docs
jtramm 1d8722f
ran git clang-format develop
jtramm a58be8c
removed random ray particle type from C++ and python
jtramm 3d2eab9
ran git clang-format develop
jtramm 982272c
fixed bug with outputting empty random ray dictionary
jtramm 43b842d
simplified docs example slightly
jtramm 4819aaa
incorporation of @gridley docs review comments
jtramm c9c691d
Line spacing in random ray documentation
paulromano 03333d2
Small changes in user's guide random ray section
paulromano e8ff8f5
Edits in random ray methods docs
paulromano 0d94bbe
Small changes and updates
paulromano 66b4a3d
Fix XML roundtrip of settings.random_ray
paulromano 06d4343
incorporation of @promano review comments pt 1
jtramm 3c13dd2
changed \vec to \mathbf in random ray docs
jtramm 433b000
incorporation of @promano review comments pt 2
jtramm 3f585ef
changed dV to d\mathbf{r}
jtramm cb813ce
incorporation of @promano review comments pt3
jtramm fa0b844
incorporation of @promano review comments pt 4
jtramm 45e3bc9
ran git clang-format develop
jtramm de456e0
updated random ray test expected results due to bug fix with ray term…
jtramm 936d703
removed unneeded vector header
jtramm d426075
Small fix in random_ray.rst
paulromano efe6353
marked random_ray_tally as const, and removed unneeded prototype
jtramm 581229e
updated docs comment
jtramm d60c3c0
incorporation of @yardasol review comments
jtramm 93bb5b2
Merge branch 'develop' into random_ray_merge
jtramm c8ffddb
Merge branch 'develop' into pr/jtramm/2823
paulromano f3dec7d
Small fixes in docstring
paulromano File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
moved tallying and tally conversion functions into separate file
- Loading branch information
commit 2b430085d59efa6bb8048187a863877a573f754d
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #ifndef OPENMC_RANDOM_RAY_TALLY_CONVERT_H | ||
| #define OPENMC_RANDOM_RAY_TALLY_CONVERT_H | ||
|
|
||
| namespace openmc { | ||
|
|
||
| struct TallyTask { | ||
| int tally_idx; | ||
| int filter_idx; | ||
| int score_idx; | ||
| int score_type; | ||
| TallyTask(int tally_idx, int filter_idx, int score_idx, int score_type) | ||
| : tally_idx(tally_idx), filter_idx(filter_idx), score_idx(score_idx), score_type(score_type) | ||
| {} | ||
| }; | ||
|
|
||
| namespace random_ray { | ||
|
|
||
| // 2D array representing values for all source regions x energy groups x tally tasks | ||
| extern std::vector<std::vector<TallyTask>> tally_task; | ||
|
|
||
| } | ||
|
|
||
| bool convert_source_regions_to_tallies(); | ||
| void random_ray_tally(); | ||
|
|
||
| } // namespace openmc | ||
|
|
||
| #endif // OPENMC_RANDOM_RAY_TALLY_CONVERT_H | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| #include "openmc/output.h" | ||
| #include "openmc/geometry.h" | ||
| #include "openmc/tallies/tally.h" | ||
| #include "openmc/tallies/filter.h" | ||
| #include "openmc/tallies/tally_scoring.h" | ||
| #include "openmc/timer.h" | ||
| #include "openmc/mgxs_interface.h" | ||
| #include "openmc/particle.h" | ||
| #include "openmc/random_ray/tally_convert.h" | ||
| #include "openmc/random_ray/source_region.h" | ||
|
|
||
| namespace openmc { | ||
|
|
||
| namespace random_ray { | ||
|
|
||
| std::vector<std::vector<TallyTask>> tally_task; | ||
|
|
||
| } | ||
|
|
||
| bool convert_source_regions_to_tallies() | ||
| { | ||
| int negroups = data::mg.num_energy_groups_; | ||
|
|
||
| random_ray::tally_task.resize(random_ray::n_source_elements); | ||
|
|
||
| bool all_source_regions_mapped = true; | ||
|
|
||
| #pragma omp parallel for | ||
| for (int sr = 0; sr < random_ray::n_source_regions; sr++) { | ||
|
|
||
| // If this source region has not been hit by a ray yet, then | ||
| // we aren't going to be able to map it, so skip it. | ||
| if (!random_ray::position_recorded[sr]) { | ||
| all_source_regions_mapped = false; | ||
| continue; | ||
| } | ||
|
|
||
| Particle p; | ||
| p.r() = random_ray::position[sr]; | ||
| bool found = exhaustive_find_cell(p); | ||
| for (int e = 0; e < negroups; e++) { | ||
| p.g() = e; | ||
| p.g_last() = e; | ||
|
|
||
| int64_t source_element = sr * negroups + e; | ||
|
|
||
| // If this task has already been populated, we can move on | ||
| if (random_ray::tally_task[source_element].size() > 0) { | ||
| continue; | ||
| } | ||
|
|
||
| for (auto i_tally : model::active_tallies) { | ||
| Tally& tally {*model::tallies[i_tally]}; | ||
|
|
||
| // Initialize an iterator over valid filter bin combinations. If there are | ||
| // no valid combinations, use a continue statement to ensure we skip the | ||
| // assume_separate break below. | ||
| auto filter_iter = FilterBinIter(tally, p); | ||
| auto end = FilterBinIter(tally, true, &p.filter_matches()); | ||
| if (filter_iter == end) | ||
| continue; | ||
|
|
||
| // Loop over filter bins. | ||
| for (; filter_iter != end; ++filter_iter) { | ||
| auto filter_index = filter_iter.index_; | ||
| auto filter_weight = filter_iter.weight_; | ||
|
|
||
| // Loop over scores | ||
| for (auto score_index = 0; score_index < tally.scores_.size(); score_index++) { | ||
| auto score_bin = tally.scores_[score_index]; | ||
| random_ray::tally_task[source_element].emplace_back(i_tally, filter_index, score_index, score_bin); | ||
| } | ||
| } | ||
| } | ||
| // Reset all the filter matches for the next tally event. | ||
| for (auto& match : p.filter_matches()) | ||
| match.bins_present_ = false; | ||
| } | ||
| } | ||
| return all_source_regions_mapped; | ||
| } | ||
|
|
||
| void random_ray_tally() | ||
| { | ||
| openmc::simulation::time_tallies.start(); | ||
|
|
||
| int negroups = data::mg.num_energy_groups_; | ||
|
|
||
| #pragma omp parallel for | ||
| for (int sr = 0; sr < random_ray::n_source_regions; sr++) { | ||
| double volume = random_ray::volume[sr]; | ||
| double material = random_ray::material[sr]; | ||
| for (int e = 0; e < negroups; e++) { | ||
| int idx = sr * negroups + e; | ||
| for (auto& task : random_ray::tally_task[idx]) { | ||
| double score; | ||
| if (task.score_type == SCORE_FLUX) { | ||
| score = random_ray::scalar_flux_new[idx] * volume; | ||
| } else if(task.score_type == SCORE_FISSION) { | ||
| double Sigma_f = data::mg.macro_xs_[material].get_xs(MgxsType::FISSION, e, NULL, NULL, NULL); | ||
| score = random_ray::scalar_flux_new[idx] * volume * Sigma_f; | ||
| } | ||
| Tally& tally {*model::tallies[task.tally_idx]}; | ||
| #pragma omp atomic | ||
| tally.results_(task.filter_idx, task.score_idx, TallyResult::VALUE) += score; | ||
| } | ||
| } | ||
| } | ||
| openmc::simulation::time_tallies.stop(); | ||
| } | ||
|
|
||
| } // namespace openmc |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.