-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagrif_lim2_update.F90
264 lines (248 loc) · 10.1 KB
/
agrif_lim2_update.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#define TWO_WAY
MODULE agrif_lim2_update
!!======================================================================
!! *** MODULE agrif_lim2_update ***
!! Nesting module : update surface ocean boundary condition over ice
!! from a child grif
!! Sea-Ice model : LIM 2.0 Sea ice model time-stepping
!!======================================================================
!! History : 2.0 ! 04-2008 (F. Dupont) initial version
!! 3.4 ! 08-2012 (R. Benshila, C. Herbaut) update and EVP
!!----------------------------------------------------------------------
#if defined key_agrif && defined key_lim2
!!----------------------------------------------------------------------
!! 'key_lim2' : LIM 2.0 sea-ice model
!! 'key_agrif' : AGRIF library
!!----------------------------------------------------------------------
!! agrif_update_lim2 : update sea-ice model on boundaries or total
!! sea-ice area for velocities and ice properties
!! update_adv_ice : sea-ice properties
!! update_u_ice : zonal ice velocity
!! update_v_ice : meridional ice velocity
!!----------------------------------------------------------------------
USE ice_2
USE dom_ice_2
USE sbc_oce
USE dom_oce
USE agrif_oce
USE agrif_ice
IMPLICIT NONE
PRIVATE
PUBLIC agrif_update_lim2
!!----------------------------------------------------------------------
!! NEMO/NST 3.4 , LOCEAN-IPSL (2012)
!! $Id: agrif_lim2_update.F90 6204 2016-01-04 13:47:06Z cetlod $
!! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
!!----------------------------------------------------------------------
CONTAINS
SUBROUTINE agrif_update_lim2 ( kt )
!!----------------------------------------------------------------------
!! *** ROUTINE agrif_update_lim2 ***
!! ** Method : Call the hydrostaticupdate pressure at the boundary or
!! the entire domain
!!
!! ** Action : - Update (u_ice,v_ice) and ice tracers
!!----------------------------------------------------------------------
INTEGER, INTENT(in) :: kt
!!
!!----------------------------------------------------------------------
!
IF((Agrif_NbStepint() .NE. (Agrif_irhot()-1)).AND.(kt /= 0)) RETURN
Agrif_UseSpecialValueInUpdate = .TRUE.
Agrif_SpecialValueFineGrid = 0.
# if defined TWO_WAY
IF( MOD(nbcline,nbclineupdate) == 0) THEN
CALL Agrif_Update_Variable( adv_ice_id , procname = update_adv_ice )
CALL Agrif_Update_Variable( u_ice_id , procname = update_u_ice )
CALL Agrif_Update_Variable( v_ice_id , procname = update_v_ice )
ELSE
CALL Agrif_Update_Variable( adv_ice_id , locupdate=(/0,2/), procname = update_adv_ice )
CALL Agrif_Update_Variable( u_ice_id , locupdate=(/0,1/), procname = update_u_ice )
CALL Agrif_Update_Variable( v_ice_id , locupdate=(/0,1/), procname = update_v_ice )
ENDIF
# endif
!
END SUBROUTINE agrif_update_lim2
SUBROUTINE update_adv_ice( tabres, i1, i2, j1, j2, before )
!!-----------------------------------------------------------------------
!! *** ROUTINE update_adv_ice ***
!! ** Method : Compute the mass properties on the fine grid and recover
!! the properties per mass on the coarse grid
!!-----------------------------------------------------------------------
INTEGER, INTENT(in) :: i1, i2, j1, j2
REAL(wp), DIMENSION(i1:i2,j1:j2,7), INTENT(inout) :: tabres
LOGICAL, INTENT(in) :: before
!!
INTEGER :: ji, jj
REAL(wp) :: zrhox, zrhoy
REAL(wp) :: z1_area
!!-----------------------------------------------------------------------
!
IF( before ) THEN
zrhox = Agrif_Rhox()
zrhoy = Agrif_Rhoy()
DO jj=j1,j2
DO ji=i1,i2
tabres(ji,jj, 1) = frld (ji,jj ) * area(ji,jj)
tabres(ji,jj, 2) = hicif (ji,jj ) * area(ji,jj)
tabres(ji,jj, 3) = hsnif (ji,jj ) * area(ji,jj)
tabres(ji,jj, 4) = tbif (ji,jj,1) * area(ji,jj)
tabres(ji,jj, 5) = tbif (ji,jj,2) * area(ji,jj)
tabres(ji,jj, 6) = tbif (ji,jj,3) * area(ji,jj)
tabres(ji,jj, 7) = qstoif(ji,jj ) * area(ji,jj)
END DO
END DO
tabres = zrhox * zrhoy * tabres
ELSE
DO jj=j1,j2
DO ji=i1,i2
z1_area = 1. / area(ji,jj) * tms(ji,jj)
frld (ji,jj) = tabres(ji,jj, 1) * z1_area
hicif (ji,jj) = tabres(ji,jj, 2) * z1_area
hsnif (ji,jj) = tabres(ji,jj, 3) * z1_area
tbif (ji,jj,1) = tabres(ji,jj, 4) * z1_area
tbif (ji,jj,2) = tabres(ji,jj, 5) * z1_area
tbif (ji,jj,3) = tabres(ji,jj, 6) * z1_area
qstoif(ji,jj) = tabres(ji,jj, 7) * z1_area
END DO
END DO
ENDIF
!
END SUBROUTINE update_adv_ice
# if defined key_lim2_vp
SUBROUTINE update_u_ice( tabres, i1, i2, j1, j2, before )
!!-----------------------------------------------------------------------
!! *** ROUTINE update_u_ice ***
!! ** Method : Update the fluxes and recover the properties (B-grid)
!!-----------------------------------------------------------------------
INTEGER, INTENT(in) :: i1, i2, j1, j2
REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
LOGICAL, INTENT(in) :: before
!!
INTEGER :: ji, jj
REAL(wp) :: zrhoy
!!-----------------------------------------------------------------------
!
IF( before ) THEN
zrhoy = Agrif_Rhoy()
DO jj=MAX(j1,2),j2
DO ji=MAX(i1,2),i2
tabres(ji,jj) = e2f(ji-1,jj-1) * u_ice(ji,jj)
END DO
END DO
tabres = zrhoy * tabres
ELSE
DO jj= MAX(j1,2),j2
DO ji=MAX(i1,2),i2
u_ice(ji,jj) = tabres(ji,jj) / (e2f(ji-1,jj-1))
u_ice(ji,jj) = u_ice(ji,jj) * tmu(ji,jj)
END DO
END DO
ENDIF
!
END SUBROUTINE update_u_ice
SUBROUTINE update_v_ice( tabres, i1, i2, j1, j2, before )
!!-----------------------------------------------------------------------
!! *** ROUTINE update_v_ice ***
!! ** Method : Update the fluxes and recover the properties (B-grid)
!!-----------------------------------------------------------------------
INTEGER, INTENT(in) :: i1,i2,j1,j2
REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
LOGICAL, INTENT(in) :: before
!!
INTEGER :: ji, jj
REAL(wp) :: zrhox
!!-----------------------------------------------------------------------
!
IF( before ) THEN
zrhox = Agrif_Rhox()
DO jj=MAX(j1,2),j2
DO ji=MAX(i1,2),i2
tabres(ji,jj) = e1f(ji-1,jj-1) * v_ice(ji,jj)
END DO
END DO
tabres = zrhox * tabres
ELSE
DO jj=j1,j2
DO ji=i1,i2
v_ice(ji,jj) = tabres(ji,jj) / (e1f(ji-1,jj-1))
v_ice(ji,jj) = v_ice(ji,jj) * tmu(ji,jj)
END DO
END DO
ENDIF
!
END SUBROUTINE update_v_ice
# else
SUBROUTINE update_u_ice( tabres, i1, i2, j1, j2, before )
!!-----------------------------------------------------------------------
!! *** ROUTINE update_u_ice ***
!! ** Method : Update the fluxes and recover the properties (C-grid)
!!-----------------------------------------------------------------------
INTEGER, INTENT(in) :: i1, i2, j1, j2
REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
LOGICAL, INTENT(in) :: before
!!
INTEGER :: ji, jj
REAL(wp) :: zrhoy
!!-----------------------------------------------------------------------
!
IF( before ) THEN
zrhoy = Agrif_Rhoy()
DO jj=MAX(j1,2),j2
DO ji=MAX(i1,2),i2
tabres(ji,jj) = e2u(ji,jj) * u_ice(ji,jj)
END DO
END DO
tabres = zrhoy * tabres
ELSE
DO jj=MAX(j1,2),j2
DO ji=MAX(i1,2),i2
u_ice(ji,jj) = tabres(ji,jj) / (e2u(ji,jj))
u_ice(ji,jj) = u_ice(ji,jj) * tmu(ji,jj)
END DO
END DO
ENDIF
!
END SUBROUTINE update_u_ice
SUBROUTINE update_v_ice( tabres, i1, i2, j1, j2, before )
!!-----------------------------------------------------------------------
!! *** ROUTINE update_v_ice ***
!! ** Method : Update the fluxes and recover the properties (C-grid)
!!-----------------------------------------------------------------------
INTEGER, INTENT(in) :: i1,i2,j1,j2
REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: tabres
LOGICAL, INTENT(in) :: before
!!
INTEGER :: ji, jj
REAL(wp) :: zrhox
!!-----------------------------------------------------------------------
!
IF( before ) THEN
zrhox = Agrif_Rhox()
DO jj=MAX(j1,2),j2
DO ji=MAX(i1,2),i2
tabres(ji,jj) = e1v(ji,jj) * v_ice(ji,jj)
END DO
END DO
tabres = zrhox * tabres
ELSE
DO jj=j1,j2
DO ji=i1,i2
v_ice(ji,jj) = tabres(ji,jj) / (e1v(ji,jj))
v_ice(ji,jj) = v_ice(ji,jj) * tmv(ji,jj)
END DO
END DO
ENDIF
!
END SUBROUTINE update_v_ice
# endif
#else
CONTAINS
SUBROUTINE agrif_lim2_update_empty
!!---------------------------------------------
!! *** ROUTINE agrif_lim2_update_empty ***
!!---------------------------------------------
WRITE(*,*) 'agrif_lim2_update : You should not have seen this print! error?'
END SUBROUTINE agrif_lim2_update_empty
#endif
END MODULE agrif_lim2_update