@@ -105,7 +105,7 @@ def test_vorticity(nx, nz, direction):
105105
106106@pytest .mark .mpi4py
107107@pytest .mark .parametrize ('v' , [0 , 3.14 ])
108- def test_Nusselt_numbers (v , nx = 6 , nz = 4 ):
108+ def test_Nusselt_numbers (v , nx = 1 , nz = 10 ):
109109 import numpy as np
110110 from pySDC .implementations .problem_classes .RayleighBenard import RayleighBenard
111111
@@ -114,12 +114,22 @@ def test_Nusselt_numbers(v, nx=6, nz=4):
114114 'v_bottom' : 0 ,
115115 }
116116
117- P = RayleighBenard (nx = nx , nz = nz , BCs = BCs , dealiasing = 1.0 , Rayleigh = 1 )
117+ P = RayleighBenard (nx = nx , nz = nz , BCs = BCs , dealiasing = 1.0 , Rayleigh = 1 , spectral_space = False )
118118 prob = P
119119 xp = prob .xp
120120 iv , iT = prob .index (['v' , 'T' ])
121121
122- u = P .u_exact (noise_level = 0 )
122+ u = prob .u_init
123+ u [iT , ...] = prob .Z
124+ Nu = prob .compute_Nusselt_numbers (u )
125+ for key , expect in zip (['t' , 'b' , 'V' ], [- 1 , - 1 , - 1 ]):
126+ assert xp .isclose (Nu [key ], expect ), f'Expected Nu_{ key } ={ expect } , but got { Nu [key ]} '
127+
128+ u = prob .u_init
129+ u [iT , ...] = 3 * prob .Z ** 2 + 1
130+ Nu = prob .compute_Nusselt_numbers (u )
131+ for key , expect in zip (['t' , 'b' , 'V' ], [- 6 , 0 , - 3 ]):
132+ assert xp .isclose (Nu [key ], expect ), f'Expected Nu_{ key } ={ expect } , but got { Nu [key ]} '
123133
124134 u = prob .u_init
125135 u [iT , ...] = 3 * prob .Z ** 2 + 1
@@ -128,17 +138,6 @@ def test_Nusselt_numbers(v, nx=6, nz=4):
128138 for key , expect in zip (['t' , 'b' , 'V' ], [prob .Lz * (3 + 1 ) * v - 6 , v , v * (1 + 1 ) - 3 ]):
129139 assert xp .isclose (Nu [key ], expect ), f'Expected Nu_{ key } ={ expect } , but got { Nu [key ]} '
130140
131- return None
132-
133- # for key, expect in zip(['t', 'b', 'V'], [prob.Lz * (3 + 1) * w - 6, w, w * (1 + 1) - 3]):
134- # assert xp.isclose(Nu[key], expect), f'Expected Nu_{key}={expect}, but got {Nu[key]}'
135-
136- # nusselt = P.compute_Nusselt_numbers(u)
137- # expect = {'V':v, 't': 0, 'b': + 2 * v}
138- # print(nusselt, expect)
139- # for key in nusselt.keys():
140- # assert np.isclose(nusselt[key], expect[key]), key
141-
142141
143142def test_viscous_dissipation (nx = 2 ** 5 + 1 , nz = 2 ** 3 + 1 ):
144143 import numpy as np
@@ -198,7 +197,7 @@ def test_Poisson_problems(nx, component):
198197 'T_bottom' : 0 ,
199198 }
200199 P = RayleighBenard (
201- nx = nx , nz = 6 , BCs = BCs , Rayleigh = (max ([abs (BCs ['T_top' ] - BCs ['T_bottom' ]), np .finfo (float ).eps ]) * 2 ** 3 )
200+ nx = nx , nz = 6 , BCs = BCs , Rayleigh = (max ([abs (BCs ['T_top' ] - BCs ['T_bottom' ]), np .finfo (float ).eps ]) * 2 ** 3 ), Lz = 2
202201 )
203202 rhs = P .u_init
204203
@@ -237,7 +236,7 @@ def test_Poisson_problem_v():
237236 'v_top' : 0 ,
238237 'v_bottom' : 0 ,
239238 'T_top' : 0 ,
240- 'T_bottom' : 2 ,
239+ 'T_bottom' : 1 ,
241240 }
242241 P = RayleighBenard (nx = 2 , nz = 2 ** 3 , BCs = BCs , Rayleigh = 1.0 )
243242 iv = P .index ('v' )
@@ -272,7 +271,7 @@ def test_CFL():
272271 from pySDC .implementations .problem_classes .RayleighBenard import RayleighBenard , CFLLimit
273272 import numpy as np
274273
275- P = RayleighBenard (nx = 5 , nz = 2 , spectral_space = False )
274+ P = RayleighBenard (nx = 5 , nz = 2 , spectral_space = False , Lz = 2 )
276275 iu , iv = P .index (['u' , 'v' ])
277276
278277 u = P .u_init
@@ -331,11 +330,11 @@ def test_apply_BCs():
331330
332331if __name__ == '__main__' :
333332 # test_eval_f(2**0, 2**2, 'z', True)
334- # test_Poisson_problem (1, 'T')
333+ # test_Poisson_problems (1, 'T')
335334 # test_Poisson_problem_v()
336335 # test_apply_BCs()
337- test_Nusselt_numbers (1 )
336+ # test_Nusselt_numbers(1)
338337 # test_buoyancy_computation()
339338 # test_viscous_dissipation()
340- # test_CFL()
339+ test_CFL ()
341340 # test_Nyquist_mode_elimination()
0 commit comments