1 | #define TWO_WAY |
---|
2 | |
---|
3 | MODULE agrif_lim3_update |
---|
4 | !!===================================================================================== |
---|
5 | !! *** MODULE agrif_lim3_update *** |
---|
6 | !! Nesting module : update surface ocean boundary condition over ice from a child grid |
---|
7 | !! Sea-Ice model : LIM 3.6 Sea ice model time-stepping |
---|
8 | !!===================================================================================== |
---|
9 | !! History : 2.0 ! 04-2008 (F. Dupont) initial version |
---|
10 | !! 3.4 ! 08-2012 (R. Benshila, C. Herbaut) update and EVP |
---|
11 | !! 3.6 ! 05-2016 (C. Rousset) Add LIM3 compatibility |
---|
12 | !!---------------------------------------------------------------------- |
---|
13 | #if defined key_agrif && defined key_lim3 |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | !! 'key_lim3' : LIM 3.6 sea-ice model |
---|
16 | !! 'key_agrif' : AGRIF library |
---|
17 | !!---------------------------------------------------------------------- |
---|
18 | !! agrif_update_lim3 : update sea-ice on boundaries or total |
---|
19 | !! child domain for velocities and ice properties |
---|
20 | !! update_tra_ice : sea-ice properties |
---|
21 | !! update_u_ice : zonal ice velocity |
---|
22 | !! update_v_ice : meridional ice velocity |
---|
23 | !!---------------------------------------------------------------------- |
---|
24 | USE dom_oce |
---|
25 | USE sbc_oce |
---|
26 | USE agrif_oce |
---|
27 | USE ice |
---|
28 | USE agrif_ice |
---|
29 | |
---|
30 | IMPLICIT NONE |
---|
31 | PRIVATE |
---|
32 | |
---|
33 | PUBLIC agrif_update_lim3 ! called by agrif_user.F90 |
---|
34 | |
---|
35 | !!---------------------------------------------------------------------- |
---|
36 | !! NEMO/NST 4.0 , LOCEAN-IPSL (2017) |
---|
37 | !! $Id: agrif_lim3_update.F90 6204 2016-01-04 13:47:06Z cetlod $ |
---|
38 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
39 | !!---------------------------------------------------------------------- |
---|
40 | CONTAINS |
---|
41 | |
---|
42 | SUBROUTINE agrif_update_lim3( kt ) |
---|
43 | !!---------------------------------------------------------------------- |
---|
44 | !! *** ROUTINE agrif_update_lim3 *** |
---|
45 | !! ** Method : Call the hydrostaticupdate pressure at the boundary or the entire domain |
---|
46 | !! |
---|
47 | !! ** Action : - Update (u_ice,v_ice) and ice tracers |
---|
48 | !!---------------------------------------------------------------------- |
---|
49 | INTEGER, INTENT(in) :: kt |
---|
50 | !!---------------------------------------------------------------------- |
---|
51 | ! |
---|
52 | !! clem: I think the update should take place each time the ocean sees the surface forcings |
---|
53 | !! (but maybe I am wrong and we should update every rhot time steps) |
---|
54 | IF( ( MOD( (kt-nit000)/nn_fsbc + 1, Agrif_irhot() * Agrif_Parent(nn_fsbc) / nn_fsbc ) /=0 ) .AND. (kt /= 0) ) RETURN ! do not update if nb of child time steps differ from time refinement |
---|
55 | ! i.e. update only at the parent time step |
---|
56 | IF( nn_ice == 0 ) RETURN ! do not update if child domain does not have ice |
---|
57 | ! |
---|
58 | Agrif_SpecialValueFineGrid = -9999. |
---|
59 | Agrif_UseSpecialValueInUpdate = .TRUE. |
---|
60 | # if defined TWO_WAY |
---|
61 | CALL Agrif_Update_Variable( tra_ice_id , procname = update_tra_ice ) |
---|
62 | CALL Agrif_Update_Variable( u_ice_id , procname = update_u_ice ) |
---|
63 | CALL Agrif_Update_Variable( v_ice_id , procname = update_v_ice ) |
---|
64 | |
---|
65 | ! CALL Agrif_Update_Variable( tra_ice_id , locupdate=(/0,2/), procname = update_tra_ice ) |
---|
66 | ! CALL Agrif_Update_Variable( u_ice_id , locupdate=(/0,1/), procname = update_u_ice ) |
---|
67 | ! CALL Agrif_Update_Variable( v_ice_id , locupdate=(/0,1/), procname = update_v_ice ) |
---|
68 | # endif |
---|
69 | Agrif_SpecialValueFineGrid = 0. |
---|
70 | Agrif_UseSpecialValueInUpdate = .FALSE. |
---|
71 | ! |
---|
72 | END SUBROUTINE agrif_update_lim3 |
---|
73 | |
---|
74 | |
---|
75 | SUBROUTINE update_tra_ice( ptab, i1, i2, j1, j2, k1, k2, before ) |
---|
76 | !!----------------------------------------------------------------------- |
---|
77 | !! *** ROUTINE update_tra_ice *** |
---|
78 | !! ** Method : Compute the mass properties on the fine grid and recover |
---|
79 | !! the properties per mass on the coarse grid |
---|
80 | !!----------------------------------------------------------------------- |
---|
81 | INTEGER , INTENT(in ) :: i1, i2, j1, j2, k1, k2 |
---|
82 | REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2), INTENT(inout) :: ptab |
---|
83 | LOGICAL , INTENT(in ) :: before |
---|
84 | !! |
---|
85 | INTEGER :: ji, jj, jk, jl, jm |
---|
86 | !!----------------------------------------------------------------------- |
---|
87 | ! it is ok not to multiply by e1*e2 since we conserve tracers here (same as in the ocean). |
---|
88 | IF( before ) THEN |
---|
89 | jm = 1 |
---|
90 | DO jl = 1, jpl |
---|
91 | ptab(i1:i2,j1:j2,jm ) = a_i (i1:i2,j1:j2,jl) |
---|
92 | ptab(i1:i2,j1:j2,jm+1) = v_i (i1:i2,j1:j2,jl) |
---|
93 | ptab(i1:i2,j1:j2,jm+2) = v_s (i1:i2,j1:j2,jl) |
---|
94 | ptab(i1:i2,j1:j2,jm+3) = sv_i(i1:i2,j1:j2,jl) |
---|
95 | ptab(i1:i2,j1:j2,jm+4) = oa_i(i1:i2,j1:j2,jl) |
---|
96 | ptab(i1:i2,j1:j2,jm+5) = a_ip(i1:i2,j1:j2,jl) |
---|
97 | ptab(i1:i2,j1:j2,jm+6) = v_ip(i1:i2,j1:j2,jl) |
---|
98 | ptab(i1:i2,j1:j2,jm+7) = t_su(i1:i2,j1:j2,jl) |
---|
99 | jm = jm + 8 |
---|
100 | DO jk = 1, nlay_s |
---|
101 | ptab(i1:i2,j1:j2,jm) = e_s(i1:i2,j1:j2,jk,jl) ; jm = jm + 1 |
---|
102 | END DO |
---|
103 | DO jk = 1, nlay_i |
---|
104 | ptab(i1:i2,j1:j2,jm) = e_i(i1:i2,j1:j2,jk,jl) ; jm = jm + 1 |
---|
105 | END DO |
---|
106 | END DO |
---|
107 | ! |
---|
108 | DO jk = k1, k2 |
---|
109 | WHERE( tmask(i1:i2,j1:j2,1) == 0. ) ptab(i1:i2,j1:j2,jk) = Agrif_SpecialValueFineGrid |
---|
110 | END DO |
---|
111 | ! |
---|
112 | ELSE |
---|
113 | ! |
---|
114 | jm = 1 |
---|
115 | DO jl = 1, jpl |
---|
116 | ! |
---|
117 | DO jj = j1, j2 |
---|
118 | DO ji = i1, i2 |
---|
119 | IF( ptab(ji,jj,jm) /= Agrif_SpecialValueFineGrid ) THEN |
---|
120 | a_i (ji,jj,jl) = ptab(ji,jj,jm ) * tmask(ji,jj,1) |
---|
121 | v_i (ji,jj,jl) = ptab(ji,jj,jm+1) * tmask(ji,jj,1) |
---|
122 | v_s (ji,jj,jl) = ptab(ji,jj,jm+2) * tmask(ji,jj,1) |
---|
123 | sv_i(ji,jj,jl) = ptab(ji,jj,jm+3) * tmask(ji,jj,1) |
---|
124 | oa_i(ji,jj,jl) = ptab(ji,jj,jm+4) * tmask(ji,jj,1) |
---|
125 | a_ip(ji,jj,jl) = ptab(ji,jj,jm+5) * tmask(ji,jj,1) |
---|
126 | v_ip(ji,jj,jl) = ptab(ji,jj,jm+6) * tmask(ji,jj,1) |
---|
127 | t_su(ji,jj,jl) = ptab(ji,jj,jm+7) * tmask(ji,jj,1) |
---|
128 | ENDIF |
---|
129 | END DO |
---|
130 | END DO |
---|
131 | jm = jm + 8 |
---|
132 | ! |
---|
133 | DO jk = 1, nlay_s |
---|
134 | WHERE( ptab(i1:i2,j1:j2,jm) /= Agrif_SpecialValueFineGrid ) |
---|
135 | e_s(i1:i2,j1:j2,jk,jl) = ptab(i1:i2,j1:j2,jm) * tmask(i1:i2,j1:j2,1) |
---|
136 | ENDWHERE |
---|
137 | jm = jm + 1 |
---|
138 | END DO |
---|
139 | ! |
---|
140 | DO jk = 1, nlay_i |
---|
141 | WHERE( ptab(i1:i2,j1:j2,jm) /= Agrif_SpecialValueFineGrid ) |
---|
142 | e_i(i1:i2,j1:j2,jk,jl) = ptab(i1:i2,j1:j2,jm) * tmask(i1:i2,j1:j2,1) |
---|
143 | ENDWHERE |
---|
144 | jm = jm + 1 |
---|
145 | END DO |
---|
146 | ! |
---|
147 | END DO |
---|
148 | ! |
---|
149 | ! integrated values |
---|
150 | vt_i(i1:i2,j1:j2) = SUM( v_i(i1:i2,j1:j2,:) , dim=3 ) |
---|
151 | vt_s(i1:i2,j1:j2) = SUM( v_s(i1:i2,j1:j2,:) , dim=3 ) |
---|
152 | at_i(i1:i2,j1:j2) = SUM( a_i(i1:i2,j1:j2,:) , dim=3 ) |
---|
153 | et_s(i1:i2,j1:j2) = SUM( SUM( e_s(i1:i2,j1:j2,:,:), dim=4 ), dim=3 ) |
---|
154 | et_i(i1:i2,j1:j2) = SUM( SUM( e_i(i1:i2,j1:j2,:,:), dim=4 ), dim=3 ) |
---|
155 | |
---|
156 | at_ip(i1:i2,j1:j2) = SUM( a_ip(i1:i2,j1:j2,:), dim=3 ) ! melt ponds |
---|
157 | vt_ip(i1:i2,j1:j2) = SUM( v_ip(i1:i2,j1:j2,:), dim=3 ) |
---|
158 | ! |
---|
159 | ato_i(i1:i2,j1:j2) = 1._wp - at_i(i1:i2,j1:j2) ! open water fraction |
---|
160 | |
---|
161 | ENDIF |
---|
162 | ! |
---|
163 | END SUBROUTINE update_tra_ice |
---|
164 | |
---|
165 | |
---|
166 | SUBROUTINE update_u_ice( ptab, i1, i2, j1, j2, before ) |
---|
167 | !!----------------------------------------------------------------------- |
---|
168 | !! *** ROUTINE update_u_ice *** |
---|
169 | !! ** Method : Update the fluxes and recover the properties (C-grid) |
---|
170 | !!----------------------------------------------------------------------- |
---|
171 | INTEGER , INTENT(in ) :: i1, i2, j1, j2 |
---|
172 | REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: ptab |
---|
173 | LOGICAL , INTENT(in ) :: before |
---|
174 | !! |
---|
175 | REAL(wp) :: zrhoy ! local scalar |
---|
176 | !!----------------------------------------------------------------------- |
---|
177 | ! |
---|
178 | IF( before ) THEN |
---|
179 | zrhoy = Agrif_Rhoy() |
---|
180 | ptab(:,:) = e2u(i1:i2,j1:j2) * u_ice(i1:i2,j1:j2) * zrhoy |
---|
181 | WHERE( umask(i1:i2,j1:j2,1) == 0._wp ) ptab(:,:) = Agrif_SpecialValueFineGrid |
---|
182 | ELSE |
---|
183 | WHERE( ptab(i1:i2,j1:j2) /= Agrif_SpecialValueFineGrid ) |
---|
184 | u_ice(i1:i2,j1:j2) = ptab(i1:i2,j1:j2) / e2u(i1:i2,j1:j2) * umask(i1:i2,j1:j2,1) |
---|
185 | ENDWHERE |
---|
186 | ENDIF |
---|
187 | ! |
---|
188 | END SUBROUTINE update_u_ice |
---|
189 | |
---|
190 | |
---|
191 | SUBROUTINE update_v_ice( ptab, i1, i2, j1, j2, before ) |
---|
192 | !!----------------------------------------------------------------------- |
---|
193 | !! *** ROUTINE update_v_ice *** |
---|
194 | !! ** Method : Update the fluxes and recover the properties (C-grid) |
---|
195 | !!----------------------------------------------------------------------- |
---|
196 | INTEGER , INTENT(in ) :: i1, i2, j1, j2 |
---|
197 | REAL(wp), DIMENSION(i1:i2,j1:j2), INTENT(inout) :: ptab |
---|
198 | LOGICAL , INTENT(in ) :: before |
---|
199 | !! |
---|
200 | REAL(wp) :: zrhox ! local scalar |
---|
201 | !!----------------------------------------------------------------------- |
---|
202 | ! |
---|
203 | IF( before ) THEN |
---|
204 | zrhox = Agrif_Rhox() |
---|
205 | ptab(:,:) = e1v(i1:i2,j1:j2) * v_ice(i1:i2,j1:j2) * zrhox |
---|
206 | WHERE( vmask(i1:i2,j1:j2,1) == 0._wp ) ptab(:,:) = Agrif_SpecialValueFineGrid |
---|
207 | ELSE |
---|
208 | WHERE( ptab(i1:i2,j1:j2) /= Agrif_SpecialValueFineGrid ) |
---|
209 | v_ice(i1:i2,j1:j2) = ptab(i1:i2,j1:j2) / e1v(i1:i2,j1:j2) * vmask(i1:i2,j1:j2,1) |
---|
210 | ENDWHERE |
---|
211 | ENDIF |
---|
212 | ! |
---|
213 | END SUBROUTINE update_v_ice |
---|
214 | |
---|
215 | #else |
---|
216 | !!---------------------------------------------------------------------- |
---|
217 | !! Empty module no sea-ice |
---|
218 | !!---------------------------------------------------------------------- |
---|
219 | CONTAINS |
---|
220 | SUBROUTINE agrif_lim3_update_empty |
---|
221 | WRITE(*,*) 'agrif_lim3_update : You should not have seen this print! error?' |
---|
222 | END SUBROUTINE agrif_lim3_update_empty |
---|
223 | #endif |
---|
224 | |
---|
225 | !!====================================================================== |
---|
226 | END MODULE agrif_lim3_update |
---|