Changeset 687 for codes/icosagcm


Ignore:
Timestamp:
03/08/18 13:05:02 (6 years ago)
Author:
dubos
Message:

devel/unstructured : piecewise-constant vertical remapping

Location:
codes/icosagcm/devel/Python
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • codes/icosagcm/devel/Python/dynamico/meshes.py

    r682 r687  
    294294        return ucov 
    295295    def plot(self, tri,data, **kwargs): 
    296         plt.figure(figsize=(12,4)) 
     296        plt.figure(figsize=(10,4)) 
    297297        plt.gca().set_aspect('equal') 
    298298        plt.tricontourf(tri, data, 20, **kwargs) 
  • codes/icosagcm/devel/Python/src/kernels_transport.jin

    r685 r687  
    234234        rhodz_cum(CELL)=0. 
    235235        cur_lev(HIDX(CELL))=1 
    236         eta(CELL)=0. 
     236        eta(CELL)=1. 
    237237        new_rhodz_cum(HIDX(CELL))=0. 
    238238      END_BLOCK 
     
    252252           IF(rhodz_cum_target<=rhodz_cum_levp1) EXIT 
    253253        END DO 
     254        IF(level>llm) level=llm 
    254255        rhodz_cum_lev = rhodz_cum(AT_LEVEL(CELL,level)) 
    255256        ! now rhodz_cum_lev <= rhodz_cum_target <= rhodz_cum_levp1   
     
    275276      BODY('1,llm+1') 
    276277        X = eta(CELL) 
    277         level = FLOOR(X) 
     278        level = MIN(llm,FLOOR(X)) ! eta=llm+1 => level=llm, X=1 
    278279        X = X-level 
    279280        new_thetarhodz_cum(CELL) = thetarhodz_cum(AT_LEVEL(CELL,level))+X*thetarhodz(AT_LEVEL(CELL,level)) 
    280281      END_BLOCK 
    281282      BODY('1,llm') 
    282         thetarhodz(CELL)) = new_thetarhodz_cum(UP(CELL)) - new_thetarhodz_cum(CELL) 
     283        thetarhodz(CELL) = new_thetarhodz_cum(UP(CELL)) - new_thetarhodz_cum(CELL) 
    283284      END_BLOCK 
    284285    END_BLOCK 
     
    300301      BODY('1,llm+1') 
    301302        X = .5*(eta(CELL1)+eta(CELL2)) 
    302         level = FLOOR(X) 
     303        level = MIN(llm,FLOOR(X)) 
    303304        X = X-level 
    304305        new_urhodz_cum(EDGE) = urhodz_cum(AT_LEVEL(EDGE,level))+X*urhodz(AT_LEVEL(EDGE,level)) 
  • codes/icosagcm/devel/Python/src/unstructured.pyx

    r681 r687  
    2929                                 double *dPhi_fast, double *dPhi_slow,  
    3030                                 double *dW_fast, double *dW_slow) 
     31     cdef void dynamico_remap(double *rhodz, double *theta_rhodz, double *u) 
    3132     cdef void dynamico_init_params() 
    3233     cpdef void dynamico_setup_xios() 
     
    161162        #time2=time.time() 
    162163        #if time2>time1: elapsed=elapsed+time2-time1 
     164    def remap(self): 
     165        dynamico_remap(self.p_mass, self.p_theta_rhodz, self.p_u) 
    163166 
    164167def caldyn_step_TRSW(mesh,time_scheme,nstep): 
  • codes/icosagcm/devel/Python/test/py/DCMIP2008c5.py

    r680 r687  
    109109#------------------------ main program ------------------------- 
    110110 
    111 grid, llm = 40962, 26 
     111#grid, llm = 40962, 26 
     112grid, llm = 2562, 26 
    112113T, Nslice, courant = 14400, 24, 3.0 
    113 #caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_lag 
    114 caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_mass 
     114caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_lag 
     115#caldyn_thermo, caldyn_eta = unst.thermo_entropy, unst.eta_mass 
    115116thermo, mesh, hybrid_coefs, params, flow0, gas0 = DCMIP2008c5(grid,llm) 
    116117llm, dx = mesh.llm, params.dx 
     
    120121else: 
    121122    print 'Mass-based coordinate.' 
    122     unst.ker.dynamico_init_hybrid(*hybrid_coefs) 
     123 
     124unst.ker.dynamico_init_hybrid(*hybrid_coefs) 
    123125     
    124126dt = courant*.5*dx/np.sqrt(gas0.c2.max()) 
     
    129131 
    130132mesh.plot_e(mesh.le/mesh.de) ; plt.title('le/de') 
    131 plt.savefig('fig_DCMIP2008c5/le_de.png') ;plt.close() 
     133plt.savefig('fig_DCMIP2008c5/le_de.png'); plt.close() 
    132134 
    133135mesh.plot_i(mesh.Ai) ; plt.title('Ai') 
     
    146148    def next_flow(m,S,u): 
    147149        caldyn_step.mass[:,:], caldyn_step.theta_rhodz[:,:], caldyn_step.u[:,:] = m,S,u 
     150        caldyn_step.remap() 
    148151        caldyn_step.next() 
    149152        return (caldyn_step.mass.copy(), caldyn_step.theta_rhodz.copy(),  
Note: See TracChangeset for help on using the changeset viewer.