Skip to content

Commit 2a595d3

Browse files
authored
Feat/sigma-tau-extraction (#50)
Added sigma & tau to the history for analysis <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Extended analysis evaluation to track and record maximum stress and maximum shear values during each iteration cycle, providing enhanced data metrics and more detailed performance insights for comprehensive evaluation results. * **Chores** * Version bump to 3.1.7: Updated package version across all configuration files, citation metadata, and user documentation. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 parents bfa7230 + 912d984 commit 2a595d3

7 files changed

Lines changed: 48 additions & 16 deletions

File tree

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors:
88
- family-names: "Weissgraeber"
99
given-names: "Philipp"
1010
orcid: "https://orcid.org/0000-0001-8320-8672"
11-
version: 3.1.6
11+
version: 3.1.7
1212
date-released: 2021-12-30
1313
identifiers:
1414
- description: Collection of archived snapshots of all versions of WEAC

demo/demo.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"id": "695bafcb",
1414
"metadata": {},
1515
"source": [
16-
"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",
16+
"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",
1717
"\n",
1818
"```bash\n",
1919
"pip install -U weac\n",

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "weac"
7-
version = "3.1.6"
7+
version = "3.1.7"
88
authors = [{ name = "2phi GbR", email = "mail@2phi.de" }]
99
description = "Weak layer anticrack nucleation model"
1010
readme = "README.md"
@@ -126,7 +126,7 @@ ignore = [
126126
]
127127

128128
[tool.bumpversion]
129-
current_version = "3.1.6"
129+
current_version = "3.1.7"
130130

131131
[[tool.bumpversion.files]]
132132
filename = "pyproject.toml"

src/weac/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
WEAC - Weak Layer Anticrack Nucleation Model
33
"""
44

5-
__version__ = "3.1.6"
5+
__version__ = "3.1.7"

src/weac/analysis/criteria_evaluator.py

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import logging
99
import time
1010
import warnings
11-
from dataclasses import dataclass
11+
from dataclasses import dataclass, field
1212

1313
# Third party imports
1414
import numpy as np
@@ -32,14 +32,37 @@
3232

3333
@dataclass
3434
class CoupledCriterionHistory:
35-
"""Stores the history of the coupled criterion evaluation."""
35+
"""
36+
Stores the history of the coupled criterion evaluation.
37+
38+
Attributes:
39+
-----------
40+
skier_weights : list[float]
41+
Skier weights evaluated during the iteration.
42+
crack_lengths : list[float]
43+
Crack lengths evaluated during the iteration.
44+
incr_energies : list[np.ndarray]
45+
Incremental energy release rates for each evaluated state.
46+
sigma_maxs : list[float]
47+
Maximum normal stress values in kPa for each evaluated state.
48+
tau_maxs : list[float]
49+
Maximum shear stress values in kPa for each evaluated state.
50+
g_deltas : list[float]
51+
Fracture toughness envelope values for each evaluated state.
52+
dist_maxs : list[float]
53+
Maximum distances to the stress envelope for each evaluated state.
54+
dist_mins : list[float]
55+
Minimum distances to the stress envelope for each evaluated state.
56+
"""
3657

37-
skier_weights: list[float]
38-
crack_lengths: list[float]
39-
incr_energies: list[np.ndarray]
40-
g_deltas: list[float]
41-
dist_maxs: list[float]
42-
dist_mins: list[float]
58+
skier_weights: list[float] = field(default_factory=list)
59+
crack_lengths: list[float] = field(default_factory=list)
60+
incr_energies: list[np.ndarray] = field(default_factory=list)
61+
sigma_maxs: list[float] = field(default_factory=list)
62+
tau_maxs: list[float] = field(default_factory=list)
63+
g_deltas: list[float] = field(default_factory=list)
64+
dist_maxs: list[float] = field(default_factory=list)
65+
dist_mins: list[float] = field(default_factory=list)
4366

4467

4568
@dataclass
@@ -441,7 +464,7 @@ def evaluate_coupled_criterion(
441464
inc_energy[1], inc_energy[2], system.weak_layer
442465
)
443466

444-
history_data = CoupledCriterionHistory([], [], [], [], [], [])
467+
history_data = CoupledCriterionHistory()
445468
analyzer.print_call_stats(
446469
message="evaluate_coupled_criterion Call Statistics"
447470
)
@@ -466,7 +489,7 @@ def evaluate_coupled_criterion(
466489
crack_length = 1.0
467490
dist_ERR_envelope = 1000
468491
g_delta = 0
469-
history = CoupledCriterionHistory([], [], [], [], [], [])
492+
history = CoupledCriterionHistory()
470493
iteration_count = 0
471494
skier_weight = initial_critical_skier_weight * 1.005
472495
min_skier_weight = 1e-6
@@ -542,6 +565,8 @@ def evaluate_coupled_criterion(
542565
history.skier_weights.append(skier_weight)
543566
history.crack_lengths.append(crack_length)
544567
history.incr_energies.append(incr_energy)
568+
history.sigma_maxs.append(np.max(sigma_kPa))
569+
history.tau_maxs.append(np.max(tau_kPa))
545570
history.g_deltas.append(g_delta)
546571
history.dist_maxs.append(max_dist_stress)
547572
history.dist_mins.append(min_dist_stress)

tests/analysis/test_criteria_evaluator.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ def test_evaluate_coupled_criterion_full_run(self):
224224
)
225225
self.assertIsInstance(results, CoupledCriterionResult)
226226
self.assertGreater(results.critical_skier_weight, 0)
227+
self.assertIsNotNone(results.history)
228+
history = results.history
229+
assert history is not None
230+
self.assertEqual(len(history.sigma_maxs), len(history.skier_weights))
231+
self.assertGreater(len(history.sigma_maxs), 0)
232+
self.assertEqual(len(history.tau_maxs), len(history.skier_weights))
233+
self.assertGreater(len(history.tau_maxs), 0)
227234

228235
def test_evaluate_SteadyState(self):
229236
"""Test the evaluate_SteadyState method."""

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)