Skip to main content

Lightweight post-processing for TELEMAC simulations: flux extraction and convergence analysis outside the TELEMAC Python environment.

Project description

pythomac

PyPI Docs

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.path manipulation at import time and the os.chdir side effect in extract_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.toml with 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

pythomac-3.0.0.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythomac-3.0.0-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

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

Hashes for pythomac-3.0.0.tar.gz
Algorithm Hash digest
SHA256 5d542c533cb1bf7f02cfe525e586c95c76c417c5ad2e10684206ab5120488f7a
MD5 3ed42ea45ce1c8a0466dc4401be5e879
BLAKE2b-256 a811d76a8b61955729155e6fd76825f01231f4528442cd20e7c9b190dae05517

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythomac-3.0.0.tar.gz:

Publisher: publish-pypi.yml on hydro-informatics/pythomac

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pythomac-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 275d63b409a59dc4726c51fadbe09431dd76e1493cb364b58219fd6c074f384c
MD5 21037a67296ea87c9e1aafde67f76bdf
BLAKE2b-256 ab3eb6e86413ad861d589f93a118966b383feccb857595ac5ce680801c8c5610

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythomac-3.0.0-py3-none-any.whl:

Publisher: publish-pypi.yml on hydro-informatics/pythomac

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page