Changeset 501 for trunk/SRC/Grid/romsdepth.pro
- Timestamp:
- 09/20/16 20:15:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SRC/Grid/romsdepth.pro
r370 r501 25 25 ; 26 26 ;- 27 FUNCTION romsdepth 27 FUNCTION romsdepth, new_s_coord = new_s_coord 28 28 ; 29 29 compile_opt idl2, strictarrsubs … … 46 46 grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz 47 47 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 52 49 ; 53 50 IF type EQ 'W' THEN BEGIN … … 59 56 ENDELSE 60 57 ; 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 64 88 ; 65 89 hinv = 1./hroms 66 90 hinv = hinv[*]#replicate(1., jpk) 67 91 ; put a z dimension to zeta 68 zeta = transpose( temporary(zeta))92 zeta = transpose((temporary(zeta))[firstx:lastx, firsty:lasty, *]) 69 93 zeta = reform((temporary(zeta))[*]#replicate(1., jpk), nt, ny, nx, jpk, /overwrite) 70 94 zeta = transpose(temporary(zeta), [2, 1, 3, 0]) 71 95 72 z0 = replicate(1., nx*ny)#cff[*] + (replicate(1., nx*ny)#cff1[*]) * (hroms[*]#replicate(1., jpk))73 96 z = (z0[*]#replicate(1., nt)) + temporary(zeta) * ((1.+z0*hinv)[*]#replicate(1., nt)) 74 97 z = reform(z, nx, ny, jpk, nt, /overwrite)
Note: See TracChangeset
for help on using the changeset viewer.