Commit 86b72255 authored by Felix's avatar Felix
Browse files

Merge remote-tracking branch 'origin/main' into main

parents 60d6eeba b1d9dc00
# kirchhoff
## Introduction
This module 'kirchhoff' is part of a series of pyton packages encompassing a set of class and method implementations for a kirchhoff network datatype, which includes a visualization routine based on plotly. The concept is to build kirchhoff networks from networkx graphs, by providing a container for the graphs as well as separate containers for network attributes meant for fast(er) computation in the follow-up modules 'hailhydro' and 'goflow'
## Installation
pip install kirchhoff
## Usage
Generally, just take a weighted networkx graph and read it in as shown. You can plot the network interactivly, with full display of edge and node attributes if desired. Default attributes are 'source'/'potential' for nodes and 'conductivity'/'flow_rate' for edges.
import kirchhoff.circuit_init as ki
G=nx.grid_graph(( n,n,1))
K = ki.initialize_circuit_from_networkx(G)
import kirchhoff.circuit_dual as kid
Single and dual networks are supported at the moment, and can be constructed from networkx generator or custom pre-defined types of spatially embedded graphs such as
- crystals/periodic, initialize_circuit_from_crystal(crystal_type='default',periods=1): 'default': simple cubic lattice 3D, 'chain': 1D chain, 'bcc': bcc lattice 3D, 'fcc': fcc lattice 3D,'diamond': diamond lattice 3D,'laves': laves lattice 3D,'trigonal_stack': trigonal lattice stacked and interconnected 3D, 'square': simple cubic lattice 2D, 'hexagonal': hexagonal lattice 2D,'trigonal_planar': trigonal lattice 2D
- random voronoi tesselation, initialize_circuit_from_random(random_type='default',periods=10,sidelength=1): 'default': planar voronoi tesselation with periodic boundaries, 'voronoi_volume': 3D voronoi tesselation with periodic boundaries
- intertwined systems, initialize_dual_circuit_from_minsurf(dual_type='simple',num_periods=2): supporting most of the above in 3D
Further one can define 'flow' and 'flux' circuits for hydrodynamic simulations which are based on Hagen-Poiseuille flow and transport of solutes via advection-diffusion. Doing so will enable more specifically tailored methods for source/solute influx topology control:
import kirchhoff.circuit_flow as kfc
import kirchhoff.circuit_flux as kfx
To set node and edge attributes ('source','potential' ,'conductivity','flow_rate') use the set_source_landscape(), set_plexus_landscape() methods of the kirchhof class and use the class method plot_circuit for plotly output:
import kirchhoff.circuit_flow as kfc
./notebook contains examples to play with in the form of jupyter notebooks
## Requirements
``` pandas ```,``` networkx ```, ``` numpy ```
## Gallery
``` pandas ```,``` networkx ```, ``` numpy ```,```plotly```
## Gallery
## Acknowledgement
```kirchhoff``` written by Felix Kramer
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment