From 53c30d2059f72fb8b0a45aeda8d017951b3f4564 Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Wed, 11 Feb 2026 16:12:04 -0500 Subject: [PATCH 1/8] remove copy_template_to_dir functions in apps --- src/myna/application/additivefoam/additivefoam.py | 7 ------- .../additivefoam/solidification_region_reduced/app.py | 2 +- .../additivefoam/solidification_region_reduced_stl/app.py | 2 +- src/myna/application/cubit/cubit.py | 7 ------- src/myna/application/deer/creep_timeseries_region/app.py | 2 +- src/myna/application/deer/deer.py | 7 ------- 6 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/myna/application/additivefoam/additivefoam.py b/src/myna/application/additivefoam/additivefoam.py index 5e9b9909..7d7a0228 100644 --- a/src/myna/application/additivefoam/additivefoam.py +++ b/src/myna/application/additivefoam/additivefoam.py @@ -35,13 +35,6 @@ def __init__(self): if self.args.exec is None: self.args.exec = "additiveFoam" - def copy_template_to_dir(self, target_dir): - """Copies the specified template directory to the specified target directory""" - # Ensure directory structure to target exists - os.makedirs(os.path.dirname(target_dir), exist_ok=True) - if self.args.template is not None: - shutil.copytree(self.args.template, target_dir, dirs_exist_ok=True) - def has_matching_template_mesh_dict(self, mesh_path, mesh_dict): """Checks if there is a usable mesh dictionary in the case directory diff --git a/src/myna/application/additivefoam/solidification_region_reduced/app.py b/src/myna/application/additivefoam/solidification_region_reduced/app.py index 987d2690..c4485c3b 100644 --- a/src/myna/application/additivefoam/solidification_region_reduced/app.py +++ b/src/myna/application/additivefoam/solidification_region_reduced/app.py @@ -410,7 +410,7 @@ def generate_resource_mesh(self, case_dict): """ # Copy app template to the resource directory - self.copy_template_to_dir(case_dict["resource_template_dir"]) + self.copy_template_to_case(case_dict["resource_template_dir"]) # Generate coarse background mesh self.create_coarse_mesh(case_dict) diff --git a/src/myna/application/additivefoam/solidification_region_reduced_stl/app.py b/src/myna/application/additivefoam/solidification_region_reduced_stl/app.py index dbe6d04d..e49569de 100644 --- a/src/myna/application/additivefoam/solidification_region_reduced_stl/app.py +++ b/src/myna/application/additivefoam/solidification_region_reduced_stl/app.py @@ -115,7 +115,7 @@ def generate_resource_mesh(self, case_dict): ]["file_local"] # Copy app template to the resource directory - self.copy_template_to_dir(case_dict["resource_template_dir"]) + self.copy_template_to_case(case_dict["resource_template_dir"]) # Generate coarse background mesh self.create_coarse_mesh(case_dict) diff --git a/src/myna/application/cubit/cubit.py b/src/myna/application/cubit/cubit.py index 1ee08164..de8f4749 100644 --- a/src/myna/application/cubit/cubit.py +++ b/src/myna/application/cubit/cubit.py @@ -50,10 +50,3 @@ def __init__(self): ) else: self.args.exec = original_executable_arg - - def copy_template_to_dir(self, target_dir): - """Copies the specified template directory to the specified target directory""" - # Ensure directory structure to target exists - os.makedirs(os.path.dirname(target_dir), exist_ok=True) - if self.args.template is not None: - shutil.copytree(self.args.template, target_dir, dirs_exist_ok=True) diff --git a/src/myna/application/deer/creep_timeseries_region/app.py b/src/myna/application/deer/creep_timeseries_region/app.py index b5acf56a..cd3d5316 100644 --- a/src/myna/application/deer/creep_timeseries_region/app.py +++ b/src/myna/application/deer/creep_timeseries_region/app.py @@ -68,7 +68,7 @@ def configure_case(self, case_dir, exodus_file): Args: case_dir: directory to configure into a valid Deer case exodus_file: Exodus mesh file associated with the case""" - self.copy_template_to_dir(case_dir) + self.copy_template_to_case(case_dir) self.generate_orientation_file(case_dir, exodus_file) self.update_case_loading_parameters(case_dir, exodus_file) diff --git a/src/myna/application/deer/deer.py b/src/myna/application/deer/deer.py index 96a9f715..2b7deaaa 100644 --- a/src/myna/application/deer/deer.py +++ b/src/myna/application/deer/deer.py @@ -28,10 +28,3 @@ def __init__(self): help="Path to the root Moose install directory", ) self.parse_known_args() - - def copy_template_to_dir(self, target_dir): - """Copies the specified template directory to the specified target directory""" - # Ensure directory structure to target exists - os.makedirs(os.path.dirname(target_dir), exist_ok=True) - if self.args.template is not None: - shutil.copytree(self.args.template, target_dir, dirs_exist_ok=True) From feb97f376801622e067e4346430289297ef3835a Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Wed, 11 Feb 2026 16:13:14 -0500 Subject: [PATCH 2/8] mynaapp: make sim_class_obj a class property to evaluate class_name dynamically --- src/myna/core/app/base.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/myna/core/app/base.py b/src/myna/core/app/base.py index 477ccc58..e187e1b4 100644 --- a/src/myna/core/app/base.py +++ b/src/myna/core/app/base.py @@ -56,20 +56,6 @@ def __init__(self): list(x.keys())[0] for x in self.settings["steps"] ].index(self.step_name) - # Check if there is a corresponding component class. This will be None if - # class name is not in the Component lookup dictionary - if self.class_name is not None: - self.sim_class_obj = None - try: - self.sim_class_obj = return_step_class(self.class_name, verbose=False) - self.sim_class_obj.apply_settings( - self.settings["steps"][self.step_number], - self.settings.get("data"), - self.settings.get("myna"), - ) - except KeyError: - pass - # Set up argparse self.parser = argparse.ArgumentParser( description="Configure input files for specified Myna cases" @@ -183,6 +169,23 @@ def template(self): return Path(self.path) / "template" return Path(self.args.template) + @property + def sim_class_obj(self): + """Return the corresponding component class. This will be None if + class name is not in the Component lookup dictionary""" + if self.class_name is not None: + obj = None + try: + obj = return_step_class(self.class_name, verbose=False) + obj.apply_settings( + self.settings["steps"][self.step_number], + self.settings.get("data"), + self.settings.get("myna"), + ) + return obj + except KeyError: + return obj + def parse_known_args(self): """Parse known command line arguments to update self.args and apply any corrections""" From f2be86c7ce947653e3ad92d1acba9454220e1097 Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Wed, 11 Feb 2026 16:13:34 -0500 Subject: [PATCH 3/8] correct error handling on copy_template_to_case --- src/myna/core/app/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/myna/core/app/base.py b/src/myna/core/app/base.py index e187e1b4..85a3ecbb 100644 --- a/src/myna/core/app/base.py +++ b/src/myna/core/app/base.py @@ -294,7 +294,7 @@ def copy_template_to_case(self, case_dir): try: case_dir_files = os.listdir(case_dir) case_dir_files.remove("myna_data.yaml") - except ValueError: + except (ValueError, FileNotFoundError): case_dir_files = [] # Copy if there are no existing files in the case directory or overwrite is specified From 9209edd21d127870223f403936143e9775064e3a Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Wed, 11 Feb 2026 16:37:30 -0500 Subject: [PATCH 4/8] linting fixes --- src/myna/application/cubit/cubit.py | 1 - src/myna/application/deer/deer.py | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/myna/application/cubit/cubit.py b/src/myna/application/cubit/cubit.py index de8f4749..ac7c91cc 100644 --- a/src/myna/application/cubit/cubit.py +++ b/src/myna/application/cubit/cubit.py @@ -10,7 +10,6 @@ inherited by all Myna Component applications in this module.""" import os -import shutil from myna.core.app.base import MynaApp diff --git a/src/myna/application/deer/deer.py b/src/myna/application/deer/deer.py index 2b7deaaa..43563733 100644 --- a/src/myna/application/deer/deer.py +++ b/src/myna/application/deer/deer.py @@ -9,8 +9,6 @@ """Define the application functionality for the base `DeerApp`, which should be inherited by all Myna Component applications in this module.""" -import os -import shutil from myna.core.app.base import MynaApp From c61e3d11136f0c27df9da276f8e648c8beebde2d Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Thu, 12 Feb 2026 15:23:17 -0500 Subject: [PATCH 5/8] fixup: syntax of additivefoam postprocess output --- .../additivefoam/solidification_region_reduced/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/myna/application/additivefoam/solidification_region_reduced/app.py b/src/myna/application/additivefoam/solidification_region_reduced/app.py index c4485c3b..c21e0078 100644 --- a/src/myna/application/additivefoam/solidification_region_reduced/app.py +++ b/src/myna/application/additivefoam/solidification_region_reduced/app.py @@ -521,7 +521,7 @@ def postprocess_case(self, mynafile): if len(datafiles) > 0: # Header process = self.start_subprocess( - ["echo", "x,y,z,tm,ts,cr"], + ["echo", "x (m),y (m),z (m),tm (s),ts (s),cr (k/s)"], stdout=mf, stderr=f, ) From 9f008a199123ce5732c3bf2ed755a6cabd6c69ea Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Thu, 12 Feb 2026 15:25:51 -0500 Subject: [PATCH 6/8] change name of MynaApp component object property --- .../additivefoam/solidification_region_reduced/app.py | 2 +- src/myna/core/app/base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/myna/application/additivefoam/solidification_region_reduced/app.py b/src/myna/application/additivefoam/solidification_region_reduced/app.py index c21e0078..99b5b2e7 100644 --- a/src/myna/application/additivefoam/solidification_region_reduced/app.py +++ b/src/myna/application/additivefoam/solidification_region_reduced/app.py @@ -478,7 +478,7 @@ def execute_case(self, mynafile): def postprocess(self): """Postprocesses all cases""" - _, _, files_are_valid = self.sim_class_obj.get_output_files() + _, _, files_are_valid = self.component_obj.get_output_files() if not all(files_are_valid): mynafiles = self.settings["data"]["output_paths"][self.step_name] for mynafile in mynafiles: diff --git a/src/myna/core/app/base.py b/src/myna/core/app/base.py index 85a3ecbb..745c5f7e 100644 --- a/src/myna/core/app/base.py +++ b/src/myna/core/app/base.py @@ -170,7 +170,7 @@ def template(self): return Path(self.args.template) @property - def sim_class_obj(self): + def component_obj(self): """Return the corresponding component class. This will be None if class name is not in the Component lookup dictionary""" if self.class_name is not None: From 467f93c721d8fa06d57306ba385e669b8c2b56d9 Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Thu, 12 Feb 2026 15:48:03 -0500 Subject: [PATCH 7/8] correct additivefoam function object library name in templates --- .../solidification_region_reduced/template/system/ExaCA | 2 +- .../solidification_region_reduced_stl/template/system/ExaCA | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/myna/application/additivefoam/solidification_region_reduced/template/system/ExaCA b/src/myna/application/additivefoam/solidification_region_reduced/template/system/ExaCA index 5bf3e412..95744fa3 100644 --- a/src/myna/application/additivefoam/solidification_region_reduced/template/system/ExaCA +++ b/src/myna/application/additivefoam/solidification_region_reduced/template/system/ExaCA @@ -7,7 +7,7 @@ ExaCA { type ExaCA; - libs ("libExaCAFunctionObject.so"); + libs ("libadditiveFoamFunctionObjects.so"); box ( 0.0495 -0.0495 -0.0003 ) ( 0.0505 -0.0485 0 ); dx 2.5e-6; diff --git a/src/myna/application/additivefoam/solidification_region_reduced_stl/template/system/ExaCA b/src/myna/application/additivefoam/solidification_region_reduced_stl/template/system/ExaCA index 11dac5b7..fc51c1e0 100644 --- a/src/myna/application/additivefoam/solidification_region_reduced_stl/template/system/ExaCA +++ b/src/myna/application/additivefoam/solidification_region_reduced_stl/template/system/ExaCA @@ -7,7 +7,7 @@ ExaCA { type ExaCA; - libs ("libExaCAFunctionObject.so"); + libs ("libadditiveFoamFunctionObjects.so"); box ( 0.172 0.072 -0.0003 ) ( 0.173 0.073 0 ); dx 2.5e-6; From f3839c124e5bbb1b4ce53931f008359d79a70a2c Mon Sep 17 00:00:00 2001 From: Gerry Knapp Date: Fri, 13 Feb 2026 16:53:54 -0500 Subject: [PATCH 8/8] syntax change for MynaApp.component --- .../additivefoam/solidification_region_reduced/app.py | 2 +- src/myna/core/app/base.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/myna/application/additivefoam/solidification_region_reduced/app.py b/src/myna/application/additivefoam/solidification_region_reduced/app.py index 99b5b2e7..a8fe7586 100644 --- a/src/myna/application/additivefoam/solidification_region_reduced/app.py +++ b/src/myna/application/additivefoam/solidification_region_reduced/app.py @@ -478,7 +478,7 @@ def execute_case(self, mynafile): def postprocess(self): """Postprocesses all cases""" - _, _, files_are_valid = self.component_obj.get_output_files() + _, _, files_are_valid = self.component.get_output_files() if not all(files_are_valid): mynafiles = self.settings["data"]["output_paths"][self.step_name] for mynafile in mynafiles: diff --git a/src/myna/core/app/base.py b/src/myna/core/app/base.py index 745c5f7e..45dc5ff1 100644 --- a/src/myna/core/app/base.py +++ b/src/myna/core/app/base.py @@ -170,7 +170,7 @@ def template(self): return Path(self.args.template) @property - def component_obj(self): + def component(self): """Return the corresponding component class. This will be None if class name is not in the Component lookup dictionary""" if self.class_name is not None: