1 |
C $Header$ |
C $Header$ |
2 |
|
C $Name$ |
3 |
|
|
4 |
#include "CPP_EEOPTIONS.h" |
#include "CPP_OPTIONS.h" |
5 |
|
|
6 |
CStartOfInterface |
CBOP |
7 |
|
C !ROUTINE: INI_VERTICAL_GRID |
8 |
|
C !INTERFACE: |
9 |
SUBROUTINE INI_VERTICAL_GRID( myThid ) |
SUBROUTINE INI_VERTICAL_GRID( myThid ) |
10 |
C /==========================================================\ |
C !DESCRIPTION: \bv |
11 |
C | SUBROUTINE INI_VERTICAL_GRID | |
C *==========================================================* |
12 |
C | o Initialise vertical gridding arrays | |
C | SUBROUTINE INI_VERTICAL_GRID |
13 |
C |==========================================================| |
C | o Initialise vertical gridding arrays |
14 |
C | | |
C *==========================================================* |
15 |
C \==========================================================/ |
C \ev |
16 |
|
|
17 |
|
C !USES: |
18 |
|
IMPLICIT NONE |
19 |
C === Global variables === |
C === Global variables === |
20 |
#include "SIZE.h" |
#include "SIZE.h" |
21 |
#include "EEPARAMS.h" |
#include "EEPARAMS.h" |
22 |
#include "PARAMS.h" |
#include "PARAMS.h" |
23 |
#include "GRID.h" |
#include "GRID.h" |
24 |
|
|
25 |
|
C !INPUT/OUTPUT PARAMETERS: |
26 |
C == Routine arguments == |
C == Routine arguments == |
27 |
C myThid - Number of this instance of INI_DEPTHS |
C myThid - Number of this instance of INI_DEPTHS |
28 |
INTEGER myThid |
INTEGER myThid |
|
CEndOfInterface |
|
29 |
|
|
30 |
|
C !LOCAL VARIABLES: |
31 |
C == Local variables == |
C == Local variables == |
32 |
C K |
C K :: loop index |
33 |
|
C msgBuf :: Informational/error meesage buffer |
34 |
INTEGER K |
INTEGER K |
35 |
|
CHARACTER*(MAX_LEN_MBUF) msgBuf |
36 |
|
CEOP |
37 |
|
|
38 |
C Calculate depths of centers and interfaces |
_BEGIN_MASTER(myThid) |
39 |
zFace(1) = 0. _d 0 |
|
40 |
DO K=1,Nz |
C-- Set factors required for mixing pressure and meters as vertical coordinate. |
41 |
dzF(K) = delZ(K) |
C rkSign is a "sign" parameter which is used where the orientation of the vertical |
42 |
zFace(K+1) = zFace(K)-delZ(K) |
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 |
ENDDO |
104 |
dzC(1) = delZ(1) * 0.5 _d 0 |
drC(1) = delR(1) * 0.5 _d 0 |
105 |
zC(1) = delZ(1) * 0.5 _d 0 |
rC(1) = rf(1) + rkSign*delR(1) * 0.5 _d 0 |
106 |
DO K=2,Nz |
DO K=2,Nr |
107 |
dzC(K) = 0.5 _d 0 *(delZ(K-1)+delZ(K)) |
drC(K) = 0.5 _d 0 *(delR(K-1)+delR(K)) |
108 |
zC(K) = zC(K) - dzC(K) |
rC(K) = rC(K-1) + rkSign*drC(K) |
109 |
ENDDO |
ENDDO |
110 |
DO K=1,Nz |
|
111 |
saFac(K) = 1. D0 |
C-- |
112 |
rDzC(K) = 1. _d 0/dzC(K) |
ENDIF |
113 |
rDzF(K) = 1. _d 0/dzF(K) |
|
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 |
ENDDO |
119 |
C |
|
120 |
|
_END_MASTER(myThid) |
121 |
|
_BARRIER |
122 |
|
|
123 |
RETURN |
RETURN |
124 |
END |
END |