/[MITgcm]/MITgcm_contrib/dgoldberg/CPL1/code/shelfice_sea_level_avg.F
ViewVC logotype

Contents of /MITgcm_contrib/dgoldberg/CPL1/code/shelfice_sea_level_avg.F

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


Revision 1.1 - (show annotations) (download)
Wed Jul 6 18:01:26 2016 UTC (9 years ago) by dgoldberg
Branch: MAIN
CVS Tags: HEAD
moving experiment out of shelfice_remeshing to replace with vertical remeshing only

1 C $Header: /u/gcmpack/MITgcm_contrib/verification_other/shelfice_remeshing/code/shelfice_sea_level_avg.F,v 1.2 2016/05/05 18:16:04 dgoldberg Exp $
2 C $Name: $
3
4 #include "SHELFICE_OPTIONS.h"
5
6 CBOP
7 C KS16, add sum_eta to subroutine fields
8 SUBROUTINE SHELFICE_SEA_LEVEL_AVG( avgSL, sum_eta, myThid )
9 C *============================================================*
10 C | SUBROUTINE SHELFICE_INIT_VARIA
11 C | o Routine to initialize SHELFICE variables.
12 C *============================================================*
13 C | Initialize SHELFICE parameters and variables.
14 C *============================================================*
15 IMPLICIT NONE
16
17 C === Global variables ===
18 #include "SIZE.h"
19 #include "EEPARAMS.h"
20 #include "PARAMS.h"
21 #include "GRID.h"
22 #include "SHELFICE.h"
23 #include "DYNVARS.h"
24 #ifdef ALLOW_COST
25 # include "SHELFICE_COST.h"
26 #endif /* ALLOW_COST */
27
28 C === Routine arguments ===
29 C myThid - Number of this instance
30 C
31 C This subroutine averages eta over all cells where
32 C here is open ocean, assessed by
33 C - maskInC = 1
34 C - kTopC = 0
35 C - shelficemass = 0
36
37 _RL avgSL
38 C KS16, put sum_eta here
39 _RL sum_eta
40 INTEGER myThid
41
42 CEndOfInterface
43
44 #ifdef ALLOW_SHELFICE
45 C === Local variables ===
46 C i,j,bi,bj - Loop counters
47 INTEGER i, j, bi, bj
48 _RL locsum_eta (nSx,nSy)
49 _RL locsum_area (nSx,nSy)
50 _RL eta_loc, area_loc
51 C KS16 comment sum_eta here
52 C _RL sum_eta
53 _RL sum_area
54 CEOP
55
56 C KS16, initilized sum_eta to 0
57 sum_eta = 0. _d 0
58 avgSL = 0. _d 0
59
60 DO bj = myByLo(myThid), myByHi(myThid)
61 DO bi = myBxLo(myThid), myBxHi(myThid)
62 locsum_eta (bi,bj) = 0. _d 0
63 locsum_area (bi,bj) = 0. _d 0
64 ENDDO
65 ENDDO
66
67 DO bj = myByLo(myThid), myByHi(myThid)
68 DO bi = myBxLo(myThid), myBxHi(myThid)
69 DO j = 1, sNy
70 DO i = 1, sNx
71
72 IF ((maskInC(i,j,bi,bj) .eq. 1) .and.
73 & (kTopC(i,j,bi,bj) .eq. 0) .and.
74 & (shelficeMass(i,j,bi,bj) .lt. .01)) then
75
76
77
78 eta_loc = etaN (i,j,bi,bj)
79 area_loc = rA (i,j,bi,bj)
80 ! print *, "GOT HERE ", i,j, eta_loc
81 locsum_eta(bi,bj) = locsum_eta(bi,bj) +
82 & eta_loc * area_loc
83 locsum_area(bi,bj) = locsum_area(bi,bj) + area_loc
84
85 ENDIF
86 ENDDO
87 ENDDO
88 ENDDO
89 ENDDO
90
91 CALL GLOBAL_SUM_TILE_RL( locsum_eta, sum_eta, myThid )
92 CALL GLOBAL_SUM_TILE_RL( locsum_area, sum_area, myThid )
93
94
95 IF (sum_area .le. 0.0) THEN
96 avgSL = 0. _d 0
97 ELSE
98 avgSL = sum_eta / sum_area
99 ENDIF
100
101
102 #endif /* ALLOW_SHELFICE */
103
104 RETURN
105 END

  ViewVC Help
Powered by ViewVC 1.1.22