Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/feat/fatigue_example' into feat/…
Browse files Browse the repository at this point in the history
…fatigue_example
  • Loading branch information
janvonrickenbach committed Jan 5, 2024
2 parents 0056258 + 5f541bc commit 0e97a20
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
24 changes: 12 additions & 12 deletions examples/006_filter_composite_data_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
Filter result data by different criteria
----------------------------------------
This example shows how data filtering can be used for custom postprocessing of
This example shows how you can use data filtering for custom postprocessing of
layered composites. You can filter strains and stresses by material, layer, or
analysis ply. Filtering by analysis ply is implemented on the server side and
exposed with the function :func:`.get_ply_wise_data`. In this case the data is
filtered (and reduced) on the server side and only the resulting field is returned
exposed with the :func:`.get_ply_wise_data` function. In this case, the data is
filtered (and reduced) on the server side, and only the resulting field is returned
to the client. This is the recommended way to filter data if possible.
For more complex filtering, the data is transferred to the client and side and filtered
using numpy functionality.
For more complex filtering, the data is transferred to the client side and filtered
using NumPy functionality.
The examples show filtering data by layer, spot, and node, as well as material
or analysis ply ID. To learn more about how layered result data is organized,
see :ref:`select_indices`.
Expand Down Expand Up @@ -68,13 +68,13 @@
all_ply_names

# %%
# The easiest way to filter data by analysis ply is to use the function :func:`.get_ply_wise_data`.
# The easiest way to filter data by analysis ply is to use the :func:`.get_ply_wise_data` function.
# This function supports different reduction strategies such as computing the average
# or maximum/minimum over the spot locations.
# It also supports selecting a specific spot (TOP, MID, BOT) directly.
# In this example we select the maximum value over all spots for each node and then request
# the elemental location which implies averaging over all nodes in an element.
# Using :func:`.get_ply_wise_data` has the advantage that all the averaging and filtering
# This example selects the maximum value over all spots for each node and then requests
# the elemental location that implies averaging over all nodes in an element.
# Using the :func:`.get_ply_wise_data` function has the advantage that all the averaging and filtering
# is done on the server side.
if version_equal_or_later(server, "8.0"):
elemental_max = get_ply_wise_data(
Expand All @@ -90,11 +90,11 @@


# %%
# Generic client side filtering
# Generic client-side filtering
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# This example shows how to filter data by layer, spot, and node using the generic filtering on
# the client side.
# Here we plot stress values in the material direction for the first node and top spot.
# It plots stress values in the material direction for the first node and top spot.

# %%
# Get element information for all elements and show the first one as an example.
Expand Down Expand Up @@ -123,7 +123,7 @@


# %%
# Filtering by material
# Filter by material
# ~~~~~~~~~~~~~~~~~~~~~
# Loop over all elements and get the maximum stress in the material direction
# for all plies that have a specific UD material.
Expand Down
21 changes: 10 additions & 11 deletions examples/012_fatigue_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,17 @@
--------------------------------------
This example shows how to evaluate fatigue for a flat plate.
It shows how PyPDF Composites can be used to select specific layers and define a custom
It shows how you can use PyPDF Composites to select specific layers and define a custom
combination method. For this example, the custom combination method is stress in fibre
direction.
A random load time series is created, and taking into account that the load is assumed
proportional, rainflow counting is applied to load time series.
Load ranges are then applied on the stress combination method and damage is evaluated
A random load time series is created. Taking into account that the load is assumed
proportional, rainflow counting is applied to the load time series.
Load ranges are then applied on the stress combination method, and damage is evaluated
by using a dummy S-N curve.
Be aware that the fatpack package is not developed by Ansys, so it is the responsibility
of the user to verify that it works as expected. For further details:
https://pypi.org/project/fatpack/
of the user to verify that it works as expected. For more information, see the `fatback package <https://pypi.org/project/fatpack/>`_,
"""

Expand Down Expand Up @@ -76,7 +75,7 @@
# Load time series and apply rainflow counting
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# A random time series is created. Load is assumed proportional, so rainflow counting
# can be directly done on load time series, to get load ranges.
# can be directly done on the load time series to get the load ranges.
# No mean stress correction is applied.
#
load_factor_time_series = np.random.normal(-1, 2.5, size=100)
Expand All @@ -94,9 +93,9 @@
# %%
# S-N curve
# ~~~~~~~~~
# A dummy S-N curve is created. Please be aware that this is not based on any
# experimental data. We choose Sc to be the orthotropic stress limit in fiber direction
# and Nc to be 1.
# A dummy S-N curve is created. Note that this curve is not based on any
# experimental data. Sc is chosen to be the orthotropic stress limit in the fiber direction.
# and Nc is set to 1.
#
Sc = 1979
Nc = 1
Expand All @@ -118,7 +117,7 @@
# Damage evaluation
# ~~~~~~~~~~~~~~~~~
# Stress S11 at time 1 and layer P1L1__ModelingPly.2 are read
# for each load range and its damage is evaluated, using the dummy S-N curve
# for each load range. Its damage is evaluated using the dummy S-N curve.
#

damage_result_field = dpf.field.Field(location=dpf.locations.elemental, nature=dpf.natures.scalar)
Expand Down
4 changes: 2 additions & 2 deletions src/ansys/dpf/composites/ply_wise_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class ReductionStrategy(Enum):
"""The reduction strategy to get from spot values (BOT, MID, TOP) to a single value."""
"""Provides the reduction strategy for getting from spot values (BOT, MID, TOP) to a single value."""

MIN = "MIN"
MAX = "MAX"
Expand All @@ -37,7 +37,7 @@ def get_ply_wise_data(
ply_name:
Name of the ply to extract data from.
mesh :
Meshed region. Needs to be enriched with composite information.
Meshed region that needs to be enriched with composite information.
Use the ``CompositeModel.get_mesh()`` method to get the meshed region.
reduction_strategy :
Reduction strategy for getting from spot values (BOT, MID, TOP) to a single value
Expand Down

0 comments on commit 0e97a20

Please sign in to comment.