Skip to content

Commit

Permalink
Merge pull request #361 from fusion-energy/adding_umesh_example
Browse files Browse the repository at this point in the history
Adding example simulations using regular and unstrucutred meshes
  • Loading branch information
shimwell authored Dec 30, 2024
2 parents d850829 + 14974ab commit 42ff5be
Show file tree
Hide file tree
Showing 17 changed files with 397 additions and 342 deletions.
102 changes: 0 additions & 102 deletions examples/example_util_functions.py

This file was deleted.

20 changes: 0 additions & 20 deletions examples/spherical_tokamak_from_plasma_minimal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from pathlib import Path

from example_util_functions import transport_particles_on_h5m_geometry

import paramak

my_reactor = paramak.spherical_tokamak_from_plasma(
Expand All @@ -21,21 +19,3 @@
rotation_angle=180,
)
my_reactor.save(f"spherical_tokamak_from_plasma_minimal.step")


# 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
20 changes: 0 additions & 20 deletions examples/spherical_tokamak_from_plasma_with_color.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from pathlib import Path

from example_util_functions import transport_particles_on_h5m_geometry

import paramak

my_reactor = paramak.spherical_tokamak_from_plasma(
Expand Down Expand Up @@ -54,19 +50,3 @@
file_path='spherical_tokamak_from_plasma_with_colors.png'
)

# 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
22 changes: 1 addition & 21 deletions examples/spherical_tokamak_from_plasma_with_divertor.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from pathlib import Path

from example_util_functions import transport_particles_on_h5m_geometry

import paramak
from cadquery import Workplane, vis
from cadquery import Workplane


# makes a rectangle that overlaps the lower blanket under the plasma
Expand All @@ -30,19 +26,3 @@
)
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.
# 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
18 changes: 0 additions & 18 deletions examples/spherical_tokamak_from_plasma_with_pf_magnets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from example_util_functions import transport_particles_on_h5m_geometry

import paramak

extra_cut_shapes = []
Expand Down Expand Up @@ -38,19 +36,3 @@
extra_cut_shapes=extra_cut_shapes,
)
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)
# 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
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from pathlib import Path

from example_util_functions import transport_particles_on_h5m_geometry

import paramak

rotation_angle = 180
Expand Down Expand Up @@ -44,19 +40,3 @@
extra_cut_shapes=poloidal_field_coils,
)
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)
# 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
16 changes: 0 additions & 16 deletions examples/spherical_tokamak_from_plasma_with_tf_magnets.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,3 @@
)

result2.save("spherical_tokamak_from_plasma_with_prin_tf_coils.step")

# from example_util_functions import transport_particles_on_h5m_geometry
# 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
20 changes: 0 additions & 20 deletions examples/spherical_tokamak_minimal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from pathlib import Path

from example_util_functions import transport_particles_on_h5m_geometry

import paramak

my_reactor = paramak.spherical_tokamak(
Expand Down Expand Up @@ -31,19 +27,3 @@
triangularity=-0.55,
)
my_reactor.save(f"spherical_tokamak_minimal.step")


# 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
1 change: 1 addition & 0 deletions examples/tokamak_from_plasma_animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import cadquery_png_plugin.plugin
import numpy as np
import cadquery as cq
import os

original_radial_build=[
(paramak.LayerType.GAP, 40),
Expand Down
17 changes: 0 additions & 17 deletions examples/tokamak_from_plasma_minimal.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from example_util_functions import transport_particles_on_h5m_geometry

import paramak

my_reactor = paramak.tokamak_from_plasma(
Expand All @@ -23,18 +21,3 @@
)
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)
# 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
17 changes: 0 additions & 17 deletions examples/tokamak_from_plasma_with_color.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from example_util_functions import transport_particles_on_h5m_geometry

import paramak

my_reactor = paramak.tokamak_from_plasma(
Expand Down Expand Up @@ -56,18 +54,3 @@
},
file_path='tokamak_from_plasma_with_colors.png'
)

# 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
19 changes: 1 addition & 18 deletions examples/tokamak_from_plasma_with_divertor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
from example_util_functions import transport_particles_on_h5m_geometry
from paramak.utils import create_wire_workplane_from_points
import paramak
from cadquery import vis, Workplane
from cadquery import Workplane

# makes a rectangle that overlaps the lower blanket under the plasma
# the intersection of this and the layers will form the lower divertor
Expand Down Expand Up @@ -31,19 +29,4 @@
)
my_reactor.save(f"tokamak_with_divertor.step")
print(f"Saved as tokamak_with_divertor.step")
# vis.show(my_reactor)

# 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
Loading

0 comments on commit 42ff5be

Please sign in to comment.