@@ -266,6 +266,44 @@ def invmatrix(self, k, l):
266
266
return L
267
267
268
268
269
+ class Surface (Model ):
270
+
271
+ """
272
+ Surface QG model
273
+
274
+ This implements an SQG model that consists of surface buoyancy conserva-
275
+ tion and implicit dynamics in an infinitely deep interior determined by
276
+ zero PV there. The conserved quantity here is PV-like and implements the
277
+ "oceanographic" case, where the surface is an upper surface. The dynamics
278
+ can also be used in an "atmospheric" case or a case with an interface
279
+ between two semi-infinite layers (see Held et al., 1995). The conserved
280
+ quantity is
281
+ q[0] = - f b(0) / N^2.
282
+ """
283
+
284
+ def __init__ (self ):
285
+ Model .__init__ (self , 1 )
286
+
287
+ def initmean (self , f , N , Sx , Sy ):
288
+ """Set up the mean state."""
289
+ self .f = f # Coriolis parameter
290
+ self .N = N # buoyancy frequency
291
+ # Set up mean flow.
292
+ self .u = np .array ([0 ])
293
+ self .v = np .array ([0 ])
294
+ # Set up mean PV gradients.
295
+ self .qx = np .array ([- f ** 2 * Sy / N ** 2 ])
296
+ self .qy = np .array ([+ f ** 2 * Sx / N ** 2 ])
297
+
298
+ def invmatrix (self , k , l ):
299
+ """Set up the inversion matrix L."""
300
+ kh = np .hypot (k , l )[:,:,0 ]
301
+ kh [kh == 0. ] = 1. # preventing div. by zero for wavenumber 0
302
+ L = np .empty ((l .size , k .size , 1 , 1 ))
303
+ L [:,:,0 ,0 ] = - self .f * kh / self .N
304
+ return L
305
+
306
+
269
307
class Layered (Model ):
270
308
271
309
"""
@@ -278,7 +316,7 @@ class Layered(Model):
278
316
279
317
def initmean (self , f , h , g , u , v , beta ):
280
318
"""Set up the mean state."""
281
- self .f = np . array ( f ) # Coriolis parameter
319
+ self .f = f # Coriolis parameter
282
320
self .h = np .array (h ) # layer thicknesses
283
321
self .g = np .array (g ) # buoyancy jumps at interfaces
284
322
self .u = np .array (u ) # mean zonal flow
0 commit comments