Changeset 800 for codes/icosagcm/devel/Python/test
- Timestamp:
- 01/16/19 15:27:39 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
codes/icosagcm/devel/Python/test/py/Baroclinic_3D_ullrich.py
r797 r800 34 34 from dynamico import DCMIP 35 35 from dynamico import meshes 36 from dynamico import maps 36 37 from dynamico import xios 37 38 from dynamico import precision as prec … … 55 56 return pmesh 56 57 57 def baroclinic_3D(pmesh, Lx,Ly,llm,ztop):58 def baroclinic_3D(pmesh, dx,Lx,Ly,llm,ztop): 58 59 Rd = 287.0 # Gas constant for dryy air (j kg^-1 K^-1) 59 60 T0 = 288.0 # Reference temperature (K) … … 90 91 91 92 def eta(alpha) : return (1.-(lap*ztop*alpha/T0))**(g/(Rd*lap)) # roughly equispaced levels 92 def coriolis(x,y): return f0+beta0*y # here y is 0 at domain center93 94 nqdyn , radius = 1, None95 mesh = meshes.Local_Mesh(pmesh, llm, nqdyn, radius, coriolis)93 94 betaplane = maps.BetaPlaneMap(dx, .5*Lx, .5*Ly, f0, beta0, .5*Ly) 95 nqdyn = 1 96 mesh = meshes.Local_Mesh(pmesh, llm, nqdyn, betaplane) 96 97 97 98 alpha_k = (np.arange(llm) +.5)/llm 98 99 alpha_l = (np.arange(llm+1)+ 0.)/llm 99 x_ik, alpha_ik = np.meshgrid(mesh.lon_i, 100 y_ik, alpha_ik = np.meshgrid(mesh.lat_i +y0, alpha_k, indexing='ij')101 x_il, alpha_il = np.meshgrid(mesh.lon_i, 102 y_il, alpha_il = np.meshgrid(mesh.lat_i +y0, alpha_l, indexing='ij')103 x_ek, alpha_ek = np.meshgrid(mesh.lon_e, 104 y_ek, alpha_ek = np.meshgrid(mesh.lat_e +y0, alpha_k, indexing='ij')100 x_ik, alpha_ik = np.meshgrid(mesh.lon_i, alpha_k, indexing='ij') 101 y_ik, alpha_ik = np.meshgrid(mesh.lat_i, alpha_k, indexing='ij') 102 x_il, alpha_il = np.meshgrid(mesh.lon_i, alpha_l, indexing='ij') 103 y_il, alpha_il = np.meshgrid(mesh.lat_i, alpha_l, indexing='ij') 104 x_ek, alpha_ek = np.meshgrid(mesh.lon_e, alpha_k, indexing='ij') 105 y_ek, alpha_ek = np.meshgrid(mesh.lat_e, alpha_k, indexing='ij') 105 106 106 107 print(np.shape(alpha_k),np.shape(alpha_l)) … … 166 167 class myDavies(Davies): 167 168 def mask(self,x,y): 168 logging.debug('davies dy = %f'% d y)169 return self.mask0(y, .5*Ly,dy)*self.mask0(-y,.5*Ly,dy)169 logging.debug('davies dy = %f'% dx) 170 return self.mask0(y,Ly,dx)*self.mask0(-y,0.,dx) 170 171 171 172 with xios.Client() as client: # setup XIOS which creates the DYNAMICO communicator … … 178 179 nx, ny, llm = args.nx, args.ny, args.llm 179 180 dx = Lx/nx 180 dy = dx 181 182 if True: # physical domain excludes relaxation zone 183 Dy = Ly + dy*2*(args.Davies_N1+args.Davies_N2) 184 print('Dy=%f, Ly = %f'%(Dy,Ly)) 185 else: # physical domain includes relaxation zone 186 Dy=Ly 187 # print('WARNING: Davies_N1 not equal to Davies_N2; average value will be used') 188 181 189 182 unst.setvar('g',g) 190 183 191 184 pmesh = create_pmesh(nx,ny) 192 thermo, mesh, params, flow0, gas0 = baroclinic_3D(pmesh, Lx,Ly,llm, args.ztop)185 thermo, mesh, params, flow0, gas0 = baroclinic_3D(pmesh, dx,Lx,Ly,llm, args.ztop) 193 186 194 187 mass_bl,mass_dak,mass_dbk = meshes.compute_hybrid_coefs(flow0[0]) … … 281 274 # context.send_field_primal('p', drhodz) 282 275 283 context.send_field_primal('theta', gas.s) 276 context.send_field_primal('theta', thermo.T0*exp(gas.s/thermo.Cpd)) 277 284 278 context.send_field_primal('uz', w) 285 279 context.send_field_primal('z', z)
Note: See TracChangeset
for help on using the changeset viewer.