/[MITgcm]/MITgcm_contrib/ksnow/press_release/code_expt/shelfice_update_masks.F
ViewVC logotype

Contents of /MITgcm_contrib/ksnow/press_release/code_expt/shelfice_update_masks.F

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


Revision 1.2 - (show annotations) (download)
Wed Feb 1 12:45:49 2017 UTC (9 years, 7 months ago) by dgoldberg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +1 -1 lines
FILE REMOVED
reorganise files to minimize duplicate files from remeshing exp

1 C $Header: /u/gcmpack/MITgcm_contrib/ksnow/press_release/code_expt/shelfice_update_masks.F,v 1.1 2016/12/16 15:25:29 ksnow Exp $
2 C $Name: $
3
4 #include "SHELFICE_OPTIONS.h"
5 #ifdef ALLOW_CTRL
6 # include "CTRL_OPTIONS.h"
7 #endif
8
9 CBOP
10 C !ROUTINE: SHELFICE_UPDATE_MASKS
11 C !INTERFACE:
12 SUBROUTINE SHELFICE_UPDATE_MASKS(
13 I rF, recip_drF,
14 U hFacC,
15 I myThid )
16 C !DESCRIPTION: \bv
17 C *==========================================================*
18 C | SUBROUTINE SHELFICE_UPDATE_MASKS
19 C | o modify topography factor hFacC according to ice shelf
20 C | topography
21 C *==========================================================*
22 C \ev
23
24 C !USES:
25 IMPLICIT NONE
26 C === Global variables ===
27 #include "SIZE.h"
28 #include "EEPARAMS.h"
29 #include "PARAMS.h"
30 #ifdef ALLOW_SHELFICE
31 # include "SHELFICE.h"
32 #endif /* ALLOW_SHELFICE */
33
34 C !INPUT/OUTPUT PARAMETERS:
35 C == Routine arguments ==
36 C rF :: R-coordinate of face of cell (units of r).
37 C recip_drF :: Recipricol of cell face separation along Z axis ( units of r ).
38 C hFacC :: Fraction of cell in vertical which is open (see GRID.h)
39 C myThid :: Number of this instance of SHELFICE_UPDATE_MASKS
40 _RS rF (1:Nr+1)
41 _RS recip_drF (1:Nr)
42 _RS hFacC (1-OLx:sNx+OLx,1-OLy:sNy+OLy,1:Nr,nSx,nSy)
43 INTEGER myThid
44
45 #ifdef ALLOW_SHELFICE
46 C !LOCAL VARIABLES:
47 C == Local variables ==
48 C bi,bj :: tile indices
49 C I,J,K :: Loop counters
50 INTEGER bi, bj
51 INTEGER I, J, K
52 _RL hFacCtmp
53 _RL hFacMnSz
54 CEOP
55
56 C initialize R_shelfIce
57 DO bj = myByLo(myThid), myByHi(myThid)
58 DO bi = myBxLo(myThid), myBxHi(myThid)
59 DO j=1-OLy,sNy+OLy
60 DO i=1-OLx,sNx+OLx
61 R_shelfIce(i,j,bi,bj) = 0. _d 0
62 ENDDO
63 ENDDO
64 ENDDO
65 ENDDO
66
67 IF ( SHELFICEtopoFile .NE. ' ' ) THEN
68 _BARRIER
69 C Read the shelfIce draught using the mid-level I/O pacakage read_write_rec
70 C The 0 is the "iteration" argument. The 1 is the record number.
71 CALL READ_REC_XY_RS( SHELFICEtopoFile, R_shelfIce,
72 & 1, 0, myThid )
73 C Read the shelfIce draught using the mid-level I/O pacakage read_write_fld
74 C The 0 is the "iteration" argument. The ' ' is an empty suffix
75 C CALL READ_FLD_XY_RS( SHELFICEtopoFile, ' ', R_shelfIce,
76 C & 0, myThid )
77 ENDIF
78 C- end setup R_shelfIce in the interior
79
80 IF (shelficeMassStepping) THEN
81 IF ( .NOT. ( startTime .EQ. baseTime .AND. nIter0 .EQ. 0
82 & .AND. pickupSuff .EQ. ' ') ) THEN
83 CALL SHELFICE_READ_PICKUP ( myThid )
84 ENDIF
85 ENDIF
86
87 C- fill in the overlap (+ BARRIER):
88 _EXCH_XY_RS(R_shelfIce, myThid )
89
90 C-- Calculate lopping factor hFacC : Remove part outside of the domain
91 C taking into account the Reference (=at rest) Surface Position Ro_shelfIce
92 DO bj=myByLo(myThid), myByHi(myThid)
93 DO bi=myBxLo(myThid), myBxHi(myThid)
94
95 C-- compute contributions of shelf ice to looping factors
96 DO K=1, Nr
97 hFacMnSz=max( hFacMin, min(hFacMinDr*recip_drF(k),1. _d 0) )
98 DO J=1-OLy,sNy+OLy
99 DO I=1-OLx,sNx+OLx
100 C o Non-dimensional distance between grid boundary and model surface
101 hFacCtmp = (rF(k)-R_shelfIce(I,J,bi,bj))*recip_drF(K)
102 C o Reduce the previous fraction : substract the outside part.
103 hFacCtmp = hFacC(I,J,K,bi,bj) - max( hFacCtmp, 0. _d 0)
104 C o set to zero if empty Column :
105 hFacCtmp = max( hFacCtmp, 0. _d 0)
106 C o Impose minimum fraction and/or size (dimensional)
107 IF (hFacCtmp.LT.hFacMnSz) THEN
108 IF (hFacCtmp.LT.hFacMnSz*0.5) THEN
109 hFacC(I,J,K,bi,bj)=0.
110 ELSE
111 hFacC(I,J,K,bi,bj)=hFacMnSz
112 ENDIF
113 ELSE
114 hFacC(I,J,K,bi,bj)=hFacCtmp
115 ENDIF
116 ENDDO
117 ENDDO
118 ENDDO
119
120 #ifdef ALLOW_SHIFWFLX_CONTROL
121 C maskSHI is a hack to play along with the general ctrl-package
122 C infrastructure, where only the k=1 layer of a 3D mask is used
123 C for 2D fields. We cannot use maskInC instead, because routines
124 C like ctrl_get_gen and ctrl_set_unpack_xy require 3D masks.
125 DO K=1,Nr
126 DO J=1-OLy,sNy+OLy
127 DO I=1-OLx,sNx+OLx
128 maskSHI(I,J,K,bi,bj) = 0. _d 0
129 ENDDO
130 ENDDO
131 ENDDO
132 DO K=1,Nr
133 DO J=1-OLy,sNy+OLy
134 DO I=1-OLx,sNx+OLx
135 IF ( ABS(R_shelfice(I,J,bi,bj)) .GT. 0. _d 0
136 & .AND. hFacC(I,J,K,bi,bj) .NE. 0. _d 0 ) THEN
137 maskSHI(I,J,K,bi,bj) = 1. _d 0
138 maskSHI(I,J,1,bi,bj) = 1. _d 0
139 ENDIF
140 ENDDO
141 ENDDO
142 ENDDO
143 #endif /* ALLOW_SHIFWFLX_CONTROL */
144
145 C - end bi,bj loops.
146 ENDDO
147 ENDDO
148 #endif /* ALLOW_SHELFICE */
149
150 RETURN
151 END

  ViewVC Help
Powered by ViewVC 1.1.22