Rainflow counting algorithm

1 Introduction

The rainflow counting algorithm is a widely used method for identifying and counting fatigue cycles in a time-varying stress or strain history. It is particularly important in fatigue analysis, where the cumulative damage from cyclic loading must be assessed. The algorithm processes a sequence of load reversals (peaks and valleys) and extracts closed stress-strain hysteresis loops, which correspond to fatigue cycles of various ranges and mean values.

2 Identification of Reversals

Before applying the rainflow counting algorithm, the load history must be reduced to a sequence of reversals (local maxima and minima). This preprocessing step involves:
  • Identifying all local peaks (maxima) and valleys (minima) in the time history
  • Removing any points that are not reversals
  • Ensuring the sequence alternates between peaks and valleys
The resulting sequence of reversals forms the input to the rainflow counting procedure.

3 Rainflow Counting Procedure

3.1 Step 1 — Initialize

Create an empty stack.
Create an empty list of counted cycles.

3.2 Step 2 — Process Reversals

For each reversal
$$x_i$$
:
Push
$$x_i$$
onto the stack.
While the stack contains at least three points:
Let:
  • $$S_1$$
    = third-from-top
  • $$S_2$$
    = second-from-top
  • $$S_3$$
    = top
Compute:
$$Y = |S_2 - S_1|$$
$$X = |S_3 - S_2|$$
If:
$$X \geq Y$$
then:
A cycle of range
$$Y$$
is identified.
Count it as:
  • 1.0 cycle if both
    $$S_1$$
    and
    $$S_2$$
    are interior points,
  • 0.5 cycle if the cycle contains the starting point of the stack.
Remove
$$S_1$$
and
$$S_2$$
from the stack if they are interior points or only
$$S_1$$
if it is the starting point.
Continue checking the new top three stack values.
Otherwise:
Stop checking and move to the next reversal.

3.3 After All Reversals Are Processed

The points remaining in the stack form residual half cycles.
For each adjacent pair of remaining stack points:
$$\text{Range} = |x_{i+1} - x_i|$$
Each of these is counted as 0.5 cycle. These are also called dangling ranges.

4 Output and Application

The output of the rainflow counting algorithm is a list of cycles, each characterized by:
  • Range: the amplitude of the cycle
  • Mean value: the average stress or strain level of the cycle
  • Count: 0.5 or 1.0, indicating whether it is a half cycle or full cycle
This cycle information is then used in fatigue damage calculations, typically in conjunction with S-N curves or strain-life approaches, and damage accumulation rules such as Miner's rule.

5 Example

The following link contains a step-by-step example of how the Rainflow counting algorithm implemented in Ashes is applied to the following sequence of reversals:
[0, 2, -14, 10, 0, 13, -9, 11, -8, 8, -9, 15, -4, 10, 0, 13, 0].

The figure below shows the sequence of reversals:

Reversals series for Rainflow counting

This sequence of reversals will produce the following range cycles:

Histogram of range cycles from Rainflow counting