Skip to content

Commit

Permalink
Update files
Browse files Browse the repository at this point in the history
  • Loading branch information
connoramoreno committed Oct 25, 2024
1 parent 28abc68 commit 37236bb
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
9 changes: 5 additions & 4 deletions parastell/invessel_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,12 +492,13 @@ def generate_surface(self):
set of points computed by calculate_loci.
"""
if not self.surface:
if self.transpose_fit:
self.surface_loci = np.transpose(self.surface_loci, (1, 0, 2))

vectors = [
[cq.Vector(tuple(pt)) for pt in profile]
for profile in self.surface_loci
[cq.Vector(tuple(pt)) for pt in grid_row]
for grid_row in self.surface_loci
]
if self.transpose_fit:
vectors = list(map(list, zip(*vectors)))

self.surface = cq.Face.makeSplineApprox(
vectors,
Expand Down
24 changes: 13 additions & 11 deletions parastell/parastell.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,17 +137,19 @@ def construct_invessel_build(
sol_mat_tag (str): alternate DAGMC material tag to use for
scrape-off layer. If none is supplied, 'Vacuum' will be used
(defaults to None).
repeat (int): number of times to repeat build segment for full model
(defaults to 0).
num_ribs (int): total number of ribs over which to loft for each
build segment (defaults to 61). Ribs are set at toroidal angles
interpolated between those specified in 'toroidal_angles' if
this value is greater than the number of entries in
'toroidal_angles'.
num_rib_pts (int): total number of points defining each rib spline
(defaults to 61). Points are set at poloidal angles interpolated
between those specified in 'poloidal_angles' if this value is
greater than the number of entries in 'poloidal_angles'.
toroidal_grid_size (int): number of toroidal angle grid points
defining point clouds over which spline surfaces are fit. If
this value is greater than the length of "toroidal_angles",
additional grid points are set at toroidal angles interpolated
between those specified in "toroidal_angles".
poloidal_grid_size (int): number of poloidal angle grid points
defining point clouds over which spline surfaces are fit. If
this value is greater than the length of "poloidal_angles",
additional grid points are set at poloidal angles interpolated
between those specified in "poloidal_angles".
transpose_fit (bool): flag to indicate whether the 2-D iterable of
points through which each component's spline surface is fit
should be transposed. Can sometimes fix errant CAD generation.
scale (float): a scaling factor between the units of VMEC and [cm]
(defaults to m2cm = 100).
"""
Expand Down
10 changes: 5 additions & 5 deletions tests/test_invessel_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

import numpy as np
import pytest
import pystell.read_vmec as read_vmec

# import this before read_vmec to deal with conflicting
# dependencies correctly
import parastell.invessel_build as ivb

import pystell.read_vmec as read_vmec


def remove_files():

Expand Down Expand Up @@ -52,7 +49,10 @@ def invessel_build(radial_build):
toroidal_grid_size = 11

ivb_obj = ivb.InVesselBuild(
vmec, radial_build, toroidal_grid_size=toroidal_grid_size
vmec,
radial_build,
toroidal_grid_size=toroidal_grid_size,
transpose_fit=True,
)

return ivb_obj
Expand Down
4 changes: 2 additions & 2 deletions tests/test_parastell.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ def test_parastell(stellarator):
* 10
}
}
num_ribs = 11
toroidal_grid_size = 11

stellarator.construct_invessel_build(
toroidal_angles,
poloidal_angles,
wall_s,
radial_build_dict,
num_ribs=num_ribs,
toroidal_grid_size=toroidal_grid_size,
)

chamber_filename_exp = Path("chamber").with_suffix(".step")
Expand Down

0 comments on commit 37236bb

Please sign in to comment.