Source code for viiapackage.analyses.helper_functions.viia_run_analysis_diana

### ===================================================================================================================
###  FUNCTION: Run the analysis in DIANA software for VIIA workflow
### ===================================================================================================================
# Copyright ©VIIA 2024

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

# General imports
from __future__ import annotations
from typing import TYPE_CHECKING

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.analyses import Analysis

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject


### ===================================================================================================================
###   2. Function viia_run_analysis_diana
### ===================================================================================================================

[docs]def viia_run_analysis_diana(project: ViiaProject, analysis: Analysis): """ Function to run an analysis in DIANA, following the VIIA workflow. .. warning:: Be aware that running in DIANA GUI can be not appropriate for NLTH (long calculation times). In those cases it is better to run analysis in combox. Input: - project (obj): VIIA project object containing collections of fem objects and project variables. - analysis (obj): Object reference of 'Analysis' class. The analysis which will be performed. Default value is 'None'. In case of SCIA calculations no analysis is needed. In case of DIANA calculations, the analysis it is required to provide the analysis. Alternative (str): Name of the analysis to be performed (there should be an object with that analysis). Output: - Analysis is run in DIANA. """ # Apply user supplied subroutine for flexbase analyses if project.viia_settings.support_type != 'FixedBase': if len(project.viia_supported_surfaces) > 0 and len(project.viia_supported_points) > 0: # For mixed foundations # Set user supplied subroutine library when running analysis in DIANA GUI project.rhdhvDIANA.setAnalysisProperty( analysis.name, 'userLibrary', (project.viia_settings.project_specific_package_location / 'software_specific' / 'DIANA' / 'subroutines' / 'usrspr_usrifc' / 'usrspr_usrifc.dll').as_posix()) elif len(project.viia_supported_surfaces) > 0: # For shallow foundations # Set user supplied subroutine library when running analysis in DIANA GUI project.rhdhvDIANA.setAnalysisProperty( analysis.name, 'userLibrary', (project.viia_settings.project_specific_package_location / 'software_specific' / 'DIANA' / 'subroutines' / 'usrifc' / 'usrifc.dll').as_posix()) elif len(project.viia_supported_points) > 0: # For pile foundations # Set user supplied subroutine library when running analysis in DIANA GUI project.rhdhvDIANA.setAnalysisProperty( analysis.name, 'userLibrary', (project.viia_settings.project_specific_package_location / 'software_specific' / 'DIANA' / 'subroutines' / 'usrspr' / 'usrspr.dll').as_posix()) # Function in rhdhv fem package is used return analysis.run_analysis()
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================