Skip to content

Commit f2848a6

Browse files
committed
Update examples
1 parent 8bf7bbc commit f2848a6

9 files changed

+56
-48
lines changed

examples/config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ source_mesh:
8282
filename: source_mesh
8383

8484
dagmc_export:
85-
skip_imprint: False
8685
filename: dagmc
8786

8887
cub5_export: False

examples/custom_first_wall_profile_example.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# Define desired toroidal and poloidal angles for building the stellarator
4343
toroidal_angles = [0.0, 11.25, 22.5, 33.75, 45.0, 56.25, 67.5, 78.75, 90.0]
4444
poloidal_angles = [0.0, 45.0, 90.0, 135.0, 180.0, 225.0, 270.0, 315.0, 360.0]
45-
wall_s = 1.08
45+
wall_s = 1.0
4646

4747
# Define a matrix of uniform unit thickness
4848
uniform_unit_thickness = np.ones((len(toroidal_angles), len(poloidal_angles)))
@@ -73,7 +73,7 @@
7373
}
7474
# Construct in-vessel components
7575
stellarator.construct_invessel_build(
76-
toroidal_angles, poloidal_angles, wall_s, radial_build_dict, scale=1
76+
toroidal_angles, poloidal_angles, wall_s, radial_build_dict
7777
)
7878
# Export in-vessel component files
7979
stellarator.export_invessel_build_step(export_dir=export_dir)
@@ -89,9 +89,6 @@
8989
)
9090
# Export magnet files
9191
stellarator.export_magnets_step(filename="magnets", export_dir=export_dir)
92-
stellarator.export_magnet_mesh_cubit(
93-
filename="magnet_mesh", export_dir=export_dir
94-
)
9592

9693
# Define source mesh parameters
9794
cfs_values = np.linspace(0.0, 1.0, num=11)
@@ -102,8 +99,7 @@
10299
# Export source file
103100
stellarator.export_source_mesh(filename="source_mesh", export_dir=export_dir)
104101

105-
# Build Cubit model of Parastell Components
106-
stellarator.build_cubit_model(skip_imprint=True)
107-
108-
# Export DAGMC neutronics H5M file
109-
stellarator.export_cubit_dagmc(filename="dagmc", export_dir=export_dir)
102+
# Build DAGMC neutronics model
103+
stellarator.build_cad_to_dagmc_model()
104+
# Export DAGMC H5M file
105+
stellarator.export_cad_to_dagmc(filename="dagmc", export_dir=export_dir)

examples/custom_source_example.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import parastell.source_mesh as sm
22
from parastell.pystell import read_vmec
3-
import subprocess
43
import numpy as np
54

65

@@ -40,6 +39,4 @@ def my_custom_reaction_rate(n_i, T_i):
4039
source_mesh_obj.create_vertices()
4140
source_mesh_obj.create_mesh()
4241

43-
# export and convert to vtk for visualization
4442
source_mesh_obj.export_mesh("source_mesh.h5m")
45-
subprocess.run("mbconvert source_mesh.h5m source_mesh.vtk", shell=True)

examples/nwl_cubit_example.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
# Construct and export DAGMC neutronics model
4646
dagmc_filename = Path("nwl_geom").with_suffix(".h5m")
47-
stellarator.build_cubit_model(skip_imprint=True)
47+
stellarator.build_cubit_model()
4848
tag_surface(1, "vacuum")
4949
stellarator.export_cubit_dagmc(filename=dagmc_filename)
5050

@@ -67,5 +67,7 @@
6767
num_threads=6,
6868
)
6969
)
70-
nwl_utils.plot_nwl(nwl_mean, toroidal_bins, poloidal_bins)
71-
nwl_utils.plot_nwl(nwl_std_dev, toroidal_bins, poloidal_bins)
70+
nwl_utils.plot_nwl(nwl_mean, toroidal_bins, poloidal_bins, filename="nwl_mean")
71+
nwl_utils.plot_nwl(
72+
nwl_std_dev, toroidal_bins, poloidal_bins, filename="nwl_std_dev"
73+
)

examples/nwl_pydagmc_example.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from pathlib import Path
22

33
import parastell.parastell as ps
4-
from parastell.cubit_utils import tag_surface
54
from parastell import nwl_utils
65
import numpy as np
76

@@ -81,5 +80,7 @@
8180
num_threads=6,
8281
)
8382
)
84-
nwl_utils.plot_nwl(nwl_mean, toroidal_bins, poloidal_bins)
85-
nwl_utils.plot_nwl(nwl_std_dev, toroidal_bins, poloidal_bins)
83+
nwl_utils.plot_nwl(nwl_mean, toroidal_bins, poloidal_bins, filename="nwl_mean")
84+
nwl_utils.plot_nwl(
85+
nwl_std_dev, toroidal_bins, poloidal_bins, filename="nwl_std_dev"
86+
)

