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