Source code for viiapackage.results.results_eigenvalue

### ===================================================================================================================
###   Eigenvalue analysis result handling
### ===================================================================================================================
# Copyright ©VIIA 2024

### ===================================================================================================================
###   1. Import modules
### ===================================================================================================================

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING, Union, Optional, Dict, List
from pathlib import Path

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.analyses import Analysis
from rhdhv_fem.abaqus_utils import fem_read_abaqus_datfile_eigenvalue
from rhdhv_fem.pictures import View

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.pictures import viia_create_result_pictures_eigenvalue
from viiapackage.results.result_functions import viia_eigen_frequency_graph, viia_convert_eigenvalue_results, \
    viia_create_eigenvalue_json


### ===================================================================================================================
###   2. Function to handle results for A7 analysis
### ===================================================================================================================

[docs]def viia_results_eigenvalue( project: ViiaProject, analysis: Analysis, analysis_nr: str, out_file: Optional[Union[Path, str]] = None, dat_file: Optional[Union[Path, str]] = None, result_pictures: bool = True, view: Optional[View] = None) \ -> Dict[str, Union[List[float], float]]: """ Combination of functions to be performed on output of eigen value analysis in VIIA. Includes: - Graph of eigenfrequency distribution. - Graphs of governing modes plotted in response spectrum. - Result pictures of the eigenmodes. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - analysis (obj): Instance of analysis class that contains the eigenvalue analysis. - analysis_nr (str): Number of analysis in VIIA for the eigenvalue analysis. Select from A3 or A7. - out_file (path): The DIANA out-file location and filename of the analysis requested as path. Optional input, if not provided the out-file will be retrieved from the analysis folder. Alternative (str): The DIANA out-file location and filename of the analysis requested as string. - dat_file (path): The ABAQUS dat-file location and filename of the analysis requested as path. Optional input, if not provided the dat-file will be retrieved from the analysis folder. Alternative (str): The ABAQUS dat-file location and filename of the analysis requested as string. - result_pictures (bool): Toggle to generate result pictures. Default value is True. - view (obj): View that should be used for the pictures. When None the default view will be used. Default is None. Output: - Result items of eigenvalue analysis are saved in workfolder. - Returns the data of the modes in converted format for further result handling functions. """ # Get the raw modes from results-file in the specific software if project.software == 'abaqus': if not dat_file: dat_file = project.viia_get_file( path=project.current_analysis_folder, starts_with=f'{analysis_nr}-', suffix='.dat') if not dat_file or not dat_file.exists(): raise FileNotFoundError( f"ERROR: Could not retrieve the ABAQUS dat-file for result handling {analysis_nr} analysis.") raw_modes = fem_read_abaqus_datfile_eigenvalue(file=dat_file) else: if not out_file: out_file = project.viia_get_file(path=project.current_analysis_folder, suffix='.out') if not out_file or not out_file.exists(): raise FileNotFoundError( f"ERROR: Could not retrieve the DIANA out-file for result handling {analysis_nr} analysis.") raw_modes = project.read_diana_outfile(file=out_file, outfile_type='eigenvalue') # Convert the collected results from software in the VIIA format for further result handling modes = viia_convert_eigenvalue_results(project=project, raw_modes=raw_modes, analysis_nr=analysis_nr) # Create json-file viia_create_eigenvalue_json(project=project, modes=modes) # Generate graphs viia_eigen_frequency_graph(project=project, modes=modes) # Result pictures for the eigenvalue analysis if result_pictures: viia_create_result_pictures_eigenvalue(project=project, analysis=analysis, view=view) # Return the collected modes return modes
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================