Example #1
0
 def test2(self):
     instance = QGmodel(redirection="none")
     instance.grid[0, 0, 0].psi
     self.assertEquals(instance.get_name_of_current_state(), 'EDIT')
     instance.initialize_grid()
     self.assertEquals(instance.get_name_of_current_state(), 'RUN')
     instance.stop()
Example #2
0
 def test1(self):
     instance = QGmodel()
     instance.evolve_model(1 | units.hour)
     self.assertEquals(instance.get_name_of_current_state(), 'EVOLVED')
     psi = instance.grid.psi
     self.assertEquals(instance.get_name_of_current_state(), 'RUN')
     instance.stop()
Example #3
0
 def test19(self):
     instance = QGmodel()
     cellsize = instance.grid.cellsize()
     self.assertEquals(instance.get_name_of_current_state(), 'EDIT')
     instance.parameters.boundary_west = "interface"
     self.assertEquals(instance.get_name_of_current_state(),
                       'CHANGE_PARAMETERS_EDIT')
     instance.recommit_parameters()
     self.assertEquals(instance.get_name_of_current_state(), 'EDIT')
     instance.stop()
Example #4
0
 def test0(self):
     instance = QGmodel()
     self.assertEquals(instance.get_name_of_current_state(),
                       'UNINITIALIZED')
     instance.initialize_code()
     self.assertEquals(instance.get_name_of_current_state(), 'INITIALIZED')
     instance.commit_parameters()
     self.assertEquals(instance.get_name_of_current_state(), 'EDIT')
     instance.evolve_model(1 | units.hour)
     self.assertEquals(instance.get_name_of_current_state(), 'EVOLVED')
     psi = instance.grid.psi
     self.assertEquals(instance.get_name_of_current_state(), 'RUN')
     instance.stop()
Example #5
0
 def test20(self):
     instance = QGmodel()
     cellsize = instance.grid.cellsize()
     self.assertEquals(instance.get_name_of_current_state(), 'EDIT')
     a = instance.parameters.robert_asselin_alpha
     instance.parameters.robert_asselin_alpha = 12345.
     self.assertEquals(instance.get_name_of_current_state(),
                       'CHANGE_PARAMETERS_EDIT')
     self.assertEqual(instance.parameters.robert_asselin_alpha, 12345.)
     instance.cleanup_code()
     self.assertEquals(instance.get_name_of_current_state(), 'END')
     instance.initialize_code()
     self.assertEqual(instance.parameters.robert_asselin_alpha, a)
     self.assertEquals(instance.get_name_of_current_state(), 'INITIALIZED')
     instance.stop()
Example #6
0
 def test22(self):
     instance = QGmodel(redirection="none")
     wind_field = instance.wind_field.copy()
     self.assertEquals(instance.get_name_of_current_state(), 'RUN')
     self.assertEqual(wind_field.shape, (401, 401))
     pi = 3.14159265358979
     #expected=cos(2.*pi*((j-1.)/(Ny-1.)-0.5))+2.*sin(pi*((j-1.)/(Ny-1.)-0.5))
     Ly = instance.parameters.Ly
     tau = instance.parameters.tau
     expected = tau * (numpy.cos(2 * pi * (wind_field.y / Ly - 0.5)) +
                       2. * numpy.sin(pi * (wind_field.y / Ly - 0.5)))
     self.assertAlmostEquals(wind_field.tau_x, expected, 7)
Example #7
0
 def test4(self):
     instance = QGmodel(redirection="none")
     instance.grid[0, 0, 0].dpsi_dt
     self.assertEquals(instance.get_name_of_current_state(), 'RUN')
     instance.stop()