Ignore:
Timestamp:
09/20/16 20:15:00 (8 years ago)
Author:
smasson
Message:

set of bugfixes...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SRC/Grid/romsdepth.pro

    r370 r501  
    2525; 
    2626;- 
    27 FUNCTION romsdepth 
     27FUNCTION romsdepth, new_s_coord = new_s_coord 
    2828; 
    2929  compile_opt idl2, strictarrsubs 
     
    4646  grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz 
    4747  hroms = hroms[firstx:lastx, firsty:lasty] 
    48   nt = n_elements(zeta)/nx/ny 
    49 ; 
    50   cff1 = 1./sinh(theta_s) 
    51   cff2 = 0.5/tanh(0.5*theta_s) 
     48  nt = n_elements(zeta[firstx:lastx, firsty:lasty, *])/nx/ny 
    5249; 
    5350  IF type EQ 'W' THEN BEGIN 
     
    5956  ENDELSE 
    6057; 
    61   cs = (1.-theta_b)*cff1*sinh(theta_s*sc)+theta_b*(cff2*tanh(theta_s*(sc+0.5))-0.5) 
    62   cff = hc*(sc-cs) 
    63   cff1 = cs 
     58  IF keyword_set(new_s_coord) THEN BEGIN 
     59 
     60    IF theta_s GT 0. THEN BEGIN 
     61      csrf = ( 1. - cosh(theta_s*sc) ) / ( cosh(theta_s) - 1. ) 
     62    ENDIF ELSE BEGIN 
     63      csrf = - sc*sc 
     64    ENDELSE  
     65    if theta_b GT 0. THEN BEGIN  
     66      cs = ( exp(theta_b*csrf) - 1. ) / ( 1. - exp(-theta_b) )   
     67    ENDIF ELSE BEGIN 
     68      cs = csrf 
     69    ENDELSE 
     70     
     71    hh = (hroms[*]#replicate(1., jpk)) 
     72    z0 = hh * ( replicate(1., nx*ny)#(hc*sc)[*] + hh * replicate(1., nx*ny)#cs[*] ) / ( hc + hh ) 
     73     
     74     
     75  ENDIF ELSE BEGIN 
     76     
     77    cff1 = 1./sinh(theta_s) 
     78    cff2 = 0.5/tanh(0.5*theta_s) 
     79 
     80    cs = (1.-theta_b)*cff1*sinh(theta_s*sc)+theta_b*(cff2*tanh(theta_s*(sc+0.5))-0.5) 
     81    cff = hc*(sc-cs) 
     82    cff1 = cs 
     83 
     84    z0 = replicate(1., nx*ny)#cff[*] + (replicate(1., nx*ny)#cff1[*]) * (hroms[*]#replicate(1., jpk)) 
     85 
     86  ENDELSE 
     87 
    6488; 
    6589  hinv = 1./hroms 
    6690  hinv = hinv[*]#replicate(1., jpk) 
    6791; put a z dimension to zeta 
    68   zeta = transpose(temporary(zeta)) 
     92  zeta = transpose((temporary(zeta))[firstx:lastx, firsty:lasty, *]) 
    6993  zeta = reform((temporary(zeta))[*]#replicate(1., jpk), nt, ny, nx, jpk, /overwrite) 
    7094  zeta = transpose(temporary(zeta), [2, 1, 3, 0]) 
    7195 
    72   z0 = replicate(1., nx*ny)#cff[*] + (replicate(1., nx*ny)#cff1[*]) * (hroms[*]#replicate(1., jpk)) 
    7396  z = (z0[*]#replicate(1., nt)) + temporary(zeta) * ((1.+z0*hinv)[*]#replicate(1., nt)) 
    7497  z = reform(z, nx, ny, jpk, nt, /overwrite) 
Note: See TracChangeset for help on using the changeset viewer.