Repository navigation
Adding support for NCrystal materials in OpenMC #2222
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
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
0e0cd0a
Added hooks for NCrystal
marquezj 0f33e0b
Add temporary requirement of natural elements in NCrystal materials
tkittel 9c54ac0
Fix access to private attributes
marquezj 70d5c76
Fixed material.h
marquezj 29a10ea
Removed MacroNCrystalXS
marquezj 2e19260
Implement recommended changes
marquezj 5afcc9e
Apply clang-format
marquezj fdf763e
Couple of fixes
marquezj 52ee2c3
Print where NCrystal was found as suggested by @paulromano
tkittel a5b811e
Use new NCrystal getFlattenedComposition method to better support mor…
tkittel f2e807e
Move NCrystalRNGWrapper data member into explicit private section as …
tkittel aca4fcb
NCrystal cfgstr printout now mentions material ID
tkittel a3dd55d
first stab at gha-install-ncrystal.sh
tkittel e64bf6a
Add installation instructions for NCrystal
marquezj 1f3c5ed
Add use instructions and examples for NCrystal
marquezj cf96ddf
Basic introduction to NCrystal
marquezj 24572a7
Added simple NCrystal test
marquezj 54745f5
Changed example NCrystal cfg strings
marquezj 91f939a
Add flag for NCrystal
marquezj 5f8e64b
Add NCrystal vairables to ci.yml
marquezj 87ed26b
Add option to install NCrystal
marquezj 8cf9dbe
Fixed in NCrystal docs
marquezj b9e8f13
Attempt to fix NCrystal installation script
marquezj b9a1fd5
Merge branch 'mixed_ncrystal' of https://github.com/highness-eu/openm…
marquezj d7ab491
Try fix of NCrystal install
marquezj b199db9
Update gha-install-ncrystal.sh
marquezj 39d0c5c
Try to initialize with setup.sh
marquezj 9e1abb3
Update gha-install-ncrystal.sh
marquezj 3e6bb9d
Upgrade installation script to NCrystal 3.5.0
marquezj be330a1
Update gha-install-ncrystal.sh
marquezj fff545a
Update gha-install-ncrystal.sh
marquezj 8598ff7
Pass CMAKE_PREFIX_PATH from NCrystall installation
marquezj c98a121
Update gha-install.py
marquezj 19bf624
Add NCrystal installation test
marquezj 4391d60
find NCrystal
marquezj e626447
Update gha-script.sh
marquezj e7b4285
Cleanup
marquezj f2c2870
Apply suggestions from code review
tkittel a86e74f
Rename compute_angular_distribution to pencil_beam_model
tkittel b6d6bdf
Merge branch 'develop' into mixed_ncrystal_pr
paulromano 7dae457
Merge pull request #1 from paulromano/ncrystal_mixed
tkittel 62af773
Refactor NCrystal interface code to ncrystal_interface.h/cpp
paulromano 4eda693
Style and spacing changes
paulromano c4227f7
Change Material.from_ncrystal to accept kwargs
paulromano fe4a1de
Merge pull request #2 from paulromano/mixed_ncrystal_pr
tkittel e83ced8
Change ncrystal_max_energy to be a global constant
paulromano 93aaa32
Merge pull request #3 from paulromano/mixed_ncrystal_const
tkittel 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
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
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
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,94 @@ | ||
| #ifndef OPENMC_NCRYSTAL_INTERFACE_H | ||
| #define OPENMC_NCRYSTAL_INTERFACE_H | ||
|
|
||
| #ifdef NCRYSTAL | ||
| #include "NCrystal/NCRNG.hh" | ||
| #include "NCrystal/NCrystal.hh" | ||
| #endif | ||
|
|
||
| #include "openmc/particle.h" | ||
|
|
||
| #include <cstdint> // for uint64_t | ||
| #include <limits> // for numeric_limits | ||
| #include <string> | ||
|
|
||
| namespace openmc { | ||
|
|
||
| //============================================================================== | ||
| // Constants | ||
| //============================================================================== | ||
|
|
||
| extern "C" const bool NCRYSTAL_ENABLED; | ||
|
|
||
| //! Energy in [eV] to switch between NCrystal and ENDF | ||
| constexpr double NCRYSTAL_MAX_ENERGY {5.0}; | ||
|
|
||
| //============================================================================== | ||
| // Wrapper class an NCrystal material | ||
| //============================================================================== | ||
|
|
||
| class NCrystalMat { | ||
| public: | ||
| //---------------------------------------------------------------------------- | ||
| // Constructors | ||
| NCrystalMat() = default; | ||
| explicit NCrystalMat(const std::string& cfg); | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| // Methods | ||
|
|
||
| #ifdef NCRYSTAL | ||
| //! Return configuration string | ||
| std::string cfg() const; | ||
|
|
||
| //! Get cross section from NCrystal material | ||
| // | ||
| //! \param[in] p Particle object | ||
| //! \return Cross section in [b] | ||
| double xs(const Particle& p) const; | ||
|
|
||
| // Process scattering event | ||
| // | ||
| //! \param[in] p Particle object | ||
| void scatter(Particle& p) const; | ||
|
|
||
| //! Whether the object holds a valid NCrystal material | ||
| operator bool() const; | ||
| #else | ||
|
|
||
| //---------------------------------------------------------------------------- | ||
| // Trivial methods when compiling without NCRYSTAL | ||
| std::string cfg() const | ||
| { | ||
| return ""; | ||
| } | ||
| double xs(const Particle& p) const | ||
| { | ||
| return -1.0; | ||
| } | ||
| void scatter(Particle& p) const {} | ||
| operator bool() const | ||
| { | ||
| return false; | ||
| } | ||
| #endif | ||
|
|
||
| private: | ||
| //---------------------------------------------------------------------------- | ||
| // Data members (only present when compiling with NCrystal support) | ||
| #ifdef NCRYSTAL | ||
| std::string cfg_; //!< NCrystal configuration string | ||
| std::shared_ptr<const NCrystal::ProcImpl::Process> | ||
| ptr_; //!< Pointer to NCrystal material object | ||
| #endif | ||
| }; | ||
|
|
||
| //============================================================================== | ||
| // Functions | ||
| //============================================================================== | ||
|
|
||
| void ncrystal_update_micro(double xs, NuclideMicroXS& micro); | ||
|
|
||
| } // namespace openmc | ||
|
|
||
| #endif // OPENMC_NCRYSTAL_INTERFACE_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
Oops, something went wrong.
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.