From 64d56360d6c38a49d647ebdc6e80e5ccb4fd8d62 Mon Sep 17 00:00:00 2001 From: dzalkind Date: Thu, 14 Aug 2025 13:44:14 -0600 Subject: [PATCH 1/2] Add parallel openfast reader --- pCrunch/__init__.py | 2 +- pCrunch/openfast_readers.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/pCrunch/__init__.py b/pCrunch/__init__.py index 7ba392b..beb4373 100644 --- a/pCrunch/__init__.py +++ b/pCrunch/__init__.py @@ -1,4 +1,4 @@ from .crunch import Crunch from .fatigue import FatigueParams -from .openfast_readers import OpenFASTAscii, OpenFASTBinary, load_FAST_out, read +from .openfast_readers import OpenFASTAscii, OpenFASTBinary, load_FAST_out, read, read_parallel from .aeroelastic_output import AeroelasticOutput diff --git a/pCrunch/openfast_readers.py b/pCrunch/openfast_readers.py index adb74d8..9b4b2d0 100644 --- a/pCrunch/openfast_readers.py +++ b/pCrunch/openfast_readers.py @@ -35,6 +35,29 @@ def read(filename, **kwargs): return fastout else: return fastout[0] + +def read_parallel(filenames, n_cores=1, **kwargs): + """ + Read OpenFAST files in parallel. + + Parameters + ---------- + filenames : list of str + List of OpenFAST file paths. + n_cores : int, optional + Number of cores to use for parallel reading. Default is 1. + + Returns + ------- + list of OpenFASTOutput + List of OpenFASTOutput instances. + """ + + import multiprocessing + with multiprocessing.Pool(n_cores) as pool: + outputs = pool.map(read, filenames, **kwargs) + + return outputs def load_FAST_out(filenames, tmin=0, tmax=float('inf'), **kwargs): From ef495770035d0eec560120ce82393c0c70fbf15f Mon Sep 17 00:00:00 2001 From: dzalkind Date: Fri, 19 Sep 2025 15:45:06 -0600 Subject: [PATCH 2/2] Increase discretization of rainflow ranges --- pCrunch/fatigue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pCrunch/fatigue.py b/pCrunch/fatigue.py index aff35bb..04832d7 100644 --- a/pCrunch/fatigue.py +++ b/pCrunch/fatigue.py @@ -301,7 +301,7 @@ def get_rainflow_counts(self, chan, bins, S_ult=None, goodman=False): """ try: - S, Mrf = fatpack.find_rainflow_ranges(chan, k=128, return_means=True) + S, Mrf = fatpack.find_rainflow_ranges(chan, k=256, return_means=True) except Exception: S = Mrf = np.zeros(1)