@@ -131,14 +131,41 @@ def dleithlocal_method(self):#, Psi_hat, Omega_hat, Kx, Ky, Ksq, Delta):
131131 eddy_viscosity = eddy_viscosity_leith (Cl , Delta , characteristic_Omega )
132132
133133 # Calculate the PI term for local PI = ∇.(ν_e ∇ω )
134- Grad_Omega_hat_dirx = Kx * np .fft .fft2 ( eddy_viscosity * np .fft .ifft2 (Kx * Omega_hat ) )
135- Grad_Omega_hat_diry = Ky * np .fft .fft2 ( eddy_viscosity * np .fft .ifft2 (Ky * Omega_hat ) )
134+ Grad_Omega_hat_dirx = Kx * np .fft .fft2 ( eddy_viscosity * np .fft .ifft2 (Kx * Omega_hat ) )
135+ Grad_Omega_hat_diry = Ky * np .fft .fft2 ( eddy_viscosity * np .fft .ifft2 (Ky * Omega_hat ) )
136136 Grad_Omega_hat = Grad_Omega_hat_dirx + Grad_Omega_hat_diry
137137
138+ #''' test: difference between local and not
139+ c_dynamic_old = coefficient_dleith_PsiOmega (Psi_hat , Omega_hat , characteristic_Omega , Kx , Ky , Ksq , Delta )
140+ Cl_old = c_dynamic_old ** (1 / 3 )
141+ eddy_viscosity_old = eddy_viscosity_leith (Cl_old , Delta , characteristic_Omega )
142+ Grad_Omega_hat_old = eddy_viscosity_old * (Ksq * Omega_hat )
143+
144+ import matplotlib .pyplot as plt
145+ VMIN , VMAX = - 2 , 2
146+ plt .figure (figsize = (10 ,3 ))
147+ plt .subplot (1 ,3 ,1 )
148+ plt .pcolor (np .fft .ifft2 (Grad_Omega_hat_old ).real ,vmin = VMIN ,vmax = VMAX ,cmap = 'bwr' );plt .colorbar ()
149+ plt .subplot (1 ,3 ,2 )
150+ plt .pcolor (np .fft .ifft2 (Grad_Omega_hat ).real ,vmin = VMIN ,vmax = VMAX ,cmap = 'bwr' );plt .colorbar ()
151+ plt .subplot (1 ,3 ,3 )
152+ plt .pcolor (np .fft .ifft2 (Grad_Omega_hat_old - Grad_Omega_hat ).real ,vmin = VMIN ,vmax = VMAX ,cmap = 'bwr' );plt .colorbar ()
153+ plt .show ()
154+
155+ plt .figure (figsize = (7 ,3 ))
156+ plt .subplot (1 ,2 ,1 )
157+ plt .title (r'$C_L$' )
158+ plt .pcolor (Cl ,vmin = VMIN ,vmax = VMAX ,cmap = 'bwr' );plt .colorbar ()
159+ plt .subplot (1 ,2 ,2 )
160+ plt .title (r'$\nu_e$' )
161+ plt .pcolor (eddy_viscosity ,cmap = 'gray_r' );plt .colorbar ()
162+ plt .show ()
163+ stop_test
164+ #'''
165+
138166 #PiOmega_hat is instead replaced
139167 eddy_viscosity = 0
140168 Cl = 0
141-
142169 self .PiOmega_hat , self .eddy_viscosity , self .C_MODEL = PiOmega_hat , eddy_viscosity , Cl
143170
144171 return PiOmega_hat , eddy_viscosity , Cl
0 commit comments