Ignore:
Timestamp:
01/16/19 15:27:39 (5 years ago)
Author:
jisesh
Message:

devel/unstructured : introduced mapping from reference domain to physical domain

File:
1 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/devel/Python/test/py/Baroclinic_3D_ullrich.py

    r797 r800  
    3434from dynamico import DCMIP 
    3535from dynamico import meshes 
     36from dynamico import maps 
    3637from dynamico import xios 
    3738from dynamico import precision as prec 
     
    5556    return pmesh 
    5657 
    57 def baroclinic_3D(pmesh, Lx,Ly,llm,ztop): 
     58def baroclinic_3D(pmesh, dx,Lx,Ly,llm,ztop): 
    5859    Rd    = 287.0      # Gas constant for dryy air (j kg^-1 K^-1) 
    5960    T0    = 288.0      # Reference temperature (K)  
     
    9091 
    9192    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 center 
    93  
    94     nqdyn, radius = 1, None 
    95     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) 
    9697 
    9798    alpha_k = (np.arange(llm)  +.5)/llm 
    9899    alpha_l = (np.arange(llm+1)+ 0.)/llm 
    99     x_ik, alpha_ik = np.meshgrid(mesh.lon_i,       alpha_k, indexing='ij') 
    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,       alpha_l, indexing='ij') 
    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,       alpha_k, indexing='ij') 
    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') 
    105106 
    106107    print(np.shape(alpha_k),np.shape(alpha_l)) 
     
    166167class myDavies(Davies): 
    167168    def mask(self,x,y): 
    168         logging.debug('davies dy = %f'% dy) 
    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) 
    170171         
    171172with xios.Client() as client: # setup XIOS which creates the DYNAMICO communicator 
     
    178179    nx, ny, llm = args.nx, args.ny, args.llm 
    179180    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     
    189182    unst.setvar('g',g) 
    190183     
    191184    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) 
    193186 
    194187    mass_bl,mass_dak,mass_dbk = meshes.compute_hybrid_coefs(flow0[0]) 
     
    281274#            context.send_field_primal('p', drhodz) 
    282275 
    283             context.send_field_primal('theta', gas.s) 
     276            context.send_field_primal('theta', thermo.T0*exp(gas.s/thermo.Cpd)) 
     277 
    284278            context.send_field_primal('uz', w) 
    285279            context.send_field_primal('z', z) 
Note: See TracChangeset for help on using the changeset viewer.