9 Functions for using FEHM in dfnWorks
14 """Corrects volumes in stor file to account for apertures
27 Currently does not work with cell based aperture
30 if self.flow_solver !=
"FEHM":
31 error =
"ERROR! Wrong flow solver requested\n"
32 sys.stderr.write(error)
35 self.stor_file = self.inp_file[:-4] +
'.stor'
36 self.mat_file = self.inp_file[:-4] +
'_material.zone'
37 f = open(
"convert_stor_params.txt",
"w")
38 f.write(
"%s\n" % self.mat_file)
39 f.write(
"%s\n" % self.stor_file)
40 f.write(
"%s" % (self.stor_file[:-5] +
'_vol_area.stor\n'))
41 f.write(
"%s\n" % self.aper_file)
45 cmd = os.environ[
'CORRECT_STOR_EXE'] +
' convert_stor_params.txt'
46 failure = subprocess.call(cmd, shell=
True)
48 error =
'ERROR: stor conversion failed\nExiting Program\n'
49 sys.stderr.write(error)
52 print(
'--> Time elapsed for STOR file conversion: %0.3f seconds\n' %
57 """ FEHM wants an empty line at the end of the perm file
58 This functions adds that line return
70 Only adds a new line if the last line is not empty
73 lines = fp.readlines()
77 if len(lines[-1].split()) != 0:
78 print(
"--> Adding line to perm.dat")
79 fp = open(
"perm.dat",
"a")
98 See https://fehm.lanl.gov/ for details about FEHM
101 print(
"--> Running FEHM")
102 if self.flow_solver !=
"FEHM":
103 error =
"ERROR! Wrong flow solver requested\n"
104 sys.stderr.write(error)
108 shutil.copy(self.dfnFlow_file, os.getcwd())
110 error =
"-->ERROR copying FEHM run file: %s" % self.dfnFlow_file
111 std.stderr.write(error)
114 path = self.dfnFlow_file.strip(self.local_dfnFlow_file)
115 fp = open(self.local_dfnFlow_file)
117 fehm_input = line.split()[-1]
120 shutil.copy(path + fehm_input, os.getcwd())
122 error =
"-->ERROR copying FEHM input file:\n" % fehm_input
123 sys.stderr.write(error)
128 subprocess.call(os.environ[
"FEHM_EXE"] +
" " + self.local_dfnFlow_file,
131 print(
"FEHM Complete")
132 print(
"Time Required %0.2f Seconds" % (time() - tic))
def correct_perm_for_fehm()
def correct_stor_file(self)