1 __author__ =
"Jeffrey Hyman and Satish Karra"
3 __maintainer__ =
"Jeffrey Hyman and Satish Karra"
4 __email__ =
"jhyman@lanl.gov"
18 Class for DFN Generation and meshing
21 * jobname: name of job, also the folder where output files are stored
22 * ncpu: number of CPUs used in the job
23 * dfnGen file: the name of the dfnGen input file
24 * dfnFlow file: the name of the dfnFlow input file
25 * dfnTrans file: the name of the dfnFlow input file
26 * local prefix: indicates that the name contains only the most local directory
27 * vtk_file: the name of the VTK file
28 * inp_file: the name of the INP file
29 * uge_file: the name of the UGE file
30 * mesh_type: the type of mesh
31 * perm_file: the name of the file containing permeabilities
32 * aper_file: the name of the file containing apertures
33 * perm_cell file: the name of the file containing cell permeabilities
34 * aper_cell_file: the name of the file containing cell apertures
35 * freeze: indicates whether the class attributes can be modified
36 * h : FRAM length scale
66 from pydfnworks.dfnFlow.pflotran import lagrit2pflotran, pflotran, parse_pflotran_vtk_python, pflotran_cleanup, write_perms_and_correct_volumes_areas, zone2ex
76 from pydfnworks.dfnGraph.dfn2graph import create_graph, k_shortest_paths_backbone, dump_json_graph, load_json_graph, plot_graph, greedy_edge_disjoint, dump_fractures, add_fracture_source, add_fracture_target
88 local_dfnFlow_file='',
92 flow_solver="PFLOTRAN",
93 inp_file='full_mesh.inp',
142 """Read command lines for use in dfnWorks.
150 options : argparse function
157 Path to working directory (Mandatory)
159 Number of CPUS (Optional, default=4)
161 Input file with paths to run files (Mandatory if the next three options are not specified)
163 Absolute path to the prune Input File
165 Path to another DFN run that you want to base the current run from
167 True/False Set True for use with cell based aperture and permeabuility (Optional, default=False)
172 parser = argparse.ArgumentParser(
173 description=
"Command Line Arguments for dfnWorks")
174 parser.add_argument(
"-name",
179 parser.add_argument(
"-ncpu",
183 help=
"Number of CPUs")
184 parser.add_argument(
"-input",
188 help=
"input file with paths to run files")
189 parser.add_argument(
"-path",
193 help=
"Path to directory for sub-network runs")
194 parser.add_argument(
"-cell",
198 help=
"Binary For Cell Based Apereture / Perm")
199 parser.add_argument(
"-prune_file",
203 help=
"Path to prune DFN list file")
204 options = parser.parse_args()
205 if options.jobname ==
"":
206 error =
"Error: Jobname is required. Exiting.\n"
207 sys.stderr.write(error)
213 '''Parse command line inputs and input files to create and populate dfnworks class
222 DFN class object populated with information parsed from the command line. Information about DFN class is in dfnworks.py
230 print(
"Command Line Inputs:")
232 print(
"\n-->Creating DFN class\n")
233 DFN =
DFNWORKS(jobname=options.jobname, ncpu=options.ncpu)
235 print(
"=" * 80 +
"\n")
236 print(
"\n--> Creating DFN class")
237 print(
'--> Jobname: ', DFN.jobname)
238 print(
'--> Number of cpus requested: ', DFN.ncpu)
240 if options.input_file ==
"":
241 error =
"ERROR!!! Input file must be provided.\n"
242 sys.stderr.write(error)
245 print(
"--> Reading Input from " + options.input_file)
247 with open(options.input_file,
"r")
as f:
248 for line
in f.readlines():
249 line = line.rstrip(
'\n')
252 DFN.dfnGen_file = line[1]
253 print(
'--> dfnGen input file: ', DFN.dfnGen_file)
254 DFN.local_dfnGen_file = line[1].split(
'/')[-1]
255 elif "dfnFlow" in line:
256 DFN.dfnFlow_file = line[1]
257 print(
'--> dfnFlow input file: ', DFN.dfnFlow_file)
258 DFN.local_dfnFlow_file = line[1].split(
'/')[-1]
259 elif "dfnTrans" in line:
260 DFN.dfnTrans_file = line[1]
261 print(
'--> dfnTrans input file: ', DFN.dfnTrans_file)
262 DFN.local_dfnTrans_file = line[1].split(
'/')[-1]
264 error =
"ERROR Reading Input File\nUnknown line: %s\n" % line
265 sys.stderr.write(error)
268 if options.path !=
"":
269 if not options.path.endswith(
'/'):
270 options.path += os.sep
271 DFN.path = options.path
272 print(
'--> DFN Path: ', DFN.path)
276 if options.prune_file !=
"":
277 DFN.prune_file = options.prune_file
278 print(
'--> DFN Prune File: ', DFN.prune_file)
282 if options.cell
is True:
283 print(
'--> Expecting Cell Based Aperture and Permeability')
284 DFN.aper_cell_file =
'aper_node.dat'
285 DFN.perm_cell_file =
'perm_node.dat'
287 DFN.aper_file =
'aperture.dat'
288 DFN.perm_file =
'perm.dat'
290 print(
"\n--> Creating DFN class: Complete")
291 print(
"=" * 80 +
"\n")
def __init__(self, jobname='', ncpu='', local_jobname='', dfnGen_file='', output_file='', local_dfnGen_file='', dfnFlow_file='', local_dfnFlow_file='', dfnTrans_file='', path='', prune_file='', flow_solver="PFLOTRAN", inp_file='full_mesh.inp', uge_file='', stor_file='', vtk_file='', mesh_type='dfn', perm_file='', aper_file='', perm_cell_file='', aper_cell_file='', dfnTrans_version='', num_frac='', h='')
def commandline_options()