Skip to content

[Question] Comparison stationary heads for IMOD Python run vs IMOD Batch function #1766

@CasvHWSBrabantseDelta

Description

@CasvHWSBrabantseDelta

Hi Developers,

I am currently trying to import a regional gwf model from imod5 into imod python. I started with writing and running a stationary model and managed to get output. I did a check where I compared the heads from the stationary model in imod Python with heads from the stationary model runned with the RUNFILE batch function. I encountered some differences up to 30 cm on some places in the model, especially close to rivers. I was wondering if I entered exactly the same input settings for both model runs. The imported .prj file is exactly the same, so it has nothing to do with the input files. I also checked the solver settings and could not find what was different. Below I provide you the settings for both model runs. I also uploaded the projectfile and the IMS files from both runs.

Question
Can you help me with figuring out if all input settings for both model runs are exactly the same, or that I missed something? Could it otherwise just be a model uncertainty? I doubt that.

Kind regards,

Cas van Haperen, WS Brabantse Delta

Image

RUNFILE Batch Function
REM Running PRJ file, creating MODFLOW NAM file and writing results to output folder

ECHO FUNCTION=RUNFILE >model3.ini
ECHO PRJFILE_IN="E:\brabantmodel\AaofWeerijs\OPLEVERING\model\Initial_model_STAT\Turfvaart_ZoW_model_2025_STAT1.prj" >>model3.ini
ECHO SIM_TYPE=3 >>model3.ini
ECHO ISOLVE=1 >>model3.ini
ECHO ISTEADY=0 >>model3.ini
ECHO OUTPUT_FOLDER= "E:\brabantmodel\AaofWeerijs\OPLEVERING\OUTPUT\Turfvaart_ZoW_model_2025_STAT_new">>model3.ini
ECHO NAMFILE_OUT="E:\brabantmodel\AaofWeerijs\OPLEVERING\OUTPUT\Turfvaart_ZoW_model_2025_STAT\Turfvaart_ZoW_model_2025_STAT_new.NAM" >>model3.ini

REM Settings for simulation

ECHO SDATE=20130101000000 >>model3.ini
ECHO EDATE=20240101000000 >>model3.ini

ECHO ISS=0 >>model3.ini
ECHO ITT=3 >>model3.ini
ECHO IDT=1 >>model3.ini
ECHO NLAY = 43 >>model3.ini
ECHO NSTEP=1 >>model3.ini
ECHO NMULT=1 >>model3.ini
ECHO SSYSTEM=1 >>model3.ini
ECHO ISAVEENDDATE=0 >>model3.ini
ECHO ICONCHK=0 >>model3.ini
ECHO IDOUBLE=0 >>model3.ini
REM ECHO IDEFLAYER=2 >>model3.ini
ECHO SAVESHD=-1 >>model3.ini
ECHO WINDOW=92000.000,368000.000,113000.000,400000.000 >>model3.ini
ECHO CELLSIZE=100 >>model3.ini
ECHO BUFFER=0.0 >>model3.ini
ECHO BUFFERCS = 100 >>model3.ini

REM RUN WITH MODFLOW 6

ECHO MODFLOW6=E:\brabantmodel\AaofWeerijs\IMOD_V5_6\bin\MODFLOW6_v6.4.2.exe >>model3.ini

"E:\brabantmodel\AaofWeerijs\IMOD_V5_6\iMOD_V5_6.EXE" model3.ini
Pause

IMOD python settings

directory = Path("E:/brabantmodel/AaofWeerijs/OPLEVERING")
model_dir = directory / "model/Initial_model_STAT"
Dbase_dir = directory / "Dbase"
prj_path = model_dir / "Turfvaart_ZoW_model_2025_STAT1.prj"
log_file = model_dir / "build_MODFLOW6_model.log"
logger = get_logger(name="mijn script", log_level=logging.INFO, log_file=log_file) ### verander "mijn script" in de gewenste Log naam.

mf6_sim = from_imod5_to_mf6_model(prj_path=prj_path,times = pd.DatetimeIndex([pd.Timestamp("2013-01-01")]))
#%%
logger.info("clip model data")
mf6_dir = model_dir / "mf6_STAT"
gwf_model = mf6_sim["imported_model"]

xmin,ymin,xmax,ymax = 92000.000,368000.000,113000.000,400000.000
gwf_model = gwf_model.clip_box(x_min=xmin, y_min=ymin, x_max=xmax, y_max=ymax)
#%%
mf6_sim["imported_model"] = gwf_model

dis = gwf_model["dis"]
idomain = dis["idomain"]
mask = (idomain != 0)
mf6_sim.mask_all_models(idomain)

gwf_model["riv-2riv"].cleanup(dis=gwf_model["dis"])

gwf_model["oc"] = imod.mf6.OutputControl(save_head="last", save_budget="last",)

times_str =["2013-01-01", "2013-01-02","2013-01-03", "2013-01-04"]
mf6_sim.create_time_discretization(additional_times=times_str)

outer_dvclose = 0.001
outer_maximum = 500
inner_maximum = 25
inner_dvclose = 0.001
inner_rclose = 0.1
linear_acceleration = "cg"
mf6_sim["ims"] = imod.mf6.Solution(modelnames=["imported_model"],outer_dvclose=outer_dvclose, outer_maximum=outer_maximum,
inner_maximum=inner_maximum, inner_dvclose=inner_dvclose, inner_rclose=inner_rclose,
linear_acceleration=linear_acceleration)

if mf6_dir.exists():
shutil.rmtree(mf6_dir)

mf6_sim.write(directory = mf6_dir, validate=True)

mf6_exe = r"E:\brabantmodel\AaofWeerijs\IMOD_V5_6\bin\MODFLOW6_v6.4.2.exe"
mf6_sim.run(mf6path=mf6_exe)

Projectfile_STAT_model.txt

MFSIM_IMS6_batchfunction.txt

MFSIM_IMS_IMOD_PYTHON.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🤝 Accepted

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions