/[MITgcm]/MITgcm_contrib/verification_other/shelfice_remeshing/code/shelfice_vert_dens.F
ViewVC logotype

Annotation of /MITgcm_contrib/verification_other/shelfice_remeshing/code/shelfice_vert_dens.F

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


Revision 1.2 - (hide annotations) (download)
Sun Feb 12 13:34:10 2017 UTC (8 years, 5 months ago) by dgoldberg
Branch: MAIN
CVS Tags: checkpoint66g, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66o, checkpoint66n, checkpoint66m, checkpoint66l, checkpoint66k, checkpoint66j, checkpoint66i, checkpoint66h, checkpoint67a, checkpoint67b, checkpoint67d, HEAD
Changes since 1.1: +1 -3 lines
fixes for multiple tiles

1 dgoldberg 1.2 C $Header: /u/gcmpack/MITgcm_contrib/verification_other/shelfice_remeshing/code/shelfice_vert_dens.F,v 1.1 2016/05/24 08:26:37 ksnow Exp $
2 ksnow 1.1 C $Name: $
3    
4     C KS_dens------
5    
6     #include "SHELFICE_OPTIONS.h"
7    
8     CBOP
9     SUBROUTINE SHELFICE_VERT_DENS( vert_rho, myThid )
10     C *============================================================*
11     C | SUBROUTINE SHELFICE_VERT_DENS
12     C | o Routine to determine vertical density profile of all wet cells
13     C *============================================================*
14     C | Initialize SHELFICE parameters and variables.
15     C *============================================================*
16     IMPLICIT NONE
17    
18     C === Global variables ===
19     #include "SIZE.h"
20     #include "EEPARAMS.h"
21     #include "PARAMS.h"
22     #include "GRID.h"
23     #include "SHELFICE.h"
24     #include "DYNVARS.h"
25     #ifdef ALLOW_COST
26     # include "SHELFICE_COST.h"
27     #endif /* ALLOW_COST */
28    
29     C === Routine arguments ===
30     C myThid - Number of this instance
31     C
32     C This subroutine takes all ocean wet cells and calculates the
33     C vertical density profile
34    
35     _RL vert_rho (Nr)
36     INTEGER myThid
37    
38     CEndOfInterface
39    
40     #ifdef ALLOW_SHELFICE
41     C === Local variables ===
42     C i,j,bi,bj - Loop counters
43     INTEGER i, j, k, bi, bj
44     _RL locsum_dens (nSx,nSy)
45     _RL locsum_thick (nSx,nSy)
46     _RL dens_loc, thick_loc
47     _RL sum_dens, sum_thick
48     CEOP
49    
50     C initilized variables
51     sum_dens = 0. _d 0
52     sum_thick = 0. _d 0
53     DO bj = myByLo(myThid), myByHi(myThid)
54     DO bi = myBxLo(myThid), myBxHi(myThid)
55     locsum_dens (bi,bj) = 0. _d 0
56     locsum_thick (bi,bj) = 0. _d 0
57     ENDDO
58     ENDDO
59    
60     DO k = 1,Nr
61     DO bj = myByLo(myThid), myByHi(myThid)
62     DO bi = myBxLo(myThid), myBxHi(myThid)
63     DO j = 1, sNy
64     DO i = 1, sNx
65     IF (maskC(i,j,k,bi,bj) .EQ. 1) THEN
66     dens_loc = rhoInSitu(i,j,k,bi,bj)
67     thick_loc = hFacC(i,j,k,bi,bj)*drF(k)
68     locsum_dens(bi,bj) = locsum_dens(bi,bj) +
69     & dens_loc * thick_loc
70     locsum_thick(bi,bj) = locsum_thick(bi,bj) +
71     & thick_loc
72     ENDIF
73     ENDDO
74     ENDDO
75     ENDDO
76     ENDDO
77    
78     CALL GLOBAL_SUM_TILE_RL( locsum_dens, sum_dens, myThid )
79     CALL GLOBAL_SUM_TILE_RL( locsum_thick, sum_thick, myThid )
80     IF (sum_thick .LE. 0.0) THEN
81     vert_rho(k) = 0. _d 0
82     ELSE
83     vert_rho(k) = sum_dens / sum_thick
84     ENDIF
85     DO bj = myByLo(myThid), myByHi(myThid)
86     DO bi = myBxLo(myThid), myBxHi(myThid)
87     locsum_dens(bi,bj) = 0. _d 0
88     locsum_thick(bi,bj) = 0. _d 0
89     ENDDO
90     ENDDO
91     ENDDO
92    
93     #endif /* ALLOW_SHELFICE */
94    
95     RETURN
96     END

  ViewVC Help
Powered by ViewVC 1.1.22