@@ -60,6 +60,7 @@ def __init__(
6060 comm = None ,
6161 Lx = 4 ,
6262 Lz = 1 ,
63+ z0 = 0 ,
6364 ** kwargs ,
6465 ):
6566 """
@@ -74,6 +75,8 @@ def __init__(
7475 dealiasing (float): Dealiasing for evaluating the non-linear part in real space
7576 comm (mpi4py.Intracomm): Space communicator
7677 Lx (float): Horizontal length of the domain
78+ Lz (float): Vertical length of the domain
79+ z0 (float): Position of lower boundary
7780 """
7881 BCs = {} if BCs is None else BCs
7982 BCs = {
@@ -103,13 +106,14 @@ def __init__(
103106 'comm' ,
104107 'Lx' ,
105108 'Lz' ,
109+ 'z0' ,
106110 localVars = locals (),
107111 readOnly = True ,
108112 )
109113
110114 bases = [
111115 {'base' : 'fft' , 'N' : nx , 'x0' : 0 , 'x1' : self .Lx },
112- {'base' : 'ultraspherical' , 'N' : nz , 'x0' : 0 , 'x1' : self .Lz },
116+ {'base' : 'ultraspherical' , 'N' : nz , 'x0' : self . z0 , 'x1' : self .Lz },
113117 ]
114118 components = ['u' , 'v' , 'T' , 'p' ]
115119 super ().__init__ (bases , components , comm = comm , ** kwargs )
@@ -252,8 +256,8 @@ def u_exact(self, t=0, noise_level=1e-3, seed=99):
252256
253257 # linear temperature gradient
254258 for comp in ['T' , 'v' , 'u' ]:
255- a = (self .BCs [f'{ comp } _top' ] - self .BCs [f'{ comp } _bottom' ]) / 2
256- b = ( self .BCs [f'{ comp } _top ' ] + self . BCs [ f' { comp } _bottom' ]) / 2
259+ a = (self .BCs [f'{ comp } _top' ] - self .BCs [f'{ comp } _bottom' ]) / self . Lz
260+ b = self .BCs [f'{ comp } _bottom ' ] - a * self . z0
257261 me [self .index (comp )] = a * self .Z + b
258262
259263 # perturb slightly
@@ -262,7 +266,7 @@ def u_exact(self, t=0, noise_level=1e-3, seed=99):
262266 noise = self .spectral .u_init
263267 noise [iT ] = rng .random (size = me [iT ].shape )
264268
265- me [iT ] += noise [iT ].real * noise_level * (self .Z - 1 ) * (self .Z + 1 )
269+ me [iT ] += noise [iT ].real * noise_level * (self .Z - self . z0 ) * (self .Z - self . z0 + self . Lz )
266270
267271 if self .spectral_space :
268272 me_hat = self .spectral .u_init_forward
0 commit comments