examples/parastell_cad_to_dagmc_example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
)
5050
# Export in-vessel component files
5151
stellarator.export_invessel_build_step(export_dir=export_dir)
52+
# Export weight window mesh
5253
stellarator.export_invessel_build_mesh_gmsh(
5354
[
5455
"chamber",
@@ -88,8 +89,7 @@
8889
# Export source file
8990
stellarator.export_source_mesh(filename="source_mesh", export_dir=export_dir)
9091

91-
# Build Cubit model of Parastell Components
92+
# Build DAGMC neutronics model
9293
stellarator.build_cad_to_dagmc_model()
93-
94-
# Export DAGMC neutronics H5M file
94+
# Export DAGMC H5M file
9595
stellarator.export_cad_to_dagmc(filename="dagmc", export_dir=export_dir)

examples/parastell_cubit_example.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,18 @@
4949
)
5050
# Export in-vessel component files
5151
stellarator.export_invessel_build_step(export_dir=export_dir)
52-
stellarator.export_invessel_build_mesh_cubit(
53-
[
54-
"chamber",
55-
"first_wall",
56-
"breeder",
57-
"back_wall",
58-
"shield",
59-
"vacuum_vessel",
60-
],
61-
"weight_window_mesh",
62-
)
52+
# Export weight window mesh
53+
# stellarator.export_invessel_build_mesh_cubit(
54+
# [
55+
# "chamber",
56+
# "first_wall",
57+
# "breeder",
58+
# "back_wall",
59+
# "shield",
60+
# "vacuum_vessel",
61+
# ],
62+
# "weight_window_mesh",
63+
# )
6364

6465
# Define build parameters for magnet coils
6566
coils_file = "coils.example"
@@ -85,8 +86,7 @@
8586
# Export source file
8687
stellarator.export_source_mesh(filename="source_mesh", export_dir=export_dir)
8788

88-
# Build Cubit model of Parastell Components
89-
stellarator.build_cubit_model(skip_imprint=False)
90-
91-
# Export DAGMC neutronics H5M file
89+
# Build DAGMC neutronics model
90+
stellarator.build_cubit_model()
91+
# Export DAGMC H5M file
9292
stellarator.export_cubit_dagmc(filename="dagmc", export_dir=export_dir)

examples/parastell_pydagmc_example.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@
5858
num_ribs=num_ribs,
5959
num_rib_pts=num_rib_pts,
6060
)
61-
# Export in-vessel component files
62-
stellarator.export_invessel_build_mesh_moab(
63-
"vacuum_vessel", "vacuum_vessel_tally_mesh"
64-
)
6561

6662
# Define build parameters for magnet coils
6763
coils_file = "coils.example"
@@ -73,7 +69,25 @@
7369
coils_file, width, thickness, toroidal_extent, sample_mod=6
7470
)
7571

72+
# PyDAGMC model must be built before any meshing in Gmsh
7673
stellarator.build_pydagmc_model(
7774
magnet_exporter="cad_to_dagmc", max_mesh_size=60
7875
)
7976
stellarator.export_pydagmc_model(filename="dagmc")
77+
78+
# Export weight window mesh
79+
# Note that PyDAGMC workflow does not model the vacuum chamber - cannot be meshed
80+
stellarator.export_invessel_build_mesh_gmsh(
81+
[
82+
"first_wall",
83+
"breeder",
84+
"back_wall",
85+
"shield",
86+
"vacuum_vessel",
87+
],
88+
"weight_window_mesh",
89+
)
90+
# Export in-vessel component files
91+
stellarator.export_invessel_build_mesh_moab(
92+
["vacuum_vessel"], "vacuum_vessel_tally_mesh"
93+
)

examples/radial_distance_example.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# symmetric
4949
available_space = enforce_helical_symmetry(available_space)
5050
# Modify available space to account for thickness of magnets
51-
available_space = available_space - max(width, thickness)
51+
available_space = available_space - max(width, thickness) - 20
5252

5353
# Define a matrix of uniform unit thickness
5454
uniform_unit_thickness = np.ones((len(toroidal_angles), len(poloidal_angles)))
@@ -111,8 +111,7 @@
111111
# Export source file
112112
stellarator.export_source_mesh(filename="source_mesh", export_dir=export_dir)
113113

114-
# Build Cubit model of Parastell Components
115-
stellarator.build_cubit_model(skip_imprint=False)
116-
117-
# Export DAGMC neutronics H5M file
118-
stellarator.export_cubit_dagmc(filename="dagmc", export_dir=export_dir)
114+
# Build DAGMC neutronics model
115+
stellarator.build_cad_to_dagmc_model()
116+
# Export DAGMC H5M file
117+
stellarator.export_cad_to_dagmc(filename="dagmc", export_dir=export_dir)

0 commit comments

Comments
 (0)