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