Ejemplo n.º 1
0
def low_level():

    q = QGmodelInterface(redirection="none")

    print 1
    q.initialize_code()
    print 2

    q.set_Lx(4.e6)
    q.set_Ly(4.e6)
    q.set_dx(1.e4)
    q.set_dy(1.e4)
    q.set_dt(1800)

    q.commit_parameters()
    print 3

    q.initialize_grid()
    print 4

    q.evolve_model(86400.)
    print 5
    print q.get_time()

    x, y = numpy.mgrid[0:400, 0:400]

    x = x.flatten() + 1
    y = y.flatten() + 1

    psi, err = q.get_psi1_state(x, y, 1)

    psi = psi.reshape((400, 400))

    print psi.shape
    pyplot.imshow(psi)

    pyplot.show()
Ejemplo n.º 2
0
    def test2(self):
        instance = QGmodelInterface()
        instance.initialize_code()

        err = instance.set_Lx(100.)
        err = instance.set_dx(1)
        err = instance.set_Ly(1000.)
        err = instance.set_dy(20)

        instance.commit_parameters()

        Nx, err = instance.get_Nx()
        self.assertEquals(Nx, 101)
        Ny, err = instance.get_Ny()
        self.assertEquals(Ny, 51)

        instance.stop()