-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
132 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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 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,47 @@ | ||
|
||
# this file makes a GMESH mesh file from a Step file | ||
# then loads up the GMESH file and converts it to a DAGMC file | ||
|
||
|
||
# making the GMESH file | ||
from cad_to_dagmc import CadToDagmc | ||
|
||
geometry = CadToDagmc() | ||
geometry.add_stp_file('two_connected_cubes.stp') | ||
geometry.export_gmsh_mesh_file(filename='example_gmsh_mesh.msh') | ||
|
||
# converting the mesh file to a DAGMC file | ||
from cad_to_dagmc import MeshToDagmc | ||
|
||
mesh = MeshToDagmc(filename='example_gmsh_mesh.msh') | ||
|
||
mesh.export_dagmc_h5m_file( | ||
material_tags = ['mat1', 'mat2'], | ||
filename = "dagmc.h5m", | ||
) | ||
|
||
# making use of the DAGMC file in OpenMC | ||
import openmc | ||
openmc.config['cross_sections'] = '/home/j/endf-b8.0-hdf5/endfb-viii.0-hdf5/cross_sections.xml' | ||
|
||
mat1 = openmc.Material(name='mat1') | ||
mat1.add_nuclide("H1", 1, percent_type="ao") | ||
mat1.set_density("g/cm3", 0.001) | ||
|
||
mat2 = openmc.Material(name='mat2') | ||
mat2.add_nuclide("H1", 1, percent_type="ao") | ||
mat2.set_density("g/cm3", 0.002) | ||
|
||
materials = openmc.Materials([mat1, mat2]) | ||
|
||
universe = openmc.DAGMCUniverse("dagmc.h5m").bounded_universe() | ||
geometry = openmc.Geometry(universe) | ||
|
||
my_settings = openmc.Settings() | ||
my_settings.batches = 10 | ||
my_settings.inactive = 0 | ||
my_settings.particles = 500 | ||
my_settings.run_mode = 'fixed source' | ||
|
||
model = openmc.Model(geometry=geometry, materials=materials, settings=my_settings) | ||
model.run() |
This file contains 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