0

我在 FloPY 中构建了一个 MODFLOW USG-Transport 模型(使用 Gridgen 的四叉树网格),我希望能够在 Vistas 等 GUI 中打开它,以便其他不使用 FloPy 的人可以使用它。

我需要一个 .gsf 文件才能做到这一点。我尝试使用 PEST 实用程序 gridgen2gsf 但并非所有节点连接都包含在该文件中。

有没有人为 USG 模型写过 gsf 文件并愿意帮我一把?

干杯,艾玛

4

1 回答 1

0

我遇到了同样的问题。我需要一个扩展名为 .gsf 的文件来将软盘模型导入 gms。我写了以下代码:

g=Gridgen(dis,exe_name='gridgen_x64', model_ws=gridgen_dir)
ncells = g.get_nodes()
verts, iverts = g.get_verts_iverts(ncells)
# vertices=g.get_vertices(ncells)
vertices = g.get_gridprops_vertexgrid()
lenverts=len(verts)
f = open("test.gsf", "a")
f.write('UNSTRUCTURED\n' + str(g.get_nodes()) + ' ' + str(g.get_nlay()) + ' ' + 
        str(1) + ' ' + str(1) + '\n' + str(
        lenverts * (nlay+1)) + '\n')

tuples = []
count = 0
for i in g.get_top():
    if count != ncells:
       for j in g._vertdict[count]:
           # np.savetxt(f, (j+(i,),), delimiter=' ', fmt='%g')
           tuples.append(j + (i,))
    count += 1
count=ncells-ncells/nlay
for i in list(g.get_bot()[int(ncells-ncells/nlay):int(ncells)]):
    for j in g._vertdict[count]:
        tuples.append(j + (i,))
    count += 1

nvertexes = list(dict.fromkeys(tuples))

for i in range(0, ncells):
    iverts[i] = [x + 1 for x in iverts[i]]
    del iverts[i][-1]
for i in nvertexes:
    np.savetxt(f, (i,), delimiter=' ', fmt='%g')
nodesgfs = []
nodeiter=0
for j in range(0,nlay):
    for i in g.get_nod_recarray()[nodeiter:]:
        ivertex=[x + lenverts*(j) for x in iverts[nodeiter]]
        nodesgfs.append((i[0] + 1,) + (i[2],) + (i[3],) + (i[4],) + (i[1] + 1,) 
                       + (len(ivertex)*2,) + tuple([x + lenverts*(j+1) for x in 
                        iverts[nodeiter]])+tuple(ivertex))
        nodeiter += 1
        if nodeiter in [numcell for numcell in range(int(ncells/nlay),ncells,int(ncells/nlay))]:
            break

nodesgfs = list(dict.fromkeys(nodesgfs))
for i in nodesgfs:
    np.savetxt(f, (i,), delimiter=' ', fmt='%g')
于 2021-06-04T22:43:31.180 回答