wave-attenuation-1d: Simple 1D Wave Attenuation Model for Coastal Vegetation
A fast numerical solver for simulating wave attenuation through coastal vegetation, solving the linearized shallow water equations with vegetation-induced drag.
Overview
This package models how coastal vegetation (e.g., mangroves, salt marshes) reduces wave energy, providing a nature-based solution for coastal protection. The model uses high-order numerical methods with Numba acceleration for efficient computation.
Mathematical Model
The solver implements the 1D linearized shallow water equations with vegetation drag:
$\frac{\partial \eta}{\partial t} + h\frac{\partial u}{\partial x} = 0$
$\frac{\partial u}{\partial t} + g\frac{\partial \eta}{\partial x} = -c_D \chi_{\text{veg}}(x) u$
where:
- $\eta(x,t)$ - free surface elevation [m]
- $u(x,t)$ - depth-averaged velocity [m/s]
- $h$ - water depth [m]
- $g$ - gravitational acceleration (9.81 m/s²)
- $c_D$ - linearized drag coefficient [1/s]
- $\chi_{\text{veg}}(x)$ - vegetation indicator function
Installation
pip install wave-attenuation-1d
Requirements
- Python ≥ 3.8
- NumPy ≥ 1.20.0
- Numba ≥ 0.54.0
- netCDF4 ≥ 1.5.0
- tqdm ≥ 4.62.0
Quick Start
# Run with example configuration
wave-attenuation-1d configs/sparse_config.txt
# Run with custom config
wave-attenuation-1d my_config.txt
# Check version
wave-attenuation-1d --version
Features
- 4th-order Runge-Kutta time integration with implicit drag treatment
- Numba JIT compilation for ~100x speedup over pure Python
- NetCDF output with CF-1.8 compliant metadata
- Automatic transmission coefficient calculation
- Configurable vegetation patches with varying drag coefficients
Configuration
Create a text configuration file:
[DOMAIN]
L = 200.0 # Domain length [m]
d = 2.0 # Water depth [m]
dx = 0.5 # Grid spacing [m]
T = 500.0 # Simulation time [s]
[WAVE]
A = 0.3 # Wave amplitude [m]
omega = 0.628 # Angular frequency [rad/s]
[VEGETATION]
start = 80.0 # Vegetation start [m]
end = 120.0 # Vegetation end [m]
cD = 0.14 # Drag coefficient [1/s]
[NUMERICAL]
cfl_target = 0.4 # Target CFL number
output_dt = 1.0 # Output interval [s]
Output Format
Results are saved as NetCDF files containing:
- Time series of surface elevation and velocity
- Wave envelope and RMS velocity
- Metadata including all parameters and transmission coefficients
Numerical Methods
- Spatial discretization: 2nd-order centered differences
- Time integration: 4th-order Runge-Kutta (RK4)
- Drag treatment: Implicit scheme for unconditional stability
- Boundary conditions:
- Left: Sinusoidal wave generation
- Right: Sommerfeld radiation condition
Citation
If you use this model in your research, please cite:
@software{herho2025wave,
author = {Herho, Sandy H. S. and Anwar, Iwan P. and Ndruru, Theo R. E. B. N.
and Suwarman, Rusmawan and Irawan, Dasapta E.},
title = {{wave-attenuation-1d: Simple 1D Wave Attenuation Model for Coastal Vegetation}},
year = {2025},
url = {https://github.com/sandyherho/wave_attenuation_1d}
}
Authors
- Sandy H. S. Herho (sandy.herho@email.ucr.edu)
- Iwan P. Anwar
- Faruq Khadami
- Theo R. E. B. N. Ndruru
- Rusmawan Suwarman
- Dasapta E. Irawan
License
MIT License - see LICENSE file for details.
Metadata
Release files for wave-attenuation-1d 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wave_attenuation_1d-0.1.5.tar.gz | 13.4 kB | Without provenance | Details for wave_attenuation_1d-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wave_attenuation_1d-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for wave_attenuation_1d-0.1.5-py3-none-any.whl |
Total release size: 27.2 kB
Release files / wave_attenuation_1d-0.1.5.tar.gz
| Download URL | wave_attenuation_1d-0.1.5.tar.gz |
|---|---|
| Size | 13.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a741c0b64012f7fc605572fb5a1ca567d33238abb948f72da705b6537d4afb4
|
|
BLAKE2b-256 checksum How to use checksums |
ec887210c85bb6bbf4b7f9f2cd6a83baa8e4abf41f9f6ad824251f0dccaeab19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64
|
Release files / wave_attenuation_1d-0.1.5-py3-none-any.whl
| Download URL | wave_attenuation_1d-0.1.5-py3-none-any.whl |
|---|---|
| Size | 13.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a47c294ffe0a03c312fc6d672478b64cd756988f44b7af492fbc191212c1e8e2
|
|
BLAKE2b-256 checksum How to use checksums |
ccb751b736dbcaf174e32fff71579fd4f525dd259c3c4a28c186117aa3654b8f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.2 Linux/6.11.9-100.fc39.x86_64
|
Security for wave-attenuation-1d 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.