From 19a27629db20f05f9d05d58eac5491ac808bb0e3 Mon Sep 17 00:00:00 2001 From: Yannik Werner Date: Mon, 27 Apr 2026 16:15:22 +0200 Subject: [PATCH 1/4] Extract sigma & tau in history --- src/weac/analysis/criteria_evaluator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/weac/analysis/criteria_evaluator.py b/src/weac/analysis/criteria_evaluator.py index 5efd569..41fedc1 100644 --- a/src/weac/analysis/criteria_evaluator.py +++ b/src/weac/analysis/criteria_evaluator.py @@ -37,6 +37,8 @@ class CoupledCriterionHistory: skier_weights: list[float] crack_lengths: list[float] incr_energies: list[np.ndarray] + sigma_maxs: list[float] + tau_maxs: list[float] g_deltas: list[float] dist_maxs: list[float] dist_mins: list[float] @@ -441,7 +443,7 @@ def evaluate_coupled_criterion( inc_energy[1], inc_energy[2], system.weak_layer ) - history_data = CoupledCriterionHistory([], [], [], [], [], []) + history_data = CoupledCriterionHistory([], [], [], [], [], [], [], []) analyzer.print_call_stats( message="evaluate_coupled_criterion Call Statistics" ) @@ -466,7 +468,7 @@ def evaluate_coupled_criterion( crack_length = 1.0 dist_ERR_envelope = 1000 g_delta = 0 - history = CoupledCriterionHistory([], [], [], [], [], []) + history = CoupledCriterionHistory([], [], [], [], [], [], [], []) iteration_count = 0 skier_weight = initial_critical_skier_weight * 1.005 min_skier_weight = 1e-6 @@ -542,6 +544,8 @@ def evaluate_coupled_criterion( history.skier_weights.append(skier_weight) history.crack_lengths.append(crack_length) history.incr_energies.append(incr_energy) + history.sigma_maxs.append(np.max(sigma_kPa)) + history.tau_maxs.append(np.max(tau_kPa)) history.g_deltas.append(g_delta) history.dist_maxs.append(max_dist_stress) history.dist_mins.append(min_dist_stress) From 666ac3556b7e4197230e2c8a20374c3b2434506b Mon Sep 17 00:00:00 2001 From: Yannik Werner Date: Mon, 27 Apr 2026 16:16:28 +0200 Subject: [PATCH 2/4] updated version artifact --- uv.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uv.lock b/uv.lock index 6018cc1..e9ccaa8 100644 --- a/uv.lock +++ b/uv.lock @@ -2775,7 +2775,7 @@ wheels = [ [[package]] name = "weac" -version = "3.1.5" +version = "3.1.6" source = { editable = "." } dependencies = [ { name = "matplotlib" }, From e3d4f445ae12105de30560553bb4a401872764c7 Mon Sep 17 00:00:00 2001 From: Yannik Werner Date: Mon, 27 Apr 2026 16:16:56 +0200 Subject: [PATCH 3/4] bump version --- CITATION.cff | 2 +- demo/demo.ipynb | 2 +- pyproject.toml | 4 ++-- src/weac/__init__.py | 2 +- uv.lock | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CITATION.cff b/CITATION.cff index b2bffda..acf4819 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -8,7 +8,7 @@ authors: - family-names: "Weissgraeber" given-names: "Philipp" orcid: "https://orcid.org/0000-0001-8320-8672" -version: 3.1.6 +version: 3.1.7 date-released: 2021-12-30 identifiers: - description: Collection of archived snapshots of all versions of WEAC diff --git a/demo/demo.ipynb b/demo/demo.ipynb index 514ce6c..928a2da 100644 --- a/demo/demo.ipynb +++ b/demo/demo.ipynb @@ -13,7 +13,7 @@ "id": "695bafcb", "metadata": {}, "source": [ - "Note that instructions in this notebook refer to **release v3.1.6.** Please make sure you are running the latest version of weac using\n", + "Note that instructions in this notebook refer to **release v3.1.7.** Please make sure you are running the latest version of weac using\n", "\n", "```bash\n", "pip install -U weac\n", diff --git a/pyproject.toml b/pyproject.toml index f518071..99f87d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "weac" -version = "3.1.6" +version = "3.1.7" authors = [{ name = "2phi GbR", email = "mail@2phi.de" }] description = "Weak layer anticrack nucleation model" readme = "README.md" @@ -126,7 +126,7 @@ ignore = [ ] [tool.bumpversion] -current_version = "3.1.6" +current_version = "3.1.7" [[tool.bumpversion.files]] filename = "pyproject.toml" diff --git a/src/weac/__init__.py b/src/weac/__init__.py index 6165210..57e4195 100644 --- a/src/weac/__init__.py +++ b/src/weac/__init__.py @@ -2,4 +2,4 @@ WEAC - Weak Layer Anticrack Nucleation Model """ -__version__ = "3.1.6" +__version__ = "3.1.7" diff --git a/uv.lock b/uv.lock index e9ccaa8..465f41c 100644 --- a/uv.lock +++ b/uv.lock @@ -2775,7 +2775,7 @@ wheels = [ [[package]] name = "weac" -version = "3.1.6" +version = "3.1.7" source = { editable = "." } dependencies = [ { name = "matplotlib" }, From 912d984d2b57acea84193e5a9867009bd900f309 Mon Sep 17 00:00:00 2001 From: Yannik Werner Date: Mon, 27 Apr 2026 16:46:13 +0200 Subject: [PATCH 4/4] CodeRabbit / Copilot Comments --- src/weac/analysis/criteria_evaluator.py | 45 +++++++++++++++++------ tests/analysis/test_criteria_evaluator.py | 7 ++++ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/weac/analysis/criteria_evaluator.py b/src/weac/analysis/criteria_evaluator.py index 41fedc1..d271c17 100644 --- a/src/weac/analysis/criteria_evaluator.py +++ b/src/weac/analysis/criteria_evaluator.py @@ -8,7 +8,7 @@ import logging import time import warnings -from dataclasses import dataclass +from dataclasses import dataclass, field # Third party imports import numpy as np @@ -32,16 +32,37 @@ @dataclass class CoupledCriterionHistory: - """Stores the history of the coupled criterion evaluation.""" + """ + Stores the history of the coupled criterion evaluation. + + Attributes: + ----------- + skier_weights : list[float] + Skier weights evaluated during the iteration. + crack_lengths : list[float] + Crack lengths evaluated during the iteration. + incr_energies : list[np.ndarray] + Incremental energy release rates for each evaluated state. + sigma_maxs : list[float] + Maximum normal stress values in kPa for each evaluated state. + tau_maxs : list[float] + Maximum shear stress values in kPa for each evaluated state. + g_deltas : list[float] + Fracture toughness envelope values for each evaluated state. + dist_maxs : list[float] + Maximum distances to the stress envelope for each evaluated state. + dist_mins : list[float] + Minimum distances to the stress envelope for each evaluated state. + """ - skier_weights: list[float] - crack_lengths: list[float] - incr_energies: list[np.ndarray] - sigma_maxs: list[float] - tau_maxs: list[float] - g_deltas: list[float] - dist_maxs: list[float] - dist_mins: list[float] + skier_weights: list[float] = field(default_factory=list) + crack_lengths: list[float] = field(default_factory=list) + incr_energies: list[np.ndarray] = field(default_factory=list) + sigma_maxs: list[float] = field(default_factory=list) + tau_maxs: list[float] = field(default_factory=list) + g_deltas: list[float] = field(default_factory=list) + dist_maxs: list[float] = field(default_factory=list) + dist_mins: list[float] = field(default_factory=list) @dataclass @@ -443,7 +464,7 @@ def evaluate_coupled_criterion( inc_energy[1], inc_energy[2], system.weak_layer ) - history_data = CoupledCriterionHistory([], [], [], [], [], [], [], []) + history_data = CoupledCriterionHistory() analyzer.print_call_stats( message="evaluate_coupled_criterion Call Statistics" ) @@ -468,7 +489,7 @@ def evaluate_coupled_criterion( crack_length = 1.0 dist_ERR_envelope = 1000 g_delta = 0 - history = CoupledCriterionHistory([], [], [], [], [], [], [], []) + history = CoupledCriterionHistory() iteration_count = 0 skier_weight = initial_critical_skier_weight * 1.005 min_skier_weight = 1e-6 diff --git a/tests/analysis/test_criteria_evaluator.py b/tests/analysis/test_criteria_evaluator.py index e7355f5..d0b5dd9 100644 --- a/tests/analysis/test_criteria_evaluator.py +++ b/tests/analysis/test_criteria_evaluator.py @@ -224,6 +224,13 @@ def test_evaluate_coupled_criterion_full_run(self): ) self.assertIsInstance(results, CoupledCriterionResult) self.assertGreater(results.critical_skier_weight, 0) + self.assertIsNotNone(results.history) + history = results.history + assert history is not None + self.assertEqual(len(history.sigma_maxs), len(history.skier_weights)) + self.assertGreater(len(history.sigma_maxs), 0) + self.assertEqual(len(history.tau_maxs), len(history.skier_weights)) + self.assertGreater(len(history.tau_maxs), 0) def test_evaluate_SteadyState(self): """Test the evaluate_SteadyState method."""