Skip to content

Commit

Permalink
Merge pull request #100 from svalinn/oo_NWL
Browse files Browse the repository at this point in the history
OO NWL
  • Loading branch information
connoramoreno authored May 17, 2024
2 parents 7247657 + ae2b8f1 commit 63a21b8
Show file tree
Hide file tree
Showing 18 changed files with 389 additions and 451 deletions.
76 changes: 49 additions & 27 deletions Examples/config.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,68 @@
vmec_file: wout_vmec.nc

invessel_build:
toroidal_angles: [0.0, 22.5, 45.0, 67.5, 90.0]
poloidal_angles: [0.0, 90.0, 180.0, 270.0, 360.0]
toroidal_angles: [0.0, 11.25, 22.5, 33.75, 45.0, 56.25, 67.5, 78.75, 90.0]
poloidal_angles: [0.0, 45.0, 90.0, 135.0, 180.0, 225.0, 270.0, 315.0, 360.0]
wall_s: 1.08
radial_build:
first_wall:
thickness_matrix:
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
breeder:
thickness_matrix:
- [80, 40, 20, 40, 80]
- [50, 40, 30, 30, 50]
- [30, 30, 25, 30, 30]
- [50, 30, 30, 40, 50]
- [80, 40, 20, 40, 80]
- [75, 75, 75, 25, 25, 25, 75, 75, 75]
- [75, 75, 75, 25, 25, 75, 75, 75, 75]
- [75, 75, 25, 25, 75, 75, 75, 75, 75]
- [65, 25, 25, 65, 75, 75, 75, 75, 65]
- [45, 45, 75, 75, 75, 75, 75, 45, 45]
- [65, 75, 75, 75, 75, 65, 25, 25, 65]
- [75, 75, 75, 75, 75, 25, 25, 75, 75]
- [75, 75, 75, 75, 25, 25, 75, 75, 75]
- [75, 75, 75, 25, 25, 25, 75, 75, 75]
back_wall:
thickness_matrix:
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
- [5, 5, 5, 5, 5, 5, 5, 5, 5]
shield:
thickness_matrix:
- [50, 25, 15, 25, 50]
- [30, 25, 20, 20, 30]
- [20, 20, 15, 20, 20]
- [30, 20, 20, 25, 30]
- [50, 25, 15, 25, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
- [50, 50, 50, 50, 50, 50, 50, 50, 50]
vacuum_vessel:
thickness_matrix:
- [15, 15, 15, 15, 15]
- [15, 15, 15, 15, 15]
- [15, 15, 15, 15, 15]
- [15, 15, 15, 15, 15]
- [15, 15, 15, 15, 15]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
- [10, 10, 10, 10, 10, 10, 10, 10, 10]
mat_tag: vac_vessel
plasma_mat_tag: Vacuum
sol_mat_tag: Vacuum
export_cad_to_dagmc: False

magnet_coils:
Expand Down
64 changes: 64 additions & 0 deletions Examples/nwl_geom_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
from pathlib import Path

import numpy as np

import parastell.parastell as ps


# Define directory to export all output files to
export_dir = ''
# Define plasma equilibrium VMEC file
vmec_file = 'wout_vmec.nc'

# Instantiate ParaStell build
stellarator = ps.Stellarator(vmec_file)

# Define build parameters for in-vessel components
toroidal_angles = [0.0, 30.0, 60.0, 90.0]
poloidal_angles = [0.0, 120.0, 240.0, 360.0]
wall_s = 1.08

empty_radial_build_dict = {}
# Construct in-vessel components
stellarator.construct_invessel_build(
toroidal_angles,
poloidal_angles,
wall_s,
empty_radial_build_dict,
split_chamber=False
)
# Export in-vessel component files
stellarator.export_invessel_build(
export_cad_to_dagmc=False,
export_dir=export_dir
)

# Define source mesh parameters
mesh_size = (11, 81, 61)
toroidal_extent = 90.0
# Construct source
stellarator.construct_source_mesh(
mesh_size,
toroidal_extent
)
# Export source file
stellarator.export_source_mesh(
filename='source_mesh',
export_dir=export_dir
)

strengths = stellarator.source_mesh.strengths

filepath = Path(export_dir) / 'source_strengths.txt'

file = open(filepath, 'w')
for tet in strengths:
file.write(f'{tet}\n')

# Export DAGMC neutronics H5M file
stellarator.export_dagmc(
skip_imprint=True,
legacy_faceting=True,
filename='nwl_geom',
export_dir=export_dir
)
20 changes: 20 additions & 0 deletions Examples/nwl_plot_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import parastell.nwl_utils as nwl


# Define simulation parameters
dagmc_geom = 'nwl_geom.h5m'
source_mesh = 'source_mesh.h5m'
tor_ext = 90.0
ss_file = 'source_strengths.txt'
num_parts = 100000

nwl.nwl_transport(dagmc_geom, source_mesh, tor_ext, ss_file, num_parts)

# Define first wall geometry and plotting parameters
source_file = 'surface_source.h5'
plas_eq = 'wout_vmec.nc'
tor_ext = 90.0
pol_ext = 360.0
wall_s = 1.08

nwl.nwl_plot(source_file, ss_file, plas_eq, tor_ext, pol_ext, wall_s)
File renamed without changes.
35 changes: 0 additions & 35 deletions NWL/NWL_geom.py

This file was deleted.

19 changes: 0 additions & 19 deletions NWL/NWL_plot.py

This file was deleted.

11 changes: 0 additions & 11 deletions NWL/NWL_transport.py

This file was deleted.

5 changes: 0 additions & 5 deletions executables/invessel_build

This file was deleted.

5 changes: 0 additions & 5 deletions executables/magnet_set

This file was deleted.

File renamed without changes.
5 changes: 0 additions & 5 deletions executables/source_mesh

This file was deleted.

1 change: 1 addition & 0 deletions parastell/cubit_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

initialized = False


def init_cubit():
"""Initializes Coreform Cubit with the DAGMC plugin.
"""
Expand Down
Loading

0 comments on commit 63a21b8

Please sign in to comment.