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
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion demo/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions 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 = "weac"
version = "3.1.6"
version = "3.1.7"
Comment thread
pillowbeast marked this conversation as resolved.
authors = [{ name = "2phi GbR", email = "mail@2phi.de" }]
description = "Weak layer anticrack nucleation model"
readme = "README.md"
Expand Down Expand Up @@ -126,7 +126,7 @@ ignore = [
]

[tool.bumpversion]
current_version = "3.1.6"
current_version = "3.1.7"

[[tool.bumpversion.files]]
filename = "pyproject.toml"
Expand Down
2 changes: 1 addition & 1 deletion src/weac/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
WEAC - Weak Layer Anticrack Nucleation Model
"""

__version__ = "3.1.6"
__version__ = "3.1.7"
45 changes: 35 additions & 10 deletions src/weac/analysis/criteria_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,14 +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]
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
Expand Down Expand Up @@ -441,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"
)
Expand All @@ -466,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
Expand Down Expand Up @@ -542,6 +565,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))
Comment thread
pillowbeast marked this conversation as resolved.
Comment thread
pillowbeast marked this conversation as resolved.
history.g_deltas.append(g_delta)
history.dist_maxs.append(max_dist_stress)
history.dist_mins.append(min_dist_stress)
Expand Down
7 changes: 7 additions & 0 deletions tests/analysis/test_criteria_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.