A simple 1D contaminant transport simulation library
Project description
COntaminant TRAnsport code (COTRA)
This code is developed for academic purposes.
It numerically solves the Adsorption-Dispersion Equation in one dimension (1D).
Installation
You can install the package by:
pip install COTRA
Functions
Examples
You can find a complete example of all the features in the showcase.py file.
List of functions
-
COTRA.run(Hydro_Dispersion, pore_velocity, porosity, bulk_density, Source_Time, Source_Intensity, Domain_Length, dx, Time_Span, dt, retardation, k_1, k_2)
Solves the 1D Adsorption-Dispersion equation and saves the output as.npzfiles automatically. -
COTRA.CvS(files, *comments)
Interactive plot of concentration profiles vs space at different times using a slider. -
COTRA.CvT(files, *comments)
Interactive plot of concentration vs time at different positions using a slider. -
COTRA.animate(file_name)
Creates an animation of the concentration profile evolving over time. -
COTRA.save_profile(file_name, point, domain='space')
Exports the concentration profile either over time at a given space point or over space at a given time point, saving it into a CSV file.
Equation
The code solves the following coupled system:
$$ \frac{dC}{dt} = \frac{-v_p \frac{dC}{dx} + D \frac{d^2C}{dx^2} - S}{R} $$
$$ \rho \frac{ds}{dt} = \dot{a} n C - \dot{d} \rho s $$
Where:
- $C$= concentration in the fluid [g/L]
- $s$= sorbed concentration [g/kg]
- $v_p$= pore velocity [m/s]
- $D$= hydrodynamic dispersion coefficient [m²/s]
- $S$= source term
- $R$= retardation factor
- $n$= porosity [-]
- $\rho$= bulk density [kg/L]
- $\dot{a}$= adsorption rate
- $\dot{d}$= desorption rate
The adsorption rate can be defined with two models:
- Freundlich Model:
$\dot{a} = k_1 \left( \dot{d} \frac{\rho}{n} \right) C^{\left( k_2 - 1\right)}$ - Linear Model:
$\dot{a} = k_1 \left( \dot{d} \frac{\rho}{n} \right)$
Output
The solver automatically saves results in .npz format containing:
t_full: full time arrayC_full: concentration over space and timeGrid_Space: discretized spatial domainDomain_Length: total domain lengthSource_Intensity: intensity of the contaminant source
These files are used for further plotting, animation, and exporting data.
Project details
Release history Release notifications | RSS feed
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 cotra-1.0.0.tar.gz.
File metadata
- Download URL: cotra-1.0.0.tar.gz
- Upload date:
- Size: 4.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 |
c744e4b3de61d2a79c105530f0798832b10a7381887024fa57614b207d28c2b9
|
|
| MD5 |
fede8269fa135135f504a89445f92e93
|
|
| BLAKE2b-256 |
aaaf6df183028d768cf8cc48531f2188130565e1cf764172a9a7d646d172580e
|
Provenance
The following attestation bundles were made for cotra-1.0.0.tar.gz:
Publisher:
python-publish.yml on simo-pagliu/COTRA
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cotra-1.0.0.tar.gz -
Subject digest:
c744e4b3de61d2a79c105530f0798832b10a7381887024fa57614b207d28c2b9 - Sigstore transparency entry: 204625816
- Sigstore integration time:
-
Permalink:
simo-pagliu/COTRA@02ce3ddb7f24153447f23d1f6bd11b6a60e86aa7 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/simo-pagliu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@02ce3ddb7f24153447f23d1f6bd11b6a60e86aa7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cotra-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cotra-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.9 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 |
2faff4f40f8e616ac9ff4b92fa322557b423197113e34f749e3ef01ba125074e
|
|
| MD5 |
5752b15fd7b6dfc040406e197fea1882
|
|
| BLAKE2b-256 |
62ccdfb92d64f9091c2b4edf6938e1ecdb39579bdfeae3c19f410976b6c185a9
|
Provenance
The following attestation bundles were made for cotra-1.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on simo-pagliu/COTRA
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cotra-1.0.0-py3-none-any.whl -
Subject digest:
2faff4f40f8e616ac9ff4b92fa322557b423197113e34f749e3ef01ba125074e - Sigstore transparency entry: 204625817
- Sigstore integration time:
-
Permalink:
simo-pagliu/COTRA@02ce3ddb7f24153447f23d1f6bd11b6a60e86aa7 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/simo-pagliu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@02ce3ddb7f24153447f23d1f6bd11b6a60e86aa7 -
Trigger Event:
release
-
Statement type: