perioddata issue

63 views
Skip to first unread message

Peggy Nguyen

unread,
Sep 12, 2023, 8:10:41 AM9/12/23
to MODFLOW Users Group
Hi, I'm using Flopy to run a Modflow 6simulation and keep getting the following error:

ERROR REPORT: 1. Error in block PERIODDATA. Could not read variable of type DOUBLE PRECISION from the following line: 'END PERIODDATA'. UNIT ERROR REPORT: 1. ERROR OCCURRED WHILE READING FILE


Here is my tdis code. Can anyone see what I'm doing wrong?

time_units='DAYS'
nper = 3   
tdis_rc=[(365.0,1,1.00)]
perioddata=np.dtype('<f8,i4,<f8')
perioddata = tdis_rc 
tdis = flopy.mf6.ModflowTdis(sim,time_units=time_units, nper=nper,pname='tdis', perioddata = perioddata)   

I actually need 3 stress periods, so I've also tried with different variations of parens and brackets the following:
time_units='DAYS'
nper = 3   # Dimensions: Number of stress periods in the model
tdis_rc=[([(365.0,3650.0,3650.0)],1,1.00)]
perioddata=np.dtype('<f8,i4,<f8')
perioddata = tdis_rc # Perioddata (perlen (length of sress period, double), nstp (number of time steps in a stress period, integer), tsmult (multiplier for length of successive time steps, double)
tdis = flopy.mf6.ModflowTdis(sim,time_units=time_units, nper=nper,pname='tdis', perioddata = perioddata)   #options inputs
tdis

But that gave me the following error:
ERROR REPORT: 1. File unit 1002: Error converting "[(365.0" to a real number in following line: 2. [(365.0, 3650.0, 3650.0)] 1 1.00000000 UNIT ERROR REPORT: 1. ERROR OCCURRED WHILE READING FILE

Thanks in advance for reading.

Peggy

Peggy Nguyen

unread,
Sep 12, 2023, 10:43:03 AM9/12/23
to MODFLOW Users Group
I figured it out. Thanks for reading:

Code:
time_units='DAYS'
tdis_rc=[(365.0,1,1.00),(3650.0,1,1.00),(3650.0,1,1.00)]
nper = len(tdis_rc)    

perioddata=np.dtype('<f8,i4,<f8')
perioddata = tdis_rc
tdis = flopy.mf6.ModflowTdis(sim,pname='tdis',time_units=time_units, nper=nper, perioddata=perioddata)   

Output:
Block options -------------------- time_units {internal} ('days') Block dimensions -------------------- nper {internal} (3) Block perioddata -------------------- perioddata {internal} (rec.array([( 365., 1, 1.), (3650., 1, 1.), (3650., 1, 1.)], dtype=[('perlen', '<f8'), ('nstp', '<i4'), ('tsmult', '<f8')]))


Run start date and time (yyyy/mm/dd hh:mm:ss): 2023/09/12 7:20:28 Writing simulation list file: mfsim.lst Using Simulation name file: mfsim.nam Solving: Stress period: 1 Time step: 1 Solving: Stress period: 2 Time step: 1 Solving: Stress period: 3 Time step: 1 Run end date and time (yyyy/mm/dd hh:mm:ss): 2023/09/12 7:20:28 Elapsed run time: 0.236 Seconds Normal termination of simulation.

# File generated by Flopy version 3.4.2 on 09/12/2023 at 07:26:10.
BEGIN options
  TIME_UNITS  days
END options

BEGIN dimensions
  NPER  3
END dimensions

BEGIN perioddata
     365.00000000  1       1.00000000
    3650.00000000  1       1.00000000
    3650.00000000  1       1.00000000
END perioddata

Mart Dayniel

unread,
Sep 12, 2023, 11:15:33 PM9/12/23
to MODFLOW Users Group
Great that you figured it out. But btw, while your code should work as intented, there is a possible quick change to improve it.

The first assignment of perioddata is being overwritten by the second assignment. So if you really prefer to pass the perioddata to the Tdis constructor as a rec.array, you should do smth like:

perioddata = np.rec.array([(365.0, 1, 1.0)], np.dtype([('perlen', '<f8'), ('nstp', '<i4'), ('tsmult', '<f8')]))

But if not, your code can be shorten to this:

time_units='DAYS'
perioddata=[(365.0,1,1.00),(3650.0,1,1.00),(3650.0,1,1.00)]
nper = len(tdis_rc) 

tdis = flopy.mf6.ModflowTdis(sim,pname='tdis',time_units=time_units, nper=nper, perioddata=perioddata)   

Peggy Nguyen

unread,
Sep 13, 2023, 10:47:30 AM9/13/23
to MODFLOW Users Group
Thanks so much, Mart! There's always little nuances...

Peggy

Reply all
Reply to author
Forward
0 new messages