/[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.1 - (hide annotations) (download)
Tue May 24 08:26:37 2016 UTC (9 years, 1 month ago) by ksnow
Branch: MAIN
CVS Tags: checkpoint66c, checkpoint66b, checkpoint66a, checkpoint65z, checkpoint65x, checkpoint65y
Routine to calculte horz average, vert varying density profile

1 ksnow 1.1 C $Header: /u/gcmpack/MITgcm_contrib/verification_other/shelfice_remeshing/code/shelfice_vert_dens.F,v 1.1 2016/05/11 18:16:04 ksnow Exp $
2     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     locsum_dens(bi,bj) = 0. _d 0
62     locsum_thick(bi,bj) = 0. _d 0
63     DO bj = myByLo(myThid), myByHi(myThid)
64     DO bi = myBxLo(myThid), myBxHi(myThid)
65     DO j = 1, sNy
66     DO i = 1, sNx
67     IF (maskC(i,j,k,bi,bj) .EQ. 1) THEN
68     dens_loc = rhoInSitu(i,j,k,bi,bj)
69     thick_loc = hFacC(i,j,k,bi,bj)*drF(k)
70     locsum_dens(bi,bj) = locsum_dens(bi,bj) +
71     & dens_loc * thick_loc
72     locsum_thick(bi,bj) = locsum_thick(bi,bj) +
73     & thick_loc
74     ENDIF
75     ENDDO
76     ENDDO
77     ENDDO
78     ENDDO
79    
80     CALL GLOBAL_SUM_TILE_RL( locsum_dens, sum_dens, myThid )
81     CALL GLOBAL_SUM_TILE_RL( locsum_thick, sum_thick, myThid )
82     IF (sum_thick .LE. 0.0) THEN
83     vert_rho(k) = 0. _d 0
84     ELSE
85     vert_rho(k) = sum_dens / sum_thick
86     ENDIF
87     DO bj = myByLo(myThid), myByHi(myThid)
88     DO bi = myBxLo(myThid), myBxHi(myThid)
89     locsum_dens(bi,bj) = 0. _d 0
90     locsum_thick(bi,bj) = 0. _d 0
91     ENDDO
92     ENDDO
93     ENDDO
94    
95     #endif /* ALLOW_SHELFICE */
96    
97     RETURN
98     END

  ViewVC Help
Powered by ViewVC 1.1.22