|
pydfnWorks
python wrapper for dfnWorks
|
Functions | |
| def | create_graph (self, graph_type, inflow, outflow) |
| def | create_fracture_graph (inflow, outflow, topology_file="connectivity.dat", fracture_info="fracture_info.dat") |
| def | boundary_index (bc_name) |
| def | create_intersection_graph (inflow, outflow, intersection_file="intersection_list.dat", fracture_info="fracture_info.dat") |
| def | create_bipartite_graph (inflow, outflow, intersection_list='intersection_list.dat', fracture_info='fracture_info.dat') |
| def | add_fracture_source (self, G, source) |
| def | add_fracture_target (self, G, target) |
| def | k_shortest_paths (G, k, source, target, weight) |
| def | k_shortest_paths_backbone (self, G, k, source='s', target='t', weight=None) |
| def | pull_source_and_target (nodes, source='s', target='t') |
| def | dump_fractures (self, G, filename) |
| def | greedy_edge_disjoint (self, G, source='s', target='t', weight='None', k='') |
| def | plot_graph (self, G, source='s', target='t', output_name="dfn_graph") |
| def | dump_json_graph (self, G, name) |
| def | load_json_graph (self, name) |
| def | add_perm (G, fracture_info="fracture_info.dat") |
| def | add_area (G, fracture_info="fracture_info.dat") |
| def | add_weight (G) |
| def pydfnworks.dfnGraph.dfn2graph.add_area | ( | G, | |
fracture_info = "fracture_info.dat" |
|||
| ) |
Read Fracture aperture from fracture_info.dat and
load on the edges in the graph. Graph must be intersection to node
representation
Parameters
----------
G : NetworkX Graph
networkX graph
fracture_info : str
filename for fracture information
Returns
-------
None
Definition at line 872 of file dfn2graph.py.
| def pydfnworks.dfnGraph.dfn2graph.add_fracture_source | ( | self, | |
| G, | |||
| source | |||
| ) |
Returns the k shortest paths in a graph
Parameters
----------
G : NetworkX Graph
NetworkX Graph based on a DFN
source_list : list
list of integers corresponding to fracture numbers
remove_old_source: bool
remove old source from the graph
Returns
-------
G : NetworkX Graph
Notes
-----
bipartite graph not supported
Definition at line 365 of file dfn2graph.py.
| def pydfnworks.dfnGraph.dfn2graph.add_fracture_target | ( | self, | |
| G, | |||
| target | |||
| ) |
Returns the k shortest paths in a graph
Parameters
----------
G : NetworkX Graph
NetworkX Graph based on a DFN
target : list
list of integers corresponding to fracture numbers
Returns
-------
G : NetworkX Graph
Notes
-----
bipartite graph not supported
Definition at line 441 of file dfn2graph.py.
| def pydfnworks.dfnGraph.dfn2graph.add_perm | ( | G, | |
fracture_info = "fracture_info.dat" |
|||
| ) |
Add fracture permeability to Graph. If Graph representation is
fracture, then permeability is a node attribute. If graph representation
is intersection, then permeability is an edge attribute
Parameters
----------
G :networkX graph
NetworkX Graph based on the DFN
fracture_infor : str
filename for fracture information
Returns
-------
Notes
-----
Definition at line 818 of file dfn2graph.py.
Referenced by pydfnworks.dfnGraph.dfn2graph.create_fracture_graph(), and pydfnworks.dfnGraph.dfn2graph.create_intersection_graph().

| def pydfnworks.dfnGraph.dfn2graph.add_weight | ( | G | ) |
Compute weight w = K*A/L associated with each edge
Parameters
----------
G : NetworkX Graph
networkX graph
Returns
-------
None
Definition at line 902 of file dfn2graph.py.
| def pydfnworks.dfnGraph.dfn2graph.boundary_index | ( | bc_name | ) |
Determines boundary index in intersections_list.dat from name
Parameters
----------
bc_name : string
Boundary condition name
Returns
-------
bc_index : int
integer indexing of cube faces
Notes
-----
top = 1
bottom = 2
left = 3
front = 4
right = 5
back = 6
Definition at line 116 of file dfn2graph.py.
Referenced by pydfnworks.dfnGraph.dfn2graph.create_bipartite_graph(), and pydfnworks.dfnGraph.dfn2graph.create_intersection_graph().

