Skip to main content

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 .npz files 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 array
  • C_full: concentration over space and time
  • Grid_Space: discretized spatial domain
  • Domain_Length: total domain length
  • Source_Intensity: intensity of the contaminant source

These files are used for further plotting, animation, and exporting data.

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

cotra-1.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

cotra-1.0.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file cotra-1.0.1.tar.gz.

File metadata

  • Download URL: cotra-1.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cotra-1.0.1.tar.gz
Algorithm Hash digest
SHA256 00cb87403dfee2fa38c7c84edc49d74da2741f1a25e6222af6f3b0a754f3626f
MD5 6931ca2d212d6ecf720a925d3d3036c6
BLAKE2b-256 8b8383304ee3c421dc3affd4c0d66178aa25246a7a3a783925424e6baba4e2a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotra-1.0.1.tar.gz:

Publisher: python-publish.yml on simo-pagliu/COTRA

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

File details

Details for the file cotra-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: cotra-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for cotra-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 949966a0f7d9366631ef673bed43d6935f7b825de6212434252b9ab413acd8fc
MD5 40fc9af3868377885a0f2a937430657d
BLAKE2b-256 a17f248f04fe0e472bf91af22d88cdeab14029a573db75b2f0e8c0a82e64e1ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotra-1.0.1-py3-none-any.whl:

Publisher: python-publish.yml on simo-pagliu/COTRA

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