Edit mf6 model

415 views
Skip to first unread message

Diego Hidalgo

unread,
Nov 30, 2020, 11:34:53 PM11/30/20
to MODFLOW Users Group
Hello I am a new student in groundwater modeling.
I am loading an existing mf6 model and I want to edit some specific packages (like the conductivity in the npf package) does anyone know how can I do it?
Thanks you!
Regards

Mak.Gurukul

unread,
Dec 1, 2020, 1:42:54 AM12/1/20
to MODFLOW Users Group
Which GUI you are using to load the existing mf6 model? You have to use the same GUI by which the mf6 model was originally prepared to edit the parameters.

Diego Hidalgo

unread,
Dec 1, 2020, 10:23:06 AM12/1/20
to MODFLOW Users Group
Sorry I forgot a lot of information. I want to load an existing model (which I did it in groundwater vistas) with flopy and there I want to change some parameters like the conductivity.
At the moment I can load it without problem, I can run it again, but I don't know how to edit it

Christian Langevin

unread,
Dec 3, 2020, 10:52:01 AM12/3/20
to MODFLOW Users Group
If you have a flopy MODFLOW 6 model in memory, you can access and set all of the package variables.  There is a lot of flexibility, but that means the syntax can be a little difficult.  

Here is a simple example that shows how to see and set the hydraulic conductivity array for a model that is in memory.  

import os
import numpy as np
import flopy
ws = "./mymodel"
name = "mymodel"
sim = flopy.mf6.MFSimulation(sim_name=name, sim_ws=ws)
tdis = flopy.mf6.ModflowTdis(sim)
ims = flopy.mf6.ModflowIms(sim)
gwf = flopy.mf6.ModflowGwf(sim, modelname=name, save_flows=True)
dis = flopy.mf6.ModflowGwfdis(gwf, nrow=10, ncol=10)
npf = flopy.mf6.ModflowGwfnpf(gwf)

# get gwf model
gwf = sim.get_model("mymodel")

# get npf package
npf = gwf.get_package("npf")

# show the data in hydraulic conductivity
print(npf.k)

# show the actual hydraulic conductivity array
print(npf.k.array)

# set k as a constant
npf.k.set_data(10.)
print(npf.k)

# set k as a random array
npf.k.set_data(np.random.random((10,10)))
print(npf.k)

# plot it
npf.k.plot(mflay=0)

Oscar Fabian Sanchez Ortiz

unread,
Dec 4, 2020, 12:01:19 AM12/4/20
to MODFLOW Users Group
Is there a way to change only one package and not rewrite all files? Just that file that has changed

Diego Hidalgo

unread,
Dec 4, 2020, 12:01:29 AM12/4/20
to MODFLOW Users Group
Thanks you! That's what I was looking for!

Christian Langevin

unread,
Dec 4, 2020, 8:42:49 AM12/4/20
to MODFLOW Users Group
npf.write()
Reply all
Reply to author
Forward
0 new messages