SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_swabs_r.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 !GLT_LIC The GELATO model is a seaice model used in stand-alone or embedded mode.
6 !GLT_LIC It has been developed by Meteo-France. The holder of GELATO is Meteo-France.
7 !GLT_LIC
8 !GLT_LIC This software is governed by the CeCILL-C license under French law and biding
9 !GLT_LIC by the rules of distribution of free software. See the CeCILL-C_V1-en.txt
10 !GLT_LIC (English) and CeCILL-C_V1-fr.txt (French) for details. The CeCILL is a free
11 !GLT_LIC software license, explicitly compatible with the GNU GPL
12 !GLT_LIC (see http://www.gnu.org/licenses/license-list.en.html#CeCILL)
13 !GLT_LIC
14 !GLT_LIC The CeCILL-C licence agreement grants users the right to modify and re-use the
15 !GLT_LIC software governed by this free software license. The exercising of this right
16 !GLT_LIC is conditional upon the obligation to make available to the community the
17 !GLT_LIC modifications made to the source code of the software so as to contribute to
18 !GLT_LIC its evolution.
19 !GLT_LIC
20 !GLT_LIC In consideration of access to the source code and the rights to copy, modify
21 !GLT_LIC and redistribute granted by the license, users are provided only with a limited
22 !GLT_LIC warranty and the software's author, the holder of the economic rights, and the
23 !GLT_LIC successive licensors only have limited liability. In this respect, the risks
24 !GLT_LIC associated with loading, using, modifying and/or developing or reproducing the
25 !GLT_LIC software by the user are brought to the user's attention, given its Free
26 !GLT_LIC Software status, which may make it complicated to use, with the result that its
27 !GLT_LIC use is reserved for developers and experienced professionals having in-depth
28 !GLT_LIC computer knowledge. Users are therefore encouraged to load and test the
29 !GLT_LIC suitability of the software as regards their requirements in conditions enabling
30 !GLT_LIC the security of their systems and/or data to be ensured and, more generally, to
31 !GLT_LIC use and operate it in the same conditions of security.
32 !GLT_LIC
33 !GLT_LIC The GELATO sofware is cureently distibuted with the SURFEX software, available at
34 !GLT_LIC http://www.cnrm.meteo.fr/surfex. The fact that you download the software deemed that
35 !GLT_LIC you had knowledge of the CeCILL-C license and that you accept its terms.
36 !GLT_LIC Attempts to use this software in a way not complying with CeCILL-C license
37 !GLT_LIC may lead to prosecution.
38 !GLT_LIC
39 !* Note that here, pent is the vertical gltools_enthalpy profile (updated as
40 ! the routine is called); pvsp is the vertical salinity profile.
41 !* pswtra is the absorbed solar heat flux by level by level due to
42 ! solar irradiance transmission.
43 !* An gltools_enthalpy difference is returned, by levels (pdhmelt). It is set
44 ! to zero if the sea ice does not melt, else it is positive where there
45 ! is melting
46 !
47 ! Modified: 11/2009 (D. Salas y Melia, Ouessant)
48 ! sea ice specific heat is now a function of temperature and salinity
49 !
50 !THXS_SFX!MODULE modi_glt_swabs_r
51 !THXS_SFX!INTERFACE
52 !THXS_SFX!!
53 !THXS_SFX!SUBROUTINE glt_swabs_r &
54 !THXS_SFX! ( tpsit,pswtra,pent,pvsp,pdhmelt )
55 !THXS_SFX! USE modd_glt_param
56 !THXS_SFX! USE modd_types_glt
57 !THXS_SFX! TYPE(t_sit), DIMENSION(nt,np), INTENT(in) :: &
58 !THXS_SFX! tpsit
59 !THXS_SFX! REAL, DIMENSION(nl,nt,np), INTENT(in) :: &
60 !THXS_SFX! pswtra
61 !THXS_SFX! REAL, DIMENSION(nl,nt,np), INTENT(inout) :: &
62 !THXS_SFX! pent
63 !THXS_SFX! REAL, DIMENSION(nl,nt,np), INTENT(inout) :: &
64 !THXS_SFX! pvsp
65 !THXS_SFX! REAL, DIMENSION(nl,nt,np), INTENT(inout) :: &
66 !THXS_SFX! pdhmelt
67 !THXS_SFX!END SUBROUTINE glt_swabs_r
68 !THXS_SFX!!
69 !THXS_SFX!END INTERFACE
70 !THXS_SFX!END MODULE modi_glt_swabs_r
71 !
72 ! ----------------------- END MODULE modi_glt_swabs_r -----------------------
73 !
74 !
75 ! -----------------------------------------------------------------------
76 ! ------------------------- SUBROUTINE glt_swabs_r --------------------------
77 !
78 SUBROUTINE glt_swabs_r &
79  ( tpsit,pswtra,pent,pvsp,pdhmelt )
80 !
82  USE modd_glt_param
83  USE modd_types_glt
84 !
85  IMPLICIT NONE
86 !
87 !
88 !
89 ! 1. Variables
90 ! ============
91 !
92 ! 1.1. Dummy arguments
93 ! --------------------
94  TYPE(t_sit), DIMENSION(nt,np), INTENT(in) :: &
95  tpsit
96  REAL, DIMENSION(nl,nt,np), INTENT(in) :: &
97  pswtra
98  REAL, DIMENSION(nl,nt,np), INTENT(inout) :: &
99  pent
100  REAL, DIMENSION(nl,nt,np), INTENT(inout) :: &
101  pvsp
102  REAL, DIMENSION(nl,nt,np), INTENT(inout) :: &
103  pdhmelt
104 !
105 !
106 ! 1.2. Local variables
107 ! --------------------
108 !
109  LOGICAL, DIMENSION(nt,np) :: &
110  omask
111  CHARACTER(80) :: &
112  ymess
113  INTEGER :: &
114  jl
115  REAL :: &
116  zdhmelt
117  REAL :: &
118  zicondt,zicondb,zidhi_swa,zidhs_swa,ziswa,zinrg,zfsit
119  REAL, DIMENSION(nilay,nt,np) :: &
120  ztsi_m
121  REAL, DIMENSION(nl,nt,np) :: &
122  zento
123 !
124 !
125 !
126 ! 1. Initializations
127 ! ===================
128 !
129 ! 1.1. Initializations
130 ! ---------------------
131 !
132 ! .. Sea ice and snow melting point
133 !
134  ztsi_m(:,:,:) = -mu * pvsp(1:nilay,:,:)
135 !
136 ! .. Initial gltools_enthalpy
137 !
138  zento(:,:,:) = pent(:,:,:)
139 !
140 !
141 !!zfsit = SUM( tpsit(:,:)%fsi, MASK=(omask) )
142 !!zidhi_swa=0.
143 !! DO jl=1,nilay
144 !! zidhi_swa = zidhi_swa + rhoice*sf3tinv(jl)* &
145 !! SUM( tpsit(:,:)%fsi*tpsit(:,:)%hsi*zento(jl,:,:))/dtt
146 !! END DO
147 !! write(noutlu,*)'enthalpy (1)=',zidhi_swa/zfsit
148 !!!
149 !
150 ! .. Take solar radiation into account (direct impact on gltools_enthalpy,
151 ! doing that on temperature leads to non-conservation)
152 !
153 ! Sea ice part
154  DO jl=1,nilay
155  WHERE ( tpsit(:,:)%fsi>epsil1 .AND. tpsit(:,:)%hsi>epsil1 )
156  pent(jl,:,:) = pent(jl,:,:) + &
157  dtt*pswtra(jl,:,:)/( rhoice*sf3tinv(jl)*tpsit(:,:)%hsi )
158  ENDWHERE
159  END DO
160 !!!
161 !!write(noutlu,*)'pfsi=',tpsit%fsi
162 !!write(noutlu,*)'phsi=',tpsit%hsi
163 !!write(noutlu,*)'pswtra=',pswtra(:,3,1)
164 !! write(noutlu,*)'---------------'
165 !! write(noutlu,*)'dans swabs=', &
166 !! ( pent(1:nilay,3,1)-zento(1:nilay,3,1))* &
167 !! sf3tinv*rhoice*tpsit(3,1)%hsi/dtt
168 !! write(noutlu,*)'dans swabs=', &
169 !! sum(( pent(1:nilay,3,1)-zento(1:nilay,3,1))* &
170 !! sf3tinv*rhoice*tpsit(3,1)%hsi/dtt)
171 !! write(noutlu,*)'---------------'
172 !!zidhi_swa=0.
173 !! DO jl=1,nilay
174 !! zidhi_swa = zidhi_swa + rhoice*sf3tinv(jl)* &
175 !! SUM( tpsit(:,:)%fsi*tpsit(:,:)%hsi*pent(jl,:,:))/dtt
176 !! END DO
177 !! write(noutlu,*)'enthalpy (3)=',zidhi_swa/zfsit
178 !!!
179 !
180 ! Snow part
181 !! write(noutlu,*)'enth. snow avant=', &
182 !! sum(tpsit%fsi*tpsit(:,:)%rsn*tpsit%hsn*pent(nilay+1,:,:))
183  WHERE ( tpsit(:,:)%fsi>epsil1 .AND. tpsit(:,:)%hsn>epsil1 )
184  pent(nilay+1,:,:) = pent(nilay+1,:,:) + &
185  dtt*pswtra(nilay+1,:,:)/( tpsit(:,:)%rsn*tpsit(:,:)%hsn )
186  ENDWHERE
187 !! write(noutlu,*)'enth. snow max=',-xmhofusn0
188 !! write(noutlu,*)'enth. snow apres=', &
189 !! sum(tpsit%fsi*tpsit%rsn*tpsit%hsn*pent(nilay+1,:,:))
190 !
191 ! .. Add up excess energy due to solar radiation (in J.m-2)
192 !
193 ! Sea ice part
194 !!write(noutlu,*)'pdhmelt (1)=',sum(pdhmelt,dim=1)/dtt
195  DO jl=1,nilay
196  WHERE ( pent(jl,:,:)>cpsw*ztsi_m(jl,:,:) )
197  pdhmelt(jl,:,:) = pdhmelt(jl,:,:) + &
198  rhoice*tpsit(:,:)%hsi*sf3tinv(jl)* &
199  ( pent(jl,:,:)-cpsw*ztsi_m(jl,:,:) )
200  pent(jl,:,:) = cpsw*ztsi_m(jl,:,:)
201  ENDWHERE
202  END DO
203 !!!
204 !!write(noutlu,*)'pdhmelt (2)=',sum(pdhmelt,dim=1)/dtt
205 !!zidhi_swa=0.
206 !! DO jl=1,nilay
207 !! zidhi_swa = zidhi_swa + &
208 !! rhoice*sf3tinv(jl)* &
209 !! SUM( tpsit%fsi*tpsit%hsi*pent(jl,:,:))/dtt
210 !! END DO
211 !! write(noutlu,*)'enthalpy (4)=',zidhi_swa/zfsit
212 !!!
213 !
214 ! Snow part
215  WHERE ( pent(nilay+1,:,:)>-xmhofusn0 )
216  pdhmelt(nilay+1,:,:) = pdhmelt(nilay+1,:,:) + &
217  tpsit(:,:)%rsn*tpsit(:,:)%hsn*( pent(nilay+1,:,:)+xmhofusn0 )
218  pent(nilay+1,:,:) = -xmhofusn0
219  ENDWHERE
220 !!write(noutlu,*)'pdhmelt (3)=',sum(pdhmelt,dim=1)/dtt
221 !! write(noutlu,*)'enth. snow final=', &
222 !! sum(tpsit%fsi*tpsit%rsn*tpsit%hsn*pent(nilay+1,:,:))
223 !
224 !
225 !
226 ! 6. Final checks
227 ! ================
228 !
229  IF (lp1) THEN
230  WRITE(noutlu,*)
231  WRITE(noutlu,*) &
232  'At the end of SWABS (vert. heat diffusion scheme), W/m2 of ice'
233 !
234 ! Total sea ice concentration
235  omask(:,:) = .false.
236  WHERE( tpsit(:,:)%hsi>epsil1 )
237  omask(:,:) = .true.
238  ENDWHERE
239  zfsit = sum( tpsit(:,:)%fsi, mask=(omask) )
240  zfsit = amax1( zfsit,epsil1 )
241 !
242 ! .. Print input solar energy
243 !
244  ziswa = 0.
245  DO jl=1,nilay+1
246  ziswa = ziswa + sum( tpsit(:,:)%fsi*pswtra(jl,:,:) ) / zfsit
247  END DO
248 !
249  WRITE(noutlu,*) &
250  ' Input solar energy:', ziswa
251 !! write(noutlu,*) SUM( pswtra(:,:,1),DIM=1 )
252 !
253 ! .. Print ice gltools_enthalpy change integral (solar)
254 !
255  zidhi_swa = 0.
256  DO jl=1,nilay
257  zidhi_swa = zidhi_swa + &
258  rhoice*sf3tinv(jl)* &
259  sum( tpsit(:,:)%fsi*tpsit(:,:)%hsi*( pent(jl,:,:)-zento(jl,:,:) ) )
260  END DO
261  zidhi_swa = zidhi_swa / (zfsit*dtt)
262 !
263  WRITE(noutlu,*) &
264  ' Ice gltools_enthalpy change due to solar warming:', &
265  zidhi_swa
266 !
267 ! .. Print snow gltools_enthalpy change integral (solar)
268 !
269  zidhs_swa = &
270  sum( tpsit(:,:)%fsi*tpsit(:,:)%rsn*tpsit(:,:)%hsn* &
271  ( pent(nilay+1,:,:)-zento(nilay+1,:,:) ) ) / (zfsit*dtt)
272 !
273  WRITE(noutlu,*) &
274  ' Snow gltools_enthalpy change due to solar warming:', &
275  zidhs_swa
276 !
277  zdhmelt = 0.
278  DO jl=1,nl
279  zdhmelt = zdhmelt + &
280  sum( tpsit(:,:)%fsi*pdhmelt(jl,:,:) ) / (zfsit*dtt)
281  END DO
282 !
283  WRITE(noutlu,*) &
284  ' dhmelt:', zdhmelt
285 !
286 ! .. Energy variation of the whole system (due to non-solar + solar flux)
287 !
288  zinrg = ziswa - ( zdhmelt + zidhi_swa + zidhs_swa )
289 !
290  WRITE(noutlu,*) &
291  ' Energy variation of the whole system (solar):', zinrg
292 !
293 ! .. If the energy variation of the system is too large, issue a warning
294 !
295  IF ( abs(zinrg)>0.01 ) THEN
296  WRITE(noutlu,*)
297  WRITE(noutlu,*) ' ** WARNING **'
298  WRITE(noutlu,*) &
299  ' Heat conduction scheme not conservative'
300  WRITE(noutlu,*) &
301  ' ========================================='
302  ENDIF
303 !
304  ENDIF
305 !
306  END SUBROUTINE glt_swabs_r
subroutine glt_swabs_r(tpsit, pswtra, pent, pvsp, pdhmelt)