Skip to content

Commit

Permalink
building geometry in test env
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Mar 18, 2024
1 parent 4c1f21c commit a41e8db
Showing 1 changed file with 27 additions and 29 deletions.
56 changes: 27 additions & 29 deletions tests/test_h5m_in_transport.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import openmc

from cad_to_Dagmc import CadToDagmc
import cadquery as cq

"""
Tests that check that:
Expand Down Expand Up @@ -117,21 +118,20 @@ def transport_particles_on_h5m_geometry(


def test_transport_result_h5m_with_2_sep_volumes():
# h5m_filename = "test_two_sep_volumes.h5m"
h5m_filename = "test_two_sep_volumes.h5m"
volumes = 2
material_tags = [f"material_{n}" for n in range(1, volumes + 1)]

# workplane1 = cq.Workplane("XY").cylinder(height=10, radius=4)
# workplane2 = cq.Workplane("XY").moveTo(0, 15).cylinder(height=10, radius=5)
# # cq.Assembly().add(workplane1).add(workplane2)
workplane1 = cq.Workplane("XY").cylinder(height=10, radius=4)
workplane2 = cq.Workplane("XY").moveTo(0, 15).cylinder(height=10, radius=5)
# cq.Assembly().add(workplane1).add(workplane2)

# my_model = CadToDagmc()
# my_model.add_cadquery_object(workplane1)
# my_model.add_cadquery_object(workplane2)
# my_model.export_dagmc_h5m_file(
# filename=h5m_filename, material_tags=[material_tags[0], material_tags[1]]
# )
h5m_filename = "test_two_sep_volumes.h5m"
my_model = CadToDagmc()
my_model.add_cadquery_object(workplane1)
my_model.add_cadquery_object(workplane2)
my_model.export_dagmc_h5m_file(
filename=h5m_filename, material_tags=[material_tags[0], material_tags[1]]
)

transport_particles_on_h5m_geometry(
h5m_filename=h5m_filename,
Expand All @@ -141,17 +141,15 @@ def test_transport_result_h5m_with_2_sep_volumes():


def test_transport_result_h5m_with_1_volumes():
# h5m_filename = "one_cylinder.h5m"
h5m_filename = "one_cylinder.h5m"
volumes = 1
material_tags = [f"material_{n}" for n in range(1, volumes + 1)]

# workplane1 = cq.Workplane("XY").cylinder(height=10, radius=4)
workplane1 = cq.Workplane("XY").cylinder(height=10, radius=4)

# my_model = CadToDagmc()
# my_model.add_cadquery_object(workplane1)
# my_model.export_dagmc_h5m_file(filename=h5m_filename, material_tags=[material_tags[0]])

h5m_filename = "one_cylinder.h5m"
my_model = CadToDagmc()
my_model.add_cadquery_object(workplane1)
my_model.export_dagmc_h5m_file(filename=h5m_filename, material_tags=[material_tags[0]])

transport_particles_on_h5m_geometry(
h5m_filename=h5m_filename,
Expand All @@ -161,22 +159,22 @@ def test_transport_result_h5m_with_1_volumes():


def test_transport_result_h5m_with_2_joined_volumes():
# h5m_filename = "two_connected_cylinders.h5m"
h5m_filename = "two_connected_cylinders.h5m"
volumes = 2
material_tags = [f"material_{n}" for n in range(1, volumes + 1)]

# workplane1 = cq.Workplane("XY").cylinder(height=10, radius=4)
# workplane2 = cq.Workplane("XY").cylinder(height=10, radius=5).cut(workplane1)
workplane1 = cq.Workplane("XY").cylinder(height=10, radius=4)
workplane2 = cq.Workplane("XY").cylinder(height=10, radius=5).cut(workplane1)

# my_model = CadToDagmc()
# my_model.add_cadquery_object(workplane1)
# my_model.add_cadquery_object(workplane2)
# my_model.export_dagmc_h5m_file(
# filename=h5m_filename, material_tags=[material_tags[0], material_tags[1]]
# )
my_model = CadToDagmc()
my_model.add_cadquery_object(workplane1)
my_model.add_cadquery_object(workplane2)
my_model.export_dagmc_h5m_file(
filename=h5m_filename, material_tags=[material_tags[0], material_tags[1]]
)

transport_particles_on_h5m_geometry(
h5m_filename="two_connected_cylinders.h5m",
h5m_filename=h5m_filename,
material_tags=material_tags,
nuclides=["H1"] * len(material_tags),
)

0 comments on commit a41e8db

Please sign in to comment.