Optimization with EVT package - flopy/mf6

27 views
Skip to first unread message

Lærke Ditlevsen

unread,
Nov 24, 2025, 6:03:48 AM (7 days ago) Nov 24
to MODFLOW Users Group
Dear all,

I'm still pretty new to coding and MF6 so pardon if my phrasing is not precise.

I've encountered that it takes a very long time to build the EVT package (~2-3 minutes), and similarly the EVT step takes a long time during the writing simulation part (~3-4 minutes).

I'm using MF6 and have a DISV grid and a transient setup (I'm simulating daily steps for a year), writing and running with flopy.

My understanding is the EVT setup is cell-id based:
From the flopy documentation:
stress_period_data ([cellid, surface, rate, depth, pxdp, petm, petm0, aux,) 

-- Since I have a transient setup, the EVT rate changes daily, and I am applying EVT rates to all top cells, meaning its a huge array with each cell, layer and rate x 365. Therefore it seems to take a long time to build and later write the simulation.

Am I understanding the setup wrong? or is there any way to optimize it? What I don't get is other packages (like the RCH package) seems to be able to be layer based, instead of cell based. Is it possible to do layer based EVT setup?

I wish to run a monte-carlo setup to perform a sensitivity analysis, so when running 500-1000 simulations, it has a huge impact that it takes so long! The other packages maximum take ~10-20 seconds to write, most maybe just 1 second.

I'll past in some of my code, below - I'll be happy to learn if there is a better way for the EVT package :-)!

Kind regards,
Lærke


Code snippets:
evt_cells = [((evt_layer, node), surf, exd)
             for node, surf, exd in zip(nodes, et_surface, ex_depth)]

evt_spd = {}

for i in range(nper_):
        rate = float(et_values[i])
        evt_spd[i] = [(cid, surf, rate, exd) for (cid, surf, exd) in evt_cells]

evt = flopy.mf6.ModflowGwfevt(
        model=gwf,
        loading_package=False,
        print_input=None,
        print_flows=None,
        save_flows=None,
        maxbound=len(nodes),
        stress_period_data= evt_spd,
        filename='{}_evt.evt'.format(sim_name),
        pname='{}_evt'.format(sim_name),
)

Richard Winston

unread,
Nov 24, 2025, 8:06:10 AM (7 days ago) Nov 24
to mod...@googlegroups.com
If you look at mf6io.pdf, you will see that there are two options for EVT. One option is to specify EVT using arrays. I don't know whether using that option would speed things up for you. Recharge might be faster for you because you might be reusing recharge in multiple stress periods. 

--
This group was created in 2004 by Mr. C. P. Kumar, Former Scientist 'G', National Institute of Hydrology, Roorkee. Please visit his webpage at https://www.angelfire.com/nh/cpkumar/
---
You received this message because you are subscribed to the Google Groups "MODFLOW Users Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modflow+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/modflow/9b54bd79-ed5d-4a03-9b12-79c7d5c1c3f2n%40googlegroups.com.

Lærke Ditlevsen

unread,
Nov 26, 2025, 8:12:53 AM (5 days ago) Nov 26
to MODFLOW Users Group
Hi Richard,

Thank you for your help - the mf6io.pdf absolutely pointed me in the right direction (I had only been looking at the flopy documentation, Documentation for the MODFLOW 6  Groundwater Flow Model chapter 6 - Modeling Techniques and Applied Groundwater Modeling 2nd edition. It really makes a difference to read other sources)!

It made me realize recharge was faster because I was using rcha not rch - so as you say I now use evta instead of evt. It has sped the process up immensely!

Pasting my modified setup below, in case it could help someone in the future.

Cheers, Lærke

    surface_list = et_surface.tolist()
    rate_list = et_values.tolist()
    depth_list = ex_depth.tolist()


    surface_dict = {}
    rate_dict    = {}
    depth_dict   = {}

    for per in range(nper_):
        rate_val = rate_list[per]
        surface_dict[per] = surface_list            
        depth_dict[per] = depth_list                  
        rate_dict[per] = [float(rate_val)] * ncells

    # create EVT package
    evt = flopy.mf6.ModflowGwfevta(
        model=gwf,
        loading_package=False,
        print_input=None,
        print_flows=None,
        save_flows=None,
        surface = surface_dict,
        rate = rate_dict,
        depth = depth_dict,
        filename='{}_evt.evt'.format(sim_name),
        pname='{}_evt'.format(sim_name),
    )
Reply all
Reply to author
Forward
0 new messages