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
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
version: "latest"

- name: Install dependencies
run: uv sync
run: uv sync --extra dev

- name: Run tests
run: uv run python tests/run_tests.py
run: uv run pytest
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ old*

.weac-reference/

# Folder for development and local testing
dev/
# Folders for development and local testing
dev/
todo/
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- markdownlint-disable MD033 MD009 MD053 -->
<!-- LOGO AND TITLE-->
<!-- <p align="right"><img src="https://github.com/2phi/weac/raw/main/img/logo.png" alt="Logo" width="80" height="80"></p> -->


<h1 align="center">
<br>
<img src="https://github.com/2phi/weac/raw/main/img/logo.png" alt="WEAC" width="120">
Expand Down Expand Up @@ -84,18 +84,19 @@ WEAC implements closed-form analytical models for the [mechanical analysis of dr
<img src="https://github.com/2phi/weac/raw/main/img/systems.png" alt="Systems" width="500"/>

Cite the repository as:
```

```text
Rosendahl, P. L., Schneider, J., & Weissgraeber, P. (2022). Weak Layer Anticrack Nucleation Model (WEAC). Zenodo. https://doi.org/10.5281/zenodo.5773113
```

Read the [📄 white paper](https://doi.org/10.5194/tc-17-1475-2023) for model derivations, illustrations, dimensions, material properties, and kinematics:

- Weißgraeber, P. & Rosendahl, P. L. (2023). A closed-form model for layered snow slabs. The Cryosphere, 17(4), 1475–1496. https://doi.org/10.5194/tc-17-1475-2023
- Weißgraeber, P. & Rosendahl, P. L. (2023). A closed-form model for layered snow slabs. The Cryosphere, 17(4), 1475–1496. <https://doi.org/10.5194/tc-17-1475-2023>

For more background info, please refer to the companion papers:

- Rosendahl, P. L. & Weißgraeber, P. (2020). Modeling snow slab avalanches caused by weak-layer failure – Part 1: Slabs on compliant and collapsible weak layers. The Cryosphere, 14(1), 115–130. https://doi.org/10.5194/tc-14-115-2020
- Rosendahl, P. L. & Weißgraeber, P. (2020). Modeling snow slab avalanches caused by weak-layer failure – Part 2: Coupled mixed-mode criterion for skier-triggered anticracks. The Cryosphere, 14(1), 131–145. https://doi.org/10.5194/tc-14-131-2020
- Rosendahl, P. L. & Weißgraeber, P. (2020). Modeling snow slab avalanches caused by weak-layer failure – Part 1: Slabs on compliant and collapsible weak layers. The Cryosphere, 14(1), 115–130. <https://doi.org/10.5194/tc-14-115-2020>
- Rosendahl, P. L. & Weißgraeber, P. (2020). Modeling snow slab avalanches caused by weak-layer failure – Part 2: Coupled mixed-mode criterion for skier-triggered anticracks. The Cryosphere, 14(1), 131–145. <https://doi.org/10.5194/tc-14-131-2020>

Written in [🐍 Python](https://www.python.org) and built with [💻 Visual Studio Code](https://code.visualstudio.com), [🐙 GitKraken](https://www.gitkraken.com), and [🪐 Jupyter](https://jupyter.org). Note that [release v1.0](https://github.com/2phi/weac/releases/tag/v1.0.0) was written and built in [🌋 MATLAB](https://www.mathworks.com/products/matlab.html).

Expand All @@ -105,19 +106,21 @@ Written in [🐍 Python](https://www.python.org) and built with [💻 Visual Stu
[![Atom](https://img.shields.io/badge/Atom-498b60.svg?style=flat-square&logo=atom&logoColor=white&label&labelColor=gray)](https://atom.io)
[![GitKraken](https://img.shields.io/badge/GitKraken-179287.svg?style=flat-square&logo=gitkraken&logoColor=white&label&labelColor=gray)](https://www.gitkraken.com) -->



<!-- INSTALLATION -->
## Installation

Install globally using the `pip` Package Installer for Python

```sh
pip install -U weac
```

or clone the repo

```sh
git clone https://github.com/2phi/weac
```

for local use.

Needs (runtime dependencies are declared in [pyproject.toml](https://github.com/2phi/weac/blob/main/pyproject.toml)):
Expand All @@ -129,7 +132,6 @@ Needs (runtime dependencies are declared in [pyproject.toml](https://github.com/
- [Pydantic](https://docs.pydantic.dev/latest/) ≥ 2.11.7
- [Snowpylot](https://github.com/connellymk/snowpylot) ≥ 1.1.3


<!-- DEVELOPMENT SETUP -->
## Development Setup

Expand Down Expand Up @@ -173,10 +175,6 @@ source .venv/bin/activate # On Windows: .venv\Scripts\activate
Run the test suite using uv:

```bash
# Run all tests
uv run python tests/run_tests.py

# Or use pytest directly (if installed)
uv run pytest
```

Expand Down Expand Up @@ -387,6 +385,12 @@ See the [open issues](https://github.com/2phi/weac/issues) for a list of propose

## Release history

### v3.2

- Split `Layer` and `WeakLayer` into separate component models
- Weak-layer Young's modulus from Schöttner FC&DH density law (`E_method="schottner_fc_dh"`)
- Lowered weak-layer preset densities to 100/150/200 kg/m³ (within the Schöttner ≤250 kg/m³ range)

### v3.0

- Refactored the codebase for improved structure and maintainability
Expand Down Expand Up @@ -468,6 +472,7 @@ See the [open issues](https://github.com/2phi/weac/issues) for a list of propose

<!-- WORKFLOWS -->
## Workflows

[![Publish Python 🐍 releases 📦 to PyPI ](https://github.com/2phi/weac/actions/workflows/release.yml/badge.svg)](https://github.com/2phi/weac/actions/workflows/release.yml)<br>
[![Build and publish Sphinx 🪬 documentation ](https://github.com/2phi/weac/actions/workflows/docs.yml/badge.svg)](https://github.com/2phi/weac/actions/workflows/docs.yml)

Expand All @@ -489,14 +494,10 @@ Under the following terms:

- **ShareAlike** — If you remix, transform, or build upon the material, you must distribute your contributions under the [same license](https://creativecommons.org/licenses/by-nc-sa/4.0/?ref=chooser-v1#ref-same-license) as the original.



<!-- CONTACT -->
## Contact

E-mail: mail@2phi.de · Web: https://2phi.de · Project Link: [https://github.com/2phi/weac](https://github.com/2phi/weac) · Project DOI: [http://dx.doi.org/10.5281/zenodo.5773113](http://dx.doi.org/10.5281/zenodo.5773113)


E-mail: <mail@2phi.de> · Web: <https://2phi.de> · Project Link: [https://github.com/2phi/weac](https://github.com/2phi/weac) · Project DOI: [http://dx.doi.org/10.5281/zenodo.5773113](http://dx.doi.org/10.5281/zenodo.5773113)

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
Expand Down Expand Up @@ -528,4 +529,4 @@ E-mail: mail@2phi.de · Web: https://2phi.de · Project Link: [https://github.co
[pypi-url]: https://pypi.org/project/weac/
[release-url]: https://github.com/2phi/weac/releases
[weac-url]: https://github.com/2phi/weac/
[doi-url]: https://zenodo.org/badge/latestdoi/203163531
[doi-url]: https://zenodo.org/badge/latestdoi/203163531
14 changes: 11 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@

## Minor

- [ ] Swap to Pytest from Unittest
- [ ] resolve fracture criterion also when lower than strength criterion
- [ ] Free-end coupled criterion for finite lab specimens (e.g. 1 m slab): `CriteriaEvaluator` currently requires `system_type="skier"` with infinite-end BCs; support free-end (PST-style) mid-load CC without approximating ends as infinite
- [ ] Per-segment effective out-of-plane load length `l_eff` [mm] on `Segment`
- Needed for: converting a point mass `m` [kg] into the unit-width line-load jump used by the solver when the load does not span the global default ski length. Today `get_skier_point_load` and `Scenario._setup_scenario` always divide by `constants.LSKI_MM` (1000 mm), so short skis, long skis, or a narrow out-of-plane contact (e.g. a cube’s depth) cannot be represented correctly—especially when sample width `b` differs from 1000 mm.
- Formula: `F [N/mm] = 1e-3 * m * G_MM_S2 / l_eff` (same as today with `l_eff = LSKI_MM`). Smaller `l_eff` → larger intensity for the same mass.
- Requires:
- Add optional `Segment.l_eff: float` (default `LSKI_MM`) applying to the mass at that segment’s right edge (`m`).
- Thread `l_eff` through `get_skier_point_load(m, l_eff=…)` (or replace it), `Scenario.fi` assembly, and both `UnknownConstantsSolver` / `GeneralizedUnknownConstantsSolver` so no path still hardcodes `LSKI_MM`.
- Keep backward compatibility: omit/`None` → `LSKI_MM`; existing skier/CC tests unchanged.
- Document interaction with slab width `b`: `l_eff` is the out-of-plane contact extent of *this* load; clipping to `min(l_eff, b)` may be needed when the object is wider than the specimen.
- Unit tests: same `m`, two `l_eff` values → interface load scales as `1/l_eff`; default `l_eff` matches legacy `LSKI_MM` results.
- Out of scope for this item: finite along-slope contact length (patch/`qs`); full `AppliedLoad` objects; tilted-cube contact modes.
- [ ] Florian CriterionEvaluator: clarify and fix damping behavior (find_minimum_force / evaluate_coupled_criterion)
- Expected behavior
- find_minimum_force: compute the critical skier weight w* [kg] such that max(stress_envelope) == 1 within tolerance_stress. This solver should not apply damping; it must return the numerically precise root of residual(weight) = max(stress_envelope) - 1 using a bracketed method and finite tolerances.
Expand Down Expand Up @@ -133,7 +142,6 @@
- [ ] Make rasterize_solution smarter (iterative convergence)
- [ ] SNOWPACK Parser
- [ ] SMP Parser
- [ ] Build Tests: Integration -> Pure

## Patch

Expand Down
1 change: 1 addition & 0 deletions docs/sphinx/weac.components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Submodules
weac.components.model_input
weac.components.scenario_config
weac.components.segment
weac.components.weak_layer

Module contents
---------------
Expand Down
7 changes: 7 additions & 0 deletions docs/sphinx/weac.components.weak_layer.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
weac.components.weak_layer module
=================================

.. automodule:: weac.components.weak_layer
:members:
:show-inheritance:
:undoc-members:
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ dev = [
"black>=24.4.0",
"isort>=5.13.0",

# Testing
"pytest>=8",

# Versioning helper matching [tool.bumpversion]
"bump-my-version", # e.g. bump-my-version bump patch
]
Expand All @@ -85,6 +88,9 @@ where = ["src"]
# [tool.uv.sources]
# snowpylot = { path = "../snowpylot", editable = true }

[tool.pytest.ini_options]
testpaths = ["tests"]

[tool.ruff.lint]
ignore = ["E741"]

Expand Down
2 changes: 1 addition & 1 deletion src/weac/analysis/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
)

# Module imports
from weac.components.layer import WeakLayer
from weac.components.weak_layer import WeakLayer
from weac.core.scenario import Scenario
from weac.core.slab import Slab
from weac.core.system_model import SystemModel
Expand Down
3 changes: 2 additions & 1 deletion src/weac/components/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from .config import Config
from .criteria_config import CriteriaConfig
from .layer import Layer, WeakLayer
from .layer import Layer
from .model_input import ModelInput
from .presets import (
LESS_WEAK_LAYER,
Expand All @@ -15,6 +15,7 @@
)
from .scenario_config import ScenarioConfig, SystemType, TouchdownMode
from .segment import Segment
from .weak_layer import WeakLayer

__all__ = [
"Config",
Expand Down
Loading