コード例 #1
0
    def test3(self):
        instance = QGmodelInterface()
        instance.initialize_code()

        instance.commit_parameters()

        psi, err = instance.get_psi1_state(1, 1, 1)
        self.assertEqual(psi, 0.)

        Nx, err = instance.get_Nx()
        Ny, err = instance.get_Ny()

        psi, err = instance.get_psi1_state(Nx, Ny, 1)
        self.assertEqual(psi, 0.)

        instance.stop()
コード例 #2
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()