A Python class to export Modflow 2005 model 3D geometry and parameters to Vtk - Tutorial

Generating 3D visualizations of groundwater models is essential to analyze the flow regime, perform quality checks and see the interaction of the groundwater body with external factors / boundary conditions. The Flopy library has tools to export the parameters, boundary conditions and results that we have modified and compiled within a Python class. The use of this class allows the generation of Vtk files on a friendly way and in few steps. The tutorial also includes a representation of the parameters generated in ParaView.

We have another Python class for Modflow 6 model available on this link.

Tutorial

Code

from workingTools import Mf2005VtkGenerator
# load model for examples
namFile = "ModelWebinar1d.nam"
modelWs = "../Model/"
exeName = "../Bin/"
vtkDir = "../Vtk"
vtkGen = Mf2005VtkGenerator(namFile=namFile,
                         modelWs=modelWs,
                         exeName=exeName,
                         vtkDir=vtkDir)
#load model
vtkGen.loadModel()
Check for files in '../Vtk'.
Deleted file: ../Vtk\modelGeometry.vtk
Deleted file: ../Vtk\modelParameters.vtk
Deleted file: ../Vtk\param_hk.npy
Deleted file: ../Vtk\param_ibound.npy
Deleted file: ../Vtk\param_ss.npy
Deleted file: ../Vtk\param_strt.npy
Deleted file: ../Vtk\param_sy.npy
Deleted file: ../Vtk\param_vka.npy

All files in '../Vtk' have been deleted.



C:\Users\saulm\anaconda3\Lib\site-packages\flopy\mbase.py:97: UserWarning: The program ../Bin/ does not exist or is not executable.
  warn(



 Models in simulation: ModelWebinar1d
#get package list
vtkGen.getPackageList()
Package list: ['DIS', 'BAS6', 'OC', 'NWT', 'UPW', 'DRN', 'RCH', 'EVT']
#generate model geometry as vtk and parameter array
vtkGen.generateGeometryArrays()
#generate parameter vtk
vtkGen.generateParamVtk() 
Parameter Vtk Generated
#not implemented yet!
#generate bc and obs vtk
#vtkGen.generateBcObsVtk()

Input data

You can download the input data on this link.

Comment

Saul Montoya

Saul Montoya es Ingeniero Civil graduado de la Pontificia Universidad Católica del Perú en Lima con estudios de postgrado en Manejo e Ingeniería de Recursos Hídricos (Programa WAREM) de la Universidad de Stuttgart con mención en Ingeniería de Aguas Subterráneas y Hidroinformática.

 

Suscribe to our online newsletter

Subscribe for free newsletter, receive news, interesting facts and dates of our courses in water resources.