Reputation: 43
I know that Flopy can export VTK files from a MF2005 dataset (e.g. flopy3_vtk_export.ipynb), however I tried to get that example to work with a MODFLOW 6 dataset and a few code edits, but had no success.
Does Flopy actually support VTK export from MODFLOW 6 datasets, or is that functionality just not available yet?
In response to Sarah Leray's reply:
I tried to use the vtk.export_heads function and found that the model object seemed to be expecting a number of attributes that didn't exist in the MF6 formulation. Did you face this problem, and if so how did you resolve it? Modified source code?
import os
import sys
try:
import flopy
except:
fpth = os.path.abspath(os.path.join('..', '..'))
sys.path.append(fpth)
import flopy
from flopy.export import vtk
sim_name = "example_model"
sim_path = os.path.join("data", "flopy_mf6_tutorial")
heads_file_name = sim_name + ".hds"
heads_file = os.path.join(sim_path, heads_file_name)
head_output_folder = os.path.join(sim_path, "heads")
# load the simulation
loaded_sim = flopy.mf6.MFSimulation.load(sim_name, 'mf6', 'mf6', sim_path)
#export VTK heads
vtk.export_heads(loaded_sim, heads_file, head_output_folder, smooth=False, kstpkper=[(0,0)], point_scalars=False, nanval=-999.99)
...and I get an 'attribute error: verbose' because verbose doesn't exist in mf6.MFSimulation (but does in the equivalent modflow.Modflow used when exporting from MF2005 etc). I forced verbose to False just to get the code to progress, then there is an 'attribute error: modelGrid', which looks like a more substantial and complicated missing attribute.
Upvotes: 0
Views: 568
Reputation: 11
# load the simulation
loaded_sim = flopy.mf6.MFSimulation.load(sim_name, 'mf6', 'mf6', sim_path)
#export VTK heads
vtk.export_heads(loaded_sim, heads_file, head_output_folder, smooth=False, kstpkper=[(0,0)], point_scalars=False, nanval=-999.99)
It looks like you're exporting the simulation, try export the simulation instead, you can use a line like this:
vtk.export_model(loaded_sim.get_model(), head_output_folder)
Upvotes: 0
Reputation: 11
I also wanted to export the results of a modflow 6 model in vtk format. The routines exist (vtk.export_heads, vtk.export_model, etc). You can check these pages: https://flopy.readthedocs.io/en/3.3.2/source/flopy.export.vtk.html https://flopy.readthedocs.io/en/3.3.2/source/flopy.export.utils.html
Unfortunately, I faced extremely long computation times. I have a two million mesh model and it takes hours. For now, it's crippling
Let me know if you find a way to reduce export times!
Upvotes: 1