diff --git a/doc/content/bib/references.bib b/doc/content/bib/references.bib index 2f742c6b..a14bdd46 100644 --- a/doc/content/bib/references.bib +++ b/doc/content/bib/references.bib @@ -38,3 +38,55 @@ @book{lieberman1994principles edition = {2nd}, year = {2005} } + +@article{giudicelli2024moose, + title = {3.0 - {MOOSE}: Enabling massively parallel multiphysics simulations}, + author = {Guillaume Giudicelli and Alexander Lindsay and Logan Harbour and Casey Icenhour and + Mengnan Li and Joshua E. Hansel and Peter German and Patrick Behne and Oana Marin and + Roy H. Stogner and Jason M. Miller and Daniel Schwen and Yaqi Wang and Lynn Munday and + Sebastian Schunert and Benjamin W. Spencer and Dewen Yushu and Antonio Recuero and + Zachary M. Prince and Max Nezdyur and Tianchen Hu and Yinbin Miao and + Yeon Sang Jung and Christopher Matthews and April Novak and Brandon Langley and + Timothy Truster and Nuno Nobre and Brian Alger and David Andr{\v{s}} and + Fande Kong and Robert Carlsen and Andrew E. Slaughter and John W. Peterson and + Derek Gaston and Cody Permann}, + year = {2024}, + journal = {{SoftwareX}}, + volume = {26}, + pages = {101690}, + issn = {2352-7110}, + doi = {https://doi.org/10.1016/j.softx.2024.101690}, + url = {https://www.sciencedirect.com/science/article/pii/S235271102400061X}, +keywords = {Framework, Finite-element, Finite-volume, Parallel, Multiphysics, Multiscale}, +} + +@article{gaston2015physics, + title = {Physics-based multiscale coupling for full core nuclear reactor simulation}, + author = {Derek R. Gaston and Cody J. Permann and John W. Peterson and Andrew E. Slaughter and + David Andr{\v{s}} and Yaqi Wang and Michael P. Short and Danielle M. Perez and Michael + R. Tonks and Javier Ortensi and Ling Zou and Richard C. Martineau}, + year = {2015}, + journal = {Annals of Nuclear Energy}, + volume = {84}, + pages = {45--54}, +publisher = {Elsevier} +} + +@Article{openmc, + author = {P.K. Romano and N.E. Horelik and B.R. Herman and A.G. Nelson and B. Forget and K. Smith}, + title = {{OpenMC: A State-of-the-Art {Monte} {Carlo} Code for Research and Development}}, + journal = {Annals of Nuclear Energy}, + year = 2015, + volume = 82, + pages = {90--97}, + DOI = {10.1016/j.anucene.2014.07.048} +} + +@article{shimwell2021paramak, + title={The Paramak: automated parametric geometry construction for fusion reactor designs.}, + author={Shimwell, Jonathan and Billingsley, John and Delaporte-Mathurin, R{\'e}mi and Morbey, Declan and Bluteau, Matthew and Shriwise, Patrick and Davis, Andrew}, + journal={F1000Research}, + volume={10}, + year={2021}, + publisher={Faculty of 1000 Ltd} +} \ No newline at end of file diff --git a/doc/content/figures/cad_workflow_Temps.png b/doc/content/figures/cad_workflow_Temps.png new file mode 100644 index 00000000..8f5022b4 Binary files /dev/null and b/doc/content/figures/cad_workflow_Temps.png differ diff --git a/doc/content/figures/cad_workflow_d1.png b/doc/content/figures/cad_workflow_d1.png new file mode 100644 index 00000000..328d7dbf Binary files /dev/null and b/doc/content/figures/cad_workflow_d1.png differ diff --git a/doc/content/figures/cad_workflow_mesh_1.png b/doc/content/figures/cad_workflow_mesh_1.png new file mode 100644 index 00000000..8531512c Binary files /dev/null and b/doc/content/figures/cad_workflow_mesh_1.png differ diff --git a/doc/content/figures/cad_workflow_paramakmodel.png b/doc/content/figures/cad_workflow_paramakmodel.png new file mode 100644 index 00000000..404d732b Binary files /dev/null and b/doc/content/figures/cad_workflow_paramakmodel.png differ diff --git a/doc/content/figures/cad_workflow_tokamak_temps.png b/doc/content/figures/cad_workflow_tokamak_temps.png new file mode 100644 index 00000000..bdd0f0b0 Binary files /dev/null and b/doc/content/figures/cad_workflow_tokamak_temps.png differ diff --git a/doc/content/figures/cad_workflow_tokamak_tritium_production.png b/doc/content/figures/cad_workflow_tokamak_tritium_production.png new file mode 100644 index 00000000..bdd0f0b0 Binary files /dev/null and b/doc/content/figures/cad_workflow_tokamak_tritium_production.png differ diff --git a/doc/content/figures/cad_workflow_transfers.png b/doc/content/figures/cad_workflow_transfers.png new file mode 100644 index 00000000..b802d5ef Binary files /dev/null and b/doc/content/figures/cad_workflow_transfers.png differ diff --git a/doc/content/figures/cad_workflow_tritium_production.png b/doc/content/figures/cad_workflow_tritium_production.png new file mode 100644 index 00000000..b38530e4 Binary files /dev/null and b/doc/content/figures/cad_workflow_tritium_production.png differ diff --git a/doc/content/verification_validation_examples/CAD_based_workflow/CAD_workflow.md b/doc/content/verification_validation_examples/CAD_based_workflow/CAD_workflow.md new file mode 100644 index 00000000..7cd06acb --- /dev/null +++ b/doc/content/verification_validation_examples/CAD_based_workflow/CAD_workflow.md @@ -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^ | + +  \ No newline at end of file diff --git a/doc/content/verification_validation_examples/index.md b/doc/content/verification_validation_examples/index.md index 5801078b..762fc931 100644 --- a/doc/content/verification_validation_examples/index.md +++ b/doc/content/verification_validation_examples/index.md @@ -42,3 +42,6 @@ FENIX is under active development and does not currently have any validation cas !alert construction title=Under development - no example cases are available yet FENIX is under active development and does not currently have any example cases available to users. +| Case | Title | +| ------- | ---------------------------------------------------------------------------------- | +| 1 | [CAD Workflow Example](CAD_based_workflow/CAD_workflow.md) based on [!cite](Eltawila2024PBNC). | diff --git a/test/tests/examples/cad_workflow/gold/solid_out.csv b/test/tests/examples/cad_workflow/gold/solid_out.csv new file mode 100644 index 00000000..b808cc8c --- /dev/null +++ b/test/tests/examples/cad_workflow/gold/solid_out.csv @@ -0,0 +1,4 @@ +time,max_T,source_integral +0,0,0 +1,800,244158.40396983 +2,1058.7439583588,243141.87849132 \ No newline at end of file diff --git a/test/tests/examples/cad_workflow/gold/solid_out.e b/test/tests/examples/cad_workflow/gold/solid_out.e new file mode 100644 index 00000000..eb9023a2 Binary files /dev/null and b/test/tests/examples/cad_workflow/gold/solid_out.e differ diff --git a/test/tests/examples/cad_workflow/gold/solid_out_openmc0.csv b/test/tests/examples/cad_workflow/gold/solid_out_openmc0.csv new file mode 100644 index 00000000..c823051c --- /dev/null +++ b/test/tests/examples/cad_workflow/gold/solid_out_openmc0.csv @@ -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 \ No newline at end of file diff --git a/test/tests/examples/cad_workflow/gold/solid_out_openmc0.e b/test/tests/examples/cad_workflow/gold/solid_out_openmc0.e new file mode 100644 index 00000000..d2812925 Binary files /dev/null and b/test/tests/examples/cad_workflow/gold/solid_out_openmc0.e differ diff --git a/test/tests/examples/cad_workflow/model.py b/test/tests/examples/cad_workflow/model.py new file mode 100644 index 00000000..a444e023 --- /dev/null +++ b/test/tests/examples/cad_workflow/model.py @@ -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() \ No newline at end of file diff --git a/test/tests/examples/cad_workflow/openmc.i b/test/tests/examples/cad_workflow/openmc.i new file mode 100644 index 00000000..9c3c65b0 --- /dev/null +++ b/test/tests/examples/cad_workflow/openmc.i @@ -0,0 +1,83 @@ +[Mesh] + [file] + type = FileMeshGenerator + file = tmesh_1.e + [] +[] + +[AuxVariables] + [cell_temperature] + family = MONOMIAL + order = CONSTANT + [] +[] + +[AuxKernels] + [cell_temperature] + type = CellTemperatureAux + variable = cell_temperature + [] +[] + +[Problem] + type = OpenMCCellAverageProblem + tally_type = cell + tally_name = 'heat_source H3' + lowest_cell_level = 0 + temperature_blocks = '1 2 3' + check_tally_sum = false + source_strength = 1e18 # Particles/s. + volume_calculation = vol + tally_score = 'heating_local H3_production' + tally_trigger = 'rel_err none' + tally_trigger_threshold = '0.1 0.1' + verbose = true + max_batches = 10 + batch_interval = 5 + particles = 5000 + output = unrelaxed_tally_std_dev + skinner = moab +[] + +[UserObjects] + [vol] + type = OpenMCVolumeCalculation + n_samples = 5000 + [] + [moab] + type = MoabSkinner + temperature_min = 800 + temperature_max = 1100 + n_temperature_bins = 10 + temperature = temp + build_graveyard = true + [] +[] + +[Postprocessors] + [heat_source] + type = ElementIntegralVariablePostprocessor + variable = heat_source + [] + [tritium_production] + type = ElementIntegralVariablePostprocessor + variable = H3 + [] + [tritium_RelativeError] + type = TallyRelativeError + tally_score = h3_production + [] + [heat_source_RelativeError] + type = TallyRelativeError + tally_score = heating_local + [] +[] + +[Executioner] + type = Transient +[] + +[Outputs] + exodus = true + csv = true +[] \ No newline at end of file diff --git a/test/tests/examples/cad_workflow/solid.i b/test/tests/examples/cad_workflow/solid.i new file mode 100644 index 00000000..14246420 --- /dev/null +++ b/test/tests/examples/cad_workflow/solid.i @@ -0,0 +1,113 @@ +[Mesh] + [file] + type = FileMeshGenerator + file = tmesh_1.e + [] +[] + +[Variables] + [temp] + initial_condition = 800.0 # [K] + [] +[] + +[AuxVariables] + [heat_source] + family = MONOMIAL + order = CONSTANT + [] +[] + +[Kernels] + [hc] + type = HeatConduction + variable = temp + [] + [heat] + type = CoupledForce + variable = temp + v = heat_source + [] +[] + +[BCs] + [surface] + type = DirichletBC + variable = temp + boundary = 1 + value = 800.0 # [K] + [] +[] + +[Materials] + [k_1] + type = GenericConstantMaterial + prop_values = '1.64' # [W/m.K] + prop_names = 'thermal_conductivity' + block = 'Armour' + [] + [k_2] + type = GenericConstantMaterial + prop_values = '0.45' # [W/m.K] + prop_names = 'thermal_conductivity' + block = 'FW' + [] + [k_3] + type = GenericConstantMaterial + prop_values = '0.65' # [W/m.K] + prop_names = 'thermal_conductivity' + block = 'BM' + [] +[] + +[Executioner] + type = Transient + nl_abs_tol = 1e-8 + num_steps = 2 + solve_type = 'NEWTON' +[] + +[Outputs] + exodus = true + print_linear_residuals = false + perf_graph = true + csv = true +[] + +[MultiApps] + [openmc] + type = TransientMultiApp + app_type = CardinalApp + input_files = 'openmc.i' + execute_on = timestep_end + [] +[] + +[Transfers] + [heat_source_from_openmc] + type = MultiAppGeneralFieldShapeEvaluationTransfer + from_multi_app = openmc + variable = heat_source + source_variable = heat_source + from_postprocessors_to_be_preserved = heat_source + to_postprocessors_to_be_preserved = source_integral + [] + [temp_to_openmc] + type = MultiAppGeneralFieldShapeEvaluationTransfer + to_multi_app = openmc + variable = temp + source_variable = temp + [] +[] + +[Postprocessors] + [source_integral] + type = ElementIntegralVariablePostprocessor + variable = heat_source + execute_on = transfer + [] + [max_T] + type = NodalExtremeValue + variable = temp + [] +[] \ No newline at end of file diff --git a/test/tests/examples/cad_workflow/tests b/test/tests/examples/cad_workflow/tests new file mode 100644 index 00000000..ce5d1a1a --- /dev/null +++ b/test/tests/examples/cad_workflow/tests @@ -0,0 +1,20 @@ +[Tests] + design = 'cad_model.md' + issues = '#30' + [solid_diff] + type = Exodiff + input = 'solid.i' + exodiff = solid_out.e + requirement = "The system shall be able to run a coupled neutronics and heat conduction simulation and solve for the temperature distribution." + required_objects = 'OpenMCCellAverageProblem' + [] + [openmc_diff] + type = Exodiff + input = 'solid.i' + exodiff = solid_out_openmc0.e + should_execute = False + prereq = solid_diff + requirement = "The system shall be able to run a coupled neutronics and heat conduction simulation and solve for the heat source and tritium production." + required_objects = 'OpenMCCellAverageProblem' + [] +[] \ No newline at end of file diff --git a/test/tests/examples/cad_workflow/tmesh_1.h5m b/test/tests/examples/cad_workflow/tmesh_1.h5m new file mode 100644 index 00000000..b1909fe0 Binary files /dev/null and b/test/tests/examples/cad_workflow/tmesh_1.h5m differ