Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/myna/application/additivefoam/additivefoam.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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.get_output_files()
if not all(files_are_valid):
mynafiles = self.settings["data"]["output_paths"][self.step_name]
for mynafile in mynafiles:
Expand Down Expand Up @@ -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,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions src/myna/application/cubit/cubit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
inherited by all Myna Component applications in this module."""

import os
import shutil
from myna.core.app.base import MynaApp


Expand Down Expand Up @@ -50,10 +49,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)
2 changes: 1 addition & 1 deletion src/myna/application/deer/creep_timeseries_region/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 0 additions & 9 deletions src/myna/application/deer/deer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand All @@ -28,10 +26,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)
33 changes: 18 additions & 15 deletions src/myna/core/app/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -183,6 +169,23 @@ def template(self):
return Path(self.path) / "template"
return Path(self.args.template)

@property
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:
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"""
Expand Down Expand Up @@ -291,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
Expand Down
Loading