Transport of contaminants in 1D groundwater flow system
Project description
| Testing of source code | |
| Testing of examples | |
| Package | |
Overview
gwtransport1d is a Python package for modeling the transport of temperature and contaminants in groundwater flow systems. It provides practical tools for analyzing advection, diffusion, deposition processes, and calculating residence time distributions in aquifer systems.
Aquifer Pore Volume Distribution
The aquifer pore volume distribution is a probability density curve that holds the fraction of flow that passes a certain pore volume between infiltration and extraction. This package relies on the estimating this distribution and uses it to compute many different transport processes related to residence time. In the examples here, the aquifer pore volume distribution is approximated by a Gamma distribution of which the two parameters are estimated from the flow rate, the temperature of the infiltration and extracted water. Alternatively, you can derive the aquifer pore volume distribution from the streamlines of your groundwater model. In all examples the assumption is made that the aquifer pore volume distribution is constant over time.
Calibration of the aquifer pore volume distribution (Example 1)
An practical approach to calibrate the two parameters of the Gamma distribution is to use the temperature response of the aquifer. This requires the following measurements over a limited time period:
- Infiltration and extraction temperature,
- Extraction rate or a quantity that is proportional to the extraction rate, such as the head gradient.
See: Example 1.
Examples that make use of the aquifer pore volume distribution
The aquifer pore volume distribution can be used to compute:
- Contaminent transport with different retardation factors
- The residence time
- Log-removal of pathogens
Installation
pip install gwtransport1d
Usage Examples
Example 1: Estimate Aquifer Pore Volume from Temperature Response
This example demonstrates how to use temperature data to estimate the aquifer pore volume distribution:
from scipy.optimize import curve_fit
from gwtransport1d import advection
# Load your temperature and flow data
# ...
# Define objective function for curve fitting
def objective(time, mean, std):
cout = advection.gamma_forward(
cin=temperature_data,
flow=flow_data,
mean=mean,
std=std,
n_bins=200,
retardation_factor=2.0
)
return cout.values
# Perform curve fitting
(apv_gamma_mean, apv_gamma_std), pcov = curve_fit(
objective,
temperature_data.index,
extracted_temperature_data,
p0=(7000.0, 500.0),
)
# Print the fitted parameters
print(
f"Fitted Gamma distribution for the aquifer pore volume has a mean of: {apv_gamma_mean:.1f} m³ and ",
f"a standard deviation of: {apv_gamma_std:.1f} m³")
Example 2: Estimate Residence Time Distribution
Once you've characterized your aquifer, you can calculate residence time distributions:
import pandas as pd
from gwtransport1d import advection, gamma
# Set up your parameters
mean = 8000.0 # m3
std = 400.0 # m3
retardation_factor = 1.0
flow_data = pd.Series(...) # Your flow data
# Calculate residence time
alpha, beta = gamma.mean_std_to_alpha_beta(mean, std)
bins = gamma.bins(alpha, beta, n_bins=1000)
# Calculate forward residence time (infiltration to extraction)
rt_forward = advection.residence_time(
flow_data,
bins["expected_value"],
retardation_factor=1.0,
direction="infiltration"
)
Example 3: Log Removal of Pathogens
Calculate the log removal of pathogens based on residence time:
import numpy as np
from gwtransport1d import logremoval
# Calculate log-removal of the extracted water
rt_alpha = 2.0 # Shape parameter of the gamma distribution for the residence time
rt_beta = 10.0 # Scale parameter of the gamma distribution for the residence time
log_removal_rate = 0.5 # Log-removal rate [1/day]
mean_removal = logremoval.gamma_mean(rt_alpha, rt_beta, log_removal_rate)
print(f"Mean log removal: {mean_removal:.2f}")
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the GNU Affero General Public License v3.0 - see the LICENSE file for details.
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 gwtransport1d-0.8.0.tar.gz.
File metadata
- Download URL: gwtransport1d-0.8.0.tar.gz
- Upload date:
- Size: 65.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a7d47483b9d6841db4bc71ed032a9f156f237b0dce95f14389d4634b93aa944
|
|
| MD5 |
247a58c9f84c82409d55f0b8a3e65d4e
|
|
| BLAKE2b-256 |
5b254ef7a54af6d8ee2c09ecd4786a73ad31b0b33827ce58fab1557f1b73d36b
|
Provenance
The following attestation bundles were made for gwtransport1d-0.8.0.tar.gz:
Publisher:
release.yml on bdestombe/python-gwtransport1d
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gwtransport1d-0.8.0.tar.gz -
Subject digest:
7a7d47483b9d6841db4bc71ed032a9f156f237b0dce95f14389d4634b93aa944 - Sigstore transparency entry: 211360695
- Sigstore integration time:
-
Permalink:
bdestombe/python-gwtransport1d@120c16c99ea42e00d4b882f4f769dcc6516017a0 -
Branch / Tag:
refs/tags/0.8.0 - Owner: https://github.com/bdestombe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@120c16c99ea42e00d4b882f4f769dcc6516017a0 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gwtransport1d-0.8.0-py3-none-any.whl.
File metadata
- Download URL: gwtransport1d-0.8.0-py3-none-any.whl
- Upload date:
- Size: 46.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
778bb331ec3e97bb46e2f25a9974e86304fd6ad493992c69228954c8c6f5d005
|
|
| MD5 |
469ac16e46872c3c40bec70718798a3f
|
|
| BLAKE2b-256 |
cac7ddde65c3510ac4aa0a2e6a80164125b8c6f030828eb45fba95a80fd03010
|
Provenance
The following attestation bundles were made for gwtransport1d-0.8.0-py3-none-any.whl:
Publisher:
release.yml on bdestombe/python-gwtransport1d
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gwtransport1d-0.8.0-py3-none-any.whl -
Subject digest:
778bb331ec3e97bb46e2f25a9974e86304fd6ad493992c69228954c8c6f5d005 - Sigstore transparency entry: 211360697
- Sigstore integration time:
-
Permalink:
bdestombe/python-gwtransport1d@120c16c99ea42e00d4b882f4f769dcc6516017a0 -
Branch / Tag:
refs/tags/0.8.0 - Owner: https://github.com/bdestombe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@120c16c99ea42e00d4b882f4f769dcc6516017a0 -
Trigger Event:
push
-
Statement type: