Skip to content

Commit

Permalink
Merge pull request #339 from fusion-energy/updating_package_dependencies
Browse files Browse the repository at this point in the history
move deps in pyproject
  • Loading branch information
shimwell authored Oct 5, 2024
2 parents 4614771 + 75d4911 commit 8689f7a
Show file tree
Hide file tree
Showing 12 changed files with 70 additions and 66 deletions.
2 changes: 1 addition & 1 deletion examples/spherical_tokamak_from_plasma_minimal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pathlib import Path

from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand All @@ -25,6 +24,7 @@



# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
# material_tags = [
# "mat1"
Expand Down
2 changes: 1 addition & 1 deletion examples/spherical_tokamak_from_plasma_with_divertor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pathlib import Path

from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand Down Expand Up @@ -32,6 +31,7 @@
my_reactor.save("spherical_tokamak_from_plasma_with_divertor.step")
print('written spherical_tokamak_from_plasma_with_divertor.step')

# from cad_to_dagmc import CadToDagmc
# vis.show(my_reactor)
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 21 # the two divertors split the 3 blanket layers into 9 and the magnets also splt the blanket.
Expand Down
2 changes: 1 addition & 1 deletion examples/spherical_tokamak_from_plasma_with_pf_magnets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand Down Expand Up @@ -44,6 +43,7 @@
my_reactor.save(f"spherical_tokamak_from_plasma_with_pf_magnets.step")


# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 5
# my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pathlib import Path

from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand Down Expand Up @@ -47,7 +46,7 @@
my_reactor.save(f"spherical_tokamak_from_plasma_with_pf_magnets_and_divertor.step")



# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 5
# my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
Expand Down
26 changes: 13 additions & 13 deletions examples/spherical_tokamak_from_plasma_with_tf_magnets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pathlib import Path

from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand Down Expand Up @@ -34,16 +33,17 @@

result.save(f"spherical_tokamak_minimal.step")

my_model = CadToDagmc()
material_tags = ["mat1"] * 7
my_model.add_cadquery_object(cadquery_object=result, material_tags=material_tags)
my_model.export_dagmc_h5m_file(min_mesh_size=3.0, max_mesh_size=20.0)
# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 7
# my_model.add_cadquery_object(cadquery_object=result, material_tags=material_tags)
# my_model.export_dagmc_h5m_file(min_mesh_size=3.0, max_mesh_size=20.0)

h5m_filename = "dagmc.h5m"
flux = transport_particles_on_h5m_geometry(
h5m_filename=h5m_filename,
material_tags=material_tags,
nuclides=["H1"] * len(material_tags),
cross_sections_xml="tests/cross_sections.xml",
)
assert flux > 0.0
# h5m_filename = "dagmc.h5m"
# flux = transport_particles_on_h5m_geometry(
# h5m_filename=h5m_filename,
# material_tags=material_tags,
# nuclides=["H1"] * len(material_tags),
# cross_sections_xml="tests/cross_sections.xml",
# )
# assert flux > 0.0
26 changes: 13 additions & 13 deletions examples/spherical_tokamak_minimal.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from pathlib import Path

from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand Down Expand Up @@ -34,16 +33,17 @@
my_reactor.save(f"spherical_tokamak_minimal.step")


my_model = CadToDagmc()
material_tags = ["mat1"] * 6
my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
my_model.export_dagmc_h5m_file(min_mesh_size=3.0, max_mesh_size=20.0)
# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 6
# my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
# my_model.export_dagmc_h5m_file(min_mesh_size=3.0, max_mesh_size=20.0)

h5m_filename = "dagmc.h5m"
flux = transport_particles_on_h5m_geometry(
h5m_filename=h5m_filename,
material_tags=material_tags,
nuclides=["H1"] * len(material_tags),
cross_sections_xml="tests/cross_sections.xml",
)
assert flux > 0.0
# h5m_filename = "dagmc.h5m"
# flux = transport_particles_on_h5m_geometry(
# h5m_filename=h5m_filename,
# material_tags=material_tags,
# nuclides=["H1"] * len(material_tags),
# cross_sections_xml="tests/cross_sections.xml",
# )
# assert flux > 0.0
2 changes: 1 addition & 1 deletion examples/tokamak_from_plasma_minimal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand All @@ -25,6 +24,7 @@
my_reactor.save(f"tokamak_minimal.step")
print(f"Saved as tokamak_minimal.step")

# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 6 # as inner and outer layers are one solid there are only 6 solids in model
# my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
Expand Down
26 changes: 13 additions & 13 deletions examples/tokamak_minimal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand Down Expand Up @@ -36,16 +35,17 @@
my_reactor.save(f"tokamak_minimal.step")
print(f"Saved as tokamak_minimal.step")

my_model = CadToDagmc()
material_tags = ["mat1"] * 6 # as inner and outer layers are one solid there are only 6 solids in model
my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
my_model.export_dagmc_h5m_file(min_mesh_size=3.0, max_mesh_size=20.0)
# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 6 # as inner and outer layers are one solid there are only 6 solids in model
# my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
# my_model.export_dagmc_h5m_file(min_mesh_size=3.0, max_mesh_size=20.0)

