Exemple #1
0
    def __init__(self, model, laytyp=0, layavg=0, chani=1.0, layvka=0, laywet=0, iupwcb = 53, hdry=-1E+30, iphdry = 0,\
                 hk=1.0, hani=1.0, vka=1.0, ss=1e-5, sy=0.15, vkcb=0.0, noparcheck=False,        \
                 extension='upw', unitnumber = 31):
        Package.__init__(self, model, extension, 'UPW', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# UPW for MODFLOW-NWT, generated by Flopy.'
        self.url = 'upw_upstream_weighting_package.htm'
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        # item 1
        self.iupwcb = iupwcb # Unit number for file with cell-by-cell flow terms
        self.hdry = hdry # Head in cells that are converted to dry during a simulation
        self.npupw = 0 # number of UPW parameters
        self.iphdry = iphdry
        self.laytyp = util_2d(model,(nlay,),np.int,laytyp,name='laytyp')
        self.layavg = util_2d(model,(nlay,),np.int,layavg,name='layavg')
        self.chani = util_2d(model,(nlay,),np.int,chani,name='chani')
        self.layvka = util_2d(model,(nlay,),np.int,layvka,name='vka')
        self.laywet = util_2d(model,(nlay,),np.int,laywet,name='laywet')

        self.options = ' '
        if noparcheck: self.options = self.options + 'NOPARCHECK  '

        self.hk = util_3d(model,(nlay,nrow,ncol),np.float32,hk,name='hk',locat=self.unit_number[0])
        self.hani = util_3d(model,(nlay,nrow,ncol),np.float32,hani,name='hani',locat=self.unit_number[0])
        self.vka = util_3d(model,(nlay,nrow,ncol),np.float32,vka,name='vka',locat=self.unit_number[0])
        self.ss = util_3d(model,(nlay,nrow,ncol),np.float32,ss,name='ss',locat=self.unit_number[0])
        self.sy = util_3d(model,(nlay,nrow,ncol),np.float32,sy,name='sy',locat=self.unit_number[0])
        self.vkcb = util_3d(model,(nlay,nrow,ncol),np.float32,vkcb,name='vkcb',locat=self.unit_number[0])
        self.parent.add_package(self)
Exemple #2
0
 def __init__(self, model, extension='list'):
     #Call ancestor's init to set self.parent, extension, name and 
     #unit number
     Package.__init__(self, model, extension, 'LIST', 7) 
     #self.parent.add_package(self) This package is not added to the base 
     #model so that it is not included in get_name_file_entries()
     return
Exemple #3
0
    def __init__(self, model, ipakcb=0, stress_period_data=None, dtype=None,
                 extension='riv', unitnumber=18, options=None, **kwargs):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'RIV', unitnumber)
        self.heading = '# RIV for MODFLOW, generated by Flopy.'
        self.url = 'riv.htm'
        if ipakcb != 0:
            self.ipakcb = 53
        else:
            self.ipakcb = 0  # 0: no cell by cell terms are written
        self.mxactr = 0
        self.np = 0
        if options is None:
            options = []
        self.options = options
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype(structured=self.parent.structured)
        # self.stress_period_data = MfList(model, self.dtype, stress_period_data)
        self.stress_period_data = MfList(self, stress_period_data)
        self.parent.add_package(self)
Exemple #4
0
    def __init__(self, model, nrchop=3, ipakcb=0, rech=1e-3, irch=0,
                 extension='rch', unitnumber=19):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'RCH', unitnumber)
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        self.heading = '# RCH for MODFLOW, generated by Flopy.'
        self.url = 'rch.htm'
        self.nrchop = nrchop
        if ipakcb != 0:
            self.ipakcb = 53
        else:
            self.ipakcb = 0  # 0: no cell by cell terms are written
        self.rech = Transient2d(model, (nrow, ncol), np.float32,
                                rech, name='rech_')
        if self.nrchop == 2:
            self.irch = Transient2d(model, (nrow, ncol), np.int,
                                    irch + 1, name='irch_')  # irch+1, as irch is zero based
        else:
            self.irch = None
        self.np = 0
        self.parent.add_package(self)
Exemple #5
0
 def __init__(self, model, mtdnconc=1, mfnadvfd=1, nswtcpl=1, iwtable=1,
              densemin=1.000, densemax=1.025,
              dnscrit=1e-2,
              denseref=1.000, denseslp=.025,
              firstdt=0.001,
              indense=0,
              dense=1.000, extension='vdf'):
     # Call ancestor's init to set self.parent, extension, name and 
     #unit number
     Package.__init__(self, model, extension, 'VDF', 37)
     nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
     self.mtdnconc = mtdnconc 
     self.mfnadvfd = mfnadvfd
     self.nswtcpl = nswtcpl
     self.iwtable = iwtable
     self.densemin = densemin 
     self.densemax = densemax
     self.dnscrit = dnscrit
     self.denseref = denseref
     self.denseslp = denseslp
     self.firstdt = firstdt
     self.indense = indense
     #self.dense = self.assignarray((nlay,nrow,ncol), np.float, dense, 
     #                              name='dense',)
     self.dense = util_3d(model,(nlay,nrow,ncol),np.float32,dense,name='dense')
     self.parent.add_package(self)
     return
Exemple #6
0
    def __init__(self, model, nevtop=3, ipakcb=0, surf=0., evtr=1e-3, exdp=1., ievt=1, 
                 extension ='evt', unitnumber=22, external=True):
        # Call ancestor's init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'EVT', unitnumber)
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        self.heading = '# EVT for MODFLOW, generated by Flopy.'
        self.url = 'evt.htm'
        self.nevtop = nevtop
        self.ipakcb = ipakcb
        self.external = external
        if self.external is False:
            load = True
        else:
            load = model.load            

        self.surf = transient_2d(model, (nrow, ncol), np.float32,
                                 surf, name='surf')
        self.evtr = transient_2d(model, (nrow, ncol), np.float32,
                                 evtr, name='etvr')
        self.exdp = transient_2d(model, (nrow, ncol), np.float32,
                                 exdp, name='exdp')
        self.ievt = transient_2d(model, (nrow, ncol), np.int,
                                 ievt, name='ievt')
        self.np = 0
        self.parent.add_package(self)
Exemple #7
0
    def __init__(self, model, mxiter=50, iiter=30, iadamp=0, hclose=1e-5, rclose=1e-5, relax=1.0, ioutgmg=0, iunitmhc=0,
                 ism=0, isc=0, damp=1.0, dup=0.75, dlow=0.01, chglimit=1.0, extension='gmg', unitnumber=27):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'GMG',
                         unitnumber)  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# GMG for MODFLOW, generated by Flopy.'
        self.url = 'gmg.htm'
        self.mxiter = mxiter
        self.iiter = iiter
        self.iadamp = iadamp
        self.hclose = hclose
        self.rclose = rclose
        self.relax = relax
        self.ism = ism
        self.isc = isc
        self.dup = dup
        self.dlow = dlow
        self.chglimit = chglimit
        self.damp = damp
        self.ioutgmg = ioutgmg
        self.iunitmhc = iunitmhc
        self.parent.add_package(self)
Exemple #8
0
    def __init__(self, model, iwelcb=0, layer_row_column_data=None,
                 layer_row_column_Q=None,
                 extension ='wel', unitnumber=20, options=None, naux=0):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'WEL', unitnumber)
        self.heading = '# Well file for MODFLOW, generated by Flopy.'
        self.url = 'wel.htm'
        self.iwelcb = iwelcb # no cell by cell terms are written
        if layer_row_column_data is None:
          if layer_row_column_Q is not None:
            print '\nWARNING: ModflowWel - Do not use layer_row_column_Q!\n'+\
                  '                      Use layer_row_column_data instead.'
            layer_row_column_data = layer_row_column_Q
          else:
            raise Exception('Failed to specify layer_row_column_Q or layer_row_column_data.')

        self.mxactw = 0
        self.mxactw, self.layer_row_column_data = \
            self.assign_layer_row_column_data(layer_row_column_data, 4+naux)

        self.np = 0
        if options is None:
            options = []
        self.options = options
        self.parent.add_package(self)
Exemple #9
0
 def __init__(self, model, itrnsp=1, ibctcb=0, mcomp=1, ic_ibound_flg=1,
              itvd=1, iadsorb=0, ict=0, cinact=-999., ciclose=1.e-6,
              idisp=1, ixdisp=0, diffnc=0., izod=0, ifod=0, icbund=1,
              porosity=0.1, bulkd=1., dlh=0., dlv=0., dth=0., dtv=0.,
              sconc=0.,
              extension='bct', unitnumber=35):
     Package.__init__(self, model, extension, 'BCT', unitnumber)
     self.url = 'bct.htm'
     nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
     self.itrnsp = itrnsp
     self.ibctcb = ibctcb
     self.mcomp = mcomp
     self.ic_ibound_flg = ic_ibound_flg
     self.itvd = itvd
     self.iadsorb = iadsorb
     self.ict = ict
     self.cinact = cinact
     self.ciclose = ciclose
     self.idisp = idisp
     self.ixdisp = ixdisp
     self.diffnc = diffnc
     self.izod = izod
     self.ifod = ifod
     self.icbund = util_3d(model, (nlay, nrow, ncol), np.float32, icbund,
                           'icbund',)
     self.porosity = util_3d(model, (nlay, nrow, ncol), np.float32,
                             porosity, 'porosity')
     self.dlh = util_3d(model, (nlay, nrow, ncol), np.float32, dlh, 'dlh')
     self.dlv = util_3d(model, (nlay, nrow, ncol), np.float32, dlv, 'dlv')
     self.dth = util_3d(model, (nlay, nrow, ncol), np.float32, dth, 'dth')
     self.dtv = util_3d(model, (nlay, nrow, ncol), np.float32, dth, 'dtv')
     self.sconc = util_3d(model, (nlay, nrow, ncol), np.float32, sconc,
                          'sconc',)
     self.parent.add_package(self)
     return
Exemple #10
0
    def __init__(self, model, ibound=1, strt=1.0, ifrefm=True, ixsec=False,
                 ichflg=False, stoper=None, hnoflo=-999.99, extension='bas',
                 unitnumber=13):
        """
        Package constructor.

        """
        # Call ancestor's init to set self.parent, extension, name and unit
        # number
        Package.__init__(self, model, extension, 'BAS6', unitnumber)
        self.url = 'bas6.htm'
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        self.__ibound = util_3d(model, (nlay, nrow, ncol), np.int, ibound,
                                name='ibound', locat=self.unit_number[0])
        self.strt = util_3d(model, (nlay, nrow, ncol), np.float32, strt,
                            name='strt', locat=self.unit_number[0])
        self.heading = '# Basic package file for MODFLOW, generated by Flopy.'
        self.options = ''
        self.ixsec = ixsec
        self.ichflg = ichflg
        self.stoper = stoper
        self.ifrefm = ifrefm
        self.hnoflo = hnoflo
        self.parent.add_package(self)
        return
Exemple #11
0
 def __init__(self, model, ighbcb=0, layer_row_column_data=None, 
              layer_row_column_head_cond=None, 
              no_print=False, options=None, naux=0,
              extension='ghb', unitnumber=23):
     Package.__init__(self, model, extension, 'GHB',
                      unitnumber)  # Call ancestor's init to set self.parent, extension, name and unit number
     self.heading = '# GHB for MODFLOW, generated by Flopy.'
     self.url = 'ghb.htm'
     self.ighbcb = ighbcb  # no cell by cell terms are written
     if layer_row_column_data is None:
       if layer_row_column_head_cond is not None:
         print '\nWARNING: ModflowGhb - Do not use layer_row_column_head_cond!\n'+\
               '                      Use layer_row_column_data instead.'
         layer_row_column_data = layer_row_column_head_cond
       else:
         raise Exception('Failed to specify layer_row_column_head_cond or layer_row_column_data.')
       
     self.mxactb, self.layer_row_column_data = self.assign_layer_row_column_data(layer_row_column_data,
                                                                                 5 + naux)
     self.no_print = no_print
     self.np = 0
     if options is None:
         options = []
     if self.no_print:
         options.append('NOPRINT')
     self.options = options
     self.parent.add_package(self)
Exemple #12
0
    def __init__(self, model, layer_row_column_data=None,
                 layer_row_column_shead_ehead=None,
                 cosines=None, extension='pbc', unitnumber=30, zerobase=True):
        Package.__init__(self, model, extension, 'PBC',
                         unitnumber)  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# PBC for MODFLOW, generated by Flopy.'
        self.mxactp = 0
        if layer_row_column_data is None:
            if layer_row_column_shead_ehead is not None:
                print('\nWARNING: ModflowPbc - Do not use layer_row_column_shead_ehead!\n' + \
                      '                      Use layer_row_column_data instead.')
                layer_row_column_data = layer_row_column_shead_ehead
            else:
                raise Exception('Failed to specify layer_row_column_shead_ehead or layer_row_column_data.')

        self.mxactp, self.layer_row_column_data = self.assign_layer_row_column_data(layer_row_column_data, 5,
                                                                                    zerobase=zerobase)
        self.mxcos, self.cosines = self.assign_layer_row_column_data(cosines, 3,
                                                                     zerobase=False)  # misuse of this function - zerobase needs to be False
        '''self.mxcos = 0
        if (cosines != None):
            error_message = 'cosines must have 3 columns'
            if (not isinstance(cosines, list)):
                cosines = [cosines]
            for a in cosines:
                a = np.atleast_2d(a)
                nr, nc = a.shape
                assert nc == 3, error_message
                if (nr > self.mxcos):
                    self.mxcos = nr
            self.cosines = cosines'''
        self.np = 0
        self.parent.add_package(self)
Exemple #13
0
 def __init__(self, model, mtdnconc=1, mfnadvfd=1, nswtcpl=1, iwtable=1,
              densemin=1.000, densemax=1.025, dnscrit=1e-2, denseref=1.000,
              denseslp=.025, crhoref=0, firstdt=0.001, indense=0,
              dense=1.000, nsrhoeos=1, drhodprhd=4.46e-3, prhdref=0.,
              extension='vdf', unitnumber=None, **kwargs):
     if unitnumber is None:
         unitnumber = self.unitnumber
     Package.__init__(self, model, extension, 'VDF', unitnumber)
     nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
     self.mtdnconc = kwargs.pop('mt3drhoflag', mtdnconc)
     self.mfnadvfd = mfnadvfd
     self.nswtcpl = nswtcpl
     self.iwtable = iwtable
     self.densemin = densemin
     self.densemax = densemax
     self.dnscrit = dnscrit
     self.nsrhoeos = nsrhoeos
     self.denseref = denseref
     self.denseslp = kwargs.pop('drhodc', denseslp)
     self.crhoref = crhoref
     self.drhodprhd = drhodprhd
     self.prhdref = prhdref
     self.firstdt = firstdt
     self.indense = indense
     if dense is not None:
         self.dense = Util3d(model, (nlay, nrow, ncol), np.float32, dense,
                              name='dense')
     self.parent.add_package(self)
     return
Exemple #14
0
    def __init__(self, model, ipakcb=0, stress_period_data=None, dtype=None,
                 no_print=False, options=None, extension='ghb', unitnumber=23):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'GHB',
                         unitnumber)
        self.heading = '# GHB for MODFLOW, generated by Flopy.'
        self.url = 'ghb.htm'
        if ipakcb != 0:
            self.ipakcb = 53
        else:
            self.ipakcb = 0  # 0: no cell by cell terms are written
        self.no_print = no_print
        self.np = 0
        if options is None:
            options = []
        if self.no_print:
            options.append('NOPRINT')
        self.options = options
        self.parent.add_package(self)
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype(structured=self.parent.structured)
        self.stress_period_data = MfList(self, stress_period_data)
Exemple #15
0
    def __init__(self, model, nrchop=3, irchcb=0, rech=1e-3, irch=1,
                 extension ='rch', unitnumber=19):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'RCH', unitnumber)
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        self.heading = '# RCH for MODFLOW, generated by Flopy.'
        self.url = 'rch.htm'
        self.nrchop = nrchop
        self.irchcb = irchcb
        self.rech = []
        self.irch = []
        if (not isinstance(rech, list)):
            rech = [rech]
        for i,a in enumerate(rech):
            r = util_2d(model,(nrow,ncol),np.float32,a,name='rech_'+str(i+1))
            self.rech = self.rech + [r]
        if (not isinstance(irch, list)):
            irch = [irch]
        for i,a in enumerate(irch):
            ir = util_2d(model,(nrow,ncol),np.int,a,name='irech_'+str(i+1))
            self.irch = self.irch + [ir]
        self.np = 0
        self.parent.add_package(self)
Exemple #16
0
 def __init__(self, model, mixelm=3, percel=0.75, mxpart=800000, nadvfd=1,
              itrack=3, wd=0.5,
              dceps=1e-5, nplane=2, npl=10, nph=40, npmin=5, npmax=80,
              nlsink=0, npsink=15,
              dchmoc=0.0001, extension='adv', unitnumber=None):
     if unitnumber is None:
         unitnumber = self.unitnumber
     Package.__init__(self, model, extension, 'ADV', unitnumber)
     self.mixelm = mixelm
     self.percel = percel
     self.mxpart = mxpart
     self.nadvfd = nadvfd
     self.mixelm = mixelm
     self.itrack = itrack
     self.wd = wd
     self.dceps = dceps
     self.nplane = nplane
     self.npl = npl
     self.nph = nph
     self. npmin = npmin
     self.npmax = npmax
     self.interp = 1 # Command-line 'interp' might once be needed if MT3DMS is updated to include other interpolation method
     self.nlsink = nlsink
     self.npsink = npsink
     self.dchmoc = dchmoc
     self.parent.add_package(self)
     return
Exemple #17
0
    def __init__(self, model, ipakcb=0, stress_period_data=None, dtype=None,
                 extension='wel', unitnumber=20, options=None):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'WEL', unitnumber)
        self.heading = '# Well file for MODFLOW, generated by Flopy.'
        self.url = 'wel.htm'
        self.ipakcb = ipakcb  # no cell by cell terms are written
        self.np = 0
        if options is None:
            options = []
        self.specify = False
        for idx, opt in enumerate(options):
            if 'specify' in opt:
                t = opt.strip().split()
                self.specify = True
                self.phiramp = np.float(t[1])
                self.phiramp_unit = np.int(t[2])
                options.pop(idx)
                break
        self.options = options
        self.parent.add_package(self)
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype(structured=self.parent.structured)
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)
Exemple #18
0
 def __init__(self, model, os=2, temp=25, asbin=0, eps_aqu=0, eps_ph=0, 
              scr_output=1, cb_offset=0, smse=['pH', 'pe'], mine=[], ie=[],
              surf=[], mobkin=[], minkin=[], surfkin=[], imobkin=[], 
              extension='phc'):
     #Call ancestor's init to set self.parent, extension, name and 
     #unit number
     Package.__init__(self, model, extension, 'PHC', 38) 
     self.os = os
     self.temp = temp
     self.asbin = asbin
     self.eps_aqu = eps_aqu
     self.eps_ph = eps_ph
     self.scr_output = scr_output
     self.cb_offset = cb_offset
     self.smse = smse
     self.nsmse = len(self.smse)
     self.mine = mine
     self.nmine = len(self.mine)
     self.ie = ie
     self.nie = len(self.ie)
     self.surf = surf
     self.nsurf = len(self.surf)
     self.mobkin = mobkin
     self.nmobkin = len(self.mobkin)
     self.minkin = minkin[0]
     self.nminkin = len(self.minkin)
     self.minkin_parms = minkin[1]
     self.surfkin = surfkin
     self.nsurfkin = len(self.surfkin)
     self.imobkin = imobkin
     self.nimobkin = len(self.imobkin)
     self.parent.add_package(self)
     return
Exemple #19
0
    def __init__(self, model, hnoflo=-9999., hdry=-8888.,
                 def_face_ct=0, bud_label=None, def_iface=None,
                 laytyp=0, ibound=1, prsity=0.30, prsityCB=0.30,
                 extension='mpbas', unitnumber = 86):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'MPBAS', unitnumber) 
        nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
        self.parent.mf.get_name_file_entries()
        self.heading1 = '# MPBAS for Modpath, generated by Flopy.'
        self.heading2 = '#'
        self.hnoflo = hnoflo
        self.hdry = hdry
        self.def_face_ct = def_face_ct
        self.bud_label = bud_label
        self.def_iface = def_iface
        self.laytyp = laytyp
        self.__ibound = util_3d(model, (nlay, nrow, ncol), np.int, ibound,
                                name='ibound', locat=self.unit_number[0])
        
        self.prsity = prsity
        self.prsityCB = prsityCB
        self.prsity = util_3d(model,(nlay,nrow,ncol),np.float32,\
                              prsity,name='prsity',locat=self.unit_number[0])        
        self.prsityCB = util_3d(model,(nlay,nrow,ncol),np.float32,\
                                prsityCB,name='prsityCB',locat=self.unit_number[0])        
        self.parent.add_package(self)
Exemple #20
0
 def __init__(self, model, laytyp=0, layavg=0, chani=1.0, layvka=0,
              laywet=0, ipakcb=53, hdry=-1E+30, iwdflg=0, wetfct=0.1,
              iwetit=1, ihdwet=0, hk=1.0, hani=1.0, vka=1.0, ss=1e-5,
              sy=0.15, vkcb=0.0, wetdry=-0.01, storagecoefficient=False,
              constantcv=False, thickstrt=False, nocvcorrection=False,
              novfc=False, extension='lpf', unitnumber=15):
     Package.__init__(self, model, extension, 'LPF',
                      unitnumber)  # Call ancestor's init to set self.parent, extension, name and unit number
     self.heading = '# LPF for MODFLOW, generated by Flopy.'
     self.url = 'lpf.htm'
     nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
     # item 1
     if ipakcb != 0:
         self.ipakcb = 53
     else:
         self.ipakcb = 0  # 0: no cell by cell terms are written
     self.hdry = hdry  # Head in cells that are converted to dry during a simulation
     self.nplpf = 0  # number of LPF parameters
     self.laytyp = Util2d(model, (nlay,), np.int, laytyp, name='laytyp')
     self.layavg = Util2d(model, (nlay,), np.int, layavg, name='layavg')
     self.chani = Util2d(model, (nlay,), np.float32, chani, name='chani')
     self.layvka = Util2d(model, (nlay,), np.int, layvka, name='layvka')
     self.laywet = Util2d(model, (nlay,), np.int, laywet, name='laywet')
     self.wetfct = wetfct  # Factor that is included in the calculation of the head when a cell is converted from dry to wet
     self.iwetit = iwetit  # Iteration interval for attempting to wet cells
     self.ihdwet = ihdwet  # Flag that determines which equation is used to define the initial head at cells that become wet
     self.options = ' '
     if storagecoefficient:
         self.options = self.options + 'STORAGECOEFFICIENT '
     if constantcv: self.options = self.options + 'CONSTANTCV '
     if thickstrt: self.options = self.options + 'THICKSTRT '
     if nocvcorrection: self.options = self.options + 'NOCVCORRECTION '
     if novfc: self.options = self.options + 'NOVFC '
     self.hk = Util3d(model, (nlay, nrow, ncol), np.float32, hk, name='hk',
                       locat=self.unit_number[0])
     self.hani = Util3d(model, (nlay, nrow, ncol), np.float32, hani,
                         name='hani', locat=self.unit_number[0])
     keys = []
     for k in range(nlay):
         key = 'vka'
         if self.layvka[k] != 0:
             key = 'vani'
         keys.append(key)
     self.vka = Util3d(model, (nlay, nrow, ncol), np.float32, vka,
                        name=keys, locat=self.unit_number[0])
     tag = 'ss'
     if storagecoefficient:
         tag = 'storage'
     self.ss = Util3d(model, (nlay, nrow, ncol), np.float32, ss, name=tag,
                       locat=self.unit_number[0])
     self.sy = Util3d(model, (nlay, nrow, ncol), np.float32, sy, name='sy',
                       locat=self.unit_number[0])
     self.vkcb = Util3d(model, (nlay, nrow, ncol), np.float32, vkcb,
                         name='vkcb', locat=self.unit_number[0])
     self.wetdry = Util3d(model, (nlay, nrow, ncol), np.float32, wetdry,
                           name='wetdry', locat=self.unit_number[0])
     self.parent.add_package(self)
     return
Exemple #21
0
 def __init__(self, model, mxiter=200, \
              accl=1, hclose=1e-5, iprsor=0, extension='sor', unitnumber=26):
     Package.__init__(self, model, extension, 'sor', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
     self.url = 'sor.htm'
     self.mxiter = mxiter
     self.accl= accl
     self.hclose = hclose
     self.iprsor = iprsor
     self.parent.add_package(self)
Exemple #22
0
 def __init__(self, model, output_file_name='mt3d_link.ftl', output_file_unit=54, output_file_header='extended', output_file_format='unformatted', extension ='lmt6', unitnumber=30):
     Package.__init__(self, model, extension, 'LMT6', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
     self.heading = '# Lmt input file for MODFLOW, generated by Flopy.'
     self.url = 'lmt.htm'
     self.output_file_name='mt3d_link.ftl'
     self.output_file_unit=54
     self.output_file_header='extended'
     self.output_file_format='unformatted'
     self.parent.add_package(self)
Exemple #23
0
 def __init__(
     self,
     model,
     itrnsp=1,
     ibctcb=0,
     mcomp=1,
     ic_ibound_flg=1,
     itvd=1,
     iadsorb=0,
     ict=0,
     cinact=-999.0,
     ciclose=1.0e-6,
     idisp=1,
     ixdisp=0,
     diffnc=0.0,
     izod=0,
     ifod=0,
     icbund=1,
     porosity=0.1,
     bulkd=1.0,
     arad=0.0,
     dlh=0.0,
     dlv=0.0,
     dth=0.0,
     dtv=0.0,
     sconc=0.0,
     extension="bct",
     unitnumber=35,
 ):
     Package.__init__(self, model, extension, "BCT", unitnumber)
     self.url = "bct.htm"
     nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
     self.itrnsp = itrnsp
     self.ibctcb = ibctcb
     self.mcomp = mcomp
     self.ic_ibound_flg = ic_ibound_flg
     self.itvd = itvd
     self.iadsorb = iadsorb
     self.ict = ict
     self.cinact = cinact
     self.ciclose = ciclose
     self.idisp = idisp
     self.ixdisp = ixdisp
     self.diffnc = diffnc
     self.izod = izod
     self.ifod = ifod
     self.icbund = util_3d(model, (nlay, nrow, ncol), np.float32, icbund, "icbund")
     self.porosity = util_3d(model, (nlay, nrow, ncol), np.float32, porosity, "porosity")
     # self.arad = util_2d(model, (1, nja), np.float32,
     #                        arad, 'arad')
     self.dlh = util_3d(model, (nlay, nrow, ncol), np.float32, dlh, "dlh")
     self.dlv = util_3d(model, (nlay, nrow, ncol), np.float32, dlv, "dlv")
     self.dth = util_3d(model, (nlay, nrow, ncol), np.float32, dth, "dth")
     self.dtv = util_3d(model, (nlay, nrow, ncol), np.float32, dth, "dtv")
     self.sconc = util_3d(model, (nlay, nrow, ncol), np.float32, sconc, "sconc")
     self.parent.add_package(self)
     return
Exemple #24
0
    def __init__(self, model, nlay=1, nrow=2, ncol=2, nper=1, delr=1.0,
                 delc=1.0, laycbd=0, top=1, botm=0, perlen=1, nstp=1,
                 tsmult=1, steady=True, itmuni=4, lenuni=2, extension='dis',
                 unitnumber=11, xul=None, yul=None, rotation=0.0,
                 start_datetime="1/1/1970"):

        # Call ancestor's init to set self.parent, extension, name and unit
        # number
        Package.__init__(self, model, extension, 'DIS', unitnumber)
        self.url = 'dis.htm'
        self.nrow = nrow
        self.ncol = ncol
        self.nlay = nlay
        self.nper = nper

        # Set values of all parameters
        self.heading = '# Discretization file for MODFLOW, generated by Flopy.'
        self.laycbd = Util2d(model, (self.nlay,), np.int, laycbd,
                              name='laycbd')
        self.laycbd[-1] = 0  # bottom layer must be zero
        self.delr = Util2d(model, (self.ncol,), np.float32, delr, name='delr',
                            locat=self.unit_number[0])
        self.delc = Util2d(model, (self.nrow,), np.float32, delc, name='delc',
                            locat=self.unit_number[0])
        self.top = Util2d(model, (self.nrow, self.ncol), np.float32,
                           top, name='model_top', locat=self.unit_number[0])
        self.botm = Util3d(model, (self.nlay + sum(self.laycbd),
                                    self.nrow, self.ncol), np.float32, botm,
                            'botm', locat=self.unit_number[0])
        self.perlen = Util2d(model, (self.nper,), np.float32, perlen,
                              name='perlen')
        self.nstp = Util2d(model, (self.nper,), np.int, nstp, name='nstp')
        self.tsmult = Util2d(model, (self.nper,), np.float32, tsmult,
                              name='tsmult')
        self.steady = Util2d(model, (self.nper,), np.bool,
                              steady, name='steady')

        try:
            self.itmuni = int(itmuni)
        except:
            self.itmuni = ITMUNI[itmuni.lower()[0]]
        try:
            self.lenuni = int(lenuni)
        except:
            self.lenuni = LENUNI[lenuni.lower()[0]]

        self.parent.add_package(self)
        self.itmuni_dict = {0: "undefined", 1: "seconds", 2: "minutes",
                            3: "hours", 4: "days", 5: "years"}

        self.sr = reference.SpatialReference(self.delr.array, self.delc.array, self.lenuni, xul=xul,
                                             yul=yul, rotation=rotation)
        self.start_datetime = start_datetime
        # calculate layer thicknesses
        self.__calculate_thickness()
Exemple #25
0
 def __init__(self, model, al=0.01, trpt=0.1, trpv=0.01, dmcoef=1e-9, 
              extension='dsp', multiDiff=False,**kwargs):
     '''
     if dmcoef is passed as a list of (nlay, nrow, ncol) arrays,
     then the multicomponent diffusion is activated
     '''
     # Call ancestor's init to set self.parent, extension, name and 
     #unit number
     Package.__init__(self, model, extension, 'DSP', 33) 
     nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
     ncomp = self.parent.get_ncomp()        
     # if multiDiff:
     #     assert isinstance(dmcoef,list),('using multicomponent diffusion '
     #                                     'requires dmcoef is list of '
     #                                     'length ncomp')
     #     if len(dmcoef) != ncomp:
     #         raise TypeError,('using multicomponent diffusion requires '
     #                          'dmcoef is list of length ncomp')
     self.multiDiff = multiDiff                                    
     #self.al = self.assignarray((nlay, nrow, ncol), np.float, al, 
     #                           name='al', load=model.load )
     self.al = util_3d(model,(nlay,nrow,ncol),np.float32,al,name='al',
                       locat=self.unit_number[0])
     #self.trpt = self.assignarray((nlay,), np.float, trpt, name='trpt', 
     #                             load=model.load)
     self.trpt = util_2d(model,(nlay,),np.float32,trpt,name='trpt',
                         locat=self.unit_number[0])
     #self.trpv = self.assignarray((nlay,), np.float, trpv, name='trpv', 
     #                             load=model.load)
     self.trpv = util_2d(model,(nlay,),np.float32,trpt,name='trpv',
                         locat=self.unit_number[0])
     self.dmcoef = []
     a = util_3d(model, (nlay, nrow, ncol), np.float32, dmcoef,
                 name='dmcoef1', locat=self.unit_number[0])
     self.dmcoef.append(a)
     if self.multiDiff:
         for icomp in range(2, ncomp+1):
             name = "dmcoef" + str(icomp)
             val = 0.0
             if name in list(kwargs.keys()):
                 val = kwargs[name]
                 kwargs.pop(name)
             else:
                 print("DSP: setting dmcoef for component " +\
                       str(icomp) + " to zero, kwarg name " +\
                       name)
             a = util_3d(model, (nlay, nrow, ncol), np.float32, val,
                         name=name, locat=self.unit_number[0])
             self.dmcoef.append(a)
     if len(list(kwargs.keys())) > 0:
         raise Exception("DSP error: unrecognized kwargs: " +
                         ' '.join(list(kwargs.keys())))
     self.parent.add_package(self)
     return
Exemple #26
0
    def __init__(self, model, extension='swr', unitnumber=36):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'SWR',
                         unitnumber)  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# SWR1 process for MODFLOW, generated by Flopy.'
        self.url = 'swr1.htm'

        self.parent.add_package(self)
Exemple #27
0
 def __init__(self, model, mxiter=200, nparm=5, \
              accl=1, hclose=1e-5, ipcalc=1, wseed=0, iprsip=0, extension='sip', unitnumber=25):
     Package.__init__(self, model, extension, 'SIP', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
     self.url = 'sip.htm'
     self.mxiter = mxiter
     self.nparm = nparm
     self.accl = accl
     self.hclose = hclose
     self.ipcalc = ipcalc
     self.wseed = wseed
     self.iprsip = iprsip
     self.parent.add_package(self)
Exemple #28
0
 def __init__(self, model, outnam='tob_output', CScale=1.0, FluxGroups=[], 
              FScale=1.0, iOutFlux=0, extension='tob'):
     #Call ancestor's init to set self.parent, extension, name and 
     #unit number
     Package.__init__(self, model, extension, 'TOB', 37)
     self.heading = '# TOB for MT3DMS, generated by Flopy.'
     self.outnam = outnam
     self.CScale = CScale
     self.FluxGroups = FluxGroups
     self.FScale = FScale
     self.iOutFlux = iOutFlux
     self.parent.add_package(self)
     return
Exemple #29
0
    def __init__(
        self,
        model,
        al=0.01,
        trpt=0.1,
        trpv=0.01,
        dmcoef=1e-9,
        extension="dsp",
        multiDiff=False,
        unitnumber=None,
        **kwargs
    ):
        if unitnumber is None:
            unitnumber = self.unitnumber
        Package.__init__(self, model, extension, "DSP", unitnumber)
        nrow = model.nrow
        ncol = model.ncol
        nlay = model.nlay
        ncomp = model.ncomp
        mcomp = model.mcomp
        self.multiDiff = multiDiff
        self.al = Util3d(model, (nlay, nrow, ncol), np.float32, al, name="al", locat=self.unit_number[0])
        self.trpt = Util2d(model, (nlay,), np.float32, trpt, name="trpt", locat=self.unit_number[0])
        self.trpv = Util2d(model, (nlay,), np.float32, trpv, name="trpv", locat=self.unit_number[0])

        # Multi-species and multi-diffusion, hence the complexity
        self.dmcoef = []
        shape = (nlay, 1)
        utype = Util2d
        nmcomp = ncomp
        if multiDiff:
            shape = (nlay, nrow, ncol)
            utype = Util3d
            nmcomp = mcomp
        u2or3 = utype(model, shape, np.float32, dmcoef, name="dmcoef1", locat=self.unit_number[0])
        self.dmcoef.append(u2or3)
        for icomp in range(2, nmcomp + 1):
            name = "dmcoef" + str(icomp)
            val = 0.0
            if name in list(kwargs.keys()):
                val = kwargs.pop(name)
            else:
                print("DSP: setting dmcoef for component " + str(icomp) + " to zero, kwarg name " + name)
            u2or3 = utype(model, shape, np.float32, val, name=name, locat=self.unit_number[0])
            self.dmcoef.append(u2or3)

        if len(list(kwargs.keys())) > 0:
            raise Exception("DSP error: unrecognized kwargs: " + " ".join(list(kwargs.keys())))
        self.parent.add_package(self)
        return
Exemple #30
0
    def __init__(
        self,
        model,
        nphfb=0,
        mxfb=0,
        nhfbnp=0,
        hfb_data=None,
        nacthfb=0,
        no_print=False,
        options=None,
        extension="hfb",
        unitnumber=17,
    ):
        Package.__init__(
            self, model, extension, "HFB6", unitnumber
        )  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = "# HFB for MODFLOW, generated by Flopy."
        self.url = "hfb6.htm"

        self.nphfb = nphfb
        self.mxfb = mxfb

        self.nacthfb = nacthfb

        self.no_print = no_print
        self.np = 0
        if options is None:
            options = []
        if self.no_print:
            options.append("NOPRINT")
        self.options = options

        aux_names = []
        it = 0
        while it < len(options):
            print(it, options[it])
            if "aux" in options[it].lower():
                aux_names.append(options[it + 1].lower())
                it += 1
            it += 1

        if hfb_data is None:
            raise Exception("Failed to specify hfb_data.")

        self.nhfbnp = len(hfb_data)
        self.hfb_data = ModflowHfb.get_empty(self.nhfbnp)
        for ibnd, t in enumerate(hfb_data):
            self.hfb_data[ibnd] = tuple(t)

        self.parent.add_package(self)
Exemple #31
0
    def __init__(self, model, pval_dict=None,
                 extension ='pval', unitnumber=1005):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'PVAL', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# PVAL for MODFLOW, generated by Flopy.\n# Really...is this actually helpful?'
        self.url = 'pval.htm'

        self.npval = 0
        if pval_dict is not None:
            self.pval = len(pval_dict)
            self.pval_dict = pval_dict
        self.parent.add_package(self)
Exemple #32
0
    def __init__(self,
                 model,
                 nphfb=0,
                 mxfb=0,
                 nhfbnp=0,
                 hfb_data=None,
                 nacthfb=0,
                 no_print=False,
                 options=None,
                 extension='hfb',
                 unitnumber=17):
        Package.__init__(
            self, model, extension, 'HFB6', unitnumber
        )  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# HFB for MODFLOW, generated by Flopy.'
        self.url = 'hfb6.htm'

        self.nphfb = nphfb
        self.mxfb = mxfb

        self.nacthfb = nacthfb

        self.no_print = no_print
        self.np = 0
        if options is None:
            options = []
        if self.no_print:
            options.append('NOPRINT')
        self.options = options

        aux_names = []
        it = 0
        while it < len(options):
            print(it, options[it])
            if 'aux' in options[it].lower():
                aux_names.append(options[it + 1].lower())
                it += 1
            it += 1

        if hfb_data is None:
            raise Exception('Failed to specify hfb_data.')

        self.nhfbnp = len(hfb_data)
        self.hfb_data = ModflowHfb.get_empty(self.nhfbnp)
        for ibnd, t in enumerate(hfb_data):
            self.hfb_data[ibnd] = tuple(t)

        self.parent.add_package(self)
Exemple #33
0
    def __init__(self, model, mxiter=200, nparm=5, \
                 accl=1, hclose=1e-5, ipcalc=1, wseed=0, iprsip=0, extension='sip', unitnumber=25):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'SIP', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
        self.url = 'sip.htm'
        self.mxiter = mxiter
        self.nparm = nparm
        self.accl = accl
        self.hclose = hclose
        self.ipcalc = ipcalc
        self.wseed = wseed
        self.iprsip = iprsip
        self.parent.add_package(self)
Exemple #34
0
    def __init__(self, model, mult_dict=None,
                 extension='mlt', unitnumber=1002):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'MULT', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# MULT for MODFLOW, generated by Flopy.'
        self.url = 'zon.htm'

        self.nml = 0
        if mult_dict is not None:
          self.nml = len(mult_dict)
          self.mult_dict = mult_dict
          #print mult_dict
        self.parent.add_package(self)
Exemple #35
0
    def __init__(self, model, zone_dict=None,
                 extension='zon', unitnumber=1001):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'ZONE',
                         unitnumber)  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# ZONE for MODFLOW, generated by Flopy.'
        self.url = 'zon.htm'

        self.nzn = 0
        if zone_dict is not None:
            self.nzn = len(zone_dict)
            self.zone_dict = zone_dict
        self.parent.add_package(self)
Exemple #36
0
 def __init__(self,
              model,
              output_file_name='mt3d_link.ftl',
              output_file_unit=54,
              output_file_header='extended',
              output_file_format='unformatted',
              extension='lmt6',
              unitnumber=30):
     # Call ancestor's init to set self.parent, extension, name and unit number
     Package.__init__(self, model, extension, 'LMT6', unitnumber)
     self.heading = '# Lmt input file for MODFLOW, generated by Flopy.'
     self.url = 'lmt.htm'
     self.output_file_name = output_file_name
     self.output_file_unit = output_file_unit
     self.output_file_header = output_file_header
     self.output_file_format = output_file_format
     self.parent.add_package(self)
Exemple #37
0
 def get_empty(ncells=0, aux_names=None):
     #get an empty recaray that corresponds to dtype
     dtype = ModflowChd.get_default_dtype()
     if aux_names is not None:
         dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
     d = np.zeros((ncells, len(dtype)), dtype=dtype)
     d[:, :] = -1.0E+10
     return np.core.records.fromarrays(d.transpose(), dtype=dtype)
Exemple #38
0
    def __init__(self, model, mxiter=100, innerit=50, \
                 isolver=1, npc=2, iscl=0, iord=0, ncoresm=1, ncoresv=1, \
                 damp=1.0, dampt=1.0, relax=0.97, \
                 ifill=0, droptol=0.0, \
                 hclose=1e-3, rclose=1e-1, l2norm=None, \
                 iprpks=0, mutpks=3,
                 mpi=False, partopt=0, novlapimpsol=1, stenimpsol=2, verbose=0, partdata=None, \
                 extension='pks', unitnumber=27):
        """
        Package constructor.

        """
        Package.__init__(
            self, model, extension, 'PKS', unitnumber
        )  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# PKS for MODFLOW, generated by Flopy.'
        self.url = 'pks.htm'
        self.mxiter = mxiter
        self.innerit = innerit
        self.isolver = isolver
        self.npc = npc
        self.iscl = iscl
        self.iord = iord
        self.ncoresm = ncoresm
        self.ncoresv = ncoresv
        self.damp = damp
        self.dampt = dampt
        self.relax = relax
        self.ifill = ifill
        self.droptol = droptol
        self.hclose = hclose
        self.rclose = rclose
        self.l2norm = l2norm
        self.iprpks = iprpks
        self.mutpks = mutpks
        # MPI
        self.mpi = mpi
        self.partopt = partopt
        self.novlapimpsol = novlapimpsol
        self.stenimpsol = stenimpsol
        self.verbose = verbose
        self.partdata = partdata

        self.parent.add_package(self)
Exemple #39
0
 def __init__(self,
              model,
              outnam='tob_output',
              CScale=1.0,
              FluxGroups=[],
              FScale=1.0,
              iOutFlux=0,
              extension='tob'):
     #Call ancestor's init to set self.parent, extension, name and
     #unit number
     Package.__init__(self, model, extension, 'TOB', 37)
     self.heading = '# TOB for MT3DMS, generated by Flopy.'
     self.outnam = outnam
     self.CScale = CScale
     self.FluxGroups = FluxGroups
     self.FScale = FScale
     self.iOutFlux = iOutFlux
     self.parent.add_package(self)
     return
Exemple #40
0
 def __init__(self, model, isothm=0, ireact=0, igetsc=1, rhob=1.8e3, 
              prsity2=0.1, srconc=0.0, sp1=0.0, sp2=0.0, rc1=0.0, rc2=0.0, 
              extension='rct'):
     #Call ancestor's init to set self.parent, extension, name and 
     #unit number
     Package.__init__(self, model, extension, 'RCT', 36) 
     nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
     self.heading1 = '# RCT for MT3DMS, generated by Flopy.'
     self.isothm = isothm
     self.ireact = ireact
     self.irctop = 2 #All RCT vars are specified as 3D arrays
     self.igetsc = igetsc
     # Set values of all parameters
     #self.rhob = self.assignarray((nlay, nrow, ncol), np.float, rhob, 
     #                             name='rhob')
     self.rhob = util_3d(model,(nlay,nrow,ncol),np.float32,rhob,name='rhob',
                         locat=self.unit_number[0])
     #self.prsity2 = self.assignarray((nlay, nrow, ncol), np.float, prsity2, 
     #                                name='prsity2')
     self.prsity2 = util_3d(model,(nlay,nrow,ncol),np.float32,prsity2,
                            name='prsity2',locat=self.unit_number[0])
     #self.srconc = self.assignarray((nlay, nrow, ncol), np.float, srconc, 
     #                               name='srconc')
     self.srconc = util_3d(model,(nlay,nrow,ncol),np.float32,srconc,
                           name='srconc',locat=self.unit_number[0])
     #self.sp1 = self.assignarray((nlay, nrow, ncol), np.float, sp1, 
     #                            name='sp1')
     self.sp1 = util_3d(model,(nlay,nrow,ncol),np.float32,sp1,name='sp1',
                        locat=self.unit_number[0])
     #self.sp2 = self.assignarray((nlay, nrow, ncol), np.float, sp2, 
     #                            name='sp2')
     self.sp2 = util_3d(model,(nlay,nrow,ncol),np.float32,sp2,name='sp2',
                        locat=self.unit_number[0])
     #self.rc1 = self.assignarray((nlay, nrow, ncol), np.float, rc1, 
     #                            name='rc1')
     self.rc1 = util_3d(model,(nlay,nrow,ncol),np.float32,rc1,name='rc1',
                        locat=self.unit_number[0])
     #self.rc2 = self.assignarray((nlay, nrow, ncol), np.float, rc2,
     #                             name='rc2')
     self.rc2 = util_3d(model,(nlay,nrow,ncol),np.float32,rc2,name='rc2',
                        locat=self.unit_number[0])
     self.parent.add_package(self)
     return
Exemple #41
0
    def __init__(self,
                 model,
                 layer_row_column_data=None,
                 layer_row_column_shead_ehead=None,
                 cosines=None,
                 extension='pbc',
                 unitnumber=30,
                 zerobase=True):
        Package.__init__(
            self, model, extension, 'PBC', unitnumber
        )  # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# PBC for MODFLOW, generated by Flopy.'
        self.mxactp = 0
        if layer_row_column_data is None:
            if layer_row_column_shead_ehead is not None:
                print('\nWARNING: ModflowPbc - Do not use layer_row_column_shead_ehead!\n'+\
                      '                      Use layer_row_column_data instead.')
                layer_row_column_data = layer_row_column_shead_ehead
            else:
                raise Exception(
                    'Failed to specify layer_row_column_shead_ehead or layer_row_column_data.'
                )

        self.mxactp, self.layer_row_column_data = self.assign_layer_row_column_data(
            layer_row_column_data, 5, zerobase=zerobase)
        self.mxcos, self.cosines = self.assign_layer_row_column_data(
            cosines, 3, zerobase=False
        )  # misuse of this function - zerobase needs to be False
        '''self.mxcos = 0
        if (cosines != None):
            error_message = 'cosines must have 3 columns'
            if (not isinstance(cosines, list)):
                cosines = [cosines]
            for a in cosines:
                a = np.atleast_2d(a)
                nr, nc = a.shape
                assert nc == 3, error_message
                if (nr > self.mxcos):
                    self.mxcos = nr
            self.cosines = cosines'''
        self.np = 0
        self.parent.add_package(self)
Exemple #42
0
    def __init__(self,
                 model,
                 nevtop=3,
                 ipakcb=0,
                 surf=0.,
                 evtr=1e-3,
                 exdp=1.,
                 ievt=1,
                 extension='evt',
                 unitnumber=22,
                 external=True):
        # Call ancestor's init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'EVT', unitnumber)
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        self.heading = '# EVT for MODFLOW, generated by Flopy.'
        self.url = 'evt.htm'
        self.nevtop = nevtop
        self.ipakcb = ipakcb
        self.external = external
        if self.external is False:
            load = True
        else:
            load = model.load

        self.surf = transient_2d(model, (nrow, ncol),
                                 np.float32,
                                 surf,
                                 name='surf')
        self.evtr = transient_2d(model, (nrow, ncol),
                                 np.float32,
                                 evtr,
                                 name='etvr')
        self.exdp = transient_2d(model, (nrow, ncol),
                                 np.float32,
                                 exdp,
                                 name='exdp')
        self.ievt = transient_2d(model, (nrow, ncol),
                                 np.int,
                                 ievt,
                                 name='ievt')
        self.np = 0
        self.parent.add_package(self)
Exemple #43
0
    def __init__(self,
                 model,
                 stress_period_data=None,
                 dtype=None,
                 extension='chd',
                 unitnumber=24,
                 **kwargs):
        # Call ancestor's init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'CHD', unitnumber)
        self.url = 'chd.htm'
        self.heading = '# CHD for MODFLOW, generated by Flopy.'

        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype()
        self.stress_period_data = mflist(model, self.dtype, stress_period_data)

        self.np = 0
        self.parent.add_package(self)
Exemple #44
0
    def __init__( self, model, wel1flag=1, qsumflag=1, byndflag=1, mnwobs=1, wellid_unit_qndflag_qhbflag_concflag=None,
                  extension='mnwi', unitnumber=58 ):
        Package.__init__(self, model, extension, 'MNWI', unitnumber) # Call ancestor's init to set self.parent, extension, name, and unit number
        self.url = 'mnwi.htm'
        self.heading = '# Multi-node well information (MNWI) file for MODFLOW, generated by Flopy'
        self.wel1flag = wel1flag        #-integer flag indicating output to be written for each MNW node at the end of each stress period
        self.qsumflag = qsumflag        #-integer flag indicating output to be written for each multi-node well
        self.byndflag = byndflag        #-integer flag indicating output to be written for each MNW node
        self.mnwobs = mnwobs            #-number of multi-node wells for which detailed flow, head, and solute data re to be saved
        self.wellid_unit_qndflag_qhbflag_concflag = wellid_unit_qndflag_qhbflag_concflag #-list of lists containing wells and related information to be output (length = [MNWOBS][4or5])

        #-input format checks:
        assert self.wel1flag >= 0, 'WEL1flag must be greater than or equal to zero.'
        assert self.qsumflag >= 0, 'QSUMflag must be greater than or equal to zero.'
        assert self.byndflag >= 0, 'BYNDflag must be greater than or equal to zero.'

        if len(self.wellid_unit_qndflag_qhbflag_concflag) != self.mnwobs:
            print 'WARNING: number of listed well ids to be monitored does not match MNWOBS.'

        self.parent.add_package(self)
Exemple #45
0
    def __init__(self,
                 model,
                 hnoflo=-9999.,
                 hdry=-8888.,
                 def_face_ct=0,
                 bud_label=None,
                 def_iface=None,
                 laytyp=0,
                 ibound=1,
                 prsity=0.30,
                 prsityCB=0.30,
                 extension='mpbas',
                 unitnumber=86):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'MPBAS', unitnumber)
        nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
        self.parent.mf.get_name_file_entries()
        self.heading1 = '# MPBAS for Modpath, generated by Flopy.'
        self.heading2 = '#'
        self.hnoflo = hnoflo
        self.hdry = hdry
        self.def_face_ct = def_face_ct
        self.bud_label = bud_label
        self.def_iface = def_iface
        self.laytyp = laytyp
        self.__ibound = util_3d(model, (nlay, nrow, ncol),
                                np.int,
                                ibound,
                                name='ibound',
                                locat=self.unit_number[0])

        self.prsity = prsity
        self.prsityCB = prsityCB
        self.prsity = util_3d(model,(nlay,nrow,ncol),np.float32,\
                              prsity,name='prsity',locat=self.unit_number[0])
        self.prsityCB = util_3d(model,(nlay,nrow,ncol),np.float32,\
                                prsityCB,name='prsityCB',locat=self.unit_number[0])
        self.parent.add_package(self)
Exemple #46
0
    def __init__(self, model, nrchop=3, ipakcb=0, rech=1e-3, irch=0,
                 extension ='rch', unitnumber=19):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'RCH', unitnumber)
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        self.heading = '# RCH for MODFLOW, generated by Flopy.'
        self.url = 'rch.htm'
        self.nrchop = nrchop
        self.ipakcb = ipakcb
        self.rech = transient_2d(model, (nrow, ncol), np.float32,
                                 rech, name = "rech_")
        if self.nrchop == 2:
            self.irch = transient_2d(model, (nrow, ncol), np.int,
                                     irch+1, name = "irch_")  # irch+1, as irch is zero based
        else:
            self.irch = None
        self.np = 0
        self.parent.add_package(self)
Exemple #47
0
    def __init__(self,
                 model,
                 ibound=1,
                 strt=1.0,
                 ifrefm=True,
                 ixsec=False,
                 ichflg=False,
                 stoper=None,
                 hnoflo=-999.99,
                 extension='bas',
                 unitnumber=13):
        """
        Package constructor.

        """
        # Call ancestor's init to set self.parent, extension, name and unit
        # number
        Package.__init__(self, model, extension, 'BAS6', unitnumber)
        self.url = 'bas6.htm'
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        self.__ibound = util_3d(model, (nlay, nrow, ncol),
                                np.int,
                                ibound,
                                name='ibound',
                                locat=self.unit_number[0])
        self.strt = util_3d(model, (nlay, nrow, ncol),
                            np.float32,
                            strt,
                            name='strt',
                            locat=self.unit_number[0])
        self.heading = '# Basic package file for MODFLOW, generated by Flopy.'
        self.options = ''
        self.ixsec = ixsec
        self.ichflg = ichflg
        self.stoper = stoper
        self.ifrefm = ifrefm
        self.hnoflo = hnoflo
        self.parent.add_package(self)
        return
Exemple #48
0
 def __init__(self, model, mxiter=50, iiter=30, iadamp=0, \
              hclose=1e-5, rclose=1e-5, relax=1.0, ioutgmg=0, \
              ism=0, isc=0, damp=1.0,dup=0.75,dlow=0.01,\
              chglimit=1.0,extension='gmg', unitnumber=27):
     Package.__init__(self, model, extension, 'GMG', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
     self.heading = '# GMG for MODFLOW, generated by Flopy.'
     self.url = 'gmg.htm'
     self.mxiter = mxiter
     self.iiter = iiter
     self.iadamp = iadamp
     self.hclose = hclose
     self.rclose = rclose
     self.relax = relax
     self.ism = ism
     self.isc = isc
     self.dup = dup
     self.dlow = dlow
     self.chglimit = chglimit
     self.damp = damp
     self.ioutgmg = ioutgmg
     self.iunitmhc = 0
     self.parent.add_package(self)
Exemple #49
0
 def __init__(self,
              model,
              mxiter=1,
              iter1=50,
              isolve=3,
              ncrs=0,
              accl=1,
              cclose=1e-5,
              iprgcg=0,
              extension='gcg'):
     #Call ancestor's init to set self.parent, extension, name and
     #unit number
     Package.__init__(self, model, extension, 'GCG', 35)
     self.mxiter = mxiter
     self.iter1 = iter1
     self.isolve = isolve
     self.ncrs = ncrs
     self.accl = accl
     self.cclose = cclose
     self.iprgcg = iprgcg
     self.parent.add_package(self)
     return
Exemple #50
0
    def __init__(self, model, ipakcb=0, stress_period_data=None,dtype=None,
                 extension ='riv', unitnumber=18, options=None,**kwargs):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'RIV', unitnumber)
        self.heading = '# RIV for MODFLOW, generated by Flopy.'
        self.url = 'riv.htm'
        self.ipakcb = ipakcb
        self.mxactr = 0
        self.np = 0
        if options is None:
            options = []
        self.options = options
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype()
        self.stress_period_data = mflist(model,self.dtype,stress_period_data)
        self.parent.add_package(self)
Exemple #51
0
 def __init__(self, model, ibcfcb = 0, intercellt=0,laycon=3, trpy=1.0, hdry=-1E+30, iwdflg=0, wetfct=0.1, iwetit=1, ihdwet=0, \
              tran=1.0, hy=1.0, vcont=1.0, sf1=1e-5, sf2=0.15, wetdry=-0.01, extension='bcf', unitnumber=15):
     Package.__init__(self, model, extension, 'BCF6', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
     self.url = 'bcf.htm'
     nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
     # Set values of all parameters
     self.intercellt = util_2d(model,(nlay,),np.int,intercellt,name='laycon',locat=self.unit_number[0])
     self.laycon = util_2d(model,(nlay,),np.int,laycon,name='laycon',locat=self.unit_number[0])
     self.trpy = util_2d(model,(nlay,),np.int,trpy,name='Anisotropy factor',locat=self.unit_number[0])
     self.ibcfcb = ibcfcb # Unit number for file with cell-by-cell flow terms
     self.hdry = hdry # Head in cells that are converted to dry during a simulation
     self.iwdflg = iwdflg # Flag that determines if the wetting capability is active
     self.wetfct = wetfct # Factor that is included in the calculation of the head when a cell is converted from dry to wet
     self.iwetit = iwetit # Iteration interval for attempting to wet cells
     self.ihdwet = ihdwet # Flag that determines which equation is used to define the initial head at cells that become wet     
     self.tran = util_3d(model,(nlay,nrow,ncol),np.float32,tran,'Transmissivity',locat=self.unit_number[0])    
     self.hy = util_3d(model,(nlay,nrow,ncol),np.float32,hy,'Horizontal Hydraulic Conductivity',locat=self.unit_number[0])    
     self.vcont = util_3d(model,(nlay-1,nrow,ncol),np.float32,vcont,'Vertical Conductance',locat=self.unit_number[0])    
     self.sf1 = util_3d(model,(nlay,nrow,ncol),np.float32,sf1,'Primary Storage Coefficient',locat=self.unit_number[0])    
     self.sf2 = util_3d(model,(nlay,nrow,ncol),np.float32,sf2,'Secondary Storage Coefficient',locat=self.unit_number[0])    
     self.wetdry = util_3d(model,(nlay,nrow,ncol),np.float32,wetdry,'WETDRY',locat=self.unit_number[0])       
     self.parent.add_package(self)
Exemple #52
0
    def get_empty(ncells=0, aux_names=None):
        """
        Get an empty recarray that correponds to hfb dtype and has
        been extended to include aux variables and associated
        aux names.

        """
        dtype = ModflowHfb.get_default_dtype()
        if aux_names is not None:
            dtype = Package.add_to_dtype(dtype, aux_names, np.float32)
        d = np.zeros((ncells, len(dtype)), dtype=dtype)
        d[:, :] = -1.0E+10
        return np.core.records.fromarrays(d.transpose(), dtype=dtype)
Exemple #53
0
 def __init__(self,
              model,
              mtdnconc=1,
              mfnadvfd=1,
              nswtcpl=1,
              iwtable=1,
              densemin=1.000,
              densemax=1.025,
              dnscrit=1e-2,
              denseref=1.000,
              denseslp=.025,
              firstdt=0.001,
              indense=0,
              dense=1.000,
              extension='vdf'):
     # Call ancestor's init to set self.parent, extension, name and
     #unit number
     Package.__init__(self, model, extension, 'VDF', 37)
     nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
     self.mtdnconc = mtdnconc
     self.mfnadvfd = mfnadvfd
     self.nswtcpl = nswtcpl
     self.iwtable = iwtable
     self.densemin = densemin
     self.densemax = densemax
     self.dnscrit = dnscrit
     self.denseref = denseref
     self.denseslp = denseslp
     self.firstdt = firstdt
     self.indense = indense
     #self.dense = self.assignarray((nlay,nrow,ncol), np.float, dense,
     #                              name='dense',)
     self.dense = util_3d(model, (nlay, nrow, ncol),
                          np.float32,
                          dense,
                          name='dense')
     self.parent.add_package(self)
     return
Exemple #54
0
    def __init__(self,
                 model,
                 ipakcb=0,
                 stress_period_data=None,
                 dtype=None,
                 extension='wel',
                 unitnumber=20,
                 options=None):
        """
        Package constructor.

        """
        # Call parent init to set self.parent, extension, name and unit number
        Package.__init__(self, model, extension, 'WEL', unitnumber)
        self.heading = '# Well file for MODFLOW, generated by Flopy.'
        self.url = 'wel.htm'
        self.ipakcb = ipakcb  # no cell by cell terms are written
        self.np = 0
        if options is None:
            options = []
        self.specify = False
        for idx, opt in enumerate(options):
            if 'specify' in opt:
                t = opt.strip().split()
                self.specify = True
                self.phiramp = np.float(t[1])
                self.phiramp_unit = np.int(t[2])
                options.pop(idx)
                break
        self.options = options
        self.parent.add_package(self)
        if dtype is not None:
            self.dtype = dtype
        else:
            self.dtype = self.get_default_dtype(
                structured=self.parent.structured)
        self.stress_period_data = mflist(self, stress_period_data)
Exemple #55
0
 def __init__(self, model, ibcfcb=53, intercellt=0,laycon=3, trpy=1.0,
              hdry=-1E+30, iwdflg=0, wetfct=0.1, iwetit=1, ihdwet=0,
              tran=1.0, hy=1.0, vcont=1.0, sf1=1e-5, sf2=0.15, wetdry=-0.01,
              extension='bcf', unitnumber=15):
     Package.__init__(self, model, extension, 'BCF6', unitnumber)
     self.url = 'bcf.htm'
     nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
     # Set values of all parameters
     self.intercellt = util_2d(model, (nlay,), np.int,intercellt,
                               name='laycon',locat=self.unit_number[0])
     self.laycon = util_2d(model, (nlay,), np.int,laycon, name='laycon',
                           locat=self.unit_number[0])
     self.trpy = util_2d(model, (nlay,), np.int, trpy,
                         name='Anisotropy factor',locat=self.unit_number[0])
     self.ibcfcb = ibcfcb
     self.hdry = hdry
     self.iwdflg = iwdflg
     self.wetfct = wetfct
     self.iwetit = iwetit
     self.ihdwet = ihdwet
     self.tran = util_3d(model, (nlay,nrow,ncol), np.float32, tran,
                         'Transmissivity', locat=self.unit_number[0])
     self.hy = util_3d(model, (nlay,nrow,ncol), np.float32, hy,
                       'Horizontal Hydraulic Conductivity',
                       locat=self.unit_number[0])
     self.vcont = util_3d(model, (nlay-1,nrow,ncol), np.float32, vcont,
                          'Vertical Conductance', locat=self.unit_number[0])
     self.sf1 = util_3d(model, (nlay,nrow,ncol), np.float32, sf1,
                        'Primary Storage Coefficient',
                        locat=self.unit_number[0])
     self.sf2 = util_3d(model, (nlay,nrow,ncol), np.float32, sf2,
                        'Secondary Storage Coefficient',
                        locat=self.unit_number[0])
     self.wetdry = util_3d(model, (nlay,nrow,ncol), np.float32, wetdry,
                           'WETDRY', locat=self.unit_number[0])
     self.parent.add_package(self)
Exemple #56
0
    def __init__(self, model, mxiter=50, iter1=30, npcond=1,
                 hclose=1e-5, rclose=1e-5, relax=1.0, nbpol=0, iprpcg=0, mutpcg=3,
                 damp=1.0, dampt=1.0, ihcofadd=0,
                 extension='pcg', unitnumber=27):
        """
        Package constructor.

        """
        Package.__init__(self, model, extension, 'PCG', unitnumber) # Call ancestor's init to set self.parent, extension, name and unit number
        self.heading = '# PCG for MODFLOW, generated by Flopy.'
        self.url = 'pcg.htm'
        self.mxiter = mxiter
        self.iter1 = iter1
        self.npcond = npcond
        self.hclose = hclose
        self.rclose = rclose
        self.relax = relax
        self.nbpol = nbpol
        self.iprpcg = iprpcg
        self.mutpcg = mutpcg
        self.damp = damp
        self.dampt = dampt
        self.ihcofadd = ihcofadd
        self.parent.add_package(self)
Exemple #57
0
    def load(f, model, nper=None, ext_unit_dict=None):
        """
        Load an existing package.

        Parameters
        ----------
        f : filename or file handle
            File to load.
        model : model object
            The model object (of type :class:`flopy.modflow.mf.Modflow`) to
            which this package will be added.
        nper : int
            The number of stress periods.  If nper is None, then nper will be
            obtained from the model object. (default is None).
        ext_unit_dict : dictionary, optional
            If the arrays in the file are specified using EXTERNAL,
            or older style array control records, then `f` should be a file
            handle.  In this case ext_unit_dict is required, which can be
            constructed using the function
            :class:`flopy.utils.mfreadnam.parsenamefile`.

        Returns
        -------
        chd : ModflowChd object
            ModflowChd object.

        Examples
        --------

        >>> import flopy
        >>> m = flopy.modflow.Modflow()
        >>> wel = flopy.modflow.ModflowChd.load('test.chd', m)

        """

        if model.verbose:
            sys.stdout.write('loading chd package file...\n')

        return Package.load(model, ModflowChd, f, nper)
Exemple #58
0
    def __init__(self, model,\
                 ihedfm=0, iddnfm=0, chedfm=None, cddnfm=None,\
                 cboufm=None, compact=True,\
                 stress_period_data={(0,0):['save head']},\
                 extension=['oc','hds','ddn','cbc'],\
                 unitnumber=[14, 51, 52, 53]):
        """
        Package constructor.

        """

        # Call ancestor's init to set self.parent,
        # extension, name and unit number
        hds_fmt = 'DATA(BINARY)'
        ddn_fmt = 'DATA(BINARY)'
        if chedfm is not None:
            hds_fmt = 'DATA'
        if cddnfm is not None:
            ddn_fmt = 'DATA'

        ibouun = 0
        ibndsav = False
        for key in stress_period_data.keys():
            t = stress_period_data[key]
            if len(t) > 0:
                for option in t:
                    if 'ibound' in option.lower():
                        ibndsav = True
                        break

        name = ['OC', hds_fmt, ddn_fmt, 'DATA(BINARY)']
        extra = ['', 'REPLACE', 'REPLACE', 'REPLACE']
        if ibndsav == True:
            if cboufm == None:
                name.append('DATA(BINARY)')
            else:
                name.append('DATA')
            extension.append('ibo')
            unitnumber.append(114)
            ibouun = unitnumber[-1]
            extra.append('REPLACE')

        Package.__init__(
            self,
            model,
            extension=extension,
            name=name,
            unit_number=unitnumber,
            extra=extra
        )  # Call ancestor's init to set self.parent, extension, name and unit number


        self.heading = '# Output control package file'+\
                       ' for MODFLOW, generated by Flopy.'

        self.url = 'oc.htm'
        self.ihedfm = ihedfm
        self.iddnfm = iddnfm
        self.chedfm = chedfm
        self.cddnfm = cddnfm

        self.ibouun = ibouun
        self.cboufm = cboufm

        self.compact = compact

        self.stress_period_data = stress_period_data

        self.parent.add_package(self)
Exemple #59
0
    def __init__(self, model, npln=1, istrat=1, iswizt=53, nprn=1, toeslope=0.05, tipslope=0.05, \
                 zetamin=0.005, delzeta=0.05, nu=0.025, zeta=[], ssz=[], isource=0, extension='swi', fname_output='swi.zta'):
        """
        Package constructor.

        """
        Package.__init__(self,
                         model)  # Call ancestor's init to set self.parent
        nrow, ncol, nlay, nper = self.parent.nrow_ncol_nlay_nper
        self.unit_number = [29, 53]
        self.extension = extension
        self.file_name = [
            self.parent.name + '.' + self.extension, fname_output
        ]
        self.name = ['SWI', 'DATA(BINARY)']
        self.heading = '# Salt Water Intrusion package file for MODFLOW-2000, generated by Flopy.'
        self.npln = npln
        self.istrat = istrat
        self.iswizt = iswizt
        self.nprn = nprn
        self.toeslope = toeslope
        self.tipslope = tipslope
        self.zetamin = zetamin
        self.delzeta = delzeta
        # Create arrays so that they have the correct size
        if self.istrat == 1:
            #self.nu = empty( self.npln+1 )
            self.nu = util_2d(model, (self.npln + 1, ),
                              np.float32,
                              nu,
                              name='nu')
        else:
            #self.nu = empty( self.npln+2 )
            self.nu = util_2d(model, (self.npln + 2, ),
                              np.float32,
                              nu,
                              name='nu')
        self.zeta = []
        for i in range(nlay):
            #self.zeta.append( empty((nrow, ncol, self.npln)) )
            self.zeta
        #self.ssz = empty((nrow, ncol, nlay))
        #self.isource = empty((nrow, ncol, nlay),dtype='int32')
        # Set values of arrays
        #self.assignarray_old( self.nu, nu )
        #for i in range(nlay):
        #    self.assignarray_old( self.zeta[i], zeta[i] )
        #self.assignarray_old( self.ssz, ssz )
        #self.assignarray_old( self.isource, isource )
        for i in range(nlay):
            self.zeta.append(
                util_2d(model, (self.npln, nrow, ncol),
                        np.float32,
                        zeta[i],
                        name='zeta_' + str(i + 1)))
        self.ssz = util_3d(model, (nlay, nrow, ncol),
                           np.float32,
                           ssz,
                           name='ssz')
        self.isource = util_3d(model, (nlay, nrow, ncol),
                               np.int,
                               isource,
                               name='isource')
        self.parent.add_package(self)
Exemple #60
0
    def __init__(self, model, crch = None, cevt = None,
                 stress_period_data = None, dtype = None,
                 extension = 'ssm',
                 **kwargs):
        # Call ancestor's init to set self.parent, extension, name and
        # unit number
        Package.__init__(self, model, extension, 'SSM', 34)

        deprecated_kwargs = ['criv', 'cghb', 'cibd', 'cchd', 'cpbc', 'cwel'] 
        for key in kwargs:
            if (key in deprecated_kwargs):
                warnings.warn("Deprecation Warning: Keyword argument '" + key +
                              "' no longer supported. Use " +
                              "'stress_period_data' instead.")
                
        nrow, ncol, nlay, nper = self.parent.mf.nrow_ncol_nlay_nper
        # ncomp > 1 support
        ncomp = self.parent.get_ncomp()

        self.__SsmPackages = []
        for i, label in enumerate(SsmLabels):
            self.__SsmPackages.append(SsmPackage(label, 
                               self.parent.mf.get_package(label),
                               (i < 6))) # First 6 need T/F flag in file line 1

        self.__maxssm = 0
        #if (self.parent.btn.icbund != None):
        if isinstance(self.parent.btn.icbund, np.ndarray):
            self.maxssm = (self.parent.btn.icbund < 0).sum()
        for p in self.__SsmPackages:
            if ((p.label == 'BAS6') and (p.instance != None)):
                self.__maxssm += (p.instance.ibound < 0).sum()
            elif p.instance != None:
                self.__maxssm += p.instance.ncells()
        
        # Note: list is used for multi-species, NOT for stress periods!        
        if (crch != None):
            self.crch = []
            t2d = transient_2d(model, (nrow, ncol), np.float32,
                               crch, name='crch1',
                               locat=self.unit_number[0])
            self.crch.append(t2d)
            if ncomp > 1:
                for icomp in range(2, ncomp+1):
                    val = 0.0
                    name = "crch" + str(icomp)
                    if name in list(kwargs.keys()):
                        val = kwargs[name]
                        kwargs.pop(name)
                    else:
                        print("SSM: setting crch for component " +\
                              str(icomp) + " to zero. kwarg name " +\
                              name)
                    t2d = transient_2d(model, (nrow, ncol), np.float32,
                                       val, name=name,
                                       locat=self.unit_number[0])
                    self.crch.append(t2d)
        else:
            self.crch = None

        if (cevt != None):
            self.cevt = []
            t2d = transient_2d(model, (nrow, ncol), np.float32,
                               cevt, name='cevt1',
                               locat=self.unit_number[0])
            self.cevt.append(t2d)
            if ncomp > 1:
                for icomp in range(2, ncomp+1):
                    val = 0.0
                    name = "cevt" + str(icomp)
                    if name in list(kwargs.keys()):
                        val = kwargs[name]
                        kwargs.pop(name)
                    else:
                        print("SSM: setting cevt for component " +\
                              str(icomp) + " to zero, kwarg name " +\
                              name)
                    t2d = transient_2d(model, (nrow, ncol), np.float32,
                                       val, name=name,
                                       locat=self.unit_number[0])
                    self.cevt.append(t2d)

        else:
            self.cevt = None

        if len(list(kwargs.keys())) > 0:
            raise Exception("SSM error: unrecognized kwargs: " +
                            ' '.join(list(kwargs.keys())))

        if dtype is not None:
            self.dtype = dtype
        else:

            self.dtype = self.get_default_dtype(ncomp)
  
        self.stress_period_data = mflist(self, model=self.parent.mf,
                                         data=stress_period_data)

        #Add self to parent and return
        self.parent.add_package(self)
        return