以水力压裂生成的离散裂缝为例,指定射孔坐标位置,裂缝半长,缝高,渗透率等参数,通过python语句运算,自动生成文件,python语句如下:
File1 = open(“fraclocation.txt”,”r”) **打开文件
list = [] **列表
for line in File1: **for循环 文件
stripped_line = line.strip()
line_list = stripped_line.split()
list.append(line_list) **列表填空
File1.close() **关文件
XF = float(input(“Fracture Half-Length: “)) ** 半长,小数
HeightUp = float(input(“Fracture Heigth Above Perforation: “)) **裂缝高度
HeightDown = float(input(“Fracture Heigth Below Perforation: “)) **裂缝高度
Perm = float(input(“Fracture Perm: “)) **裂缝渗透率
Width = float(input(“Fracture Width: “)) **裂缝开度
I=1 **步长
with open(‘DFN.txt’, ‘w’) as f: **开启文件
for line in list: **循环列表
print(“BEGIN_DFN ‘dfn”+str(i)+”‘”, “CMG 1”, file = f) **打印 DFN表头
print(“PERM-DF ALL” , Perm, file = f) **打印 DFN裂缝渗透率
print(“APER-DF ALL”, Width, file = f) **打印 DFN裂缝开度
print(“VERTEX”, file = f) **打印 DFN裂缝坐标
print(float(line[0]), float(line[1]) + XF, float(line[2]) – HeightDown, file = f) **打印第一行坐标格式
print(float(line[0]), float(line[1]) + XF, float(line[2]) + HeightUp, file = f) **打印第二行坐标格式
print(float(line[0]), float(line[1]) – XF, float(line[2]) + HeightUp, file = f) **打印第三行坐标格式
print(float(line[0]), float(line[1]) – XF, float(line[2]) – HeightDown, file = f) **打印第四行坐标格式
print(“END_DFN”,file=f) **打印结束语句
i=i+1 **循环步
f.close() ** 结束
1 Answers
2021-08-16