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

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

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

revision 1.4 by cnh, Sat Aug 22 17:51:09 1998 UTC revision 1.14 by jmc, Wed Jun 22 00:25:32 2005 UTC
# Line 1  Line 1 
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        IF (setCenterDr) THEN
39        rF(1) = 0. _d 0  C-- Interface at middle between 2 centers :
40    
41    C-    Check that all thickness are > 0 :
42           DO K=1,Nr+1
43            IF (delRc(K).LE.0.) THEN
44             WRITE(msgBuf,'(A,I4,A,E16.8)')
45         &  'S/R INI_VERTICAL_GRID: delRc(K=',K,' )=',delRc(K)
46             CALL PRINT_ERROR( msgBuf , 1)
47             WRITE(msgBuf,'(A)')
48         &  'S/R INI_VERTICAL_GRID: Vert. grid spacing MUST BE > 0'
49             CALL PRINT_ERROR( msgBuf , 1)
50             STOP 'ABNORMAL END: S/R INI_VERTICAL_GRID'
51            ENDIF
52           ENDDO
53    
54    C-    Calculate depths of centers and interfaces
55            rF(1)  = Ro_SeaLevel
56            rC(1)  = rF(1) + rkSign*delRc(1)
57            drC(1) = delRc(1)
58            drF(1) = delRc(1)
59           DO K=2,Nr
60            drC(K)   = delRc(K)
61            drF(K-1) =  drF(K-1) + 0.5 _d 0*delRc(K)
62            drF(K)   = 0.5 _d 0*delRc(K)
63            rC(K)    = rC(K-1) + rkSign*drC(K)
64            rF(K)    = rF(K-1) + rkSign*drF(K-1)
65           ENDDO
66            drF(Nr)  = drF(Nr) + delRc(Nr+1)
67            rF(Nr+1) = rF(Nr) + rkSign*drF(Nr)
68    
69          ELSE
70    C-- Center at middle between 2 interfaces :
71    
72    C-    Check that all thickness are > 0 :
73           DO K=1,Nr
74            IF (delR(K).LE.0.) THEN
75             WRITE(msgBuf,'(A,I4,A,E16.8)')
76         &  'S/R INI_VERTICAL_GRID: delR(K=',K,' )=',delR(K)
77             CALL PRINT_ERROR( msgBuf , 1)
78             WRITE(msgBuf,'(A)')
79         &  'S/R INI_VERTICAL_GRID: Vert. grid spacing MUST BE > 0'
80             CALL PRINT_ERROR( msgBuf , 1)
81             STOP 'ABNORMAL END: S/R INI_VERTICAL_GRID'
82            ENDIF
83           ENDDO
84    
85    C-    Calculate depths of interfaces and centers
86          rF(1) = Ro_SeaLevel
87        DO K=1,Nr        DO K=1,Nr
88         drF(K)     = delZ(K)         drF(K)     = delR(K)
89         rF(K+1) = rF(K)-delZ(K)         rF(K+1) = rF(K) + rkSign*delR(K)
90        ENDDO        ENDDO
91        drC(1)      = delZ(1) * 0.5 _d 0        drC(1)      = delR(1) * 0.5 _d 0
92        rC(1)       = -delZ(1) * 0.5 _d 0        rC(1)       = rf(1) + rkSign*delR(1) * 0.5 _d 0
93        DO K=2,Nr        DO K=2,Nr
94         drC(K)     = 0.5 _d 0 *(delZ(K-1)+delZ(K))         drC(K)     = 0.5 _d 0 *(delR(K-1)+delR(K))
95         rC(K)      = rC(K-1) - drC(K)         rC(K)      = rC(K-1) + rkSign*drC(K)
96        ENDDO        ENDDO
97    
98    C--
99          ENDIF
100    
101    C-    Calculate reciprol vertical grid spacing :
102        DO K=1,Nr        DO K=1,Nr
103         saFac(K)  = 1. D0         saFac(K)  = 1. _d 0
104         recip_drC(K)   = 1. _d 0/drC(K)         recip_drC(K)   = 1. _d 0/drC(K)
105         recip_drF(K)   = 1. _d 0/drF(K)         recip_drF(K)   = 1. _d 0/drF(K)
106        ENDDO        ENDDO
107  C  
108        RETURN        RETURN
109        END        END

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.22