Collection of tools for computation of flows and and fluxes on Kirchhoff circuits.
Project description
hailhydro
A module for computation of Hagen-Poiseuille flows and Advection-Diffusion+Absorption landscapes on Kirchhoff networks. For further documentation see: https://felixk1990.github.io/kirchhoff-hydro/
Introduction
The module 'hailhydro' is part of a series of pyton packages encompassing a set of class and method implementations for a kirchhoff network datatype, in order to to calculate flow/flux on lumped parameter model circuits. The flow/flux objects are embedded in the kirchhoff networks, and can be altered independently from the underlying graph structure. This is meant for fast(er) and efficient computation in the follow-up module 'goflow' and dependend of 'kirchhoff'.
Installation
pip install hailhydro
Usage
Generally, just take a weighted networkx graph and create a kirchhoff circuit from it (giving it a defined spatialy embedding and conductivity structure)
import kirchhoff.circuit_flow as kfc
import hailhydro.flow_init as hf
circuit=kfc.initialize_flow_circuit_from_crystal('simple',3)
flow=hf.initialize_flow_on_circuit(circuit)
To set node and edge attributes ('source','potential' ,'conductivity','flow_rate') use the set_source_landscape(), set_plexus_landscape() methods of the kirchhoff class. Further offering non-trivial random flow patterns for complex net adapation models(see 'goflow')
import kirchhoff.circuit_flow as kfc
import hailhydro.flow_random as hfr
circuit1=kfc.initialize_flow_circuit_from_crystal('simple',3)
circuit1.set_source_landscape('root_multi',num_sources=1)
circuit1.set_plexus_landscape()
random_flow=hfr.initialize_random_flow_on_circuit(circuit1)
circuit2=kfc.initialize_flow_circuit_from_crystal('simple',3)
circuit2.set_source_landscape('root_multi',num_sources=1)
circuit2.set_plexus_landscape()
rerouting_flow=hfr.initialize_rerouting_flow_on_circuit(circuit2)
Furter, extra classes for flux of solute along a kirchhoff network are implemented (use hailhydro.flux_overflow to handle critical regimes of large Peclet numbers)
import hailhydro.flux_init as hfx
import kirchhoff.circuit_flux as kfx
n=2
pars={
'plexus':nx.grid_graph(( n,n,1)),
'absorption':0.1,
'diffusion':1.
}
circuit=kfx.setup_default_flux_circuit(pars)
flux=hfx.initialize_flux_on_circuit(circuit)
overflow=hro.initialize_overflow_on_circuit(circuit)
Further examples and recipes can be found here:
Requirements
networkx==2.5
numpy==1.19.1
scipy==1.5.2
kirchhoff==0.2.7
Acknowledgement
hailhydro written by Felix Kramer
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
File details
Details for the file hailhydro-0.1.1.tar.gz.
File metadata
- Download URL: hailhydro-0.1.1.tar.gz
- Upload date:
- Size: 17.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.8.2 requests/2.27.1 setuptools/61.2.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ee370743ace5c9a850c26a60af9f2e13a2bcb2d018a634c41cb5caa93fb34bb
|
|
| MD5 |
c21e64f07eb25400ba4dda49a50e7257
|
|
| BLAKE2b-256 |
5e4cb7477be9e2a5ad475c6e09e0699e91f4539eda0f4ec197b7eba3341c76e9
|