| def pydfnworks.dfnGraph.dfn2graph.create_bipartite_graph | ( | inflow, | |
| outflow, | |||
intersection_list = 'intersection_list.dat', |
|||
fracture_info = 'fracture_info.dat' |
|||
| ) |
Creates a bipartite graph of the DFN.
Nodes are in two sets, fractures and intersections, with edges connecting them.
Parameters
----------
inflow : str
name of inflow boundary
outflow : str
name of outflow boundary
intersection_list: str
filename of intersections generated from DFN
fracture_infor : str
filename for fracture information
Returns
-------
B : NetworkX Graph
Notes
-----
See Hyman et al. 2018 "Identifying Backbones in Three-Dimensional Discrete Fracture Networks: A Bipartite Graph-Based Approach" SIAM Multiscale Modeling and Simulation for more details
Definition at line 272 of file dfn2graph.py.
References pydfnworks.dfnGraph.dfn2graph.boundary_index().
Referenced by pydfnworks.dfnGraph.dfn2graph.create_graph().


| def pydfnworks.dfnGraph.dfn2graph.create_fracture_graph | ( | inflow, | |
| outflow, | |||
topology_file = "connectivity.dat", |
|||
fracture_info = "fracture_info.dat" |
|||
| ) |
Create a graph based on topology of network. Fractures
are represented as nodes and if two fractures intersect
there is an edge between them in the graph.
Source and Target node are added to the graph.
Parameters
----------
inflow : string
Name of inflow boundary (connect to source)
outflow : string
Name of outflow boundary (connect to target)
topology_file : string
Name of adjacency matrix file for a DFN default=connectivity.dat
fracture_infor : str
filename for fracture information
Returns
-------
G : NetworkX Graph
NetworkX Graph where vertices in the graph correspond to fractures and edges indicated two fractures intersect
Notes
-----
Definition at line 53 of file dfn2graph.py.
References pydfnworks.dfnGraph.dfn2graph.add_perm().
Referenced by pydfnworks.dfnGraph.dfn2graph.create_graph().


| def pydfnworks.dfnGraph.dfn2graph.create_graph | ( | self, | |
| graph_type, | |||
| inflow, | |||
| outflow | |||
| ) |
Header function to create a graph based on a DFN
Parameters
----------
self : object
DFN Class object
graph_type : string
Option for what graph representation of the DFN is requested. Currently supported are fracture, intersection, and bipartitie
inflow : string
Name of inflow boundary (connect to source)
outflow : string
Name of outflow boundary (connect to target)
Returns
-------
G : NetworkX Graph
Graph based on DFN
Notes
-----
Definition at line 17 of file dfn2graph.py.
References pydfnworks.dfnGraph.dfn2graph.create_bipartite_graph(), pydfnworks.dfnGraph.dfn2graph.create_fracture_graph(), and pydfnworks.dfnGraph.dfn2graph.create_intersection_graph().

| def pydfnworks.dfnGraph.dfn2graph.create_intersection_graph | ( | inflow, | |
| outflow, | |||
intersection_file = "intersection_list.dat", |
|||
fracture_info = "fracture_info.dat" |
|||
| ) |
Create a graph based on topology of network.
Edges are represented as nodes and if two intersections
are on the same fracture, there is an edge between them in the graph.
Source and Target node are added to the graph.
Parameters
----------
inflow : string
Name of inflow boundary
outflow : string
Name of outflow boundary
intersection_file : string
File containing intersection information
File Format:
fracture 1, fracture 2, x center, y center, z center, intersection length
fracture_infor : str
filename for fracture information
Returns
-------
G : NetworkX Graph
Vertices have attributes x,y,z location and length. Edges has attribute length
Notes
-----
Aperture and Perm on edges can be added using add_app and add_perm functions
Definition at line 154 of file dfn2graph.py.
References pydfnworks.dfnGraph.dfn2graph.add_perm(), and pydfnworks.dfnGraph.dfn2graph.boundary_index().
Referenced by pydfnworks.dfnGraph.dfn2graph.create_graph().


| def pydfnworks.dfnGraph.dfn2graph.dump_fractures | ( | self, | |
| G, | |||
| filename | |||
| ) |
Write fracture numbers assocaited with the graph G out into an ASCII file inputs
Parameters
----------
self : object
DFN Class
G : NetworkX graph
NetworkX Graph based on the DFN
filename : string
Output filename
Returns
-------
Notes
-----
Definition at line 615 of file dfn2graph.py.
References pydfnworks.dfnGraph.dfn2graph.pull_source_and_target().

