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.2.tar.gz (6.0 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.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cotra-1.0.2.tar.gz
  • Upload date:
  • Size: 6.0 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.2.tar.gz
Algorithm Hash digest
SHA256 d74aabeb80de4f7ac43e841610fb77f620a33638be9252e43f4479ab9458665e
MD5 02e17aee5d67b950b64c8cf7aa95a1d2
BLAKE2b-256 641ebfd352ce077ff4502051ece0522861bcdd65ed71ad785dafaf62145b758c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cotra-1.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: cotra-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 43c09de4d457cff11c04c0460876cb879a635088712a50597fe1d0ca87271c82
MD5 f60987a175c0eba35b4e629034ecfa62
BLAKE2b-256 6a4c8adf6a4cdc718f22494ea3d258bcf4e229008818c5727e194adbd88f540f

See more details on using hashes here.

Provenance

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