Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pCrunch/aeroelastic_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,14 @@ def kurtosis(self):

@dataproperty
def integrated(self):
return np.trapz(self.data, self.time, axis=0)
return np.trapezoid(self.data, self.time, axis=0)

def compute_energy(self, pwrchan):
return np.trapz(self[pwrchan], self.time)
return np.trapezoid(self[pwrchan], self.time)

def total_travel(self, chanstr):
dchan = np.gradient(self[chanstr], self.time)
return np.trapz(np.abs(dchan), self.time)
return np.trapezoid(np.abs(dchan), self.time)

def histogram(self, chanstr, bins=15):
return np.histogram(self[chanstr], bins=bins, density=False)
Expand Down
29 changes: 24 additions & 5 deletions pCrunch/fatigue.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,17 @@ def get_rainflow_counts(self, chan, bins, S_ult=None, goodman=False):
Default: False
S_ult: float (optional)
Ultimate stress/load for the material

Returns
-------
N, S : 1darray
The count and the characteristic value for the ranges.
"""

try:
S, Mrf = fatpack.find_rainflow_ranges(chan, k=256, return_means=True)
ranges, Mrf = fatpack.find_rainflow_ranges(chan, k=256, return_means=True)
except Exception:
S = Mrf = np.zeros(1)
ranges = Mrf = np.zeros(1)

if goodman:
if S_ult is None:
Expand All @@ -312,9 +317,23 @@ def get_rainflow_counts(self, chan, bins, S_ult=None, goodman=False):
if S_ult == 0.0:
raise ValueError('Must specify an ultimate_stress to use Goodman correction')

S = fatpack.find_goodman_equivalent_stress(S, Mrf, S_ult)

return fatpack.find_range_count(S, bins)
ranges = fatpack.find_goodman_equivalent_stress(ranges, Mrf, S_ult)

success = False
while not success:
try:
N, S = fatpack.find_range_count(ranges, bins)
success = True
except ValueError:
bins *= 0.5
if bins < 1:
print(ranges)
print(bins)
raise Exception("Failed to find bins for ranges")
else:
bins = int(bins)

return N, S


def compute_del(self, chan, elapsed_time, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "pCrunch"
version = "2.1.3"
version = "2.1.4"
description = "IO and Post Processing for generic time series data of multibody aeroelastic wind turbine simulations."
readme = "README.rst"
requires-python = ">=3.9"
Expand Down
Loading