Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

143 refactor notch approximation #150

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
34 changes: 18 additions & 16 deletions benchmarks/generate_time_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,23 @@
import numpy as np
import pylife.stress.timesignal as TS

np.random.seed(23424711)

load_signal = TS.TimeSignalGenerator(
10,
{
'number': 50_000,
'amplitude_median': 50.0,
'amplitude_std_dev': 0.5,
'frequency_median': 4,
'frequency_std_dev': 3,
'offset_median': 0,
'offset_std_dev': 0.4,
},
None,
None,
).query(1_000_000)
if __name__ == "__main__":
np.random.seed(23424711)

np.savetxt('load_signal.csv', load_signal)
load_signal = TS.TimeSignalGenerator(
10,
{
'number': 50_000,
'amplitude_median': 50.0,
'amplitude_std_dev': 0.5,
'frequency_median': 4,
'frequency_std_dev': 3,
'offset_median': 0,
'offset_std_dev': 0.4,
},
None,
None,
).query(1_000_000)

np.savetxt('load_signal.csv', load_signal)
20 changes: 5 additions & 15 deletions demos/fkm_nonlinear/fkm_nonlinear_full.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
"plt.rcParams.update({'font.size': 22})\n",
"plt.plot(range(len(scaled_load_sequence)), load_sequence, \"o-\", c=\"g\", lw=3)\n",
"plt.grid()\n",
"plt.ylabel(\"$\\sigma_V$ [MPa]\")"
"plt.ylabel(r\"$\\sigma_V$ [MPa]\")"
]
},
{
Expand Down Expand Up @@ -559,18 +559,13 @@
"load_sequence_list = scaled_load_sequence\n",
"print(load_sequence_list)\n",
"\n",
"# wrap the notch approximation law by a binning class, which precomputes the values\n",
"maximum_absolute_load = max(np.abs(load_sequence_list))\n",
"print(f\"maximum_absolute_load: {maximum_absolute_load}\")\n",
"extended_neuber_binned = pylife.materiallaws.notch_approximation_law.Binned(\n",
" extended_neuber, maximum_absolute_load, 100)\n",
"\n",
"# create recorder object\n",
"recorder = pylife.stress.rainflow.recorders.FKMNonlinearRecorder()\n",
"\n",
"# create detector object\n",
"detector = pylife.stress.rainflow.fkm_nonlinear.FKMNonlinearDetector(\n",
" recorder=recorder, notch_approximation_law=extended_neuber_binned)\n",
" recorder=recorder, notch_approximation_law=extended_neuber\n",
")\n",
"\n",
"# perform HCM algorithm, first run\n",
"detector.process(load_sequence_list, flush=False)\n",
Expand Down Expand Up @@ -759,18 +754,13 @@
"load_sequence_list = scaled_load_sequence\n",
"print(load_sequence_list)\n",
"\n",
"# wrap the notch approximation law by a binning class, which precomputes the values\n",
"maximum_absolute_load = max(np.abs(load_sequence_list))\n",
"print(f\"maximum_absolute_load: {maximum_absolute_load}\")\n",
"seeger_beste_binned = pylife.materiallaws.notch_approximation_law.Binned(\n",
" seeger_beste, maximum_absolute_load, 100)\n",
"\n",
"# create recorder object\n",
"recorder = pylife.stress.rainflow.recorders.FKMNonlinearRecorder()\n",
"\n",
"# create detector object\n",
"detector = pylife.stress.rainflow.fkm_nonlinear.FKMNonlinearDetector(\n",
" recorder=recorder, notch_approximation_law=seeger_beste_binned)\n",
" recorder=recorder, notch_approximation_law=seeger_beste\n",
")\n",
"\n",
"# perform HCM algorithm, first run\n",
"detector.process(load_sequence_list, flush=False)\n",
Expand Down
Loading
Loading