.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery_examples/1_failure_operator_example.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_1_failure_operator_example.py: .. _failure_operator_example: Composite failure analysis -------------------------- This example shows how to analyze a composite structure by a combined failure criterion. The failure operator of DPF Composites computes the minimum and maximum failure values and failure modes of a combined failure criterion. A combined failure criterion is a selection of failure criteria such as Puck, Tsai-Wu, or face sheet wrinkling. For a list of all failure criteria, see :ref:`failure_criteria`. The :class:`Combined Failure Criterion <.failure_criteria.CombinedFailureCriterion>` class allows you to assess different type of materials and failure modes at once. The scoping enables you to evaluate the minimum and maximum failures per element or select a list of materials or plies. .. GENERATED FROM PYTHON SOURCE LINES 21-27 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 27-40 .. code-block:: default from ansys.dpf.composites.composite_model import CompositeModel, CompositeScope 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, MaxStrainCriterion, MaxStressCriterion, VonMisesCriterion, ) from ansys.dpf.composites.server_helpers import connect_to_or_start_server .. GENERATED FROM PYTHON SOURCE LINES 41-42 Start a DPF server and copy the example files into the current working directory. .. GENERATED FROM PYTHON SOURCE LINES 42-45 .. code-block:: default server = connect_to_or_start_server() composite_files_on_server = get_continuous_fiber_example_files(server, "shell") .. GENERATED FROM PYTHON SOURCE LINES 46-49 Configure combined failure criterion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Configure the combined failure criterion. .. GENERATED FROM PYTHON SOURCE LINES 49-61 .. code-block:: default combined_fc = CombinedFailureCriterion( name="failure of all materials", failure_criteria=[ MaxStrainCriterion(), MaxStressCriterion(), CoreFailureCriterion(), VonMisesCriterion(vme=True, vms=False), ], ) .. GENERATED FROM PYTHON SOURCE LINES 62-65 Set up model and evaluate failures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set up the composite model. .. GENERATED FROM PYTHON SOURCE LINES 65-68 .. code-block:: default composite_model = CompositeModel(composite_files_on_server, server) .. GENERATED FROM PYTHON SOURCE LINES 69-70 Evaluate failures for the entire model .. GENERATED FROM PYTHON SOURCE LINES 70-76 .. 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() .. image-sg:: /examples/gallery_examples/images/sphx_glr_1_failure_operator_example_001.png :alt: 1 failure operator example :srcset: /examples/gallery_examples/images/sphx_glr_1_failure_operator_example_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 77-78 Scope failure evaluation to a certain element scope. .. GENERATED FROM PYTHON SOURCE LINES 78-85 .. code-block:: default output_two_elements = composite_model.evaluate_failure_criteria( combined_criterion=combined_fc, composite_scope=CompositeScope(elements=[1, 3]), ) irf_field = output_two_elements.get_field({"failure_label": FailureOutput.FAILURE_VALUE}) irf_field.plot() .. image-sg:: /examples/gallery_examples/images/sphx_glr_1_failure_operator_example_002.png :alt: 1 failure operator example :srcset: /examples/gallery_examples/images/sphx_glr_1_failure_operator_example_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 86-87 Scope failure evaluation by plies. .. GENERATED FROM PYTHON SOURCE LINES 87-93 .. code-block:: default output_woven_plies = composite_model.evaluate_failure_criteria( combined_criterion=combined_fc, composite_scope=CompositeScope(plies=["P1L1__ud_patch ns1"]), ) irf_field = output_woven_plies.get_field({"failure_label": FailureOutput.FAILURE_VALUE}) irf_field.plot() .. image-sg:: /examples/gallery_examples/images/sphx_glr_1_failure_operator_example_003.png :alt: 1 failure operator example :srcset: /examples/gallery_examples/images/sphx_glr_1_failure_operator_example_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 9.334 seconds) .. _sphx_glr_download_examples_gallery_examples_1_failure_operator_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 1_failure_operator_example.py <1_failure_operator_example.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 1_failure_operator_example.ipynb <1_failure_operator_example.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_