Skip to content

Commit

Permalink
Minor fixes to path resolving for FEM result and input files
Browse files Browse the repository at this point in the history
  • Loading branch information
Krande committed Oct 18, 2021
1 parent 121751f commit c7b40ea
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/ada/concepts/levels.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ def to_fem(
from ada.fem.results import Results

scratch_dir = Settings.scratch_dir if scratch_dir is None else pathlib.Path(scratch_dir)
fem_res_files = default_fem_res_path(name, scratch_dir)
fem_res_files = default_fem_res_path(name, scratch_dir=scratch_dir)

res_path = fem_res_files.get(fem_format, None)
metadata = dict() if metadata is None else metadata
Expand Down
4 changes: 2 additions & 2 deletions src/ada/fem/formats/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations

import logging

from typing import Callable, Dict
from . import abaqus, calculix, code_aster, sesam, usfos
from .utils import interpret_fem

Expand Down Expand Up @@ -30,7 +30,7 @@ class FEATypes:
FEATypes.USFOS: usfos.to_fem,
}

fem_executables = {
fem_executables: Dict[str, Callable] = {
FEATypes.ABAQUS: abaqus.run_abaqus,
FEATypes.CALCULIX: calculix.run_calculix,
FEATypes.CODE_ASTER: code_aster.run_code_aster,
Expand Down
5 changes: 4 additions & 1 deletion src/ada/fem/formats/abaqus/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def get_eigen_data(dat_file: Union[str, os.PathLike]) -> EigenDataSummary:

def read_abaqus_results(results: Results, file_ref: pathlib.Path, overwrite):
dat_file = file_ref.with_suffix(".dat")
if dat_file.exists() and type(results.assembly.fem.steps[0]) == StepEigen:
# if results.assembly is not None:
# if results.assembly.fem.steps[0]) == StepEigen:
# is_eigen = True
if dat_file.exists():
results.eigen_mode_data = get_eigen_data(dat_file)

logging.error("Result mesh data extraction is not supported for abaqus")
Expand Down
8 changes: 4 additions & 4 deletions src/ada/fem/formats/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,8 @@ def convert_part_objects(p: Part, skip_plates, skip_beams):
p._beams = convert_part_elem_bm_to_beams(p)


def default_fem_res_path(name, scratch_dir) -> Dict[str, pathlib.Path]:
base_path = scratch_dir / name / name
def default_fem_res_path(name, scratch_dir=None, analysis_dir=None) -> Dict[str, pathlib.Path]:
base_path = scratch_dir / name / name if analysis_dir is None else analysis_dir / name
return dict(
code_aster=base_path.with_suffix(".rmed"),
abaqus=base_path.with_suffix(".odb"),
Expand All @@ -491,8 +491,8 @@ def default_fem_res_path(name, scratch_dir) -> Dict[str, pathlib.Path]:
)


def default_fem_inp_path(name, scratch_dir):
base_path = scratch_dir / name / name
def default_fem_inp_path(name, scratch_dir=None, analysis_dir=None):
base_path = scratch_dir / name / name if analysis_dir is None else analysis_dir / name
return dict(
code_aster=base_path.with_suffix(".export"),
abaqus=base_path.with_suffix(".inp"),
Expand Down

0 comments on commit c7b40ea

Please sign in to comment.