diff --git a/environment.yml b/environment.yml index 2f13f89..e805545 100644 --- a/environment.yml +++ b/environment.yml @@ -14,5 +14,3 @@ dependencies: - openmc=0.13.3=dagmc* - networkx - pip - - pip: - - openmc_data_downloader \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 18a95bc..a1a9795 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,8 +31,7 @@ write_to = "src/_version.py" [project.optional-dependencies] tests = [ - "pytest", - "openmc_data_downloader" + "pytest" ] [project.urls] diff --git a/tests/ENDFB-7.1-NNDC_H1.h5 b/tests/ENDFB-7.1-NNDC_H1.h5 new file mode 100644 index 0000000..ff20c6a Binary files /dev/null and b/tests/ENDFB-7.1-NNDC_H1.h5 differ diff --git a/tests/test_brep_to_h5m/test_h5m_in_transport.py b/tests/test_brep_to_h5m/test_h5m_in_transport.py index 02c6d72..020ea2b 100644 --- a/tests/test_brep_to_h5m/test_h5m_in_transport.py +++ b/tests/test_brep_to_h5m/test_h5m_in_transport.py @@ -1,5 +1,4 @@ import openmc -import openmc_data_downloader from cad_to_dagmc.brep_to_h5m import brep_to_h5m import math @@ -25,8 +24,7 @@ def transport_particles_on_h5m_geometry( ): """A function for testing the geometry file with particle transport in DAGMC OpenMC. Requires openmc and either the cross_sections_xml to be - specified or openmc_data_downloader installed. Returns the flux on each - volume + specified. Returns the flux on each volume Arg: h5m_filename: The name of the DAGMC h5m file to test @@ -47,19 +45,26 @@ def transport_particles_on_h5m_geometry( # simplified material definitions have been used to keen this example minimal mat_dag_material_tag = openmc.Material(name=material_tag) mat_dag_material_tag.add_nuclide(nuclides[i], 1, "ao") - mat_dag_material_tag.set_density("g/cm3", 0.1) + mat_dag_material_tag.set_density("g/cm3", 0.01) materials.append(mat_dag_material_tag) if cross_sections_xml: - materials.cross_sections = cross_sections_xml + openmc.config["cross_sections"] = cross_sections_xml + else: - # downloads the nuclear data and sets the openmc_cross_sections environmental variable - materials.download_cross_section_data( - libraries=["ENDFB-7.1-NNDC"], - set_OPENMC_CROSS_SECTIONS=True, - particles=["neutron"], - ) + with open("cross_sections.xml", "w") as file: + file.write( + """ + + + + + + """ + ) + + openmc.config["cross_sections"] = "cross_sections.xml" dag_univ = openmc.DAGMCUniverse(filename=h5m_filename) bound_dag_univ = dag_univ.bounded_universe() @@ -133,7 +138,9 @@ def test_transport_on_h5m_with_6_volumes(): ) transport_particles_on_h5m_geometry( - h5m_filename=h5m_filename, material_tags=material_tags + h5m_filename=h5m_filename, + material_tags=material_tags, + nuclides=["H1"] * len(material_tags), ) @@ -153,7 +160,9 @@ def test_transport_on_h5m_with_1_volumes(): ) transport_particles_on_h5m_geometry( - h5m_filename=h5m_filename, material_tags=material_tags + h5m_filename=h5m_filename, + material_tags=material_tags, + nuclides=["H1"] * len(material_tags), ) @@ -173,7 +182,9 @@ def test_transport_on_h5m_with_2_joined_volumes(): ) transport_particles_on_h5m_geometry( - h5m_filename=h5m_filename, material_tags=material_tags + h5m_filename=h5m_filename, + material_tags=material_tags, + nuclides=["H1"] * len(material_tags), ) @@ -193,7 +204,9 @@ def test_transport_on_h5m_with_2_sep_volumes(): ) transport_particles_on_h5m_geometry( - h5m_filename=h5m_filename, material_tags=material_tags + h5m_filename=h5m_filename, + material_tags=material_tags, + nuclides=["H1"] * len(material_tags), ) @@ -213,7 +226,9 @@ def test_transport_result_h5m_with_2_sep_volumes(): ) new_tally = transport_particles_on_h5m_geometry( - h5m_filename=h5m_filename, material_tags=material_tags + h5m_filename=h5m_filename, + material_tags=material_tags, + nuclides=["H1"] * len(material_tags), ) brep_to_h5m( @@ -225,7 +240,9 @@ def test_transport_result_h5m_with_2_sep_volumes(): mesh_algorithm=1, ) stl_tally = transport_particles_on_h5m_geometry( - h5m_filename=h5m_filename, material_tags=material_tags + h5m_filename=h5m_filename, + material_tags=material_tags, + nuclides=["H1"] * len(material_tags), ) assert math.isclose(new_tally, stl_tally) @@ -250,7 +267,9 @@ def test_stl_vs_in_memory_1_volume(): ) transport_particles_on_h5m_geometry( - h5m_filename="h5m_from_in_memory_method.h5m", material_tags=material_tags + h5m_filename="h5m_from_in_memory_method.h5m", + material_tags=material_tags, + nuclides=["H1"] * len(material_tags), ) @@ -273,5 +292,7 @@ def test_stl_vs_in_memory_2_joined_volume(): ) transport_particles_on_h5m_geometry( - h5m_filename="h5m_from_in_memory_method.h5m", material_tags=material_tags + h5m_filename="h5m_from_in_memory_method.h5m", + material_tags=material_tags, + nuclides=["H1"] * len(material_tags), ) diff --git a/tests/test_cad_to_dagmc/test_h5m_in_simulation.py b/tests/test_cad_to_dagmc/test_h5m_in_simulation.py index 713c474..490e95f 100644 --- a/tests/test_cad_to_dagmc/test_h5m_in_simulation.py +++ b/tests/test_cad_to_dagmc/test_h5m_in_simulation.py @@ -1,6 +1,4 @@ import openmc -import openmc_data_downloader - """ - h5m files can be used a transport geometry in DAGMC with OpenMC @@ -13,21 +11,28 @@ def transport_particles_on_h5m_geometry( ): """A function for testing the geometry file with particle transport in DAGMC OpenMC""" + with open("cross_sections.xml", "w") as file: + file.write( + """ + + + + + + """ + ) + + openmc.config["cross_sections"] = "cross_sections.xml" + materials = openmc.Materials() for material_tag in material_tags: # simplified material definitions have been used to keen this example minimal mat_dag_material_tag = openmc.Material(name=material_tag) mat_dag_material_tag.add_nuclide("H1", 1, "ao") - mat_dag_material_tag.set_density("g/cm3", 2) + mat_dag_material_tag.set_density("g/cm3", 0.01) materials.append(mat_dag_material_tag) - materials.download_cross_section_data( - libraries=["ENDFB-7.1-NNDC"], - set_OPENMC_CROSS_SECTIONS=True, - particles=["neutron"], - ) - # makes use of the dagmc geometry dag_univ = openmc.DAGMCUniverse(h5m_filename) diff --git a/tests/test_vertices_to_h5m/test_package.py b/tests/test_vertices_to_h5m/test_package.py index baf16a5..a4fb39d 100644 --- a/tests/test_vertices_to_h5m/test_package.py +++ b/tests/test_vertices_to_h5m/test_package.py @@ -2,7 +2,6 @@ import numpy as np import openmc -import openmc_data_downloader import pymoab as mb from pymoab import core, types @@ -58,8 +57,8 @@ def transport_particles_on_h5m_geometry( for material_tag in material_tags: # simplified material definitions have been used to keen this example minimal mat_dag_material_tag = openmc.Material(name=material_tag) - mat_dag_material_tag.add_element("H", 1, "ao") - mat_dag_material_tag.set_density("g/cm3", 2) + mat_dag_material_tag.add_nuclide("H1", 1, "ao") + mat_dag_material_tag.set_density("g/cm3", 0.01) materials.append(mat_dag_material_tag) @@ -67,11 +66,22 @@ def transport_particles_on_h5m_geometry( materials.cross_sections = cross_sections_xml # downloads the nuclear data and sets the openmc_cross_sections environmental variable - materials.download_cross_section_data( - libraries=["ENDFB-7.1-NNDC"], - set_OPENMC_CROSS_SECTIONS=True, - particles=["neutron"], - ) + if cross_sections_xml: + openmc.config["cross_sections"] = cross_sections_xml + + else: + with open("cross_sections.xml", "w") as file: + file.write( + """ + + + + + + """ + ) + + openmc.config["cross_sections"] = "cross_sections.xml" # makes use of the dagmc geometry dag_univ = openmc.DAGMCUniverse(h5m_filename)