Source code for viiapackage.results.results_a10

### ===================================================================================================================
###  A10 Nonlinear static analysis of flexbase model
### ===================================================================================================================
# Copyright ©2026 Haskoning Nederland B.V.
# For use by VIIA

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

# General imports
from __future__ import annotations
import warnings
from typing import TYPE_CHECKING, Optional

# References for functions and classes in the haskoning_structural package
from haskoning_structural.pictures import View

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject
from viiapackage.database import myviia_post_a10_results
from viiapackage.pictures import viia_create_result_pictures_nls
from viiapackage.results.result_functions import viia_nls_ssi_compression
from viiapackage.results.collect_results_for_myviia import viia_collect_results_a10
from viiapackage.results.results_load_model import viia_results_load_model


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

[docs]def viia_results_a10( project: ViiaProject, convergence_graphs: bool = True, geo_output: bool = True, result_pictures: bool = True, load_model: bool = True, view: Optional[View] = None): """ Combination of functions to be performed on output of A10 nonlinear static analysis. Includes: - Graph of convergence. - Generating json-file with data for the geotechnical advisor. - Result pictures for A10 analysis. Input: - project (obj): Project object containing collections and of fem objects and project variables. - convergence_graphs (bool): Toggle to generate convergence graphs. Default value is True. - geo_output (bool): This allows the user to choose if the geo output needs to be created. This can be handy if the user wants to create results for multiple signals together. Then the user does not need to create the geo output each time. Default value is set to True. - result_pictures (bool): Toggle to generate result pictures. Default value is True. - load_model (bool): Select to reload the model. Default value is True, but when directly creating analysis and running, it needs to be switched off. - 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 A10 analysis are created. """ # Checking for version number if project.version != 1: raise ValueError("ERROR: The A10 analysis is to be applied only on non-strengthened models.") # Check if model needs to be loaded if load_model: # Load the model viia_results_load_model(project=project, analysis_nr='A10') # Collect the analysis analysis = project.viia_get(collection='analyses', name='A10 - Niet-lineair statische analyse met flexbase') # Plot convergence graphs if requested if convergence_graphs: out_file = project.viia_get_file(path=project.current_analysis_folder, suffix='.out') if out_file: project.viia_convergence_graph(file=out_file, criterion='force', analysis=analysis, show=False) project.viia_convergence_graph(file=out_file, criterion='displacement', analysis=analysis, show=False) else: project.write_log("WARNING: No convergence graph is created because out-file could not be found.") fos = project.shallow_foundation_present() piles = project.pile_foundation_present() if not piles and not fos: raise ValueError( "ERROR: No shallow or pile foundation present in the model, please check. Maybe you are using the model " "json-file, not the json-file used for the analysis?") output_5a = None output_5b = None # Collect required files for result handling if fos: output_5a = project.viia_get_file(path=project.current_analysis_folder, in_name='_OUTPUT_5A', suffix='.tb') if output_5a: # Calculate the maximum compression from the tb-file 5A maximum_compression = viia_nls_ssi_compression( project=project, tb_file=output_5a, analysis=analysis, analysis_nr='A10') # Collect the data required to post results on MYVIIA eng_a10 = viia_collect_results_a10(project=project, a10_data={'maximum_compression': maximum_compression}) # Upload results of the A10 analysis response = myviia_post_a10_results(data=eng_a10, token=project.token) if not response: warnings.warn( f"WARNING: An issue occurred during uploading the A10 analysis results to MYVIIA. No response " f"received, this could be due to debugging. Data that was sent: {eng_a10}.") elif response.status_code >= 300: warnings.warn( f"WARNING: An issue occurred during uploading the A10 analysis results to MYVIIA. Please check the " f"outputs of the nonlinear static analysis, or contact the automation-team. Response: " f"{response.status_code} | {response.text}.\n") else: project.write_log("The results of A10 analysis have been successfully uploaded to MYVIIA.") if piles: output_5b = project.viia_get_file(path=project.current_analysis_folder, in_name='_OUTPUT_5B', suffix='.tb') # Create geo output if geo_output and (output_5a or output_5b): project.viia_create_geo_output_static_analysis(output_5a=output_5a, output_5b=output_5b, analysis=analysis) project.write_log("The geo-output json-file from analysis A10 is created in the analysis folder.") # Collect the pile reactions if project.pile_foundation_present(): output_5b = project.viia_get_file(path=project.current_analysis_folder, in_name='OUTPUT_5B', suffix='.tb') if output_5b: project.viia_collect_pile_reactions(pile_output_file=output_5b, analysis=analysis) else: project.write_log("WARNING: OUTPUT_5B not found. Pile force plots cannot be created.") # Result pictures for A10 if result_pictures: viia_create_result_pictures_nls(project=project, analysis=analysis, view=view) # Add tabulated output for result plotting in python if project.viia_settings.python_result_plotting: tb_file = project.viia_get_file( path=project.current_analysis_folder, in_name='OUTPUT_STATIC-NL_TB', suffix='.tb') if not tb_file.exists(): project.write_log("WARNING: Result tb-file not found for creating result plots. Plotting is skipped.") else: # Read the tb-file project.read_diana_tbfile(file=tb_file, analysis=analysis) # Collect the analysis-reference for the plot last_calculation_block = analysis.calculation_blocks[-1] last_execute_block = last_calculation_block.execute_blocks[-1] last_step = last_execute_block.total_nr_of_steps analysis_reference = project.get_analysis_reference( analysis=analysis, calculation_block=last_calculation_block, execute_block=last_execute_block, step_nr=last_step) # Create result plot for displacements in z-direction project.plot_results_3d(output_item='U_z_tot', analysis_reference=analysis_reference)
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================