SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
put_sfx_sea.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 ! #########
6  SUBROUTINE put_sfx_sea (S, U, W, &
7  kluout,ocpl_seaice,owater,psea_sst,psea_ucu, &
8  psea_vcu,pseaice_sit,pseaice_cvr,pseaice_alb )
9 ! ####################################################
10 !
11 !!**** *PUT_SFX_SEA* - routine to put some variables from
12 !! an oceanic general circulation model
13 !! PURPOSE
14 !! -------
15 !!
16 !!** METHOD
17 !! ------
18 !!
19 !! EXTERNAL
20 !! --------
21 !!
22 !!
23 !! IMPLICIT ARGUMENTS
24 !! ------------------
25 !!
26 !! REFERENCE
27 !! ---------
28 !!
29 !!
30 !! AUTHOR
31 !! ------
32 !! B. Decharme *Meteo France*
33 !!
34 !! MODIFICATIONS
35 !! -------------
36 !! Original 08/2009
37 !-------------------------------------------------------------------------------
38 !
39 !* 0. DECLARATIONS
40 ! ------------
41 !
42 !
43 USE modd_seaflux_n, ONLY : seaflux_t
44 USE modd_surf_atm_n, ONLY : surf_atm_t
45 USE modd_watflux_n, ONLY : watflux_t
46 !
47 USE modd_surf_par, ONLY : xundef
48 USE modd_csts, ONLY : xtt, xtts, xicec
49 !
50 !
52 USE modi_abor1_sfx
53 !
54 USE yomhook ,ONLY : lhook, dr_hook
55 USE parkind1 ,ONLY : jprb
56 !
57 IMPLICIT NONE
58 !
59 !* 0.1 Declarations of arguments
60 ! -------------------------
61 !
62 !
63 TYPE(seaflux_t), INTENT(INOUT) :: s
64 TYPE(surf_atm_t), INTENT(INOUT) :: u
65 TYPE(watflux_t), INTENT(INOUT) :: w
66 !
67 INTEGER, INTENT(IN) :: kluout
68 LOGICAL, INTENT(IN) :: ocpl_seaice
69 LOGICAL, INTENT(IN) :: owater
70 !
71 REAL, DIMENSION(:), INTENT(IN) :: psea_sst
72 REAL, DIMENSION(:), INTENT(IN) :: psea_ucu
73 REAL, DIMENSION(:), INTENT(IN) :: psea_vcu
74 REAL, DIMENSION(:), INTENT(IN) :: pseaice_sit
75 REAL, DIMENSION(:), INTENT(IN) :: pseaice_cvr
76 REAL, DIMENSION(:), INTENT(IN) :: pseaice_alb
77 !
78 !* 0.2 Declarations of local variables
79 ! -------------------------------
80 !
81 !
82  CHARACTER(LEN=50) :: ycomment
83 !
84 REAL(KIND=JPRB) :: zhook_handle
85 !
86 !-------------------------------------------------------------------------------
87 !
88 IF (lhook) CALL dr_hook('PUT_SFX_SEA',0,zhook_handle)
89 !
90 !* 1.0 Initialization
91 ! --------------
92 !
93 !
94 !* 2.0 Get variable over sea
95 ! ---------------------
96 !
97 IF(u%NSIZE_SEA>0)THEN
98 !
99  CALL treat_sea(u%NSIZE_SEA)
100 !
101 ENDIF
102 !
103 !* 3.0 Get variable over water without flake
104 ! -------------------------------------
105 !
106 IF(owater.AND.u%NSIZE_WATER>0)THEN
107 !
108  CALL treat_water(u%NSIZE_WATER)
109 !
110 ENDIF
111 !
112 IF (lhook) CALL dr_hook('PUT_SFX_SEA',1,zhook_handle)
113 !
114 !-------------------------------------------------------------------------------
115  CONTAINS
116 !-------------------------------------------------------------------------------
117 !
118 SUBROUTINE treat_sea(KLU)
119 !
121 !
122 IMPLICIT NONE
123 !
124 INTEGER, INTENT(IN) :: klu
125 !
126 REAL, DIMENSION(KLU) :: zsst ! sea surface temperature
127 REAL, DIMENSION(KLU) :: zice_frac! ice fraction
128 REAL :: ztmin ! Minimum temperature over this proc
129 REAL :: ztmax ! Maximum temperature over this proc
130  CHARACTER(LEN=50) :: ycomment
131 !
132 REAL(KIND=JPRB) :: zhook_handle
133 !
134 IF (lhook) CALL dr_hook('PUT_SFX_SEA:TREAT_SEA',0,zhook_handle)
135 !
136 ycomment='Sea surface temperature'
137  CALL pack_same_rank(u%NR_SEA(:),psea_sst(:),zsst(:))
138 WHERE (zsst(:)/=0.0) s%XSST(:)=zsst(:)
139  CALL check_sea(ycomment,s%XSST(:))
140 !
141 ztmin=minval(s%XSST(:))
142 ztmax=maxval(s%XSST(:))
143 !
144 IF(ztmin<=0.0.OR.ztmax>500.)THEN
145  WRITE(kluout,*)'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
146  WRITE(kluout,*)'SST from ocean model not define or not physic'
147  WRITE(kluout,*)'SST MIN =',ztmin,'SST MAX =',ztmax
148  WRITE(kluout,*)'There is certainly a problem between '
149  WRITE(kluout,*)'SURFEX and OASIS sea/land mask '
150  WRITE(kluout,*)'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
151  CALL abor1_sfx('PUT_SFX_SEA: SST from ocean model not define or not physic')
152 ENDIF
153 !
154 ycomment='Sea u-current stress'
155  CALL pack_same_rank(u%NR_SEA(:),psea_ucu(:),s%XUMER(:))
156  CALL check_sea(ycomment,s%XUMER(:))
157 !
158 ycomment='Sea v-current stress'
159  CALL pack_same_rank(u%NR_SEA(:),psea_vcu(:),s%XVMER(:))
160  CALL check_sea(ycomment,s%XVMER(:))
161 !
162 IF(ocpl_seaice)THEN
163 !
164  ycomment='Sea-ice Temperature'
165  CALL pack_same_rank(u%NR_SEA(:),pseaice_sit(:),s%XTICE(:))
166  CALL check_sea(ycomment,s%XTICE(:))
167 !
168  ycomment='Sea-ice cover'
169  CALL pack_same_rank(u%NR_SEA(:),pseaice_cvr(:),zice_frac(:))
170  CALL check_sea(ycomment,zice_frac(:))
171 !
172  WHERE(zice_frac(:)>=xicec)
173  s%XSST(:) = min(s%XSST(:),xtts-0.01)
174  ELSEWHERE
175  s%XSST(:) = max(s%XSST(:),xtts)
176  ENDWHERE
177 !
178  ycomment='Sea-ice albedo'
179  CALL pack_same_rank(u%NR_SEA(:),pseaice_alb(:),s%XICE_ALB(:))
180  CALL check_sea(ycomment,s%XICE_ALB(:))
181 !
182 ! Fill the table with sea ice albedo where temperature is lower than the
183 ! freezing point
184  WHERE(s%XSST(:) < xtts)
185  s%XDIR_ALB(:)=s%XICE_ALB(:)
186  s%XSCA_ALB(:)=s%XICE_ALB(:)
187  ENDWHERE
188 !
189 ENDIF
190 !
191 IF (lhook) CALL dr_hook('PUT_SFX_SEA:TREAT_SEA',1,zhook_handle)
192 !
193 END SUBROUTINE treat_sea
194 !
195 !-------------------------------------------------------------------------------
196 !
197 SUBROUTINE treat_water(KLU)
198 !
199 !
200 IMPLICIT NONE
201 !
202 INTEGER, INTENT(IN) :: klu
203 !
204 REAL, DIMENSION(KLU) :: zice_frac! ice fraction
205 REAL :: ztmin ! Minimum temperature over this proc
206 REAL :: ztmax ! Maximum temperature over this proc
207  CHARACTER(LEN=50) :: ycomment
208 !
209 REAL(KIND=JPRB) :: zhook_handle
210 !
211 IF (lhook) CALL dr_hook('PUT_SFX_SEA:TREAT_WATER',0,zhook_handle)
212 !
213 ycomment='Water surface temperature'
214  CALL pack_same_rank(u%NR_WATER(:),psea_sst(:),w%XTS(:))
215  CALL check_sea(ycomment,w%XTS(:))
216 !
217 ztmin=minval(w%XTS(:))
218 ztmax=maxval(w%XTS(:))
219 !
220 IF(ztmin<=0.0.OR.ztmax>500.)THEN
221  WRITE(kluout,*)'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
222  WRITE(kluout,*)'TS_WATER from ocean model not define or not physic'
223  WRITE(kluout,*)'TS_WATER MIN =',ztmin,'TS_WATER MAX =',ztmax
224  WRITE(kluout,*)'There is certainly a problem between '
225  WRITE(kluout,*)'SURFEX and OASIS sea/land mask '
226  WRITE(kluout,*)'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
227  CALL abor1_sfx('PUT_SFX_SEA: SST from ocean model not define or not physic')
228 ENDIF
229 !
230 ycomment='Water-ice Temperature'
231  CALL pack_same_rank(u%NR_WATER(:),pseaice_sit(:),w%XTICE(:))
232  CALL check_sea(ycomment,w%XTICE(:))
233 !
234 ycomment='Water-ice cover'
235  CALL pack_same_rank(u%NR_WATER(:),pseaice_cvr(:),zice_frac(:))
236  CALL check_sea(ycomment,zice_frac(:))
237 !
238 WHERE(zice_frac(:)>=xicec)
239  w%XTS(:) = min(w%XTS(:),xtt-0.01)
240 ELSEWHERE
241  w%XTS(:) = max(w%XTS(:),xtt)
242 ENDWHERE
243 !
244 ycomment='Water-ice albedo'
245  CALL pack_same_rank(u%NR_WATER(:),pseaice_alb(:),w%XICE_ALB(:))
246  CALL check_sea(ycomment,w%XICE_ALB(:))
247 !
248 ! Fill the table with sea ice albedo where temperature is lower than the freezing
249 ! point
250 WHERE(w%XTS(:) < xtt)
251  w%XDIR_ALB(:)=w%XICE_ALB(:)
252  w%XSCA_ALB(:)=w%XICE_ALB(:)
253 ENDWHERE
254 !
255 IF (lhook) CALL dr_hook('PUT_SFX_SEA:TREAT_WATER',1,zhook_handle)
256 !
257 END SUBROUTINE treat_water
258 !
259 !-------------------------------------------------------------------------------
260 !
261 SUBROUTINE check_sea(HCOMMENT,PFIELD)
262 !
263 IMPLICIT NONE
264 !
265  CHARACTER(LEN=*), INTENT(IN) :: hcomment
266 REAL, DIMENSION(:), INTENT(IN) :: pfield
267 !
268 REAL(KIND=JPRB) :: zhook_handle
269 !
270 IF (lhook) CALL dr_hook('PUT_SFX_SEA:CHECK_SEA',0,zhook_handle)
271 !
272 IF(any(pfield(:)>=xundef))THEN
273  WRITE(kluout,*)'PUT_SFX_SEA: problem after get '//trim(hcomment)//' from OASIS'
274  WRITE(kluout,*)'PUT_SFX_SEA: some points not defined = ',count(pfield(:)>=xundef)
275  CALL abor1_sfx('PUT_SFX_SEA: problem after get '//trim(hcomment)//' from OASIS')
276 ENDIF
277 !
278 IF (lhook) CALL dr_hook('PUT_SFX_SEA:CHECK_SEA',1,zhook_handle)
279 !
280 END SUBROUTINE check_sea
281 !
282 !-------------------------------------------------------------------------------
283 !
284 END SUBROUTINE put_sfx_sea
subroutine treat_water(KLU)
subroutine treat_sea(KLU)
subroutine put_sfx_sea(S, U, W, KLUOUT, OCPL_SEAICE, OWATER, PSEA_SST, PSEA_UCU, PSEA_VCU, PSEAICE_SIT, PSEAICE_CVR, PSEAICE_ALB)
Definition: put_sfx_sea.F90:6
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:6
subroutine check_sea(HCOMMENT, PFIELD)