Esempio n. 1
0
mm = flopy.plot.ModelMap(model=ms)
mm.plot_grid()
flopy.plot.plot_shapefile(rf2shp,
                          ax=ax,
                          facecolor='lightgrey',
                          edgecolor='none')
flopy.plot.plot_shapefile(rf1shp, ax=ax, linewidth=10, color='darkblue')
flopy.plot.plot_shapefile(rf0shp, ax=ax, facecolor='red', radius=1)
mpl.pyplot.savefig(os.path.join(model_ws, 'fig1.png'))

g.build(verbose=True)

# Plot the Grid
fig = plt.figure(figsize=(15, 15))
ax = fig.add_subplot(1, 1, 1, aspect='equal')
g.plot(ax, linewidth=0.5)
flopy.plot.plot_shapefile(rf2shp,
                          ax=ax,
                          facecolor='lightgrey',
                          edgecolor='none',
                          alpha=0.2)
flopy.plot.plot_shapefile(rf1shp,
                          ax=ax,
                          linewidth=10,
                          alpha=0.2,
                          color='darkblue')
flopy.plot.plot_shapefile(rf0shp, ax=ax, facecolor='red', radius=1, alpha=0.2)
mpl.pyplot.savefig(os.path.join(model_ws, 'fig2.png'))

mu = flopy.modflow.Modflow(model_ws=model_ws, modelname='mfusg')
disu = g.get_disu(mu)
#%% Build the Grid
# note: more refinement means longer run time
start = time.time()
print('Started "Build the Grid" cell.')

g.build(verbose=False)

end = time.time()
print('"Build the Grid" cell finished after ' + 
      '{0:0.2f} minutes'.format((end-start)/60))


#%% PLOT GRIDGEN OUTPUTS (POST-REFINEMENT)
fig = plt.figure(figsize=(15, 15))
ax = fig.add_subplot(1, 1, 1, aspect='equal')
g.plot(ax, linewidth=0.5)
flopy.plot.plot_shapefile( miss_riv_fp, ax=ax, facecolor='none', edgecolor='blue', alpha=1 )
flopy.plot.plot_shapefile( mod_dom_fp, ax=ax, facecolor='none', edgecolor='yellow', alpha=1 )
flopy.plot.plot_shapefile( idot_wells_fp, ax=ax, facecolor='red', edgecolor='red', alpha=1 )
flopy.plot.plot_shapefile( ambot_fp, ax=ax, facecolor='none', edgecolor='green', alpha=1 )


#%% CREATE A FLOPY ModflowDisu OBJECT
mu = flopy.modflow.Modflow(model_ws=model_ws, modelname='mfusg')
disu = g.get_disu(mu)
disu.write_file()




Esempio n. 3
0
]
refine_paths = [
    os.path.join(sig_dir, 'sim', 'refine', i + '.shp') for i in refine_names
]
refine_dic = {k: v for k, v in zip(refine_names, refine_paths)}

for ref_id, ref_path in refine_dic.items():
    feature = ref_path.replace('.shp', '')
    ftype = 'polygon'
    level = ref_id.split('_')[1]
    g.add_refinement_features(feature, ftype, level, range(nlay))

# ---- Build new grid ----
model_utils.cprint('Building Gridgen model ...')
g.build()
'''
fig = plt.figure(figsize=(15, 15))
ax = fig.add_subplot(1, 1, 1, aspect='equal')
g.plot(ax, linewidth=0.3)
plt.show()
'''

###############################################################################################################################
#                                      Fetch DISV properties & build icpl dictionnary                                         #
###############################################################################################################################
model_utils.cprint('Processing Gridgen intersection ...')
# ---- Fetch DISV properties
gridprops = g.get_gridprops_disv()
# ---- Fetch centroids coordinates
cx = [cell[1] for cell in gridprops['cell2d']]
cy = [cell[2] for cell in gridprops['cell2d']]