| def pydfnworks.dfnGraph.dfn2graph.dump_json_graph | ( | self, | |
| G, | |||
| name | |||
| ) |
Write graph out in json format
Parameters
----------
self : object
DFN Class
G :networkX graph
NetworkX Graph based on the DFN
name : string
Name of output file (no .json)
Returns
-------
Notes
-----
Definition at line 769 of file dfn2graph.py.
| def pydfnworks.dfnGraph.dfn2graph.greedy_edge_disjoint | ( | self, | |
| G, | |||
source = 's', |
|||
target = 't', |
|||
weight = 'None', |
|||
k = '' |
|||
| ) |
Greedy Algorithm to find edge disjoint subgraph from s to t.
See Hyman et al. 2018 SIAM MMS
Parameters
----------
self : object
DFN Class Object
G : NetworkX graph
NetworkX Graph based on the DFN
source : node
Starting node
target : node
Ending node
weight : string
Edge weight used for finding the shortest path
k : int
Number of edge disjoint paths requested
Returns
-------
H : NetworkX Graph
Subgraph of G made up of the k shortest of all edge-disjoint paths from source to target
Notes
-----
1. Edge weights must be numerical and non-negative.
2. See Hyman et al. 2018 "Identifying Backbones in Three-Dimensional Discrete Fracture Networks: A Bipartite Graph-Based Approach" SIAM Multiscale Modeling and Simulation for more details
Definition at line 654 of file dfn2graph.py.
| def pydfnworks.dfnGraph.dfn2graph.k_shortest_paths | ( | G, | |
| k, | |||
| source, | |||
| target, | |||
| weight | |||
| ) |
Returns the k shortest paths in a graph
Parameters
----------
G : NetworkX Graph
NetworkX Graph based on a DFN
k : int
Number of requested paths
source : node
Starting node
target : node
Ending node
weight : string
Edge weight used for finding the shortest path
Returns
-------
paths : sets of nodes
a list of lists of nodes in the k shortest paths
Notes
-----
Edge weights must be numerical and non-negative
Definition at line 514 of file dfn2graph.py.
Referenced by pydfnworks.dfnGraph.dfn2graph.k_shortest_paths_backbone().

| def pydfnworks.dfnGraph.dfn2graph.k_shortest_paths_backbone | ( | self, | |
| G, | |||
| k, | |||
source = 's', |
|||
target = 't', |
|||
weight = None |
|||
| ) |
Returns the subgraph made up of the k shortest paths in a graph
Parameters
----------
G : NetworkX Graph
NetworkX Graph based on a DFN
k : int
Number of requested paths
source : node
Starting node
target : node
Ending node
weight : string
Edge weight used for finding the shortest path
Returns
-------
H : NetworkX Graph
Subgraph of G made up of the k shortest paths
Notes
-----
See Hyman et al. 2017 "Predictions of first passage times in sparse discrete fracture networks using graph-based reductions" Physical Review E for more details
Definition at line 543 of file dfn2graph.py.
References pydfnworks.dfnGraph.dfn2graph.k_shortest_paths().

| def pydfnworks.dfnGraph.dfn2graph.load_json_graph | ( | self, | |
| name | |||
| ) |
Read in graph from json format
Parameters
----------
self : object
DFN Class
name : string
Name of input file (no .json)
Returns
-------
G :networkX graph
NetworkX Graph based on the DFN
Definition at line 795 of file dfn2graph.py.
| def pydfnworks.dfnGraph.dfn2graph.plot_graph | ( | self, | |
| G, | |||
source = 's', |
|||
target = 't', |
|||
output_name = "dfn_graph" |
|||
| ) |
Create a png of a graph with source nodes colored blue, target red, and all over nodes black
Parameters
----------
G : NetworkX graph
NetworkX Graph based on the DFN
source : node
Starting node
target : node
Ending node
output_name : string
Name of output file (no .png)
Returns
-------
Notes
-----
Image is written to output_name.png
Definition at line 714 of file dfn2graph.py.
| def pydfnworks.dfnGraph.dfn2graph.pull_source_and_target | ( | nodes, | |
source = 's', |
|||
target = 't' |
|||
| ) |
Removes source and target from list of nodes, useful for dumping subnetworks to file for remeshing
Parameters
----------
nodes :list
List of nodes in the graph
source : node
Starting node
target : node
Ending node
Returns
-------
nodes : list
List of nodes with source and target nodes removed
Notes
-----
Definition at line 587 of file dfn2graph.py.
Referenced by pydfnworks.dfnGraph.dfn2graph.dump_fractures().
