SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
modi_glt_sndatmf.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 ! =======================================================================
40 ! ========================= MODULE modi_glt_sndatmf =========================
41 ! =======================================================================
42 !
43 ! This routine was created for Gelato version 3, i.e. Gelato is under
44 ! the form of a routine inserted in the OPA 8 code.
45 ! It allows Gelato to transmit the forcing the atmosphere model needs as
46 ! a routine glt_output argument.
47 !
48 ! Created : 10/1999 (D. Salas y Melia)
49 ! Modified: 08/2009 (D. Salas y Melia) Manages single or double physics
50 ! Modified: 07/2012 (D. Salas y Melia) Parallelism
51 !
52 ! --------------------- BEGIN MODULE modi_glt_sndatmf -----------------------
53 !
54 !THXS_SFX!MODULE modi_glt_sndatmf
55 !THXS_SFX!INTERFACE
56 !THXS_SFX!!
57 !THXS_SFX!SUBROUTINE glt_sndatmf(tpglt)
58 !THXS_SFX! USE modd_types_glt
59 !THXS_SFX! USE modd_glt_param
60 !THXS_SFX! TYPE(t_glt), INTENT(inout) :: &
61 !THXS_SFX! tpglt
62 !THXS_SFX!END SUBROUTINE glt_sndatmf
63 !THXS_SFX!!
64 !THXS_SFX!END INTERFACE
65 !THXS_SFX!END MODULE modi_glt_sndatmf
66 !
67 ! ---------------------- END MODULE modi_glt_sndatmf ------------------------
68 !
69 !
70 ! -----------------------------------------------------------------------
71 ! ----------------------- SUBROUTINE glt_sndatmf ----------------------------
72 
73 SUBROUTINE glt_sndatmf(tpglt, xtmlf)
74  USE modd_types_glt
75  USE modd_glt_param
77 !USE MODI_ABOR1_SFX
78 #if ! defined in_surfex
79  USE mode_gltools_bound
80  USE modi_gltools_advmsk
81  USE modi_gltools_expand
82 #endif
83 !
84  IMPLICIT NONE
85 !
86  TYPE(t_glt), INTENT(inout) :: &
87  tpglt
88  ! Useful in Surfex init phase, when SST+SSS are not yet known, and hence
89  ! tml%mlf not yet filled in, but one wants a sensible value for TICE everywhere:
90  REAL, OPTIONAL, INTENT(IN) :: &
91  xtmlf
92 !
93  INTEGER, PARAMETER :: &
94  jporder=5
95  INTEGER, DIMENSION(jporder,SIZE(tpglt%dom,1),SIZE(tpglt%dom,2)) :: &
96  iadvmsk
97  REAL, DIMENSION(SIZE(tpglt%dom,1),SIZE(tpglt%dom,2)) :: &
98  zalbc
99  REAL, DIMENSION(SIZE(tpglt%dom,1),SIZE(tpglt%dom,2)) :: &
100  zalbm,ztsfm,zfsit
101  TYPE(t_sit), &
102  DIMENSION(SIZE(tpglt%sit,1),SIZE(tpglt%sit,2),SIZE(tpglt%sit,3)) :: &
103  tzsit
104 !
105 !
106 !
107 ! 1. Initializations
108 ! ===================
109 !
110 ! Get ice state from super-type
111 !
112  tzsit = tpglt%sit
113 !
114 ! Total sea ice cover (fraction of unity)
115  zfsit(:,:) = &
116  sum( tzsit(:,:,:)%fsi,dim=1 )*float( tpglt%dom(:,:)%tmk )
117 #if ! defined in_surfex
118  CALL gltools_bound( 'T','scalar',zfsit )
119 #endif
120 !
121 ! Stratus clouds albedo
122  zalbc(:,:) = 0.
123  WHERE( zfsit(:,:)>=0.05 )
124  zalbc(:,:) = alblc
125  ENDWHERE
126 !
127 !
128 !
129 ! 2. Double physics case
130 ! =======================
131 !
132  IF ( nnflxin/=0 ) THEN
133 !
134 !
135 ! 2.1. Only ice cats-averaged data is sent to the atmosphere
136 ! -----------------------------------------------------------
137 !
138 ! .. Define only sea ice surface data. The open water fraction can be deduced
139 ! from total sea ice fraction, its temperature is computed by the ocean and
140 ! its albedo is normally computed by the atmospheric model.
141 !
142  IF ( nnflxin==1 ) THEN
143 ! Ice average temperature and albedo (without stratus clouds)
144  WHERE( zfsit(:,:)>epsil5 )
145  ztsfm(:,:) = &
146  sum( tzsit(:,:,:)%fsi*tzsit(:,:,:)%tsf,dim=1 ) / zfsit(:,:)
147  zalbm(:,:) = &
148  sum( tzsit(:,:,:)%fsi*tzsit(:,:,:)%asn,dim=1 ) / zfsit(:,:)
149  ENDWHERE
150  IF (present(xtmlf)) THEN
151  WHERE( zfsit(:,:)<=epsil5 )
152  ztsfm(:,:) = xtmlf
153  ENDWHERE
154  ELSE
155  WHERE( zfsit(:,:)<=epsil5 )
156  ztsfm(:,:) = tpglt%tml(:,:)%mlf
157  ENDWHERE
158  ENDIF
159  WHERE( zfsit(:,:)<=epsil5 )
160  zalbm(:,:) = albi
161  ENDWHERE
162 !
163 ! Add stratus clouds (if alblc /= 0)
164  zalbm(:,:) = 1.-( 1.-zalbm(:,:) )*( 1.-zalbc(:,:) )
165 !
166 #if ! defined in_surfex
167 ! Extend the data near the ice edge to avoid interpolation problems when
168 ! coupling (note that concentration should not be extended, but ice temperature
169 ! and albedo should)
170  iadvmsk(:,:,:) = gltools_advmsk( jporder, tpglt%dom, zfsit(:,:)>epsil5 )
171  ztsfm(:,:) = gltools_expand( iadvmsk,ztsfm )
172  zalbm(:,:) = gltools_expand( iadvmsk,zalbm )
173 #endif
174 !
175 ! Define glt_output structure: gltools_bound, gather and broadcast
176 !
177 ! Ice fraction
178  tpglt%ice_atm(1,:,:)%fsi = zfsit(:,:)
179 !
180 ! Ice albedo
181 #if ! defined in_surfex
182  CALL gltools_bound( 'T','scalar',zalbm )
183 #endif
184  tpglt%ice_atm(1,:,:)%alb = zalbm(:,:)
185 !
186 ! Ice temperature
187 #if ! defined in_surfex
188  CALL gltools_bound( 'T','scalar',ztsfm )
189 #endif
190  ztsfm(:,:) = ztsfm(:,:)+t0deg
191  tpglt%ice_atm(1,:,:)%tsf = ztsfm(:,:)
192 !
193  ELSE
194 !
195 !
196 ! 2.2. Data from every ice category is sent to the atmosphere
197 ! ------------------------------------------------------------
198 !
199 ! NOTE : A DATA EXTENSION SHOULD ALSO BE APPLIED HERE !!
200 !
201 ! Ice fraction
202  tpglt%ice_atm(:,:,:)%fsi = tzsit(:,:,:)%fsi
203 !
204 ! Ice albedo
205  tpglt%ice_atm(:,:,:)%alb = tzsit(:,:,:)%asn
206 !
207 ! Ice temperature
208  tpglt%ice_atm(:,:,:)%tsf = tzsit(:,:,:)%tsf + t0deg
209 !
210  ENDIF
211  ELSE
212 !
213 !
214 !
215 ! 3. Single physics case
216 ! =======================
217 !
218 ! Weighted (ice+ocean) temperature and albedo (without stratus clouds)
219  zalbm(:,:) = &
220  sum( tzsit(:,:,:)%fsi*tzsit(:,:,:)%asn,dim=1 ) + &
221  ( 1.-zfsit(:,:) )*albw
222 ! Add stratus (no effect if alblc = 0 in gltpar)
223  zalbm(:,:) = 1.-( 1.-zalbm(:,:) )*( 1.-zalbc(:,:) )
224 !
225 ! Weighted surface temperature
226  ztsfm(:,:) = &
227  sum( tzsit(:,:,:)%fsi*tzsit(:,:,:)%tsf,dim=1 ) + &
228  ( 1.-zfsit(:,:) )*tpglt%tml(:,:)%tml + t0deg
229 !
230 ! Apply boundary conditions
231 #if ! defined in_surfex
232  CALL gltools_bound( 'T','scalar',zalbm )
233  CALL gltools_bound( 'T','scalar',ztsfm )
234 #endif
235 !
236 ! Define glt_output arrays
237 !
238 ! Ice fraction
239  tpglt%mix_atm(1,:,:)%fsi = zfsit(:,:)
240 !
241 ! Ice albedo
242  tpglt%mix_atm(1,:,:)%alb = zalbm(:,:)
243 !
244 ! Ice temperature
245  tpglt%mix_atm(1,:,:)%tsf = ztsfm(:,:)
246 !
247  ENDIF
248 !
249 END SUBROUTINE glt_sndatmf
250 !
251 ! --------------------- END SUBROUTINE glt_sndatmf --------------------------
252 ! -----------------------------------------------------------------------
subroutine glt_sndatmf(tpglt, xtmlf)