diff --git a/parastell/invessel_build.py b/parastell/invessel_build.py index dbd41e4..a453022 100644 --- a/parastell/invessel_build.py +++ b/parastell/invessel_build.py @@ -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, diff --git a/parastell/parastell.py b/parastell/parastell.py index e73628d..368f781 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -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). """ diff --git a/tests/test_invessel_build.py b/tests/test_invessel_build.py index 9bceab6..5850efb 100644 --- a/tests/test_invessel_build.py +++ b/tests/test_invessel_build.py @@ -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(): @@ -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 diff --git a/tests/test_parastell.py b/tests/test_parastell.py index 70a6f40..c3c8066 100644 --- a/tests/test_parastell.py +++ b/tests/test_parastell.py @@ -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")