source: trunk/SRC/Computation/e3u_3d.pro @ 445

Last change on this file since 445 was 445, checked in by smasson, 13 years ago

improve the implementation of the partial steps + bugfix in bsf

File size: 2.1 KB
Line 
1;+
2;
3; @file_comments
4; compute the 3D e3u from e3t and e3t_ps
5;
6; @categories
7; diagnostics
8;
9; @keyword e1 {default=0}{type=scalar: 0 or 1}
10; activate to compute e1u * e3u instead of e3u
11; note that of both keywords e1 and e2 are acticated we compute e1u * e2u * e3u instead of e3u
12;
13; @keyword e2 {default=0}{type=scalar: 0 or 1}
14; activate to compute e2u * e3u instead of e3u
15; note that of both keywords e1 and e2 are acticated we compute e1u * e2u * e3u instead of e3u
16;
17; @returns
18; e3u 3D array
19;
20; @uses
21; cm_4mesh.pro
22;
23; @history
24; Sebastien Masson, Jan 2011
25;
26; @version
27; $Id$
28;
29;-
30function e3u_3d, e1 = e1, e2 = e2
31;
32  compile_opt idl2, strictarrsubs
33;
34@cm_4mesh
35;
36  IF keyword_set(key_partialstep) THEN lastx = ( lastxu + 1 ) < ( jpi - 1 ) ELSE lastx = lastxu
37  nx = lastx - firstxu + 1
38; get e3t 3D
39  e3t3d = e3t_3d(fstx = firstxu, lstx = lastx, fsty = firstyu, lsty = lastyu)
40;
41  IF keyword_set(key_partialstep) THEN BEGIN
42;
43; Rebuild the U-point 3D partial steps array from T-point 3D e3t_3D array
44;
45    tmp = shift(e3t3d, -1, 0, 0)
46    IF nx EQ nxu THEN BEGIN
47      IF keyword_set(key_periodic) THEN BEGIN
48        IF nx NE jpi THEN BEGIN
49; get the values from i = 0
50          tmp[nx-1, *, *] = e3t_3d(fstx = 0, lstx = 0, fsty = firstyu, lsty = lastyu)
51        ENDIF
52      ENDIF ELSE BEGIN
53        tmp[nx-1, *, *] = e3t3d[nx-1, *, *]
54      ENDELSE
55    ENDIF
56    e3u3d = [ [ (temporary(e3t3d))[*] ], [ (temporary(tmp))[*] ] ]
57    e3u3d = min(temporary(e3u3d), dimension = 2)
58    e3u3d = reform(e3u3d, nx, nyu, nzt, /overwrite)
59;
60    IF nx EQ nxu + 1 THEN e3u3d = (temporary(e3u3d))[0:nx-2, *, *]
61;   
62  ENDIF ELSE e3u3d = temporary(e3t3d)
63;
64  CASE 1 OF
65    keyword_set(e1) AND keyword_set(e2):arr2d = e1u[firstxu:lastxu, firstyu:lastyu] $
66                                              * e2u[firstxu:lastxu, firstyu:lastyu]
67    keyword_set(e1)                    :arr2d = e1u[firstxu:lastxu, firstyu:lastyu]
68                        keyword_set(e2):arr2d = e2u[firstxu:lastxu, firstyu:lastyu]
69    ELSE:
70  ENDCASE
71;
72  IF n_elements(arr2d) NE 0 THEN e3u3d = temporary(e3u3d) * ( arr2d[*] # replicate(1., nzt) )
73;
74  return, e3u3d
75END
76
Note: See TracBrowser for help on using the repository browser.