Flopy - Assigning time series in recharge package

318 views
Skip to first unread message

Eduardo DeSousa

unread,
Jul 13, 2021, 5:37:19 AM7/13/21
to MODFLOW Users Group

I've been trying to assign transient recharge in Flopy using a time series, boundnames and multipliers as follows (note that I'm using discretization with vertices (DISV)):





rch_period = {} rch_bcs = flopy.mf6.ModflowGwfrch.stress_period_data.empty(gwf, maxbound = disv.ncpl.get_data(), aux_vars=['MULTIPLIER'], boundnames='True',timeseries=True) for ii in range(len(rch_bcs[0])): if zones[ii] == 4: rch_zone = 'Rch_bas' else: rch_zone = 'Rch_sed' rch_bcs[0][ii]=((0,ii), 'Rainfall',0.5,rch_zone) rch_period[0] = list(rch_bcs[0]) pack_rch = flopy.mf6.ModflowGwfrch(gwf, fixed_cell=False, pname='Rainfall', maxbound = disv.ncpl.get_data(), auxiliary='MULTPLIER', auxmultname='MULTIPLIER', boundnames=True, stress_period_data = rch_period) pack_rch.ts.initialize(filename='tseries_rch.ts', timeseries=ts_data_rain, time_series_namerecord='Rainfall', interpolation_methodrecord='stepwise'


This part of the codes runs without any error message, but when I look in to the package stress period data using:

pack_rch.stress_period_data.get_data()

I get the following:



{0: rec.array([(((0, 0), 'Rainfall', 0.5, 'Rch_sed'), None, nan, None), (((0, 1), 'Rainfall', 0.5, 'Rch_bas'), None, nan, None), (((0, 2), 'Rainfall', 0.5, 'Rch_bas'), None, nan, None), ..., (((0, 24865), 'Rainfall', 0.5, 'Rch_bas'), None, nan, None), (((0, 24866), 'Rainfall', 0.5, 'Rch_bas'), None, nan, None), (((0, 24867), 'Rainfall', 0.5, 'Rch_bas'), None, nan, None)], dtype=[('cellid', 'O'), ('recharge', 'O'), ('MULTPLIER', '<f8'), ('boundname', 'O')])


I

t returns a rec.array of tuples for stress period 0 (which is what I want), but the tuples are disarranged, as :

(((0, 0), 'Rainfall', 0.5, 'Rch_sed'), None, nan, None)

with all the members packed in the first tuple member while it should be:

((0, 0), 'Rainfall', 0.5, 'Rch_sed')

Any suggestions on where I'm going wrong here?


Thanks in advance!

Kevin Hayley

unread,
Jul 14, 2021, 12:34:51 AM7/14/21
to mod...@googlegroups.com
Hi Ed,
I recently went through this when assigning an output from lumprem to a mf6 model.
for the timeseries data made a list of tuples called tsdata, with each tuple containing 4 entries. one for the time and 3 for the value of the three recharge timeseries that I was assigning to my model in 3 zones eg. tsdata=[(t_0,r1_0,r2_0,r3_0),(t_1,r1_1,r2_1,r3_1),......]
for the stress period data it was a dictionary with one key (0) and a list of tuples containing 4 entries ((lay,row,col),tsname,multiplier,boundname) eg rchspd={0:[((0,row,col),'rech1',1,'rch1'),.......]}
then used the following code to apply recharge to the model,
"""
rch = flopy.mf6.ModflowGwfrch(gwf, filename='{}.rch'.format(gwfname),
                                pname='rch', fixed_cell=True,
                                auxiliary='MULTIPLIER', auxmultname='MULTIPLIER',
                                print_input=True, print_flows=True,
                                save_flows=True, boundnames=True,
                                maxbound=nrow*ncol, stress_period_data=rchspd)#initialize the ts
rch.ts.initialize(filename='rch.ts', timeseries=tsdata,
                 time_series_namerecord=['rech1','rech2','rech3'],
                 interpolation_methodrecord=['stepwise','stepwise','stepwise'])


ts_0=gwf.get_package('ts_0')
ts_0.write()
rch.write() 
"""
cheers
Kevin

--
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 on the web visit https://groups.google.com/d/msgid/modflow/c3f02f3b-b90d-4707-8168-2ee801312cd5n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages