Skip to content

Commit

Permalink
make use_pydagmc a kwarg
Browse files Browse the repository at this point in the history
  • Loading branch information
Edgar-21 committed Jan 27, 2025
1 parent 036ad43 commit e28cb20
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
11 changes: 5 additions & 6 deletions parastell/invessel_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ class InVesselBuild(object):
defined.
logger (object): logger object (optional, defaults to None). If no
logger is supplied, a default logger will be instantiated.
use_pydagmc (bool): If True, generate components with pydagmc, rather
than CADQuery
Optional attributes:
repeat (int): number of times to repeat build segment for full model
Expand All @@ -121,29 +119,30 @@ class InVesselBuild(object):
greater than the number of entries in 'poloidal_angles'.
scale (float): a scaling factor between the units of VMEC and [cm]
(defaults to m2cm = 100).
use_pydagmc (bool): If True, generate components with pydagmc, rather
than CADQuery. Defaults to False.
"""

def __init__(
self, vmec_obj, radial_build, use_pydagmc, logger=None, **kwargs
):
def __init__(self, vmec_obj, radial_build, logger=None, **kwargs):

self.mbc = core.Core()
self.dag_model = dagmc.DAGModel(self.mbc)
self.logger = logger
self.vmec_obj = vmec_obj
self.radial_build = radial_build
self.use_pydagmc = use_pydagmc

self.repeat = 0
self.num_ribs = 61
self.num_rib_pts = 67
self.scale = m2cm
self.use_pydagmc = False

for name in kwargs.keys() & (
"repeat",
"num_ribs",
"num_rib_pts",
"scale",
"use_pydagmc",
):
self.__setattr__(name, kwargs[name])

Expand Down
13 changes: 6 additions & 7 deletions parastell/parastell.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def construct_invessel_build(
wall_s,
radial_build,
split_chamber=False,
use_pydagmc=False,
**kwargs,
):
"""Construct InVesselBuild class object.
Expand Down Expand Up @@ -130,9 +129,6 @@ def construct_invessel_build(
scrape-off layer definition for 'chamber', add an item with a
'chamber' key and desired 'thickness_matrix' value to the
radial_build dictionary.
use_pydagmc (bool): if True, generate dagmc model directly with
pydagmc, bypassing CAD generation. Results in faceted geometry,
rather than smooth spline surfaces.
Optional attributes:
plasma_mat_tag (str): alternate DAGMC material tag to use for
Expand All @@ -154,6 +150,9 @@ def construct_invessel_build(
greater than the number of entries in 'poloidal_angles'.
scale (float): a scaling factor between the units of VMEC and [cm]
(defaults to m2cm = 100).
use_pydagmc (bool): if True, generate dagmc model directly with
pydagmc, bypassing CAD generation. Results in faceted geometry,
rather than smooth spline surfaces. Defaults to False.
"""
self.radial_build = ivb.RadialBuild(
toroidal_angles,
Expand All @@ -171,8 +170,8 @@ def construct_invessel_build(

self.invessel_build.populate_surfaces()
self.invessel_build.calculate_loci()
self.use_pydagmc = use_pydagmc
if use_pydagmc:
self.use_pydagmc = self.invessel_build.use_pydagmc
if self.use_pydagmc:
self.invessel_build.generate_components_pydagmc()
else:
self.invessel_build.generate_components()
Expand Down Expand Up @@ -373,7 +372,7 @@ def _tag_materials_native(self):
vol_id_str = " ".join(str(i) for i in vol_list)
make_material_block(self.magnet_set.mat_tag, block_id, vol_id_str)

if self.invessel_build:
if self.invessel_build and not self.invessel_build.use_pydagmc:
for data in self.invessel_build.radial_build.radial_build.values():
block_id = data["vol_id"]
vol_id_str = str(block_id)
Expand Down

0 comments on commit e28cb20

Please sign in to comment.