hailhydro modules

hailhydro.flow_init

class hailhydro.flow_init.Flow(constr: networkx.classes.graph.Graph, pars_source: dict = <factory>, pars_plexus: dict = <factory>)[source]

Bases: object

The flow class defines variables and methods for computing Hagen-Poiseuille flows on kirchhoff networks.

To be used in conjunction with ‘kirchhoff’ and ‘goflow’ in order to simulate flow-driven network morphogenesis.

Attributes:

constr (networkx.Graph):

A networkx graph or circuit to initilize a flow on.

pars_source (dict):

The boundary conditions (Neumann) determining the in/outlfow of fluid accross the network.

pars_plexus (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

Methods:

init_flow():

Initialize flow variables, boundaries and handle constructor exceptions.

set_boundaries():

Explicitly set Neumann-boudaries and initial plexus as defined via ‘pars_source/plexus’ parameters. Set internal output varaibles and incidence information.

find_roots(G):

Given a networkx graph, return all source-nodes (needs the nodal ‘source’ attribute set).

find_sinks(G):

Given a networkx graph, return all sink-nodes (needs the nodal ‘source’ attribute set).

alpha_omega(G, j):

Return the start (alpha) and end(omega) node of an edge, for any given networkx graph with edge labeling j.

calc_pressure(conduct, source):

Compute the pressure landscape, considering the current parameter and plexus condition.

calc_flow_from_pressure(conduct, dP):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_flow(conduct, source):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_sq_flow(sconduct, source):

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition.

calc_cross_section_from_conductivity(conductivity, conductance):

Compute the squared radii values from the current conductivity matrix and conductance value.

calc_conductivity_from_cross_section(R_sq, conductance):

Compute the conductivity matrix from the current squared radii values and conductance value.

calc_configuration_flow():

Compute the pressure/flow landscape, considering the current parameter and plexus condition.

alpha_omega(G, j)[source]

Return the start (alpha) and end(omega) node of an edge, for any given networkx graph with edge labeling j.

Args:

G (networkx.Graph):

A networkx graph.

j (int):

An existent edge label.

Returns:

node: The ‘alpha’ node of edge (labeld j) node: The ‘omega’ node of edge (labeld j)

calc_conductivity_from_cross_section(R_sq, conductance)[source]

Compute the conductivity matrix from the current squared radii values and conductance value.

Args:

R_sq (array):

Edge-vector of squared radii values.

conductance (array):

The graph’s conductance unit.

Returns:

ndarray: The network’s edge conductivity matrix.

calc_configuration_flow()[source]

Compute the pressure/flow landscape, considering the current parameter and plexus condition.

Returns:

ndarray: Edge-vector of directed flow rates. ndarray: Edge-vector of pressure differences.

calc_cross_section_from_conductivity(conductivity, conductance)[source]

Compute the squared radii values from the current conductivity matrix and conductance value.

Args:

conductivity (array):

The network’s edge conductivity matrix.

conductance (array):

The graph’s conductance unit.

Returns:

ndarray: Edge-vector of squared radii values.

calc_flow(conduct, source)[source]

Compute the flow landscape, considering the current parameter and plexus condition.

Args:

conduct (array):

The network’s edge conductivity matrix.

source (array):

The nodal source vector.

Returns:

ndarray: Edge-vector of directed flow rates.

calc_flow_from_pressure(conduct, dP)[source]

Compute the flow landscape, considering the current parameter and plexus condition.

Args:

conduct (array):

The network’s edge conductivity matrix.

dP (array):

Edge-vector of pressure-differences.

Returns:

ndarray: Edge-vector of directed flow rates.

calc_pressure(conduct, source)[source]

Compute the pressure landscape, considering the current parameter and plexus condition.

Args:

conduct (array):

The network’s edge conductivity matrix.

source (array):

The nodal source vector.

Returns:

ndarray: Edge-vector of pressure-differences. ndarray: Node-vector of pressures levels.

calc_sq_flow(conduct, source)[source]

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition.

Args:

conduct (array):

The network’s edge conductivity matrix.

source (array):

The nodal source vector.

Returns:

ndarray: Edge-vector of squared flow rate values. ndarray: Edge-vector of squared pressure difference values.

find_roots(G)[source]

Given a networkx graph, return all source-nodes (needs the nodal ‘source’ attribute set).

Args:

G (networkx.Graph):

A networkx graph.

Returns:

list:

A list of root/source nodes of the given graph.

find_sinks(G)[source]

Given a networkx graph, return all sink-nodes (needs the nodal ‘source’ attribute set).

Args:

G (networkx.Graph):

A networkx graph.

Returns:

list:

A list of outlet/sink nodes of the given graph.

init_flow()[source]

Initialize flow variables, boundaries and handle constructor exceptions.

Raises:

Exception:

Warning! Non-networkx type given for initialization, no internal circuit established.

set_boundaries()[source]

Explicitly set Neumann-boudaries and initial plexus as defined via ‘pars_source/plexus’ parameters. Set internal output varaibles and incidence information.

hailhydro.flow_random

class hailhydro.flow_random.FlowRandom(constr: networkx.classes.graph.Graph, pars_source: dict = <factory>, pars_plexus: dict = <factory>, flow_setting: dict = <factory>)[source]

Bases: hailhydro.flow_init.Flow

The random flow class defines variables and methods for computing randomized-averaged Hagen-Poiseuille flows on kirchhoff networks.

To be used in conjunction with ‘kirchhoff’ and ‘goflow’ in order to simulate flow-driven network morphogenesis. The implementation is based on the models of Corson (PRL, 2010) and Hu-Cai(PRL, 2013), which consider random flow patterns to emerge from a variation in sink strengths.

Attributes:

constr (networkx.Graph):

A networkx graph or circuit to initilize a flow on.

pars_source (dict):

The boundary conditions (Neumann) determining the in/outlfow of fluid accross the network.

pars_plexus (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

flow_setting (dict):

The setting for randomized flow, i.e. noise levels and correlations.

Methods:

init_flow():

Initialize flow variables, boundaries and handle constructor exceptions.

set_boundaries():

Explicitly set Neumann-boudaries and initial plexus as defined via ‘pars_source/plexus’ parameters. Set internal output varaibles and incidence information.

find_roots(G):

Given a networkx graph, return all source-nodes (needs the nodal ‘source’ attribute set).

find_sinks(G):

Given a networkx graph, return all sink-nodes (needs the nodal ‘source’ attribute set).

alpha_omega(G, j):

Return the start (alpha) and end(omega) node of an edge, for any given networkx graph with edge labeling j.

calc_pressure(conduct, source):

Compute the pressure landscape, considering the current parameter and plexus condition.

calc_flow_from_pressure(conduct, dP):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_flow(conduct, source):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_sq_flow(sconduct, source):

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition.

calc_cross_section_from_conductivity(conductivity, conductance):

Compute the squared radii values from the current conductivity matrix and conductance value.

calc_conductivity_from_cross_section(R_sq, conductance):

Compute the conductivity matrix from the current squared radii values and conductance value.

calc_configuration_flow():

Compute the pressure/flow landscape, considering the current parameter and plexus condition.

init_random():

Initialize random-flow variables and boundaries.

set_root_source_matrix(mean, variance):

Set the (positive) parameters of deterministic and noisy flow levels.

set_effective_source_matrix(noise):

Set the effective fluctuation matrix with ggiven noise level.

calc_sq_flow_effective(conduct):

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition (given the internal effective noise matrix was initialized).

calc_sq_flow_root(conduct):

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition (given the internal sink mean and variance were initialized).

calc_sq_flow_effective(conduct)[source]

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition (given the internal effective noise matrix was initialized).

Args:

conduct (array):

The network’s edge conductivity matrix.

Returns:

ndarray: Edge-vector of squared pressure difference values. ndarray: Edge-vector of squared flow rate values.

calc_sq_flow_root(conduct)[source]

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition (given the internal sink mean and variance were initialized).

Args:

conduct (array):

The network’s edge conductivity matrix.

Returns:

ndarray: Edge-vector of squared pressure difference values. ndarray: Edge-vector of squared flow rate values.

init_random()[source]

Initialize random-flow variables and boundaries.

Raises:

Exception:

Warning flow landscape not set!

set_effective_source_matrix(noise)[source]

Set the effective fluctuation matrix with ggiven noise level.

Args:

noise (float):

The ratio of squared mean and variance of sink strength.

set_root_source_matrix(mean, variance)[source]

Set the (positive) parameters of deterministic and noisy flow levels.

Args:

mean (float):

The squared mean value of sink strength.

variance (float):

The variance value of sink strength.

class hailhydro.flow_random.FlowReroute(constr: networkx.classes.graph.Graph, pars_source: dict = <factory>, pars_plexus: dict = <factory>, flow_setting: dict = <factory>)[source]

Bases: hailhydro.flow_init.Flow

The random flow class defines variables and methods for computing randomized-averaged Hagen-Poiseuille flows on kirchhoff networks.

To be used in conjunction with ‘kirchhoff’ and ‘goflow’ in order to simulate flow-driven network morphogenesis. The implementation is based on the models which assume flow variation to emerge from random edge failure (homogenous probability), e.g. see Katifori, PRL, 2010

Attributes:

constr (networkx.Graph):

A networkx graph or circuit to initilize a flow on.

pars_source (dict):

The boundary conditions (Neumann) determining the in/outlfow of fluid accross the network.

pars_plexus (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

flow_setting (dict):

The setting for randomized flow, i.e. noise levels and correlations.

Methods:

init_flow():

Initialize flow variables, boundaries and handle constructor exceptions.

set_boundaries():

Explicitly set Neumann-boudaries and initial plexus as defined via ‘pars_source/plexus’ parameters. Set internal output varaibles and incidence information.

find_roots(G):

Given a networkx graph, return all source-nodes (needs the nodal ‘source’ attribute set).

find_sinks(G):

Given a networkx graph, return all sink-nodes (needs the nodal ‘source’ attribute set).

alpha_omega(G, j):

Return the start (alpha) and end(omega) node of an edge, for any given networkx graph with edge labeling j.

calc_pressure(conduct, source):

Compute the pressure landscape, considering the current parameter and plexus condition.

calc_flow_from_pressure(conduct, dP):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_flow(conduct, source):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_sq_flow(sconduct, source):

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition.

calc_cross_section_from_conductivity(conductivity, conductance):

Compute the squared radii values from the current conductivity matrix and conductance value.

calc_conductivity_from_cross_section(R_sq, conductance):

Compute the conductivity matrix from the current squared radii values and conductance value.

calc_configuration_flow():

Compute the pressure/flow landscape, considering the current parameter and plexus condition.

initialize_broken_link():

Initialize random-flow variables and boundaries, pre-generate broken edge states for faster sampling.

generate_coherent_closure_deterministic(H, x):

Generate a pruned version of a plexus, where a number ‘x’ of randomly sampled edges are failing during each realizsation.

generate_coherent_closure():

Generate a pruned version of a plexus, where a random number of edges are failing during each realizsation(each indivually with probability p).

break_links(idx, conduct):

Break/Fail the edges in list ‘idx’, by setting the respective conductivity values to numerically close to zero.

get_sets():

Sample a random set of network edges.

calc_random_radii(idx, conduct):

Compute the edge radii values, correpsonding to a randomly pruned conductivity matrix.

calc_sq_flow(idx, conduct):

Compute the squared pressure/flow landscape, considering a sequence of pruned conductivity matrices.

calc_flows_mapping(graph_matrices):

Compute the pressure/flow landscape, considering a sequence of conductivity matrix realizations.

calc_sq_flow_avg(conduct):

Compute the average squared pressure/flow landscape, by internally generating a random sequence of pruned conductivity matrix realizations.

get_broken_links_asarray(idx, conduct):

Compute a sequence of pruned conductivity matrices based on the failed edge sets ‘idx’.

Break/Fail the edges in list ‘idx’, by setting the respective conductivity values to numerically close to zero.

Args:

idx (list):

A list of edges to fail.

conduct (array):

The network’s conductivity matrix.

Returns:

ndarray:

The network’s pruned conductivity matrix.

calc_flows_mapping(graph_matrices)[source]

Compute the pressure/flow landscape, considering a sequence of conductivity matrix realizations.

Args:

graph_matrices (iterable):

An iterable of conductivity matrix realizations.

Returns:

list: A list of edge/nodal-vectors of effective flow/pressure landscape realizations.

calc_random_radii(idx, conduct)[source]

Compute the edge radii values, correpsonding to a randomly pruned conductivity matrix.

Args:

idx (list):

The list of failed edges.

conduct (array):

The network’s conductivity matrix.

Returns:

list:

A list of radii values R, as well as radii functions R^2, R^3

calc_sq_flow(idx, conduct)[source]

Compute the squared pressure/flow landscape, considering a sequence of pruned conductivity matrices.

Args:

idx (list):

The list of failed edges.

conduct (array):

The network’s conductivity matrix.

Returns:

ndarray: Edge-vector of squared pressure difference values. ndarray: Edge-vector of squared flow rate values.

calc_sq_flow_avg(conduct)[source]

Compute the average squared pressure/flow landscape, by internally generating a random sequence of pruned conductivity matrix realizations.

Args:

conduct (array):

The network’s conductivity matrix.

Returns:

list: A list of average, squared flows, pressures as well as the average radii and dissipation values.

generate_coherent_closure()[source]

Generate a pruned version of a plexus, where a random number of edges are failing during each realizsation(each indivually with probability p).

Returns:

bool: Boolean on whether the pruned network is connected. list: The list of failed edges.

generate_coherent_closure_deterministic(H, x)[source]

Generate a pruned version of a plexus, where a number ‘x’ of randomly sampled edges are failing during each realizsation.

Args:

H (networkx.Graph):

A networkx graph.

x (int):

The pre-determined number of edge to fail.

Returns:

bool: Boolean on whether the pruned network is connected. list: The list of failed edges.

Compute a sequence of pruned conductivity matrices based on the failed edge sets ‘idx’.

Args:

idx (list):

The list of failed edge sets.

conduct (array):

The network’s conductivity matrix.

Returns:

list: A list of pruned conductivity matrices.

get_sets()[source]

Sample a random set of network edges.

Returns:

list:

A list of randomly sampled edges.

Initialize random-flow variables and boundaries, pre-generate broken edge states for faster sampling.

hailhydro.flux_init

class hailhydro.flux_init.Flux(constr: networkx.classes.graph.Graph, pars_source: dict = <factory>, pars_plexus: dict = <factory>, pars_solute: dict = <factory>, pars_abs: dict = <factory>, pars_geom: dict = <factory>)[source]

Bases: hailhydro.flow_init.Flow

The flux class defines variables and methods for computing Hagen-Poiseuille flows on kirchhoff networks. Furthermore it enables to compute simple, stationary advection-diffusion+absorption problems and concentration landscapes.

To be used in conjunction with ‘kirchhoff’ and ‘goflow’ in order to simulate flow-driven network morphogenesis.

Attributes:

constr (networkx.Graph):

A networkx graph or circuit to initilize a flow on.

pars_source (dict):

The boundary conditions (Neumann) determining the in/outlfow of fluid accross the network.

pars_plexus (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_solute (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_abs (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_geom (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_in (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_out (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_edges (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_node_out (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_node_in (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

Methods:

init_flow():

Initialize flow variables, boundaries and handle constructor exceptions.

set_boundaries():

Explicitly set Neumann-boudaries and initial plexus as defined via ‘pars_source/plexus’ parameters. Set internal output varaibles and incidence information.

find_roots(G):

Given a networkx graph, return all source-nodes (needs the nodal ‘source’ attribute set).

find_sinks(G):

Given a networkx graph, return all sink-nodes (needs the nodal ‘source’ attribute set).

alpha_omega(G, j):

Return the start (alpha) and end(omega) node of an edge, for any given networkx graph with edge labeling j.

calc_pressure(conduct, source):

Compute the pressure landscape, considering the current parameter and plexus condition.

calc_flow_from_pressure(conduct, dP):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_flow(conduct, source):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_sq_flow(sconduct, source):

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition.

calc_cross_section_from_conductivity(conductivity, conductance):

Compute the squared radii values from the current conductivity matrix and conductance value.

calc_conductivity_from_cross_section(R_sq, conductance):

Compute the conductivity matrix from the current squared radii values and conductance value.

calc_configuration_flow():

Compute the pressure/flow landscape, considering the current parameter and plexus condition.

init_flux():

Initialize internal flux variables, boundaries and handle constructor exceptions.

init_parameters():

Initialize internal variables and containers.

set_solute_boundaries():

Set flux parameters and boundaries.

calc_diff_flux(R_sq):

Compute the reweighted cross-section given an advection-diffusion problem.

calc_velocity_from_flowrate(Q, R_sq):

Compute the effective flow velocities.

calc_peclet(V):

Compute the Peclet numbers.

calc_diff_flux(R_sq)[source]

Compute the reweighted cross-section given an advection-diffusion problem.

Args:

R_sq (array):

The squared edge radii values.

Returns:

ndarray:

Edge-vector of effective diffusion flux across the cross-section.

calc_peclet(V)[source]

Compute the Peclet numbers.

Args:

V (array):

Edge-vector of cross-section averaged flow velocities.

Returns:

ndarray: Edge-vector of peclet numbers.

calc_velocity_from_flowrate(Q, R_sq)[source]

Compute the effective flow velocities.

Args:

Q (array):

Edge-vector of directed flow rates.

R_sq (array):

The squared edge radii values.

Returns:

ndarray: Edge-vector of cross-section averaged flow velocities.

init_flux()[source]

Initialize internal flux variables, boundaries and handle constructor exceptions.

Raises:

Exception:

Warning! Non-networkx type given for initialization, no internal circuit established.

init_parameters()[source]

Initialize internal variables and containers.

set_solute_boundaries()[source]

Set flux parameters and boundaries.

hailhydro.flux_overflow

class hailhydro.flux_overflow.Overflow(constr: networkx.classes.graph.Graph, pars_source: dict = <factory>, pars_plexus: dict = <factory>, pars_solute: dict = <factory>, pars_abs: dict = <factory>, pars_geom: dict = <factory>)[source]

Bases: hailhydro.flux_init.Flux

The flux class defines variables and methods for computing Hagen-Poiseuille flows on kirchhoff networks. Furthermore it enables to compute simple, stationary advection-diffusion+absorption problems and concentration landscapes.

To be used in conjunction with ‘kirchhoff’ and ‘goflow’ in order to simulate flow-driven network morphogenesis. This class contains manually implemented handling for large Peclet numbers.

Attributes:

constr (networkx.Graph):

A networkx graph or circuit to initilize a flow on.

pars_source (dict):

The boundary conditions (Neumann) determining the in/outlfow of fluid accross the network.

pars_plexus (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_solute (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_abs (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_geom (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_in (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_out (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_edges (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_node_out (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_node_in (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

Methods:

init_flow():

Initialize flow variables, boundaries and handle constructor exceptions.

set_boundaries():

Explicitly set Neumann-boudaries and initial plexus as defined via ‘pars_source/plexus’ parameters. Set internal output varaibles and incidence information.

find_roots(G):

Given a networkx graph, return all source-nodes (needs the nodal ‘source’ attribute set).

find_sinks(G):

Given a networkx graph, return all sink-nodes (needs the nodal ‘source’ attribute set).

alpha_omega(G, j):

Return the start (alpha) and end(omega) node of an edge, for any given networkx graph with edge labeling j.

calc_pressure(conduct, source):

Compute the pressure landscape, considering the current parameter and plexus condition.

calc_flow_from_pressure(conduct, dP):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_flow(conduct, source):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_sq_flow(sconduct, source):

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition.

calc_cross_section_from_conductivity(conductivity, conductance):

Compute the squared radii values from the current conductivity matrix and conductance value.

calc_conductivity_from_cross_section(R_sq, conductance):

Compute the conductivity matrix from the current squared radii values and conductance value.

calc_configuration_flow():

Compute the pressure/flow landscape, considering the current parameter and plexus condition.

init_flux():

Initialize internal flux variables, boundaries and handle constructor exceptions.

init_parameters():

Initialize internal variables and containers.

set_solute_boundaries():

Set flux parameters and boundaries.

calc_diff_flux(R_sq):

Compute the reweighted cross-section given an advection-diffusion problem.

calc_velocity_from_flowrate(Q, R_sq):

Compute the effective flow velocities.

calc_peclet(V):

Compute the Peclet numbers.

solve_absorbing_boundary():

Compute the concentration landscape for the absorbing boundary problem.

update_transport_matrix(R):

Update the effective transport matrix.

compute_flux_PeAbs():

Compute the effective exponential factors for the stationary concentraiton problem.

compute_flux_idx():

Identify regimes of Peclet numbers and the respective indices of edges.

compute_flux_exp(x, z, idx_pack):

Computes auxillary exponential factors for transport matrix evaluation.

calc_absorption():

Computes total absorption lanscape of the advection-diffusion network.

get_concentrations_from_edges():

Returns the current start and end concentraiton values of each individual edge.

calc_absorption_jacobian():

Compute total edge’s absorption Jacobian matrix (with regard to radial changes).

get_alpha_omega_from_edges():

Returns the start(alpha) and end(omega) node of all network edges.

calc_absorption_jacobian_coefficients_1(*args):

Caluclation of intermediate transport matrix and Jacobain components.

calc_abs_jac_coeff_11(x, pars):

Auxillarycilary function for sequenced ndarray multiplication.

calc_absorption_jacobian_coefficients_2(*args):

Caluclation of intermediate transport matrix and Jacobain omponents.

calc_flux_jacobian():

Compute the flow components of the absorption Jacobian matrix.

calc_cross_section_jacobian():

Compute the radial Jacobian component of the absorption Jacobian matrix.

calc_concentration_jacobian(J_PE, c):

Compute the concentration Jacobian component of the absorption Jacobian matrix.

calc_concentration_jacobian_coefficients(c):

Auxillary function to compute intermediate coefficients for concentration Jacobian matrix evaluation.

flux_sum_1(i, z, f2):

Auxillary function for intermediate coefficient computation.

flux_sum_2(i, z, A, f4):

Auxillary function for intermediate coefficient computation.

calc_inv_B(c):

Return the reduced concentration vector and inverted transport matrix.

calc_inc_jac_diag(flux_sum_1, flux_sum_2, pars):

Auxillary function to compute intermediate Jacobian components for absoprtion Jacobian matrix.

calc_incidence_jacobian_dev(JB_eff, dict_coeff, pars):

Auxillary function to merge intermediate Jacobian components into effective absoprtion Jacobian matrix.

evaluate_jacobian(j, J_C, JB_eff, inv_B, c):

Update the jth row of the current concentration Jacobian matrix.

calc_abs_jac_coeff_11(x, pars)[source]

Auxillarycilary function for sequenced ndarray multiplication.

Args:

x (array):

An array as constant target for numpy multiplication.

pars (iterable):

An sequence of arrays for numpy multiplication.

Returns:

list: A list of ndarray products.

calc_absorption()[source]

Computes total absorption lanscape of the advection-diffusion network.

Returns:

ndarray: Edge-vector of total absorption rates.

calc_absorption_jacobian()[source]

Compute total edge’s absorption Jacobian matrix (with regard to radial changes).

Returns:

ndarray: The Jacobian matrix (with regard to radial changes).

calc_absorption_jacobian_coefficients_1(*args)[source]

Caluclation of intermediate transport matrix and Jacobain components.

Args:

args (iterable):

A sequence of arguments for caluclations of intermediate transport matrix and Jacobain components.

Returns:

ndarray: Edge-vector of intermediate components (UP) ndarray: Edge-vector of intermediate components (DOWN)

calc_absorption_jacobian_coefficients_2(*args)[source]

Caluclation of intermediate transport matrix and Jacobain components.

Args:

args (iterable):

A sequence of arguments for caluclations of intermediate transport matrix and Jacobain components.

Returns:

ndarray: Edge-vector of intermediate components (UP) ndarray: Edge-vector of intermediate components (DOWN)

calc_concentration_jacobian(J_PE, c)[source]

Compute the concentration Jacobian component of the absorption Jacobian matrix.

Args:

J_PE (array):

The Pleclet number Jacobian matrix (with regard to radial changes).

c (array):

The nodal concentration vector.

Returns:

ndarray:

The concentration Jacobian matrix (with regard to radial changes).

calc_concentration_jacobian_coefficients(c)[source]

Auxillary function to compute intermediate coefficients for concentration Jacobian matrix evaluation.

Args:

c (array):

The nodal concentration vector.

Returns:

dict: A series of coefficient arrays for further numerics.

calc_cross_section_jacobian()[source]

Compute the radial Jacobian component of the absorption Jacobian matrix.

Returns:

ndarray: The cross-section Jacobian matrix (with regard to radial changes).

calc_flux_jacobian()[source]

Compute the flow components of the absorption Jacobian matrix.

Returns:

ndarray:

The Pleclet number Jacobian matrix (with regard to radial changes).

ndarray:

The flow rate Jacobian matrix (with regard to radial changes).

calc_inc_jac_diag(flux_sum_1, flux_sum_2, pars)[source]

Auxillary function to compute intermediate Jacobian components for absoprtion Jacobian matrix.

Args:

flux_sum1 (array):

Auxillary edge-vector.

flux_sum2 (array):

Auxillary edge-vector.

pars(iterable):

A list of Jacobian factor components.

Returns:

ndarray: Intermediate absorption Jacobian matrix.

calc_incidence_jacobian_dev(JB_eff, dict_coeff, pars)[source]

Auxillary function to merge intermediate Jacobian components into effective absoprtion Jacobian matrix.

Args:

JB_eff (ndarray):

Intermediate absorption Jacobian matrix.

dict_coeff (dict):

A series of coefficient arrays for further numerics.

pars(iterable):

A list of Jacobian factor components.

calc_inv_B(c)[source]

Return the reduced concentration vector and inverted transport matrix.

Args:

c(array):

The nodal concentration vector.

Returns:

ndarray: Inverse, reduced transport matrix ndarray: Reduced concentration vector

compute_flux_PeAbs()[source]

Compute the effective exponential factors for the stationary concentraiton problem.

Returns:

ndarray: Edge-vector of effective exponents. ndarray: Edge-vector of Peclet numbers*0.5.

compute_flux_exp(x, z, idx_pack)[source]

Computes auxillary exponential factors for transport matrix evaluation.

Args:

x (array):

Edge-vector of effective exponents.

z (array):

Edge-vector of Peclet numbers*0.5.

idx_pack (list):

List of index sets, for handling limit cases for Peclet number regimes.

Returns:

ndarray: Edge-vector of exponential parameters (UP) ndarray: Edge-vector of exponential parameters (DOWN) ndarray: Edge-vector of exponential parameters (COTH)

compute_flux_idx()[source]

Identify regimes of Peclet numbers and the respective indices of edges.

Returns:

list:

List of index sets, for handling limit cases for Peclet number regimes.

evaluate_jacobian(j, J_C, JB_eff, inv_B, c)[source]

Update the jth row of the current concentration Jacobian matrix.

Args:

j (int):

Row index for concentration Jacobian matrix

J_C (array):

The current concentration Jacobian matrix.

JB_eff (array):

Intermediate absorption Jacobian matrix.

inv_B (array):

The inverse trasport matrix.

c (array):

The nodal concentration vector.

flux_sum_1(i, z, f2)[source]

Auxillary function for intermediate coefficient computation.

Args:

i (int):

Index for incidence row of matrix.

z (array):

Edge-vector of Peclet numbers*0.5.

f2 (array):

Auxillary edge-vector.

Returns:

ndarray: Auxillary edge-vector for further numerics.

flux_sum_2(i, z, A, f4)[source]

Auxillary function for intermediate coefficient computation.

Args:

i (int):

Index for incidence row of matrix.

z (array):

Edge-vector of Peclet numbers*0.5.

A (array):

Edge-vector of cross-section values.

f4 (array):

Auxillary edge-vector.

Returns:

ndarray: Auxillary edge-vector for further numerics.

get_alpha_omega_from_edges()[source]

Returns the start(alpha) and end(omega) node of all network edges.

Returns:

ndarray: Edge-vector of start nodes. ndarray: Edge-vector of end nodes.

get_concentrations_from_edges()[source]

Returns the current start and end concentraiton values of each individual edge.

Returns:

ndarray: Edge-vector of start concentions. ndarray: Edge-vector of end concentions.

solve_absorbing_boundary()[source]

Compute the concentration landscape for the absorbing boundary problem.

Returns:

ndarray: The reduced concentraiton vector ndarray: The reduced transport matrix

update_transport_matrix(R)[source]

Update the effective transport matrix.

Args:

R (array):

The current edge radii distribution.

hailhydro.flux_random_overflow

class hailhydro.flux_random_overflow.FluxRandom(constr: networkx.classes.graph.Graph, pars_source: dict = <factory>, pars_plexus: dict = <factory>, flow_setting: dict = <factory>, pars_solute: dict = <factory>, pars_abs: dict = <factory>, pars_geom: dict = <factory>)[source]

Bases: hailhydro.flux_overflow.Overflow, hailhydro.flow_random.FlowReroute

The flux class defines variables and methods for computing Hagen-Poiseuille flows on kirchhoff networks. Furthermore it enables to compute simple, stationary advection-diffusion+absorption problems and concentration landscapes.

To be used in conjunction with ‘kirchhoff’ and ‘goflow’ in order to simulate flow-driven network morphogenesis. This class contains manually implemented handling for large Peclet numbers.

Attributes:

constr (networkx.Graph):

A networkx graph or circuit to initilize a flow on.

pars_source (dict):

The boundary conditions (Neumann) determining the in/outlfow of fluid accross the network.

pars_plexus (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_solute (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_abs (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

pars_geom (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_in (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_out (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_edges (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_node_out (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

dict_node_in (dict):

The initial plexus, edge values of conductivity, the flow is to be calculated on.

Methods:

init_flow():

Initialize flow variables, boundaries and handle constructor exceptions.

set_boundaries():

Explicitly set Neumann-boudaries and initial plexus as defined via ‘pars_source/plexus’ parameters. Set internal output varaibles and incidence information.

find_roots(G):

Given a networkx graph, return all source-nodes (needs the nodal ‘source’ attribute set).

find_sinks(G):

Given a networkx graph, return all sink-nodes (needs the nodal ‘source’ attribute set).

alpha_omega(G, j):

Return the start (alpha) and end(omega) node of an edge, for any given networkx graph with edge labeling j.

calc_pressure(conduct, source):

Compute the pressure landscape, considering the current parameter and plexus condition.

calc_flow_from_pressure(conduct, dP):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_flow(conduct, source):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_sq_flow(sconduct, source):

Compute the squared pressure/flow landscape, considering the current parameter and plexus condition.

calc_cross_section_from_conductivity(conductivity, conductance):

Compute the squared radii values from the current conductivity matrix and conductance value.

calc_conductivity_from_cross_section(R_sq, conductance):

Compute the conductivity matrix from the current squared radii values and conductance value.

calc_configuration_flow():

Compute the pressure/flow landscape, considering the current parameter and plexus condition.

init_flux():

Initialize internal flux variables, boundaries and handle constructor exceptions.

init_parameters():

Initialize internal variables and containers.

set_solute_boundaries():

Set flux parameters and boundaries.

calc_diff_flux(R_sq):

Compute the reweighted cross-section given an advection-diffusion problem.

calc_velocity_from_flowrate(Q, R_sq):

Compute the effective flow velocities.

calc_peclet(V):

Compute the Peclet numbers.

solve_absorbing_boundary():

Compute the concentration landscape for the absorbing boundary problem.

update_transport_matrix(R):

Update the effective transport matrix.

compute_flux_PeAbs():

Compute the effective exponential factors for the stationary concentraiton problem.

compute_flux_idx():

Identify regimes of Peclet numbers and the respective indices of edges.

compute_flux_exp(x, z, idx_pack):

Computes auxillary exponential factors for transport matrix evaluation.

calc_absorption():

Computes total absorption lanscape of the advection-diffusion network.

get_concentrations_from_edges():

Returns the current start and end concentraiton values of each individual edge.

calc_absorption_jacobian():

Compute total edge’s absorption Jacobian matrix (with regard to radial changes).

get_alpha_omega_from_edges():

Returns the start(alpha) and end(omega) node of all network edges.

calc_absorption_jacobian_coefficients_1(*args):

Caluclation of intermediate transport matrix and Jacobain components.

calc_abs_jac_coeff_11(x, pars):

Auxillarycilary function for sequenced ndarray multiplication.

calc_absorption_jacobian_coefficients_2(*args):

Caluclation of intermediate transport matrix and Jacobain omponents.

calc_flux_jacobian():

Compute the flow components of the absorption Jacobian matrix.

calc_cross_section_jacobian():

Compute the radial Jacobian component of the absorption Jacobian matrix.

calc_concentration_jacobian(J_PE, c):

Compute the concentration Jacobian component of the absorption Jacobian matrix.

calc_concentration_jacobian_coefficients(c):

Auxillary function to compute intermediate coefficients for concentration Jacobian matrix evaluation.

flux_sum_1(i, z, f2):

Auxillary function for intermediate coefficient computation.

flux_sum_2(i, z, A, f4):

Auxillary function for intermediate coefficient computation.

calc_inv_B(c):

Return the reduced concentration vector and inverted transport matrix.

calc_inc_jac_diag(flux_sum_1, flux_sum_2, pars):

Auxillary function to compute intermediate Jacobian components for absoprtion Jacobian matrix.

calc_incidence_jacobian_dev(JB_eff, dict_coeff, pars):

Auxillary function to merge intermediate Jacobian components into effective absoprtion Jacobian matrix.

evaluate_jacobian(j, J_C, JB_eff, inv_B, c):

Update the jth row of the current concentration Jacobian matrix.

calc_flow(*args):

Compute the flow landscape, considering the current parameter and plexus condition.

calc_transport_observables(idx, conduct, flow_obs):

Compute the average wall-shear stress and absorption rates.

calc_noisy_absorption(R_sq, flow_observables):

Compute the absorption rate for the current flow landscpae realizsation.

update_transport_matrix(R_sq, flow_obs):

Update the tranport matrix for broken edge realizsations.

calc_flow(*args)[source]

Compute the flow landscape, considering the current parameter and plexus condition.

Args:

args (iterable):

Diverse set of model parameterst for ‘get_broken_links_asarray()’’

Returns:

list: A list of edge/nodal-vectors of effective flow/pressure landscape realizations.

calc_noisy_absorption(R_sq, flow_observables)[source]

Compute the absorption rate for the current flow landscpae realizsation.

Args:

R_sq (array):

Edge-vector of squared edge radii.

flow_observables (array):

A list of edge/nodal-vectors of effective flow/pressure landscape realizations.

Returns:

ndarray: Edge-vector of absorption rate values.

calc_transport_observables(idx, conduct, flow_obs)[source]

Compute the average wall-shear stress and absorption rates.

Args:

idx (list):

The list of failed edge sets.

conduct (array):

The network’s conductivity matrix.

flow_obs (list):

A list of edge/nodal-vectors of effective flow/pressure landscape realizations.

Returns:

ndarray: Edge-vector of average squared wall-shear stress. ndarray: Edge-vector of average edge absorption rate.

update_transport_matrix(R_sq, flow_obs)[source]

Update the tranport matrix for broken edge realizsations.

Args:

R_sq (array):

Edge-vector of squared edge radii.

flow_obs (array):

A list of edge/nodal-vectors of effective flow/pressure landscape realizations.