Lightweight post-processing for TELEMAC simulations: flux extraction and convergence analysis outside the TELEMAC Python environment.
Project description
pythomac
Lightweight post-processing for TELEMAC simulations:
extract the volume and boundary-flux printouts from a .sortie listing, quantify
the boundary-flux convergence of steady runs, and identify the optimum simulation
length - all outside the TELEMAC Python environment (only numpy, pandas, and
matplotlib are required).
Installation
pip install pythomac
Requires Python >= 3.9. The analyzed simulation must have run with the -s flag
(telemac2d.py steady2d.cas -s) and the steering file must contain
PRINTING CUMULATED FLOWRATES : YES.
Quickstart
from pythomac import extract_fluxes, calculate_convergence, get_convergence_time
fluxes_df = extract_fluxes(model_directory="/path/to/simulation",
cas_name="steady2d.cas", plotting=True)
iota_t = calculate_convergence(fluxes_df["Fluxes Boundary 1"][1:],
fluxes_df["Fluxes Boundary 2"][1:],
cas_timestep=50, plot_dir="/path/to/simulation")
idx = get_convergence_time(iota_t["Relative imbalance"], convergence_precision=1e-4)
This writes extracted-fluxes.csv + flux-convergence.png (the per-boundary
fluxes) and convergence-rate.png (the relative flux imbalance and its
convergence rate) into the simulation directory, and returns the printout index
from which the imbalance stays permanently below the tolerance. A worked example
lives in example_flux_convergence.py (with example-simulation/).
Read the full tutorial at https://hydro-informatics.com/numerics/telemac/convergence.html and the API documentation at https://pythomac.readthedocs.io.
Changelog
3.0.0
- Proper package structure: absolute in-package imports; the
sys.pathmanipulation at import time and theos.chdirside effect inextract_fluxes()are gone (the caller's working directory is never touched). - Parses the TELEMAC v9 listing format (
NUMBER OF LIQUID BOUNDARIES:with a colon), which previously yielded an empty flux table. - Runtime dependencies are declared in
pyproject.tomlwith modern floors (numpy>=1.24,pandas>=2.0,matplotlib>=3.7); Python >= 3.9. - Test suite (
pytest) and GitHub workflows for CI and PyPI publishing (Trusted Publishing). - Breaking:
from parser_output import .../from utils... import ...no longer work from copied folders - use the package imports (from pythomac import ...); Python 3.7/3.8 are no longer supported.
2.0.0 - convergence-formula correction; calculate_convergence returns the
relative imbalance alongside the rate; convergence plot improvements.
License
GPL-3.0 - see LICENSE. Parts of pythomac/parser_output.py and
pythomac/utils/ are adapted from the TELEMAC-MASCARET scripts (GPL v3).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pythomac-3.0.0.tar.gz.
File metadata
- Download URL: pythomac-3.0.0.tar.gz
- Upload date:
- Size: 39.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d542c533cb1bf7f02cfe525e586c95c76c417c5ad2e10684206ab5120488f7a
|
|
| MD5 |
3ed42ea45ce1c8a0466dc4401be5e879
|
|
| BLAKE2b-256 |
a811d76a8b61955729155e6fd76825f01231f4528442cd20e7c9b190dae05517
|
Provenance
The following attestation bundles were made for pythomac-3.0.0.tar.gz:
Publisher:
publish-pypi.yml on hydro-informatics/pythomac
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pythomac-3.0.0.tar.gz -
Subject digest:
5d542c533cb1bf7f02cfe525e586c95c76c417c5ad2e10684206ab5120488f7a - Sigstore transparency entry: 2056433406
- Sigstore integration time:
-
Permalink:
hydro-informatics/pythomac@524f2b21268d6f6b0c2b70b158444cbeaead980d -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/hydro-informatics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@524f2b21268d6f6b0c2b70b158444cbeaead980d -
Trigger Event:
release
-
Statement type:
File details
Details for the file pythomac-3.0.0-py3-none-any.whl.
File metadata
- Download URL: pythomac-3.0.0-py3-none-any.whl
- Upload date:
- Size: 38.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
275d63b409a59dc4726c51fadbe09431dd76e1493cb364b58219fd6c074f384c
|
|
| MD5 |
21037a67296ea87c9e1aafde67f76bdf
|
|
| BLAKE2b-256 |
ab3eb6e86413ad861d589f93a118966b383feccb857595ac5ce680801c8c5610
|
Provenance
The following attestation bundles were made for pythomac-3.0.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on hydro-informatics/pythomac
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pythomac-3.0.0-py3-none-any.whl -
Subject digest:
275d63b409a59dc4726c51fadbe09431dd76e1493cb364b58219fd6c074f384c - Sigstore transparency entry: 2056433587
- Sigstore integration time:
-
Permalink:
hydro-informatics/pythomac@524f2b21268d6f6b0c2b70b158444cbeaead980d -
Branch / Tag:
refs/tags/v3.0.0 - Owner: https://github.com/hydro-informatics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@524f2b21268d6f6b0c2b70b158444cbeaead980d -
Trigger Event:
release
-
Statement type: