コード例 #1
0
ファイル: mfevt.py プロジェクト: 2012konrad77/flopy
    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)
コード例 #2
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)
コード例 #3
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)
コード例 #4
0
ファイル: mfrch.py プロジェクト: ksl0/flopy
    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)
コード例 #5
0
ファイル: mtssm.py プロジェクト: nixnfg/integrated
    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