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.0.tar.gz (4.9 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.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

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

Hashes for cotra-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c744e4b3de61d2a79c105530f0798832b10a7381887024fa57614b207d28c2b9
MD5 fede8269fa135135f504a89445f92e93
BLAKE2b-256 aaaf6df183028d768cf8cc48531f2188130565e1cf764172a9a7d646d172580e

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotra-1.0.0.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.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

Hashes for cotra-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2faff4f40f8e616ac9ff4b92fa322557b423197113e34f749e3ef01ba125074e
MD5 5752b15fd7b6dfc040406e197fea1882
BLAKE2b-256 62ccdfb92d64f9091c2b4edf6938e1ecdb39579bdfeae3c19f410976b6c185a9

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotra-1.0.0-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