コード例 #1
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
        if ipakcb != 0:
            self.ipakcb = 53
        else:
            self.ipakcb = 0  # 0: no cell by cell terms are written
        self.external = external
        if self.external is False:
            load = True
        else:
            load = model.load            

        self.surf = Transient2d(model, (nrow, ncol), np.float32,
                                 surf, name='surf')
        self.evtr = Transient2d(model, (nrow, ncol), np.float32,
                                 evtr, name='etvr')
        self.exdp = Transient2d(model, (nrow, ncol), np.float32,
                                 exdp, name='exdp')
        self.ievt = Transient2d(model, (nrow, ncol), np.int,
                                 ievt, name='ievt')
        self.np = 0
        self.parent.add_package(self)
コード例 #2
0
ファイル: t004_test.py プロジェクト: shelbyahrendt/flopy
def test_transient2d():
    ml = flopy.modflow.Modflow()
    dis = flopy.modflow.ModflowDis(ml, nlay=10, nrow=10, ncol=10, nper=3)
    t2d = Transient2d(ml, (10, 10), np.float32, 10., "fake")
    a1 = t2d.array
    assert a1.shape == (3, 1, 10, 10), a1.shape
    t2d.cnstnt = 2.0
    assert np.array_equal(t2d.array, np.zeros((3, 1, 10, 10)) + 20.0)

    t2d[0] = 1.0
    t2d[2] = 999
    assert np.array_equal(t2d[0].array, np.ones((ml.nrow, ml.ncol)))
    assert np.array_equal(t2d[2].array, np.ones((ml.nrow, ml.ncol)) * 999)

    m4d = t2d.array
    t2d2 = Transient2d.from_4d(ml, "rch", {"rech": m4d})
    m4d2 = t2d2.array
    assert np.array_equal(m4d, m4d2)
コード例 #3
0
def test_transient2d():
    ml = flopy.modflow.Modflow()
    dis = flopy.modflow.ModflowDis(ml, nlay=10, nrow=10, ncol=10, nper=3)
    t2d = Transient2d(ml, (10, 10), np.float32, 10., "fake")
    a1 = t2d.array
    assert a1.shape == (3, 1, 10, 10), a1.shape
    t2d.cnstnt = 2.0
    assert np.array_equal(t2d.array, np.zeros((3, 1, 10, 10)) + 20.0)

    t2d[0] = 1.0
    t2d[2] = 999
    assert np.array_equal(t2d[0].array, np.ones((ml.nrow, ml.ncol)))
    assert np.array_equal(t2d[2].array, np.ones((ml.nrow, ml.ncol)) * 999)

    m4d = t2d.array
    t2d2 = Transient2d.from_4d(ml, "rch", {"rech": m4d})
    m4d2 = t2d2.array
    assert np.array_equal(m4d, m4d2)