.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery_examples/001_failure_operator_example.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_examples_gallery_examples_001_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 43-49 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 49-62 .. code-block:: Python 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 63-64 Start a DPF server and copy the example files into the current working directory. .. GENERATED FROM PYTHON SOURCE LINES 64-67 .. code-block:: Python server = connect_to_or_start_server() composite_files_on_server = get_continuous_fiber_example_files(server, "shell") .. GENERATED FROM PYTHON SOURCE LINES 68-71 Configure combined failure criterion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Configure the combined failure criterion. .. GENERATED FROM PYTHON SOURCE LINES 71-83 .. code-block:: Python combined_fc = CombinedFailureCriterion( name="failure of all materials", failure_criteria=[ MaxStrainCriterion(), MaxStressCriterion(), CoreFailureCriterion(), VonMisesCriterion(vme=True, vms=False), ], ) .. GENERATED FROM PYTHON SOURCE LINES 84-87 Set up model and evaluate failures ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Set up the composite model. .. GENERATED FROM PYTHON SOURCE LINES 87-90 .. code-block:: Python composite_model = CompositeModel(composite_files_on_server, server) .. GENERATED FROM PYTHON SOURCE LINES 91-92 Evaluate failures for the entire model .. GENERATED FROM PYTHON SOURCE LINES 92-98 .. code-block:: Python 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_001_failure_operator_example_001.png :alt: 001 failure operator example :srcset: /examples/gallery_examples/images/sphx_glr_001_failure_operator_example_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_001_failure_operator_example_001.vtksz .. GENERATED FROM PYTHON SOURCE LINES 99-100 Scope failure evaluation to a certain element scope. .. GENERATED FROM PYTHON SOURCE LINES 100-107 .. code-block:: Python 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() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/gallery_examples/images/sphx_glr_001_failure_operator_example_002.png :alt: 001 failure operator example :srcset: /examples/gallery_examples/images/sphx_glr_001_failure_operator_example_002.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_001_failure_operator_example_002.vtksz .. GENERATED FROM PYTHON SOURCE LINES 108-109 Scope failure evaluation by plies. .. GENERATED FROM PYTHON SOURCE LINES 109-115 .. code-block:: Python 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() .. tab-set:: .. tab-item:: Static Scene .. image-sg:: /examples/gallery_examples/images/sphx_glr_001_failure_operator_example_003.png :alt: 001 failure operator example :srcset: /examples/gallery_examples/images/sphx_glr_001_failure_operator_example_003.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_001_failure_operator_example_003.vtksz .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 22.294 seconds) .. _sphx_glr_download_examples_gallery_examples_001_failure_operator_example.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 001_failure_operator_example.ipynb <001_failure_operator_example.ipynb>` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: 001_failure_operator_example.py <001_failure_operator_example.py>` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: 001_failure_operator_example.zip <001_failure_operator_example.zip>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_