forked from idaholab/fenix
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Mahmoud Eltawila
committed
Nov 22, 2024
1 parent
6ae5cf4
commit 0bbfd23
Showing
20 changed files
with
529 additions
and
0 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
150 changes: 150 additions & 0 deletions
150
doc/content/verification_validation_examples/CAD_based_workflow/CAD_workflow.md
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,150 @@ | ||
# CAD-based Geometry Workflow for Multiphysics Fusion Problems Using OpenMC and MOOSE | ||
|
||
This demonstration describes a workflow for modeling fusion problems in OpenMC and MOOSE using a computer aided design (CAD)-based geometry workflow. It is based on the work published in [!cite](Eltawila2024PBNC). | ||
|
||
Fusion system designs are complex and require intricate and accurate models that can be best represented using CAD-based geometry. Fusion neutronics models are frequently leverage on CAD based geometries. An example is the Paramak python package [!cite](shimwell2021paramak) which allows production of 3D CAD models of fusion reactors. The model shown in [paramak] is based on the same generic workflow described in this tutorial. | ||
|
||
!media figures/cad_workflow_transfers.png | ||
id=paramak | ||
caption=Tokamak model based on CAD generated with Paramak package | ||
style=width:90%;display:block;margin-left:auto;margin-right:auto; | ||
|
||
!row! style=display:inline-flex; | ||
!col! small=12 medium=4 large=3 | ||
|
||
The results of the coupled neutronics and heat transfer model are shown in [tok_temps] and [tok_h3production] for the temperature distribution and tritium production rate density. | ||
|
||
!media figures/cad_workflow_tokamak_temps.png | ||
id=tok_temps | ||
caption=Example Paramak tokamak model temperature distribution result | ||
style=width:90%;display:block;margin-left:auto;margin-right:auto; | ||
|
||
!col-end! | ||
|
||
!col! small=12 medium=4 large=3 | ||
|
||
!media figures/cad_workflow_tokamak_tritium_production.png | ||
id=tok_h3production | ||
caption=Example Paramak tokamak model tritium production rate density result | ||
style=width:90%;display:block;margin-left:auto;margin-right:auto; | ||
|
||
!col-end! | ||
!row-end! | ||
|
||
In this example, you'll learn how to: | ||
- Generate meshes for a coupled multiphysics FENIX model. | ||
- Couple OpenMC [!cite](openmc) and MOOSE [!cite](giudicelli2024moose) using Cardinal for fixed source Monte Carlo calculations. | ||
- Use Cardinal [!cite](novak2022_cardinal) to tally values of interest such as tritium production and heating which would be used in MOOSE to solve for the temperature distribution | ||
|
||
We describe this workflow for a generic CAD model which is extremely simplified for the purpose of presenting the modeling workflow. This model was also used in [!cite](Eltawila2024PBNC) to perform mesh refinement studies to investigate how the different model meshes refinement affect multiphysics results. The meshed geometry was prepared using direct accelerated geometry Monte Carlo (DAGMC) for particle transport, and a volumetric mesh was also prepared to be used in MOOSE’s finite element solver and to tally OpenMC results for heat source distribution and tritium production. Cardinal was used to run OpenMC Monte Carlo particle transport within MOOSE framework. The data transfer system transferred heat source and temperature distribution between OpenMC and MOOSE as shown in [transfers], with coupling between neutron transport and heat conduction achieved via Picard iteration. | ||
|
||
!media figures/cad_workflow_transfers.png | ||
id=transfers | ||
caption=OpenMC and MOOSE Coupling | ||
style=width:90%;display:block;margin-left:auto;margin-right:auto; | ||
|
||
## Generating the meshes | ||
|
||
The CAD model was first developed in FUSION360 and was imported into Cubit to assign blocks, materials, and side sets and generate the mesh ([volumetric_mesh]). A corresponding DAGMC surface mesh ([dagmc]) was exported directly from the meshed geometry in Cubit (by loading the volumetric meshed geometry in Cubit and exporting a DAGMC surface mesh). | ||
|
||
In this example, `tmesh_1.e` ([volumetric_mesh]) is the finite element mesh used in MOOSE on which the heat conduction physics is solved. `tmesh_1.h5m` ([dagmc]) is the DAGMC surface mesh used for particle transport in OpenMC (which bounds the surfaces between different materials). Cardinal also allows for mesh tallying for tallying OpenMC results directly on the mesh overlayed on the OpenMC geometry which `tmesh_1.e` ([volumetric_mesh]) could be used for as well as an unstructured volume mesh. This could be used by changing the tally type and adding a mesh template (`tally_type = mesh`, `mesh_template = tmesh_1.e`) in Cardinal input under Problem. | ||
|
||
| ||
|
||
!row! style=display:inline-flex; | ||
!col! small=12 medium=4 large=3 | ||
|
||
!media figures/cad_workflow_mesh_1.png | ||
id=volumetric_mesh | ||
caption=Model volumetric mesh | ||
style=width:90%;display:block;margin-left:auto;margin-right:auto; | ||
|
||
!col-end! | ||
|
||
!col! small=12 medium=4 large=3 | ||
|
||
!media figures/cad_workflow_d1.png | ||
id=dagmc | ||
caption=Model DAGMC mesh | ||
style=width:90%;display:block;margin-left:auto;margin-right:auto; | ||
|
||
!col-end! | ||
!row-end! | ||
|
||
## OpenMC | ||
|
||
The OpenMC input files is as follows: | ||
|
||
!listing /test/tests/examples/cad_workflow/model.py language=python | ||
|
||
## Cardinal | ||
|
||
The Cardinal input files is shown below. The ([MoabSkinner](https://cardinal.cels.anl.gov/source/userobjects/MoabSkinner.html)) was chosen in this model to update the DAGMC geometry from the MOOSE mesh directly ensuring meshes matching which is furhter discussed in[!cite](Eltawila2024PBNC) as well as the use of cell tallies. | ||
|
||
!listing /test/tests/examples/cad_workflow/openmc.i | ||
|
||
## FENIX (MOOSE) Heat transfer | ||
|
||
The FENIX input files is as follows: | ||
|
||
!listing /test/tests/examples/cad_workflow/solid.i | ||
|
||
## Execution | ||
|
||
To generate OpenMC xml files, run: | ||
|
||
``` | ||
python model.py | ||
``` | ||
|
||
Then to run the coupled calculation: | ||
|
||
``` | ||
mpiexec -np 2 fenix-opt -i solid.i --n-threads=2 | ||
``` | ||
|
||
This will run both MOOSE and OpenMC (with Cardinal) with 2 MPI processes and 2 OpenMP threads per rank. To run the simulation faster, you can increase the parallel processes/threads, or simply decrease the number of particles used in OpenMC. When the simulation has completed, you will have created a number of different output files: | ||
|
||
- `solid_out.e`, an Exodus output with the solid mesh and solution from the MOOSE/FENIX input file | ||
- `solid_out_openmc0.e`, an Exodus output with the OpenMC solution and the data that was ultimately transferred in/out of OpenMC | ||
|
||
## Results | ||
|
||
| ||
|
||
The results of this simulation are shown in [temps], [h3production], and [results]. More information - including a mesh sensitivity study and results from a finer mesh - is available in [!cite](Eltawila2024PBNC). | ||
|
||
| ||
|
||
!row! style=display:inline-flex; | ||
!col! small=12 medium=4 large=3 | ||
|
||
!media figures/cad_workflow_Temps.png | ||
id=temps | ||
caption=Temperature distribution result from [!cite](Eltawila2024PBNC) | ||
style=width:90%;display:block;margin-left:auto;margin-right:auto; | ||
|
||
!col-end! | ||
|
||
!col! small=12 medium=4 large=3 | ||
|
||
!media figures/cad_workflow_tritium_production.png | ||
id=h3production | ||
caption=Tritium production rate density result from [!cite](Eltawila2024PBNC) | ||
style=width:90%;display:block;margin-left:auto;margin-right:auto; | ||
|
||
!col-end! | ||
!row-end! | ||
|
||
| ||
|
||
!table id=results caption=Results summary | ||
| Parameter (Units) | Value | | ||
| :- | :- | | ||
| Armor Max. Temp. (K) | 1062.4 | | ||
| First Wall Max. Temp. (K) | 1057.6 | | ||
| Breeder Max. Temp. (K) | 987.4 | | ||
| Heat Source (W) | 2.44 × 10^5^ ± 3 × 10^3^ | | ||
| Tritium Production (atoms/s) | 4.70 × 10^13^ ± 8 × 10^11^ | | ||
|
||
|
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,4 @@ | ||
time,max_T,source_integral | ||
0,0,0 | ||
1,800,244158.40396983 | ||
2,1058.7439583588,243141.87849132 |
Binary file not shown.
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,4 @@ | ||
time,heat_source,heat_source_RelativeError,tritium_RelativeError,tritium_production | ||
0,0,0,0,0 | ||
1,244158.40396983,0.0039604975020543,0.0030447507289791,47082007910425 | ||
2,243141.87849132,0.39003312775355,0.39353117228504,46825507978724 |
Binary file not shown.
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,100 @@ | ||
import openmc | ||
import math | ||
|
||
mat1 = openmc.Material(name="mat1") | ||
mat1.set_density('g/cc', 19.30) | ||
mat1.add_element('W', 1.0) | ||
|
||
eurofer = openmc.Material(name="eurofer") | ||
eurofer.add_element('Fe', 0.011 , 'wo') | ||
eurofer.add_element('Al', 0.002 , 'wo') | ||
eurofer.add_element('As', 0.0002 , 'wo') | ||
eurofer.add_element('B', 0.0012 , 'wo') | ||
eurofer.add_element('C', 0.0005 , 'wo') | ||
eurofer.add_element('Co', 0.0005 , 'wo') | ||
eurofer.add_element('Cr', 0.0005 , 'wo') | ||
eurofer.add_element('Cu', 0.00005 , 'wo') | ||
eurofer.add_element('Mn', 0.00005 , 'wo') | ||
eurofer.add_element('Mo', 0.0001 , 'wo') | ||
eurofer.add_element('N', 0.0001 , 'wo') | ||
eurofer.add_element('Nb', 0.00005 , 'wo') | ||
eurofer.add_element('Ni', 0.0003 , 'wo') | ||
eurofer.add_element('O', 0.00005 , 'wo') | ||
eurofer.add_element('P', 0.004 , 'wo') | ||
eurofer.add_element('S', 0.0001 , 'wo') | ||
eurofer.add_element('Sb', 0.09 , 'wo') | ||
eurofer.add_element('Sn', 0.0001 , 'wo') | ||
eurofer.add_element('Si', 0.0011 , 'wo') | ||
eurofer.add_element('Ta', 0.00002 , 'wo') | ||
eurofer.add_element('Ti', 0.0005 , 'wo') | ||
eurofer.add_element('V', 0 , 'wo') | ||
eurofer.add_element('W', 0.0001 , 'wo') | ||
eurofer.add_element('Zr', 0.88698 , 'wo') | ||
eurofer.set_density("g/cm3", 7.798) | ||
|
||
Helium = openmc.Material(name="Helium") | ||
Helium.add_element('He', 1.0) | ||
Helium.set_density("kg/m3", 0.166) | ||
|
||
mat2 = openmc.Material.mix_materials([eurofer, Helium], [0.65, 0.35], 'ao', name="mat2") | ||
|
||
beryllium = openmc.Material(name="beryllium") | ||
beryllium.add_element('Be', 1.0) | ||
beryllium.set_density("g/cm3", 1.85) | ||
|
||
Li4SiO4 = openmc.Material(name="Li4SiO4") | ||
Li4SiO4.add_element('Li', 4.0) | ||
Li4SiO4.add_element('Si', 1.0) | ||
Li4SiO4.add_element('O', 4.0) | ||
Li4SiO4.set_density("g/cm3", 2.39) | ||
|
||
mat3 = openmc.Material.mix_materials([eurofer, beryllium, Li4SiO4, Helium], [0.1, 0.37, 0.15, 0.38], 'ao',name="mat3") | ||
|
||
mats = openmc.Materials([mat1, eurofer, Helium, mat2, beryllium, Li4SiO4, mat3]) | ||
mats.export_to_xml() | ||
|
||
pz = openmc.Plot() | ||
pz.basis = 'yz' | ||
pz.origin = (0.0, 0.0, 0.0) | ||
pz.width = (200.0, 200.0) | ||
pz.pixels = (500, 500) | ||
pz.color_by = 'material' | ||
|
||
px = openmc.Plot() | ||
px.basis = 'xy' | ||
px.origin = (0.0, 0.0, 0.0) | ||
px.width = (200, 200) | ||
px.pixels = (500, 500) | ||
px.color_by = 'material' | ||
|
||
plots = openmc.Plots([pz,px]) | ||
plots.export_to_xml() | ||
|
||
settings = openmc.Settings() | ||
settings.dagmc = True | ||
settings.batches = 100 | ||
settings.particles = 10000000 | ||
settings.run_mode = "fixed source" | ||
|
||
settings.temperature = {'default': 800.0, | ||
'method': 'interpolation', | ||
'range': (294.0, 3000.0), | ||
'tolerance': 1000.0} | ||
|
||
source = openmc.Source() | ||
|
||
r = openmc.stats.PowerLaw(55, 65, 1.0) | ||
phi = openmc.stats.Uniform(0.0, 2*math.pi) | ||
z = openmc.stats.Discrete([0,], [1.0,]) | ||
spatial_dist = openmc.stats.CylindricalIndependent(r, phi, z) | ||
|
||
source.angle = openmc.stats.Isotropic() | ||
source.energy = openmc.stats.Discrete([14.08e6], [1.0]) | ||
source.space=spatial_dist | ||
settings.source = source | ||
settings.export_to_xml() | ||
|
||
dagmc_univ = openmc.DAGMCUniverse(filename='tmesh_1.h5m') | ||
|
||
geometry = openmc.Geometry(root=dagmc_univ) | ||
geometry.export_to_xml() |
Oops, something went wrong.