Skip to content
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

Differentiate materials in DAGMC universes #3056

Merged
merged 128 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
903d114
start commenting
bam241 Jun 11, 2024
66a2be4
test
Jun 20, 2024
afd5a96
up
Jun 20, 2024
538313a
new state
Jun 22, 2024
e2c41c6
new state
Jun 22, 2024
ceb12fb
removing print
Jun 22, 2024
42dc9c3
removing unnecessary comment
Jun 22, 2024
2102210
fix
Jul 22, 2024
52dcd3f
add differente_mats into model
Jul 22, 2024
b6df271
syntax
Jul 22, 2024
8f827cc
docstring
Jul 22, 2024
a71e488
tmp commit
Jul 24, 2024
6a80008
computer change
Jul 31, 2024
394d585
computer change
Jul 31, 2024
4ec6b2b
in progress
Aug 2, 2024
5dc39fb
in progress
Aug 2, 2024
0a1e6c5
temp
Aug 7, 2024
7aa6f64
temp
Aug 7, 2024
f7a9b23
up
bam241 Aug 12, 2024
f3acb0b
cleaning printout
bam241 Aug 12, 2024
9bfab40
adding openmc_get_dagmc_cell_ids to compilation without DAGMC
bam241 Aug 12, 2024
635f1f5
Adding some test for dagmc_split
bam241 Aug 12, 2024
44ae1ad
put test restriction on dagmc model test if there is no DAGMC
bam241 Aug 12, 2024
25d29a6
adding missing import
bam241 Aug 12, 2024
f53ec5c
Apply suggestions from code review
bam241 Aug 19, 2024
4b84f67
updatE
bam241 Aug 22, 2024
657da23
formating
bam241 Aug 22, 2024
ca2efe3
cells now contain distribmat after differentiate with match_cell
bam241 Aug 22, 2024
c403854
move dagmc related methods into dagmc.py, factorise Universes method
bam241 Aug 26, 2024
b215d9e
update dagmc.cpp
bam241 Aug 26, 2024
fd2a7a2
raise an error if diff_volume_method is unknown and correct mat name …
bam241 Aug 27, 2024
95ff5bf
forgot to close the parenthesis
bam241 Aug 27, 2024
0fa8a44
missing a loop
bam241 Aug 28, 2024
7ce1b0a
proper order if
bam241 Aug 28, 2024
3197ee4
diff without option is ok
bam241 Aug 29, 2024
3a7c19c
rm commented code
bam241 Aug 29, 2024
8f3ffa5
my enforcing was not the problem
bam241 Aug 29, 2024
8e5c3ef
this adds a diff_volume_method as None by default, and just split mat…
bam241 Sep 4, 2024
55e59ca
Merge remote-tracking branch 'upstream/develop' into dagmc_decoupling
bam241 Sep 5, 2024
293e2f0
fixing dagmc geometry name
bam241 Sep 5, 2024
f96d6e3
pointer should be POINTER
bam241 Sep 9, 2024
81168e0
Update openmc/lib/dagmc.py
bam241 Sep 9, 2024
23a3108
Update openmc/model/model.py
bam241 Sep 9, 2024
94f04ce
Update openmc/model/model.py
bam241 Sep 9, 2024
429ee4a
Update openmc/dagmc.py
bam241 Sep 9, 2024
8baa99a
Update openmc/model/model.py
bam241 Sep 9, 2024
01b4c9d
fixe a to_lower shortcut typo
bam241 Sep 9, 2024
c8de658
adding docstring in dagmc.py
bam241 Sep 9, 2024
86cff56
forgot renameing file open
bam241 Sep 10, 2024
95136d7
no run necesseray
bam241 Sep 12, 2024
610bc95
restore old behavior for diff_deplet_mat, warning instead of error fo…
bam241 Sep 12, 2024
6756288
Apply suggestions from code review
bam241 Sep 12, 2024
c0680dd
adressing most @pshriwise comments
bam241 Sep 21, 2024
31fbcdc
cleaning
bam241 Sep 21, 2024
ebc9829
Merge remote-tracking branch 'upstream/develop' into dagmc_decoupling
bam241 Sep 21, 2024
9d55c28
update
bam241 Sep 21, 2024
416e794
fixing compilation error when searching in map
bam241 Sep 21, 2024
f6a7e76
add safeguard against overridings DAGMC cell with more materials than…
bam241 Sep 22, 2024
e2f392f
add single mat override
bam241 Sep 23, 2024
8148957
Update src/dagmc.cpp
bam241 Oct 1, 2024
ce99675
quickfix depletable only
bam241 Oct 2, 2024
b6ad4b7
factoring method form Universe to UniverseBase, do DAGMCUniverse can …
bam241 Oct 2, 2024
8b0906d
allow assignement overload per cell_id for DAGMC universe
bam241 Oct 5, 2024
c25d34e
Merge remote-tracking branch 'upstream/develop' into dagmc_decoupling
bam241 Oct 8, 2024
569348e
reset fmt to upstream/develop val
bam241 Oct 8, 2024
a9e0306
Apply suggestions from code review
bam241 Oct 9, 2024
dae5527
adressing third round of comment from @pshriwise
bam241 Oct 11, 2024
182d991
Merge remote-tracking branch 'upstream/develop' into dagmc_decoupling
bam241 Oct 11, 2024
50cfcab
Adding missing import for input_path
bam241 Oct 11, 2024
46f1ecf
Apply suggestions from code review
bam241 Oct 30, 2024
6b4efa9
add missing docstring
bam241 Oct 28, 2024
1d49274
direct import in init
bam241 Oct 28, 2024
89b4e37
adressing @pshriwise comments
bam241 Oct 30, 2024
af80702
updte test and adding test to check differentiation and volume calcul…
bam241 Oct 31, 2024
117e3ce
Merge remote-tracking branch 'upstream/develop' into dagmc_decoupling
bam241 Nov 11, 2024
4297bc7
factorising dagmc model tests
bam241 Nov 11, 2024
0b7411e
add comments
bam241 Nov 11, 2024
3078dc4
update
bam241 Nov 11, 2024
8f7d9af
typo
bam241 Nov 11, 2024
8579ae1
forgot the return...
bam241 Nov 11, 2024
5fdc49a
Apply suggestions from code review
bam241 Dec 5, 2024
58ce43b
new round of edits
bam241 Dec 5, 2024
2783196
Merge remote-tracking branch 'upstream/develop' into dagmc_decoupling
bam241 Dec 5, 2024
d6f0913
fixing not working tests
bam241 Dec 5, 2024
9f458c4
Update src/dagmc.cpp
bam241 Dec 6, 2024
387f648
Update tests/unit_tests/dagmc/test_model.py
bam241 Dec 6, 2024
e63f285
addressing comment, improving tests
bam241 Dec 6, 2024
c4f7259
ongoing
bam241 Dec 12, 2024
84898c5
can't check n_instance match number of override as n_instance is coun…
bam241 Dec 12, 2024
d6f9af8
factorizing adding override
bam241 Dec 12, 2024
da8cf37
add a missing error
bam241 Dec 12, 2024
f71acc4
add a missing error
bam241 Dec 12, 2024
1b9b58e
update from_xml for dagmc
bam241 Dec 12, 2024
f1e9935
update docs
bam241 Dec 12, 2024
287201a
using material ID for the xml istead of the name per default
bam241 Dec 16, 2024
d88a4bb
changing xml layout
bam241 Dec 17, 2024
bec954e
removing ; separator, changing docs accordingly
bam241 Dec 17, 2024
783547d
Apply suggestions from code review
bam241 Dec 20, 2024
1ff5d61
Apply suggestions from code review
bam241 Dec 20, 2024
06133ed
Addressing next round of comment
bam241 Dec 20, 2024
ed04232
Refactor DAGMC material diferentiation tests
pshriwise Dec 20, 2024
ee1bec8
Update IO format docs for material_overrides
paulromano Dec 20, 2024
415e614
Remove unused imports
paulromano Dec 20, 2024
383a878
Cleanup with material_overrides
paulromano Dec 20, 2024
2a8747a
Get rid of unused overload for split
paulromano Dec 20, 2024
548c04e
Simplifications in lib/dagmc.py
paulromano Dec 20, 2024
ff947b8
Remove get_all_dagmc_universes
paulromano Dec 20, 2024
6b00d66
Cell Id as key
bam241 Dec 20, 2024
11a6b50
Altering override data structure type on the C++ side.
pshriwise Dec 21, 2024
bf714c7
Docstring updates and build_override_mat_from_cells method simplifica…
pshriwise Dec 21, 2024
31e6ebc
removing build_override_mat_from_cells method as it's just a few line…
pshriwise Dec 21, 2024
3898c2b
Skipping cells with a None fill while building material override to m…
pshriwise Dec 21, 2024
4729309
Simplify control flow in diff mats. Docstring updates
pshriwise Dec 21, 2024
ad6a877
Better position for try in existing test. Add test for ValueErro when…
pshriwise Dec 21, 2024
e1655e2
Style fixes
pshriwise Dec 21, 2024
4576e26
adding test for XML generation and creation from, fixing _from_XML me…
bam241 Dec 22, 2024
2340aac
Apply suggestion from @bam241
pshriwise Dec 23, 2024
76564cd
Separate and simplify how cell override assignments are set and creat…
pshriwise Dec 23, 2024
9801c80
Update C++ tags to reflect XML structure changes
pshriwise Dec 23, 2024
92ed191
Update tests related to XML IO
pshriwise Dec 23, 2024
a08663a
Adding test with full roundtrip
pshriwise Dec 23, 2024
4da07c6
Simplifying further
pshriwise Dec 23, 2024
1f28a9e
Removing errant print
pshriwise Dec 23, 2024
23f2bc6
consolidating all test related to dagmc material override xml generation
bam241 Dec 25, 2024
af175cd
Adding test for bad name for replacement, bad override type, override…
bam241 Dec 25, 2024
120a1de
Simplifying tests. Assigning materials directly to cells and adding m…
pshriwise Dec 30, 2024
08fa0a9
C++ style
pshriwise Dec 30, 2024
636160e
Updates throughout dagmc.py and tests
paulromano Jan 7, 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
34 changes: 27 additions & 7 deletions docs/source/io_formats/geometry.rst
Original file line number Diff line number Diff line change
Expand Up @@ -407,13 +407,33 @@ Each ``<dagmc_universe>`` element can have the following attributes or sub-eleme

