.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "examples/gallery_examples/8_assembly_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_8_assembly_example.py: .. _assembly_example: Postprocess an assembly ----------------------- This example shows how to postprocess an assembly with multiple composite parts. The assembly consists of a shell and solid composite model. The :class:`Composite Model <.CompositeModel>` class is used to access the data of the different parts. .. GENERATED FROM PYTHON SOURCE LINES 14-20 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 20-27 .. 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, MaxStressCriterion from ansys.dpf.composites.server_helpers import connect_to_or_start_server .. GENERATED FROM PYTHON SOURCE LINES 28-29 Start a DPF server and copy the example files into the current working directory. .. GENERATED FROM PYTHON SOURCE LINES 29-32 .. code-block:: default server = connect_to_or_start_server() composite_files_on_server = get_continuous_fiber_example_files(server, "assembly") .. GENERATED FROM PYTHON SOURCE LINES 33-36 Configure combined failure criterion ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Configure the combined failure crition. .. GENERATED FROM PYTHON SOURCE LINES 36-41 .. code-block:: default combined_fc = CombinedFailureCriterion( name="failure of all materials", failure_criteria=[MaxStressCriterion()], ) .. GENERATED FROM PYTHON SOURCE LINES 42-45 Set up model ~~~~~~~~~~~~ Set up the composite model. .. GENERATED FROM PYTHON SOURCE LINES 45-47 .. code-block:: default composite_model = CompositeModel(composite_files_on_server, server) .. GENERATED FROM PYTHON SOURCE LINES 48-51 Plot IRF ~~~~~~~~ Plot the maximum IRF per element. .. GENERATED FROM PYTHON SOURCE LINES 51-55 .. 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_8_assembly_example_001.png :alt: 8 assembly example :srcset: /examples/gallery_examples/images/sphx_glr_8_assembly_example_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 56-63 Get element information ~~~~~~~~~~~~~~~~~~~~~~~ In the assembly, two composite definitions exist: one with a "shell" label and one with a "solid" label. To query the lay-up properties, you must query the properties with the correct composite definition label. This code gets element information for all layered elements. .. GENERATED FROM PYTHON SOURCE LINES 63-69 .. code-block:: default element_infos = [] for composite_label in composite_model.composite_definition_labels: for element_id in composite_model.get_all_layered_element_ids_for_composite_definition_label( composite_label ): element_infos.append(composite_model.get_element_info(element_id, composite_label)) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 5.533 seconds) .. _sphx_glr_download_examples_gallery_examples_8_assembly_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: 8_assembly_example.py <8_assembly_example.py>` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: 8_assembly_example.ipynb <8_assembly_example.ipynb>` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_