Commit d085f61ff7386d3d0fa8d5990ee29cbf40b0556f

  • avatar
  • MichaƂ Januszewski <spock @gen…oo.org>
  • Tue Feb 09 23:38:22 CET 2010
Fix axes ordering in the free surface code.

As everywhere else in Sailfish, the ordering of the dimensions in numpy
arrays is [Z,]Y,X.
  
66
77class LBMGeoFS(geo.LBMGeo2D):
88 def init_dist(self, dist):
9 sigma = self.lat_nx / 12.0
9 sigma = min(self.lat_ny, self.lat_nx) / 12.0
1010 amp = 0.4
1111
1212 vx = vy = numpy.zeros_like(dist[0]).astype(numpy.float32)
13 hx, hy = numpy.mgrid[(-self.lat_nx/2.0):(self.lat_nx/2.0):complex(0, self.lat_nx),
14 (-self.lat_ny/2.0):(self.lat_ny/2.0):complex(0,
15 self.lat_ny)].astype(numpy.float32)
13 hx, hy = numpy.mgrid[
14 (-self.lat_ny/2.0):(self.lat_ny/2.0):complex(0, self.lat_ny),
15 (-self.lat_nx/2.0):(self.lat_nx/2.0):complex(0, self.lat_nx)].astype(numpy.float32)
1616
1717 h = 1.0 + amp * numpy.exp(-(numpy.square(hx) + numpy.square(hy)) / sigma**2)
1818 self.velocity_to_dist(slice(None), (vx, vy), dist, h)
  
4848 self.lat_ny = lat_ny
4949 self.sim = sim
5050
51 self.mesh_x, self.mesh_y = numpy.mgrid[-1:1:complex(0, self.lat_nx),
52 -1:1:complex(0, self.lat_ny)]
51 m = min(lat_nx, lat_ny)
52 mx = lat_nx / m
53 my = lat_ny / m
5354
55 self.mesh_x, self.mesh_y = numpy.mgrid[
56 -my:my:complex(0, lat_ny),
57 -mx:mx:complex(0, lat_nx)]
58
5459 self.mesh_x = self.mesh_x.astype(numpy.float32)
5560 self.mesh_y = self.mesh_y.astype(numpy.float32)
5661 self.mesh_n = (self.lat_nx-1) * (self.lat_ny-1) * 4
141141
142142 glTranslatef(0.0, -0.5, -4.0)
143143 glRotatef(-60.0, 1.0, 0.0, 0.0)
144 glRotatef(90.0, 0.0, 0.0, 1.0)
144145
145146 glEnableClientState(GL_COLOR_ARRAY)
146147 glEnableClientState(GL_VERTEX_ARRAY)