.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery_examples/011_rst_workflow.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_gallery_examples_011_rst_workflow.py: .. _rst_workflow_example: Failure analysis of an MAPDL (RST) model ---------------------------------------- This example shows the postprocessing of an MAPDL (RST) model with layered elements that was not preprocessed by ACP. The difference between the RST-only and ACP-based workflow is that the section data are loaded from the RST file instead of the ACP layup file. This happens automatically if the parameter `composite` of the :class:`.ContinuousFiberCompositesFiles` class is not set. The engineering data file (XML or ENGD) with the material properties is needed anyway. Otherwise, the material properties cannot be mapped. At the end of this example, two workflows are shown on how to create the engineering data file based on a MAPDL model and how to set the material UUIDs in MAPDL. .. important:: The material UUIDs in the engineering data file must be identical to the UUIDs in Mechanical APDL (RST file). The postprocessing of MAPDL models is supported in 2024 R2 (DPF Server version 8.0) and later. A few advanced features are not supported with the RST only workflow. For more information, see :ref:`limitations`. .. GENERATED FROM PYTHON SOURCE LINES 50-56 Set up analysis ~~~~~~~~~~~~~~~ Setting up the analysis consists of loading Ansys libraries, connecting to the DPF server, and retrieving the example files. Load Ansys libraries. .. GENERATED FROM PYTHON SOURCE LINES 56-70 .. code-block:: default from ansys.dpf.composites.composite_model import CompositeModel from ansys.dpf.composites.constants import FailureOutput from ansys.dpf.composites.example_helper import get_continuous_fiber_example_files from ansys.dpf.composites.failure_criteria import ( CombinedFailureCriterion, CoreFailureCriterion, FaceSheetWrinklingCriterion, MaxStrainCriterion, MaxStressCriterion, VonMisesCriterion, ) from ansys.dpf.composites.server_helpers import connect_to_or_start_server .. GENERATED FROM PYTHON SOURCE LINES 71-72 Start a DPF server and copy the example files into the current working directory. .. GENERATED FROM PYTHON SOURCE LINES 72-74 .. code-block:: default server = connect_to_or_start_server() .. GENERATED FROM PYTHON SOURCE LINES 75-76 Get input files (RST and material.engd but skip the ACP layup file). .. GENERATED FROM PYTHON SOURCE LINES 76-79 .. code-block:: default composite_files_on_server = get_continuous_fiber_example_files(server, "shell", True) print(composite_files_on_server) .. rst-class:: sphx-glr-script-out .. code-block:: none ContinuousFiberCompositesFiles(rst=['/tmp/dataProcessingTemp139962901063424/5eada5af-edb2-46f0-8aed-a1deba5fb65f/shell.rst'], composite={}, engineering_data='/tmp/dataProcessingTemp139962901063424/b8969876-69f2-4caa-aefe-490c3c4dbd47/material.engd', files_are_local=False) .. GENERATED FROM PYTHON SOURCE LINES 80-83 Configure combined failure criterion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Configure the combined failure criterion. .. GENERATED FROM PYTHON SOURCE LINES 83-95 .. code-block:: default combined_fc = CombinedFailureCriterion( name="failure of all materials", failure_criteria=[ MaxStrainCriterion(), MaxStressCriterion(), CoreFailureCriterion(), VonMisesCriterion(vme=True, vms=False), FaceSheetWrinklingCriterion(), ], ) .. GENERATED FROM PYTHON SOURCE LINES 96-99 Set up model and evaluate failures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set up the composite model. .. GENERATED FROM PYTHON SOURCE LINES 99-102 .. code-block:: default composite_model = CompositeModel(composite_files_on_server, server) .. GENERATED FROM PYTHON SOURCE LINES 103-104 Evaluate failures for the entire model .. GENERATED FROM PYTHON SOURCE LINES 104-110 .. code-block:: default output_all_elements = composite_model.evaluate_failure_criteria( combined_criterion=combined_fc, ) irf_field = output_all_elements.get_field({"failure_label": FailureOutput.FAILURE_VALUE}) irf_field.plot() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/gallery_examples/images/sphx_glr_011_rst_workflow_001.png :alt: 011 rst workflow :srcset: /examples/gallery_examples/images/sphx_glr_011_rst_workflow_001.png :class: sphx-glr-single-img .. tab-item:: Interactive Scene .. offlineviewer:: /home/runner/work/pydpf-composites/pydpf-composites/doc/source/examples/gallery_examples/images/sphx_glr_011_rst_workflow_001.vtksz .. GENERATED FROM PYTHON SOURCE LINES 111-113 Create and plot a sampling point ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .. GENERATED FROM PYTHON SOURCE LINES 113-118 .. code-block:: default sampling_point = composite_model.get_sampling_point(combined_criterion=combined_fc, element_id=2) sampling_plot = sampling_point.get_result_plots(core_scale_factor=0.1) sampling_plot.figure.show() .. image-sg:: /examples/gallery_examples/images/sphx_glr_011_rst_workflow_002.png :alt: Strains, Stresses, Failures :srcset: /examples/gallery_examples/images/sphx_glr_011_rst_workflow_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 119-137 Create Engineering Data file and set material UUIDs in MAPDL ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Here are two workflows for setting up the engineering data file and the material UUIDs in MAPDL. The material UUIDs must be set in MAPDL before the model is solved. With WB and Engineering Data: - Create an External Model system in WB and load the solver input file - Link the External Model with an Engineering Data system and update it - Save the project and copy the generated engineering data file (EngineeringData.xml) - For each material, look for the ``DataTransferID``, go to MAPDL and set the material UUIDs with the ``MP,UVID,,`` command With ACP Standalone (for constant material properties only): - Start ACP, go to *File - Import Model* and load the solver input file (CDB) - Go to the Materials folder and export the engineering data file (Ansys Workbench XML) - For each material, look for the ``DataTransferID``, go to MAPDL and set the material UUID with the ``MP,UVID,,`` command. .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 16.043 seconds) .. _sphx_glr_download_examples_gallery_examples_011_rst_workflow.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 011_rst_workflow.py <011_rst_workflow.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 011_rst_workflow.ipynb <011_rst_workflow.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_