SURFEX v8.1
General documentation of Surfex
init_seafluxn.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 init_seaflux_n (DTCO, OREAD_BUDGETC, UG, U, GCP, SM, &
7  HPROGRAM,HINIT,KI,KSV,KSW, &
8  HSV,PCO2,PRHOA,PZENITH,PAZIM,PSW_BANDS, &
9  PDIR_ALB,PSCA_ALB, PEMIS,PTSRAD,PTSURF, &
10  KYEAR, KMONTH,KDAY,PTIME, &
11  HATMFILE,HATMFILETYPE,HTEST )
12 ! #############################################################
13 !
14 !!**** *INIT_SEAFLUX_n* - routine to initialize SEAFLUX
15 !!
16 !! PURPOSE
17 !! -------
18 !!
19 !!** METHOD
20 !! ------
21 !!
22 !! EXTERNAL
23 !! --------
24 !!
25 !!
26 !! IMPLICIT ARGUMENTS
27 !! ------------------
28 !!
29 !! REFERENCE
30 !! ---------
31 !!
32 !!
33 !! AUTHOR
34 !! ------
35 !! V. Masson *Meteo France*
36 !!
37 !! MODIFICATIONS
38 !! -------------
39 !! Original 01/2003
40 !! Modified 01/2006 : sea flux parameterization.
41 !! 01/2008 : coupling with 1D ocean
42 !! B. Decharme 08/2009 : specific treatment for sea/ice in the Earth System Model
43 !! B. Decharme 07/2011 : read pgd+prep
44 !! B. Decharme 04/2013 : new coupling variables
45 !! S. Senesi 01/2014 : introduce sea-ice model
46 !! S. Belamari 03/2014 : add NZ0 (to choose PZ0SEA formulation)
47 !! R. Séférian 01/2015 : introduce interactive ocean surface albedo
48 !-------------------------------------------------------------------------------
49 !
50 !* 0. DECLARATIONS
51 ! ------------
52 !
54 !
57 USE modd_surf_atm_n, ONLY : surf_atm_t
59 !
61 !
62 USE modd_read_namelist, ONLY : lnam_read
63 USE modd_csts, ONLY : xtts
64 USE modd_snow_par, ONLY : xz0hsn
65 USE modd_surf_par, ONLY : xundef, nundef
69 !
70 USE modi_init_io_surf_n
71 USE modi_default_ch_dep
72 !
73 USE modi_default_seaflux
74 USE modi_default_diag_seaflux
75 USE modi_read_default_seaflux_n
76 USE modi_read_seaflux_conf_n
77 USE modi_read_seaflux_n
78 !
79 USE modi_read_ocean_n
80 !
81 USE modi_default_seaice
82 USE modi_read_seaice_n
83 !
84 USE modi_read_pgd_seaflux_n
85 USE modi_diag_seaflux_init_n
86 USE modi_diag_seaice_init_n
87 USE modi_end_io_surf_n
88 USE modi_get_luout
90 USE modi_read_seaflux_date
91 USE modi_read_nam_prep_seaflux_n
92 USE modi_init_chemical_n
93 USE modi_prep_ctrl_seaflux
94 USE modi_update_rad_sea
95 USE modi_read_sbl_n
96 USE modi_abor1_sfx
97 !
98 USE modi_set_surfex_filein
99 !
100 USE yomhook ,ONLY : lhook, dr_hook
101 USE parkind1 ,ONLY : jprb
102 !
103 !
104 IMPLICIT NONE
105 !
106 !* 0.1 Declarations of arguments
107 ! -------------------------
108 !
109 !
110 TYPE(data_cover_t), INTENT(INOUT) :: DTCO
111 TYPE(surf_atm_grid_t), INTENT(INOUT) :: UG
112 TYPE(surf_atm_t), INTENT(INOUT) :: U
113 TYPE(grid_conf_proj_t),INTENT(INOUT) :: GCP
114 TYPE(seaflux_model_t), INTENT(INOUT) :: SM
115 !
116 LOGICAL, INTENT(IN) :: OREAD_BUDGETC
117 !
118  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
119  CHARACTER(LEN=3), INTENT(IN) :: HINIT ! choice of fields to initialize
120 INTEGER, INTENT(IN) :: KI ! number of points
121 INTEGER, INTENT(IN) :: KSV ! number of scalars
122 INTEGER, INTENT(IN) :: KSW ! number of short-wave spectral bands
123  CHARACTER(LEN=6), DIMENSION(KSV), INTENT(IN) :: HSV ! name of all scalar variables
124 REAL, DIMENSION(KI), INTENT(IN) :: PCO2 ! CO2 concentration (kg/m3)
125 REAL, DIMENSION(KI), INTENT(IN) :: PRHOA ! air density
126 REAL, DIMENSION(KI), INTENT(IN) :: PZENITH ! solar zenithal angle
127 REAL, DIMENSION(KI), INTENT(IN) :: PAZIM ! solar azimuthal angle (rad from N, clock)
128 REAL, DIMENSION(KSW), INTENT(IN) :: PSW_BANDS ! middle wavelength of each band
129 REAL, DIMENSION(KI,KSW),INTENT(OUT) :: PDIR_ALB ! direct albedo for each band
130 REAL, DIMENSION(KI,KSW),INTENT(OUT) :: PSCA_ALB ! diffuse albedo for each band
131 REAL, DIMENSION(KI), INTENT(OUT) :: PEMIS ! emissivity
132 REAL, DIMENSION(KI), INTENT(OUT) :: PTSRAD ! radiative temperature
133 REAL, DIMENSION(KI), INTENT(OUT) :: PTSURF ! surface effective temperature (K)
134 INTEGER, INTENT(IN) :: KYEAR ! current year (UTC)
135 INTEGER, INTENT(IN) :: KMONTH ! current month (UTC)
136 INTEGER, INTENT(IN) :: KDAY ! current day (UTC)
137 REAL, INTENT(IN) :: PTIME ! current time since
138  ! midnight (UTC, s)
139 !
140  CHARACTER(LEN=28), INTENT(IN) :: HATMFILE ! atmospheric file name
141  CHARACTER(LEN=6), INTENT(IN) :: HATMFILETYPE! atmospheric file type
142  CHARACTER(LEN=2), INTENT(IN) :: HTEST ! must be equal to 'OK'
143 !
144 !
145 !* 0.2 Declarations of local variables
146 ! -------------------------------
147 !
148 INTEGER :: ILU ! sizes of SEAFLUX arrays
149 INTEGER :: ILUOUT ! unit of output listing file
150 INTEGER :: IRESP ! return code
151 REAL(KIND=JPRB) :: ZHOOK_HANDLE
152 !
153 !-------------------------------------------------------------------------------
154 !
155 ! Initialisation for IO
156 !
157 IF (lhook) CALL dr_hook('INIT_SEAFLUX_N',0,zhook_handle)
158 !
159  CALL get_luout(hprogram,iluout)
160 !
161 IF (htest/='OK') THEN
162  CALL abor1_sfx('INIT_SEAFLUXN: FATAL ERROR DURING ARGUMENT TRANSFER')
163 END IF
164 !
165 !
166 ! Others litlle things
167 !
168 pdir_alb = xundef
169 psca_alb = xundef
170 pemis = xundef
171 ptsrad = xundef
172 ptsurf = xundef
173 !
174 sm%O%LMERCATOR = .false.
175 sm%O%LCURRENT = .false.
176 !
177 IF (lnam_read) THEN
178  !
179  !* 0. Defaults
180  ! --------
181  !
182  ! 0.1. Hard defaults
183  !
184 
185  CALL default_seaflux(sm%S%XTSTEP,sm%S%XOUT_TSTEP,sm%S%CSEA_ALB,sm%S%CSEA_FLUX,sm%S%LPWG, &
186  sm%S%LPRECIP,sm%S%LPWEBB,sm%S%NZ0,sm%S%NGRVWAVES,sm%O%LPROGSST, &
187  sm%O%NTIME_COUPLING,sm%O%XOCEAN_TSTEP,sm%S%XICHCE,sm%S%CINTERPOL_SST,&
188  sm%S%CINTERPOL_SSS )
189  CALL default_seaice(hprogram, &
190  sm%S%CINTERPOL_SIC,sm%S%CINTERPOL_SIT, sm%S%XFREEZING_SST, &
191  sm%S%XSEAICE_TSTEP, sm%S%XSIC_EFOLDING_TIME, &
192  sm%S%XSIT_EFOLDING_TIME, sm%S%XCD_ICE_CST, sm%S%XSI_FLX_DRV)
193  !
194  CALL default_ch_dep(sm%CHS%CCH_DRY_DEP)
195  !
196  CALL default_diag_seaflux(sm%SD%O%N2M,sm%SD%O%LSURF_BUDGET,sm%SD%O%L2M_MIN_ZS,&
197  sm%SD%O%LRAD_BUDGET,sm%SD%O%LCOEF,sm%SD%O%LSURF_VARS,&
198  sm%SD%GO%LDIAG_OCEAN,sm%SD%DMI%LDIAG_MISC_SEAICE,&
199  sm%SD%O%LSURF_BUDGETC,sm%SD%O%LRESET_BUDGETC,sm%SD%O%XDIAG_TSTEP )
200 
201 ENDIF
202 !
203 !
204 ! 0.2. Defaults from file header
205 !
206  CALL read_default_seaflux_n(sm%CHS, sm%SD%GO, sm%SD%O, sm%SD%DMI, sm%O, sm%S, hprogram)
207 !
208 !* 1.1 Reading of configuration:
209 ! -------------------------
210 !
211  CALL read_seaflux_conf_n(sm%CHS, sm%SD%GO, sm%SD%O, sm%SD%DMI, sm%O, sm%S, hprogram)
212 !
213 sm%S%LINTERPOL_SST=.false.
214 sm%S%LINTERPOL_SSS=.false.
215 sm%S%LINTERPOL_SIC=.false.
216 sm%S%LINTERPOL_SIT=.false.
217 !
218 IF(lcpl_sea)THEN
219  IF(sm%SD%O%N2M<1)THEN
220  CALL abor1_sfx('INIT_SEAFLUX_n: N2M must be set >0 in case of LCPL_SEA')
221  ENDIF
222 ! No STT / SSS interpolation in Earth System Model
223  sm%S%CINTERPOL_SST='NONE '
224  sm%S%CINTERPOL_SSS='NONE '
225  sm%S%CINTERPOL_SIC='NONE '
226  sm%S%CINTERPOL_SIT='NONE '
227 ELSE
228  IF(trim(sm%S%CINTERPOL_SST)/='NONE')THEN
229  sm%S%LINTERPOL_SST=.true.
230  ENDIF
231  IF(trim(sm%S%CINTERPOL_SSS)/='NONE')THEN
232  sm%S%LINTERPOL_SSS=.true.
233  ENDIF
234  IF(trim(sm%S%CINTERPOL_SIC)/='NONE')THEN
235  sm%S%LINTERPOL_SIC=.true.
236  ENDIF
237  IF(trim(sm%S%CINTERPOL_SIT)/='NONE')THEN
238  sm%S%LINTERPOL_SIT=.true.
239  ENDIF
240 ENDIF
241 !
242 !* 1. Cover fields and grid:
243 ! ---------------------
244 !* date
245 !
246 SELECT CASE (hinit)
247 !
248  CASE ('PGD')
249 !
250  sm%S%TTIME%TDATE%YEAR = nundef
251  sm%S%TTIME%TDATE%MONTH= nundef
252  sm%S%TTIME%TDATE%DAY = nundef
253  sm%S%TTIME%TIME = xundef
254 !
255  CASE ('PRE')
256 !
257  CALL prep_ctrl_seaflux(sm%SD%O,sm%SD%GO%LDIAG_OCEAN,sm%SD%DMI%LDIAG_MISC_SEAICE,iluout )
258  IF (lnam_read) CALL read_nam_prep_seaflux_n(hprogram)
259  CALL read_seaflux_date(sm%O%LMERCATOR,hprogram,hinit,iluout,hatmfile,hatmfiletype,&
260  kyear,kmonth,kday,ptime,sm%S%TTIME)
261 !
262  CASE DEFAULT
263 !
264  CALL init_io_surf_n(dtco, u, hprogram,'FULL ','SURF ','READ ')
265  CALL read_surf(hprogram,'DTCUR',sm%S%TTIME,iresp)
266  CALL end_io_surf_n(hprogram)
267 !
268 END SELECT
269 !
270 !-----------------------------------------------------------------------------------------------------
271 ! READ PGD FILE
272 !-----------------------------------------------------------------------------------------------------
273 !
274 ! Initialisation for IO
275 !
276  CALL set_surfex_filein(hprogram,'PGD ') ! change input file name to pgd name
277 !
278  CALL init_io_surf_n(dtco, u, hprogram,'SEA ','SEAFLX','READ ')
279 !
280 ! Reading of the fields
281 !
282  CALL read_pgd_seaflux_n(dtco, sm%DTS, sm%G, sm%S, u, ug, gcp, hprogram)
283 !
284  CALL end_io_surf_n(hprogram)
285 !
286  CALL set_surfex_filein(hprogram,'PREP') ! restore input file name
287 !-------------------------------------------------------------------------------
288 !
289 !* if only physiographic fields are to be initialized, stop here.
290 !
291 IF (hinit/='ALL' .AND. hinit/='SOD') THEN
292  IF (lhook) CALL dr_hook('INIT_SEAFLUX_N',1,zhook_handle)
293  RETURN
294 END IF
295 !
296 !-------------------------------------------------------------------------------
297 !
298 ! Initialisation for IO
299 !
300  CALL init_io_surf_n(dtco, u, hprogram,'SEA ','SEAFLX','READ ')
301 !
302 !* 2. Prognostic fields:
303 ! ----------------
304 !
305 IF(sm%S%LINTERPOL_SST.OR.sm%S%LINTERPOL_SSS.OR.sm%S%LINTERPOL_SIC.OR.sm%S%LINTERPOL_SIT)THEN
306 ! Initialize current Month for SST interpolation
307  sm%S%TZTIME%TDATE%YEAR = sm%S%TTIME%TDATE%YEAR
308  sm%S%TZTIME%TDATE%MONTH = sm%S%TTIME%TDATE%MONTH
309  sm%S%TZTIME%TDATE%DAY = sm%S%TTIME%TDATE%DAY
310  sm%S%TZTIME%TIME = sm%S%TTIME%TIME
311 ENDIF
312 !
313  CALL read_seaflux_n(dtco, sm%G, sm%S, u, hprogram,iluout)
314 !
315 IF (hinit/='ALL') THEN
316  CALL end_io_surf_n(hprogram)
317  IF (lhook) CALL dr_hook('INIT_SEAFLUX_N',1,zhook_handle)
318  RETURN
319 END IF
320 !-------------------------------------------------------------------------------
321 !
322 !* 2.1 Ocean fields:
323 ! -------------
324 !
325  CALL read_ocean_n(dtco, sm%O, sm%OR, u, hprogram)
326 !
327 !-------------------------------------------------------------------------------
328 !
329 ilu = SIZE(sm%S%XCOVER,1)
330 !
331 ALLOCATE(sm%S%XSST_INI (ilu))
332 sm%S%XSST_INI(:) = sm%S%XSST(:)
333 !
334 ALLOCATE(sm%S%XZ0H(ilu))
335 WHERE (sm%S%XSST(:)>=xtts)
336  sm%S%XZ0H(:) = sm%S%XZ0(:)
337 ELSEWHERE
338  sm%S%XZ0H(:) = xz0hsn
339 ENDWHERE
340 !
341 !-------------------------------------------------------------------------------
342 !
343 !* 3. Specific fields when using earth system model or sea-ice scheme
344 ! (Sea current and Sea-ice temperature)
345 ! -----------------------------------------------------------------
346 !
347 IF(lcpl_sea.OR.sm%S%LHANDLE_SIC)THEN
348 !
349  ALLOCATE(sm%S%XUMER (ilu))
350  ALLOCATE(sm%S%XVMER (ilu))
351 !
352  sm%S%XUMER (:)=xundef
353  sm%S%XVMER (:)=xundef
354 !
355 ELSE
356 !
357  ALLOCATE(sm%S%XUMER (0))
358  ALLOCATE(sm%S%XVMER (0))
359 !
360 ENDIF
361 !
362 IF(lcpl_seaice.OR.sm%S%LHANDLE_SIC)THEN
363  ALLOCATE(sm%S%XTICE (ilu))
364  ALLOCATE(sm%S%XICE_ALB(ilu))
365  sm%S%XTICE (:)=xundef
366  sm%S%XICE_ALB(:)=xundef
367 ELSE
368  ALLOCATE(sm%S%XTICE (0))
369  ALLOCATE(sm%S%XICE_ALB(0))
370 ENDIF
371 !
372 !-------------------------------------------------------------------------------
373 !
374 !* 4. Seaice prognostic variables and forcings :
375 !
376  CALL read_seaice_n(sm%G, sm%S, hprogram,ilu,iluout)
377 !
378 !-------------------------------------------------------------------------------
379 !
380 !* 5. Albedo, emissivity and temperature fields on the mix (open sea + sea ice)
381 ! -----------------------------------------------------------------
382 !
383 ALLOCATE(sm%S%XEMIS (ilu))
384 sm%S%XEMIS = 0.0
385 !
386  CALL update_rad_sea(sm%S,pzenith,xtts,pdir_alb,psca_alb,pemis,ptsrad )
387 !
388 IF (sm%S%LHANDLE_SIC) THEN
389  ptsurf(:) = sm%S%XSST(:) * ( 1 - sm%S%XSIC(:)) + sm%S%XTICE(:) * sm%S%XSIC(:)
390 ELSE
391  ptsurf(:) = sm%S%XSST(:)
392 ENDIF
393 !
394 !-------------------------------------------------------------------------------
395 !
396 !* 6. SBL air fields:
397 ! --------------
398 !
399  CALL read_sbl_n(dtco, u, sm%SB, sm%S%LSBL, hprogram, "SEA ")
400 !
401 !-------------------------------------------------------------------------------
402 !
403 !* 7. Chemistry /dust
404 ! ---------
405 !
406  CALL init_chemical_n(iluout, ksv, hsv, sm%CHS%SVS, &
407  sm%CHS%CCH_NAMES, sm%CHS%CAER_NAMES, &
408  hdstnames=sm%CHS%CDSTNAMES, hsltnames=sm%CHS%CSLTNAMES )
409 !
410 !* deposition scheme
411 !
412 IF (sm%CHS%SVS%NBEQ>0 .AND. sm%CHS%CCH_DRY_DEP=='WES89') THEN
413  ALLOCATE(sm%CHS%XDEP(ilu,sm%CHS%SVS%NBEQ))
414 ELSE
415  ALLOCATE(sm%CHS%XDEP(0,0))
416 END IF
417 !
418 !-------------------------------------------------------------------------------
419 !
420 !* 8. diagnostics initialization
421 ! --------------------------
422 !
423 IF(.NOT.(sm%S%LHANDLE_SIC.OR.lcpl_seaice))THEN
424  sm%SD%DMI%LDIAG_MISC_SEAICE=.false.
425 ENDIF
426 !
427  CALL diag_seaflux_init_n(sm%SD%GO, sm%SD%O, sm%SD%D, sm%SD%DC, oread_budgetc, sm%S, &
428  hprogram,ilu,ksw)
429 IF (sm%S%LHANDLE_SIC.OR.lcpl_seaice) &
430  CALL diag_seaice_init_n(sm%SD%O, sm%SD%DI, sm%SD%DIC, sm%SD%DMI, &
431  oread_budgetc, sm%S, hprogram,ilu,ksw)
432 
433 !
434 !-------------------------------------------------------------------------------
435 !
436 ! End of IO
437 !
438  CALL end_io_surf_n(hprogram)
439 IF (lhook) CALL dr_hook('INIT_SEAFLUX_N',1,zhook_handle)
440 !
441 !
442 END SUBROUTINE init_seaflux_n
subroutine init_chemical_n(KLUOUT, KSV, HSV, SV, HCH_NAMES, HAER_NAMES, HDSTNAMES, HSLTNAMES)
subroutine prep_ctrl_seaflux(DGO, ODIAG_OCEAN, ODIAG_MISC_SEAICE, KLU
integer ndst_mdebeg
subroutine default_seaflux(PTSTEP, POUT_TSTEP, HSEA_ALB, HSEA_FLUX,
subroutine read_pgd_seaflux_n(DTCO, DTS, SG, S, U, UG, GCP, HPROG
subroutine diag_seaice_init_n(DGO, DI, DIC, DGMSI, OREAD_BUDGETC,
subroutine read_seaflux_conf_n(CHS, DOC, DGO, DGMSI, O, S, HPROGR
subroutine default_diag_seaflux(K2M, OSURF_BUDGET, O2M_MIN_ZS, ORAD_B
logical lvarsig_dst
subroutine set_surfex_filein(HPROGRAM, HMASK)
subroutine diag_seaflux_init_n(DOC, DGO, D, DC, OREAD_BUDGETC, S,
subroutine read_ocean_n(DTCO, O, OR, U, HPROGRAM)
Definition: read_oceann.F90:7
real, save xtts
Definition: modd_csts.F90:68
subroutine read_sbl_n(DTCO, U, SB, OSBL, HPROGRAM, HSURF)
Definition: read_sbln.F90:7
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:7
real, parameter xundef
subroutine read_seaice_n(G, S, HPROGRAM, KLU, KLUOUT)
Definition: read_seaicen.F90:7
subroutine read_nam_prep_seaflux_n(HPROGRAM)
logical lrgfix_dst
subroutine read_seaflux_n(DTCO, G, S, U, HPROGRAM, KLUOUT)
integer, parameter jprb
Definition: parkind1.F90:32
subroutine default_seaice(HPROGRAM, HINTERPOL_SIC, HINTERPOL_SIT, PFREEZING_SST, PSEAICE_TSTEP, PSIC_EFOLDING_TIME, PSIT_EFOLDING_TIME, PCD_ICE, PSI_FLX_DRV)
subroutine update_rad_sea(S, PZENITH, PTT, PDIR_ALB_ATMOS, PSCA_ALB_ATMOS, PEMIS_ATMOS, PTRAD, PU, PV)
logical lvarsig_slt
integer, parameter nundef
subroutine read_default_seaflux_n(CHS, DOC, DGO, DGMSI, O, S, HPR
subroutine default_ch_dep(HCH_DRY_DEP)
subroutine end_io_surf_n(HPROGRAM)
Definition: end_io_surfn.F90:7
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:7
logical lhook
Definition: yomhook.F90:15
subroutine read_seaflux_date(OMERCATOR, HPROGRAM, HINIT, KLUOUT, HATMFILE, HATMF
integer nslt_mdebeg
logical lrgfix_slt
subroutine init_io_surf_n(DTCO, U, HPROGRAM, HMASK, HSCHEME, HACTION
subroutine init_seaflux_n(DTCO, OREAD_BUDGETC, UG, U, GCP, SM, HPROGRAM, HINIT, KI, KSV, KSW,