From 862ac55a168df54317f5712f9c4ca065d57a07a7 Mon Sep 17 00:00:00 2001 From: Edgar-21 Date: Sat, 1 Jun 2024 10:52:22 -0500 Subject: [PATCH 01/13] added option for exporting cub5 --- Examples/parastell_example.py | 1 + parastell/cubit_io.py | 12 ++++++++++++ parastell/parastell.py | 11 ++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Examples/parastell_example.py b/Examples/parastell_example.py index 996ca809..83c22d99 100644 --- a/Examples/parastell_example.py +++ b/Examples/parastell_example.py @@ -97,6 +97,7 @@ stellarator.export_dagmc( skip_imprint=False, legacy_faceting=True, + export_cub5=False, filename='dagmc', export_dir=export_dir ) diff --git a/parastell/cubit_io.py b/parastell/cubit_io.py index ff2867f6..471b4163 100644 --- a/parastell/cubit_io.py +++ b/parastell/cubit_io.py @@ -61,6 +61,18 @@ def export_step_cubit(filename, export_dir=''): export_path = Path(export_dir) / Path(filename).with_suffix('.step') cubit.cmd(f'export step "{export_path}" overwrite') +def export_cub5(filename, export_dir=''): + """Export cub5 representation of model (native cubit format) + + Arguments: + filename (str): name of cub5 output file, excluding '.cub5' extension. + export_dir (str): directory to which to export the cub5 output file + (defaults to empty string). + """ + init_cubit() + + export_path = Path(export_dir) / Path(filename).with_suffix('.cub5') + cubit.cmd(f'') def export_mesh_cubit(filename, export_dir=''): """Exports Cubit mesh to H5M file format, first exporting to Exodus format diff --git a/parastell/parastell.py b/parastell/parastell.py index 61bd62ce..64b8ccf6 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -350,9 +350,8 @@ def _tag_materials_native(self): make_material_block(data['mat_tag'], block_id, vol_id_str) def export_dagmc( - self, skip_imprint=False, legacy_faceting=True, filename='dagmc', - export_dir='', **kwargs - ): + self, skip_imprint=False, legacy_faceting=True, export_cub5=False, + filename='dagmc', export_dir='', **kwargs): """Exports DAGMC neutronics H5M file of ParaStell components via Coreform Cubit. @@ -416,6 +415,12 @@ def export_dagmc( **kwargs ) + if export_cub5: + cubit_io.export_cub5( + filename=filename, + export_dir=export_dir + ) + def parse_args(): """Parser for running as a script. From 24e7323fdbddbdc9c9ad378920ef4622fbb44ff2 Mon Sep 17 00:00:00 2001 From: Edgar Date: Sat, 1 Jun 2024 11:55:12 -0500 Subject: [PATCH 02/13] added cub5 export command --- parastell/cubit_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parastell/cubit_io.py b/parastell/cubit_io.py index 471b4163..477c32a4 100644 --- a/parastell/cubit_io.py +++ b/parastell/cubit_io.py @@ -72,7 +72,7 @@ def export_cub5(filename, export_dir=''): init_cubit() export_path = Path(export_dir) / Path(filename).with_suffix('.cub5') - cubit.cmd(f'') + cubit.cmd(f'save cub5 "{export_path}" overwrite') def export_mesh_cubit(filename, export_dir=''): """Exports Cubit mesh to H5M file format, first exporting to Exodus format From 1df8345b6b42e32eb53072bc5d17fdeba7208faa Mon Sep 17 00:00:00 2001 From: Edgar-21 Date: Sat, 1 Jun 2024 13:54:40 -0500 Subject: [PATCH 03/13] add split_chamber to config.yaml --- Examples/config.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Examples/config.yaml b/Examples/config.yaml index c8bca2bf..c2c2d86e 100644 --- a/Examples/config.yaml +++ b/Examples/config.yaml @@ -63,6 +63,7 @@ invessel_build: mat_tag: vac_vessel plasma_mat_tag: Vacuum sol_mat_tag: Vacuum + split_chamber: True export_cad_to_dagmc: False magnet_coils: @@ -82,4 +83,5 @@ source_mesh: dagmc_export: skip_imprint: False legacy_faceting: True + export_cub5: False filename: dagmc From 56ea4b2c71504760e189661423422662b2a32aa5 Mon Sep 17 00:00:00 2001 From: Edgar-21 Date: Sat, 1 Jun 2024 14:07:43 -0500 Subject: [PATCH 04/13] added test for cub5 export --- tests/test_parastell.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_parastell.py b/tests/test_parastell.py index da55c062..2218efe5 100644 --- a/tests/test_parastell.py +++ b/tests/test_parastell.py @@ -20,6 +20,8 @@ def remove_files(): Path.unlink('magnet_mesh.h5m') if Path('dagmc.h5m').exists(): Path.unlink('dagmc.h5m') + if Path('dagmc.cub5').exists(): + Path.unlink('dagmc.cub5') if Path('source_mesh.h5m').exists(): Path.unlink('source_mesh.h5m') if Path('stellarator.log').exists(): @@ -118,8 +120,9 @@ def test_parastell(stellarator): filename_exp = 'dagmc' - stellarator.export_dagmc(filename=filename_exp) + stellarator.export_dagmc(filename=filename_exp, export_cub5=True) assert Path(filename_exp).with_suffix('.h5m').exists() + assert Path(filename_exp).with_suffix('.cub5').exists() remove_files() From a37806f1c3dd55d31c1421a1b7430e7900136f3e Mon Sep 17 00:00:00 2001 From: Edgar-21 Date: Sat, 1 Jun 2024 14:10:07 -0500 Subject: [PATCH 05/13] updated export_dagmc docstring --- parastell/parastell.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parastell/parastell.py b/parastell/parastell.py index 64b8ccf6..19a1a347 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -361,6 +361,8 @@ def export_dagmc( geometry information (optional, defaults to False). legacy_faceting (bool): choose legacy or native faceting for DAGMC export (optional, defaults to True). + export_cub5 (bool): choose whether or not to save to the cubit + native format after exporting to DAGMC. filename (str): name of DAGMC output file, excluding '.h5m' extension (optional, defaults to 'dagmc'). export_dir (str): directory to which to export DAGMC output file From ac645f7b78f010d1b96c278be56b8c06c38f4437 Mon Sep 17 00:00:00 2001 From: Edgar Date: Mon, 3 Jun 2024 14:08:39 -0500 Subject: [PATCH 06/13] separated building and exporting cubit model --- Examples/config.yaml | 1 - Examples/parastell_example.py | 8 ++-- parastell/parastell.py | 87 +++++++++++++++++++++++++---------- 3 files changed, 67 insertions(+), 29 deletions(-) diff --git a/Examples/config.yaml b/Examples/config.yaml index c2c2d86e..0d5b78c6 100644 --- a/Examples/config.yaml +++ b/Examples/config.yaml @@ -83,5 +83,4 @@ source_mesh: dagmc_export: skip_imprint: False legacy_faceting: True - export_cub5: False filename: dagmc diff --git a/Examples/parastell_example.py b/Examples/parastell_example.py index 83c22d99..7f8e27d6 100644 --- a/Examples/parastell_example.py +++ b/Examples/parastell_example.py @@ -93,11 +93,13 @@ export_dir=export_dir ) +# Build Cubit model of Parastell Components +stellarator.build_cubit_model( + skip_imprint=False, + legacy_faceting=True) + # Export DAGMC neutronics H5M file stellarator.export_dagmc( - skip_imprint=False, - legacy_faceting=True, - export_cub5=False, filename='dagmc', export_dir=export_dir ) diff --git a/parastell/parastell.py b/parastell/parastell.py index 19a1a347..10060a23 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -14,6 +14,11 @@ from . import cubit_io from .utils import read_yaml_config, filter_kwargs, m2cm +build_cubit_model_allowed_kwargs = ['skip_imprint', 'legacy_faceting'] +export_allowed_kwargs = ['faceting_tolerance', 'length_tolerance', + 'normal_tolerance', 'anisotropic_ratio', + 'deviation_angle'] + def make_material_block(mat_tag, block_id, vol_id_str): """Issue commands to make a material block using Cubit's @@ -349,11 +354,11 @@ def _tag_materials_native(self): vol_id_str = str(block_id) make_material_block(data['mat_tag'], block_id, vol_id_str) - def export_dagmc( - self, skip_imprint=False, legacy_faceting=True, export_cub5=False, - filename='dagmc', export_dir='', **kwargs): - """Exports DAGMC neutronics H5M file of ParaStell components via - Coreform Cubit. + def build_cubit_model( + self, skip_imprint=False, legacy_faceting=True, **kwargs + ): + """Build model for DAGMC neutronics H5M file of Parastell components via + Coreform Cubit Arguments: skip_imprint (bool): choose whether to imprint and merge all in @@ -361,8 +366,33 @@ def export_dagmc( geometry information (optional, defaults to False). legacy_faceting (bool): choose legacy or native faceting for DAGMC export (optional, defaults to True). - export_cub5 (bool): choose whether or not to save to the cubit - native format after exporting to DAGMC. + """ + self.legacy_faceting = legacy_faceting + + self._logger.info( + 'Building DAGMC neutronics model via Coreform Cubit...' + ) + + if self.invessel_build: + self._import_ivb_step() + + if skip_imprint: + self.invessel_build.merge_layer_surfaces() + else: + cubit.cmd('imprint volume all') + cubit.cmd('merge volume all') + + if legacy_faceting: + self._tag_materials_legacy() + else: + self._tag_materials_native() + + + def export_dagmc(self, filename='dagmc', export_dir='', **kwargs): + """Exports DAGMC neutronics H5M file of ParaStell components via + Coreform Cubit. + + Arguments: filename (str): name of DAGMC output file, excluding '.h5m' extension (optional, defaults to 'dagmc'). export_dir (str): directory to which to export DAGMC output file @@ -393,35 +423,36 @@ def export_dagmc( 'Exporting DAGMC neutronics model...' ) - if self.invessel_build: - self._import_ivb_step() - - if skip_imprint: - self.invessel_build.merge_layer_surfaces() - else: - cubit.cmd('imprint volume all') - cubit.cmd('merge volume all') - - if legacy_faceting: - self._tag_materials_legacy() + if self.legacy_faceting: cubit_io.export_dagmc_cubit_legacy( filename=filename, export_dir=export_dir, **kwargs ) else: - self._tag_materials_native() cubit_io.export_dagmc_cubit_native( filename=filename, export_dir=export_dir, **kwargs ) + + def export_cub5(self, filename='dagmc', export_dir='', **kwargs): + """Export native Coreform Cubit format (cub5) of Parastell model. - if export_cub5: - cubit_io.export_cub5( - filename=filename, - export_dir=export_dir - ) + Arguments: + filename (str): name of DAGMC output file, excluding '.h5m' + extension (optional, defaults to 'dagmc'). + export_dir (str): directory to which to export DAGMC output file + (optional, defaults to empty string). + """ + cubit_io.init_cubit() + + self._logger.info( + 'Exporting cub5 model...' + ) + + cubit_io.export_cub5(filename=filename, + export_dir=export_dir) def parse_args(): @@ -629,10 +660,16 @@ def parastell(): if args.ivb or args.magnets: dagmc_export = all_data['dagmc_export'] + stellarator.build_cubit_model( + **(filter_kwargs(dagmc_export, build_cubit_model_allowed_kwargs))) stellarator.export_dagmc( export_dir=args.export_dir, - **dagmc_export + **(filter_kwargs(dagmc_export, export_allowed_kwargs)) ) + cub5_export = all_data['cub5_export'] + if cub5_export['export_cub5']: + stellarator.export_cub5(export_dir=args.export_dir, + **cub5_export) if args.nwl: if not args.ivb: From 3ba37d6e584fb64a8c9c914d281d33bcf2b65772 Mon Sep 17 00:00:00 2001 From: Edgar Date: Mon, 3 Jun 2024 14:21:54 -0500 Subject: [PATCH 07/13] updated test_parastell with new export method --- tests/test_parastell.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_parastell.py b/tests/test_parastell.py index 2218efe5..75d0f10c 100644 --- a/tests/test_parastell.py +++ b/tests/test_parastell.py @@ -120,7 +120,9 @@ def test_parastell(stellarator): filename_exp = 'dagmc' - stellarator.export_dagmc(filename=filename_exp, export_cub5=True) + stellarator.build_cubit_model() + stellarator.export_dagmc(filename=filename_exp) + stellarator.export_cub5(filename=filename_exp) assert Path(filename_exp).with_suffix('.h5m').exists() assert Path(filename_exp).with_suffix('.cub5').exists() From 4d3f5548c8bd4a8df027266a50ee8cdb98d94d2c Mon Sep 17 00:00:00 2001 From: Edgar-21 <84034227+Edgar-21@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:26:08 -0500 Subject: [PATCH 08/13] Update parastell/cubit_io.py Co-authored-by: connoramoreno <67344181+connoramoreno@users.noreply.github.com> --- parastell/cubit_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parastell/cubit_io.py b/parastell/cubit_io.py index 477c32a4..a16307de 100644 --- a/parastell/cubit_io.py +++ b/parastell/cubit_io.py @@ -67,7 +67,7 @@ def export_cub5(filename, export_dir=''): Arguments: filename (str): name of cub5 output file, excluding '.cub5' extension. export_dir (str): directory to which to export the cub5 output file - (defaults to empty string). + (defaults to empty string). """ init_cubit() From de321b1c107d31386c86342e52b1d7991ceb8f57 Mon Sep 17 00:00:00 2001 From: Edgar-21 <84034227+Edgar-21@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:26:20 -0500 Subject: [PATCH 09/13] Update parastell/parastell.py Co-authored-by: connoramoreno <67344181+connoramoreno@users.noreply.github.com> --- parastell/parastell.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parastell/parastell.py b/parastell/parastell.py index 10060a23..75f48992 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -668,8 +668,9 @@ def parastell(): ) cub5_export = all_data['cub5_export'] if cub5_export['export_cub5']: - stellarator.export_cub5(export_dir=args.export_dir, - **cub5_export) + stellarator.export_cub5( + export_dir=args.export_dir, **cub5_export + ) if args.nwl: if not args.ivb: From 866c35109f78a39c87d5fc2a696ef2a8c5539ba9 Mon Sep 17 00:00:00 2001 From: Edgar-21 <84034227+Edgar-21@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:27:01 -0500 Subject: [PATCH 10/13] Update parastell/cubit_io.py Co-authored-by: connoramoreno <67344181+connoramoreno@users.noreply.github.com> --- parastell/cubit_io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parastell/cubit_io.py b/parastell/cubit_io.py index a16307de..0096a49e 100644 --- a/parastell/cubit_io.py +++ b/parastell/cubit_io.py @@ -62,7 +62,7 @@ def export_step_cubit(filename, export_dir=''): cubit.cmd(f'export step "{export_path}" overwrite') def export_cub5(filename, export_dir=''): - """Export cub5 representation of model (native cubit format) + """Export cub5 representation of model (native Cubit format). Arguments: filename (str): name of cub5 output file, excluding '.cub5' extension. From 1c0c8b761e739b6760c6d9fcd5ef3024f962b20b Mon Sep 17 00:00:00 2001 From: Edgar-21 <84034227+Edgar-21@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:28:01 -0500 Subject: [PATCH 11/13] Update parastell/parastell.py Co-authored-by: connoramoreno <67344181+connoramoreno@users.noreply.github.com> --- parastell/parastell.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parastell/parastell.py b/parastell/parastell.py index 75f48992..20367742 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -355,8 +355,8 @@ def _tag_materials_native(self): make_material_block(data['mat_tag'], block_id, vol_id_str) def build_cubit_model( - self, skip_imprint=False, legacy_faceting=True, **kwargs - ): + self, skip_imprint=False, legacy_faceting=True, **kwargs + ): """Build model for DAGMC neutronics H5M file of Parastell components via Coreform Cubit From 4050c945e6c5f1f0300d340709d8398a33777dd6 Mon Sep 17 00:00:00 2001 From: Edgar-21 <84034227+Edgar-21@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:28:15 -0500 Subject: [PATCH 12/13] Update parastell/parastell.py Co-authored-by: connoramoreno <67344181+connoramoreno@users.noreply.github.com> --- parastell/parastell.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parastell/parastell.py b/parastell/parastell.py index 20367742..173ee6e3 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -661,7 +661,8 @@ def parastell(): if args.ivb or args.magnets: dagmc_export = all_data['dagmc_export'] stellarator.build_cubit_model( - **(filter_kwargs(dagmc_export, build_cubit_model_allowed_kwargs))) + **(filter_kwargs(dagmc_export, build_cubit_model_allowed_kwargs)) + ) stellarator.export_dagmc( export_dir=args.export_dir, **(filter_kwargs(dagmc_export, export_allowed_kwargs)) From 1d45418eb4c260182a062a797f99bfed7ec345d9 Mon Sep 17 00:00:00 2001 From: Edgar Date: Mon, 3 Jun 2024 16:44:16 -0500 Subject: [PATCH 13/13] changes per PR comments, autopep8 --- Examples/config.yaml | 2 ++ parastell/parastell.py | 75 ++++++++++++++++++++---------------------- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/Examples/config.yaml b/Examples/config.yaml index 0d5b78c6..263e7707 100644 --- a/Examples/config.yaml +++ b/Examples/config.yaml @@ -84,3 +84,5 @@ dagmc_export: skip_imprint: False legacy_faceting: True filename: dagmc + +cub5_export: False \ No newline at end of file diff --git a/parastell/parastell.py b/parastell/parastell.py index 173ee6e3..6d62f7e5 100644 --- a/parastell/parastell.py +++ b/parastell/parastell.py @@ -15,15 +15,15 @@ from .utils import read_yaml_config, filter_kwargs, m2cm build_cubit_model_allowed_kwargs = ['skip_imprint', 'legacy_faceting'] -export_allowed_kwargs = ['faceting_tolerance', 'length_tolerance', - 'normal_tolerance', 'anisotropic_ratio', - 'deviation_angle'] +export_dagmc_allowed_kwargs = ['faceting_tolerance', 'length_tolerance', + 'normal_tolerance', 'anisotropic_ratio', + 'deviation_angle'] def make_material_block(mat_tag, block_id, vol_id_str): """Issue commands to make a material block using Cubit's native capabilities. - + Arguments: mat_tag (str) : name of material block block_id (int) : block number @@ -63,7 +63,7 @@ def __init__( vmec_file, logger=None ): - + self.logger = logger self.vmec_file = vmec_file @@ -74,7 +74,7 @@ def __init__( @property def vmec_file(self): return self._vmec_file - + @vmec_file.setter def vmec_file(self, file): self._vmec_file = file @@ -87,7 +87,7 @@ def vmec_file(self, file): @property def logger(self): return self._logger - + @logger.setter def logger(self, logger_object): self._logger = log.check_init(logger_object) @@ -345,7 +345,7 @@ def _tag_materials_native(self): block_id = min(vol_list) 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: for data in ( self.invessel_build.radial_build.radial_build.values() @@ -354,9 +354,7 @@ def _tag_materials_native(self): vol_id_str = str(block_id) make_material_block(data['mat_tag'], block_id, vol_id_str) - def build_cubit_model( - self, skip_imprint=False, legacy_faceting=True, **kwargs - ): + def build_cubit_model(self, skip_imprint=False, legacy_faceting=True): """Build model for DAGMC neutronics H5M file of Parastell components via Coreform Cubit @@ -387,7 +385,6 @@ def build_cubit_model( else: self._tag_materials_native() - def export_dagmc(self, filename='dagmc', export_dir='', **kwargs): """Exports DAGMC neutronics H5M file of ParaStell components via Coreform Cubit. @@ -418,7 +415,7 @@ def export_dagmc(self, filename='dagmc', export_dir='', **kwargs): attribute is used only for the native faceting method. """ cubit_io.init_cubit() - + self._logger.info( 'Exporting DAGMC neutronics model...' ) @@ -435,8 +432,8 @@ def export_dagmc(self, filename='dagmc', export_dir='', **kwargs): export_dir=export_dir, **kwargs ) - - def export_cub5(self, filename='dagmc', export_dir='', **kwargs): + + def export_cub5(self, filename='stellarator', export_dir=''): """Export native Coreform Cubit format (cub5) of Parastell model. Arguments: @@ -451,7 +448,7 @@ def export_cub5(self, filename='dagmc', export_dir='', **kwargs): 'Exporting cub5 model...' ) - cubit_io.export_cub5(filename=filename, + cubit_io.export_cub5(filename=filename, export_dir=export_dir) @@ -483,7 +480,7 @@ def parse_args(): ) parser.add_argument( - '-i', '--ivb', + '-i', '--ivb', action='store_true', help=( 'flag to indicate the creation of in-vessel component geometry ' @@ -492,15 +489,15 @@ def parse_args(): ) parser.add_argument( - '-m', '--magnets', + '-m', '--magnets', action='store_true', help=( 'flag to indicate the creation of magnet geometry (default: False)' ) ) - + parser.add_argument( - '-s', '--source', + '-s', '--source', action='store_true', help=( 'flag to indicate the creation of a tetrahedral source mesh ' @@ -509,7 +506,7 @@ def parse_args(): ) parser.add_argument( - '-n', '--nwl', + '-n', '--nwl', action='store_true', help=( 'flag to indicate the creation of a geometry for neutron wall ' @@ -541,7 +538,7 @@ def check_inputs( ivb_tor_ext = (repeat + 1) * invessel_build['toroidal_angles'][-1] mag_tor_ext = magnet_coils['toroidal_extent'] src_tor_ext = source_mesh['toroidal_extent'] - + if ivb_tor_ext != mag_tor_ext: w = Warning( f'The total toroidal extent of the in-vessel build, {ivb_tor_ext} ' @@ -549,7 +546,7 @@ def check_inputs( f'{mag_tor_ext} degrees.' ) logger.warning(w.args[0]) - + if ivb_tor_ext != src_tor_ext: w = Warning( f'The total toroidal extent of the in-vessel build, {ivb_tor_ext} ' @@ -557,14 +554,14 @@ def check_inputs( f'{src_tor_ext} degrees.' ) logger.warning(w.args[0]) - + if mag_tor_ext != src_tor_ext: w = Warning( f'The toroidal extent of the magnet coils, {mag_tor_ext} degrees, ' f'does not match that of the source mesh, {src_tor_ext} degrees.' ) logger.warning(w.args[0]) - + if 'scale' in invessel_build: ivb_scale = invessel_build['scale'] else: @@ -582,7 +579,7 @@ def check_inputs( ) logger.error(e.args[0]) raise e - + if ( 'export_cad_to_dagmc' in invessel_build and invessel_build['export_cad_to_dagmc'] @@ -591,7 +588,7 @@ def check_inputs( ivb_dagmc_filename = invessel_build['dagmc_filename'] else: ivb_dagmc_filename = 'dagmc' - + if 'filename' in dagmc_export: ps_dagmc_filename = dagmc_export['filename'] else: @@ -648,7 +645,7 @@ def parastell(): stellarator.export_magnets( export_dir=args.export_dir, **(filter_kwargs(magnet_coils, mc.export_allowed_kwargs)) - ) + ) if args.source: source_mesh = all_data['source_mesh'] @@ -657,7 +654,7 @@ def parastell(): export_dir=args.export_dir, **(filter_kwargs(source_mesh, sm.export_allowed_kwargs)) ) - + if args.ivb or args.magnets: dagmc_export = all_data['dagmc_export'] stellarator.build_cubit_model( @@ -665,20 +662,18 @@ def parastell(): ) stellarator.export_dagmc( export_dir=args.export_dir, - **(filter_kwargs(dagmc_export, export_allowed_kwargs)) + **(filter_kwargs(dagmc_export, export_dagmc_allowed_kwargs)) ) - cub5_export = all_data['cub5_export'] - if cub5_export['export_cub5']: - stellarator.export_cub5( - export_dir=args.export_dir, **cub5_export - ) + + if all_data['cub5_export']: + stellarator.export_cub5(export_dir=args.export_dir) if args.nwl: if not args.ivb: invessel_build = all_data['invessel_build'] if not args.magnets: dagmc_export = all_data['dagmc_export'] - + if cubit_io.initialized: cubit.cmd('new') @@ -690,22 +685,22 @@ def parastell(): nwl_required_keys = [ 'toroidal_angles', 'poloidal_angles', 'wall_s' ] - + nwl_build = {} for key in nwl_keys: nwl_build[key] = invessel_build[key] nwl_build['radial_build'] = {} - + nwl_optional_keys = [ 'num_ribs', 'num_rib_pts', 'repeat', 'scale' ] - + for key in invessel_build.keys() & nwl_optional_keys: nwl_build[key] = invessel_build[key] nwl_geom.construct_invessel_build(**nwl_build) nwl_geom.export_invessel_build(export_dir=args.export_dir) - + nwl_geom.export_dagmc( skip_imprint=True, filename='nwl_geom',