h5m_filename = "dagmc.h5m"
flux = transport_particles_on_h5m_geometry(
h5m_filename=h5m_filename,
material_tags=material_tags,
nuclides=["H1"] * len(material_tags),
cross_sections_xml="tests/cross_sections.xml",
)
assert flux > 0.0
# h5m_filename = "dagmc.h5m"
# flux = transport_particles_on_h5m_geometry(
# h5m_filename=h5m_filename,
# material_tags=material_tags,
# nuclides=["H1"] * len(material_tags),
# cross_sections_xml="tests/cross_sections.xml",
# )
# assert flux > 0.0
26 changes: 13 additions & 13 deletions examples/tokamak_with_pf_magnets.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from cad_to_dagmc import CadToDagmc
from example_util_functions import transport_particles_on_h5m_geometry

import paramak
Expand Down Expand Up @@ -57,16 +56,17 @@
my_reactor.save(f"tokamak_minimal.step")
print(f"Saved as tokamak_minimal.step")

my_model = CadToDagmc()
material_tags = ["mat1"] * 6 # as inner and outer layers are one solid there are only 6 solids in model
my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
my_model.export_dagmc_h5m_file(min_mesh_size=3.0, max_mesh_size=20.0)
# from cad_to_dagmc import CadToDagmc
# my_model = CadToDagmc()
# material_tags = ["mat1"] * 6 # as inner and outer layers are one solid there are only 6 solids in model
# my_model.add_cadquery_object(cadquery_object=my_reactor, material_tags=material_tags)
# my_model.export_dagmc_h5m_file(min_mesh_size=3.0, max_mesh_size=20.0)

h5m_filename = "dagmc.h5m"
flux = transport_particles_on_h5m_geometry(
h5m_filename=h5m_filename,
material_tags=material_tags,
nuclides=["H1"] * len(material_tags),
cross_sections_xml="tests/cross_sections.xml",
)
assert flux > 0.0
# h5m_filename = "dagmc.h5m"
# flux = transport_particles_on_h5m_geometry(
# h5m_filename=h5m_filename,
# material_tags=material_tags,
# nuclides=["H1"] * len(material_tags),
# cross_sections_xml="tests/cross_sections.xml",
# )
# assert flux > 0.0
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ license = {file = "LICENSE.txt"}
requires-python = ">=3.8"
keywords = ["python", "geometry", "reactor", "model", "cad", "fusion", "parametric", "dagmc", "openmc"]
dependencies = [
"cadquery"
"cadquery",
"numpy<=1.26.4",
"mpmath",
"sympy",
"scipy",
]

[project.urls]
Expand All @@ -42,10 +46,6 @@ docs = [
"sphinx",
"pydata-sphinx-theme",
"cadquery",
"numpy<=1.26.4",
"mpmath",
"sympy",
"scipy",
"ipython"
]

Expand Down
6 changes: 5 additions & 1 deletion tests/test_assemblies/test_spherical_tokamak.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from pathlib import Path

import pytest
from cad_to_dagmc import CadToDagmc

import paramak

from .test_utils import transport_particles_on_h5m_geometry

import importlib

@pytest.mark.parametrize("rotation_angle", [30, 360])
@pytest.mark.skipif(not importlib.util.find_spec("cad_to_dagmc"), reason="Skipping transport tests")
def test_transport_with_magnets(rotation_angle):
from cad_to_dagmc import CadToDagmc
poloidal_field_coils = []
for case_thickness, height, width, center_point in zip(
[10, 15],
Expand Down Expand Up @@ -68,7 +70,9 @@ def test_transport_with_magnets(rotation_angle):
assert flux > 0.0


@pytest.mark.skipif(not importlib.util.find_spec("cad_to_dagmc"), reason="Skipping transport tests")
def test_transport_without_magnets():
from cad_to_dagmc import CadToDagmc
reactor = paramak.spherical_tokamak_from_plasma(
radial_build=[
(paramak.LayerType.GAP, 10),
Expand Down
5 changes: 3 additions & 2 deletions tests/test_workplanes/test_plasma_simplified.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from pathlib import Path

import importlib
import cadquery as cq
import pytest
from cad_to_dagmc import CadToDagmc

import paramak

Expand All @@ -19,7 +18,9 @@ def test_creation_different_angles(rotation_angle):


@pytest.mark.parametrize("rotation_angle", [60, 360])
@pytest.mark.skipif(not importlib.util.find_spec("cad_to_dagmc"), reason="Skipping transport tests")
def test_transport_different_angles(rotation_angle):
from cad_to_dagmc import CadToDagmc
test_shape = paramak.plasma_simplified(rotation_angle=rotation_angle)

my_model = CadToDagmc()
Expand Down

0 comments on commit 8689f7a

Please sign in to comment.