Skip to content

Commit

Permalink
Restructure NWL files
Browse files Browse the repository at this point in the history
  • Loading branch information
connoramoreno committed May 6, 2024
1 parent e5e6ee8 commit 5e89fec
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 257 deletions.
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) / '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=False,
legacy_faceting=True,
filename='dagmc',
export_dir=export_dir
)
21 changes: 21 additions & 0 deletions Examples/nwl_plot_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import parastell.nwl_utils as nwl


# Define simulation parameters
dagmc_geom = 'first_wall.h5m'
source_mesh = 'SourceMesh.h5m'
tor_ext = 90.0
ss_file = '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'
ss_file = 'strengths.txt'
plas_eq = 'plas_eq.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.

Loading

0 comments on commit 5e89fec

Please sign in to comment.