*Default*: None

:material_overrides:
This element contains information on material overrides to be applied to the
DAGMC universe. It has the following attributes and sub-elements:

.. note:: A geometry.xml file containing only a DAGMC model for a file named `dagmc.h5m` (no CSG)
looks as follows
:cell:
Material override information for a single cell. It contains the following
attributes and sub-elements:

.. code-block:: xml
:id:
The cell ID in the DAGMC geometry for which the material override will
apply.

<?xml version='1.0' encoding='utf-8'?>
<geometry>
<dagmc_universe filename="dagmc.h5m" id="1" />
</geometry>
:materials:
A list of material IDs that will apply to instances of the cell. If the
list contains only one ID, it will replace the original material
assignment of all instances of the DAGMC cell. If the list contains more
than one material, each material ID of the list will be assigned to the
various instances of the DAGMC cell.

*Default*: None

.. note:: A geometry.xml file containing only a DAGMC model for a file named
`dagmc.h5m` (no CSG) looks as follows:

.. code-block:: xml

<?xml version='1.0' encoding='utf-8'?>
<geometry>
<dagmc_universe filename="dagmc.h5m" id="1" />
</geometry>
1 change: 1 addition & 0 deletions docs/source/pythonapi/capi.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Functions
finalize
find_cell
find_material
dagmc_universe_cell_ids
global_bounding_box
global_tallies
hard_reset
Expand Down
3 changes: 3 additions & 0 deletions include/openmc/capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ int openmc_cell_set_temperature(
int32_t index, double T, const int32_t* instance, bool set_contained = false);
int openmc_cell_set_translation(int32_t index, const double xyz[]);
int openmc_cell_set_rotation(int32_t index, const double rot[], size_t rot_len);
int openmc_dagmc_universe_get_cell_ids(
int32_t univ_id, int32_t* ids, size_t* n);
int openmc_dagmc_universe_get_num_cells(int32_t univ_id, size_t* n);
int openmc_energy_filter_get_bins(
int32_t index, const double** energies, size_t* n);
int openmc_energy_filter_set_bins(
Expand Down
8 changes: 7 additions & 1 deletion include/openmc/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ class Cell {
int32_t universe_; //!< Universe # this cell is in
int32_t fill_; //!< Universe # filling this cell
int32_t n_instances_ {0}; //!< Number of instances of this cell
GeometryType geom_type_; //!< Geometric representation type (CSG, DAGMC)

//! \brief Index corresponding to this cell in distribcell arrays
int distribcell_index_ {C_NONE};
Expand Down Expand Up @@ -350,6 +349,13 @@ class Cell {
vector<double> rotation_;

vector<int32_t> offset_; //!< Distribcell offset table

// Accessors
const GeometryType& geom_type() const { return geom_type_; }
bam241 marked this conversation as resolved.
Show resolved Hide resolved
GeometryType& geom_type() { return geom_type_; }

private:
GeometryType geom_type_; //!< Geometric representation type (CSG, DAGMC)
};

struct CellInstanceItem {
Expand Down
15 changes: 15 additions & 0 deletions include/openmc/dagmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ void check_dagmc_root_univ();
#include "openmc/particle.h"
#include "openmc/position.h"
#include "openmc/surface.h"
#include "openmc/vector.h"

#include <memory> // for shared_ptr, unique_ptr
#include <string>
#include <unordered_map>
#include <utility> // for pair

class UWUW;

Expand Down Expand Up @@ -133,6 +139,10 @@ class DAGUniverse : public Universe {
void legacy_assign_material(
std::string mat_string, std::unique_ptr<DAGCell>& c) const;

//! Assign a material overriding normal assignement to a cell
//! \param[in] c The OpenMC cell to which the material is assigned
void override_assign_material(std::unique_ptr<DAGCell>& c) const;

//! Return the index into the model cells vector for a given DAGMC volume
//! handle in the universe
//! \param[in] vol MOAB handle to the DAGMC volume set
Expand Down Expand Up @@ -184,6 +194,11 @@ class DAGUniverse : public Universe {
//!< generate new material IDs for the universe
bool has_graveyard_; //!< Indicates if the DAGMC geometry has a "graveyard"
//!< volume
std::unordered_map<int32_t, vector<int32_t>>
material_overrides_; //!< Map of material overrides
//!< keys correspond to the DAGMCCell id
//!< values are a list of material ids used
//!< for the override
};

//==============================================================================
Expand Down
8 changes: 7 additions & 1 deletion include/openmc/surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class Surface {
int id_; //!< Unique ID
std::string name_; //!< User-defined name
unique_ptr<BoundaryCondition> bc_; //!< Boundary condition
GeometryType geom_type_; //!< Geometry type indicator (CSG or DAGMC)
bool surf_source_ {false}; //!< Activate source banking for the surface?

explicit Surface(pugi::xml_node surf_node);
Expand Down Expand Up @@ -91,6 +90,13 @@ class Surface {
//! Get the BoundingBox for this surface.
virtual BoundingBox bounding_box(bool /*pos_side*/) const { return {}; }

// Accessors
const GeometryType& geom_type() const { return geom_type_; }
GeometryType& geom_type() { return geom_type_; }

private:
GeometryType geom_type_; //!< Geometry type indicator (CSG or DAGMC)

protected:
virtual void to_hdf5_inner(hid_t group_id) const = 0;
};
Expand Down
1 change: 1 addition & 0 deletions openmc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from openmc.weight_windows import *
from openmc.surface import *
from openmc.universe import *
from openmc.dagmc import *
from openmc.source import *
from openmc.settings import *
from openmc.lattice import *
Expand Down
Loading
Loading