/[MITgcm]/MITgcm/model/src/ini_vertical_grid.F
ViewVC logotype

Contents of /MITgcm/model/src/ini_vertical_grid.F

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.16 - (show annotations) (download)
Tue Nov 28 22:49:29 2006 UTC (17 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.15: +12 -2 lines
set gravitySign & rkSign here (since belong to header file "GRID.h")

1 C $Header: /u/gcmpack/MITgcm/model/src/ini_vertical_grid.F,v 1.15 2006/10/17 18:52:34 jmc Exp $
2 C $Name: $
3
4 #include "CPP_OPTIONS.h"
5
6 CBOP
7 C !ROUTINE: INI_VERTICAL_GRID
8 C !INTERFACE:
9 SUBROUTINE INI_VERTICAL_GRID( myThid )
10 C !DESCRIPTION: \bv
11 C *==========================================================*
12 C | SUBROUTINE INI_VERTICAL_GRID
13 C | o Initialise vertical gridding arrays
14 C *==========================================================*
15 C \ev
16
17 C !USES:
18 IMPLICIT NONE
19 C === Global variables ===
20 #include "SIZE.h"
21 #include "EEPARAMS.h"
22 #include "PARAMS.h"
23 #include "GRID.h"
24
25 C !INPUT/OUTPUT PARAMETERS:
26 C == Routine arguments ==
27 C myThid - Number of this instance of INI_DEPTHS
28 INTEGER myThid
29
30 C !LOCAL VARIABLES:
31 C == Local variables ==
32 C K :: loop index
33 C msgBuf :: Informational/error meesage buffer
34 INTEGER K
35 CHARACTER*(MAX_LEN_MBUF) msgBuf
36 CEOP
37
38 _BEGIN_MASTER(myThid)
39
40 C-- Set factors required for mixing pressure and meters as vertical coordinate.
41 C rkSign is a "sign" parameter which is used where the orientation of the vertical
42 C coordinate (pressure or meters) relative to the vertical index (K) is important.
43 C rkSign = -1 applies when K and the coordinate are in the opposite sense.
44 C rkSign = 1 applies when K and the coordinate are in the same sense.
45 rkSign = -1. _d 0
46 gravitySign = -1. _d 0
47 IF ( usingPCoords ) THEN
48 gravitySign = 1. _d 0
49 ENDIF
50
51 IF (setCenterDr) THEN
52 C-- Interface at middle between 2 centers :
53
54 C- Check that all thickness are > 0 :
55 DO K=1,Nr+1
56 IF (delRc(K).LE.0.) THEN
57 WRITE(msgBuf,'(A,I4,A,E16.8)')
58 & 'S/R INI_VERTICAL_GRID: delRc(K=',K,' )=',delRc(K)
59 CALL PRINT_ERROR( msgBuf , 1)
60 WRITE(msgBuf,'(A)')
61 & 'S/R INI_VERTICAL_GRID: Vert. grid spacing MUST BE > 0'
62 CALL PRINT_ERROR( msgBuf , 1)
63 STOP 'ABNORMAL END: S/R INI_VERTICAL_GRID'
64 ENDIF
65 ENDDO
66
67 C- Calculate depths of centers and interfaces
68 rF(1) = Ro_SeaLevel
69 rC(1) = rF(1) + rkSign*delRc(1)
70 drC(1) = delRc(1)
71 drF(1) = delRc(1)
72 DO K=2,Nr
73 drC(K) = delRc(K)
74 drF(K-1) = drF(K-1) + 0.5 _d 0*delRc(K)
75 drF(K) = 0.5 _d 0*delRc(K)
76 rC(K) = rC(K-1) + rkSign*drC(K)
77 rF(K) = rF(K-1) + rkSign*drF(K-1)
78 ENDDO
79 drF(Nr) = drF(Nr) + delRc(Nr+1)
80 rF(Nr+1) = rF(Nr) + rkSign*drF(Nr)
81
82 ELSE
83 C-- Center at middle between 2 interfaces :
84
85 C- Check that all thickness are > 0 :
86 DO K=1,Nr
87 IF (delR(K).LE.0.) THEN
88 WRITE(msgBuf,'(A,I4,A,E16.8)')
89 & 'S/R INI_VERTICAL_GRID: delR(K=',K,' )=',delR(K)
90 CALL PRINT_ERROR( msgBuf , 1)
91 WRITE(msgBuf,'(A)')
92 & 'S/R INI_VERTICAL_GRID: Vert. grid spacing MUST BE > 0'
93 CALL PRINT_ERROR( msgBuf , 1)
94 STOP 'ABNORMAL END: S/R INI_VERTICAL_GRID'
95 ENDIF
96 ENDDO
97
98 C- Calculate depths of interfaces and centers
99 rF(1) = Ro_SeaLevel
100 DO K=1,Nr
101 drF(K) = delR(K)
102 rF(K+1) = rF(K) + rkSign*delR(K)
103 ENDDO
104 drC(1) = delR(1) * 0.5 _d 0
105 rC(1) = rf(1) + rkSign*delR(1) * 0.5 _d 0
106 DO K=2,Nr
107 drC(K) = 0.5 _d 0 *(delR(K-1)+delR(K))
108 rC(K) = rC(K-1) + rkSign*drC(K)
109 ENDDO
110
111 C--
112 ENDIF
113
114 C- Calculate reciprol vertical grid spacing :
115 DO K=1,Nr
116 recip_drC(K) = 1. _d 0/drC(K)
117 recip_drF(K) = 1. _d 0/drF(K)
118 ENDDO
119
120 _END_MASTER(myThid)
121 _BARRIER
122
123 RETURN
124 END

  ViewVC Help
Powered by ViewVC 1.1.22