SURFEX v8.1
General documentation of Surfex
init_ideal_flux.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_ideal_flux (DGO, D, DC, OREAD_BUDGETC, &
7  HPROGRAM,HINIT,KI,KSV,KSW, &
8  HSV,PDIR_ALB,PSCA_ALB, &
9  PEMIS,PTSRAD,PTSURF, HTEST )
10 ! ############################################################
11 !
12 !!**** *INIT_IDEAL_FLUX * - Prescription of the surface fluxes for the temperature,
13 !! vapor, horizontal components of the wind and the scalar variables.
14 !!
15 !! PURPOSE
16 !! -------
17 ! Give prescribed values of the surface fluxes for the potential
18 ! temperature, the vapor, the horizontal components of the wind and the
19 ! scalar variables. These fluxes are unsteady when a diurnal cycle
20 ! is taken into account.
21 !
22 !!** METHOD
23 !! ------
24 !!
25 !! EXTERNAL
26 !! --------
27 !!
28 !!
29 !! IMPLICIT ARGUMENTS
30 !! ------------------
31 !!
32 !!
33 !! REFERENCE
34 !! ---------
35 !!
36 !!
37 !! AUTHOR
38 !! ------
39 !! J. Cuxart and J. Stein * Meteo France *
40 !!
41 !! MODIFICATIONS
42 !! -------------
43 !! Original 06/01/95
44 !! V. Masson 02/03 split the routine in two (initialization here, and run)
45 !! R. Honnert 07/10 allows reading of data in namelist
46 !! B. Decharme 04/2013 new coupling variables
47 !! P. Le Moigne 03/2015 add diagnostics IDEAL case
48 !-------------------------------------------------------------------------------
49 !
50 !* 0. DECLARATIONS
51 ! ------------
52 !
53 !
55 !
56 USE modd_ideal_flux, ONLY : xsfts, xalb, xemis
58 USE modd_read_namelist, ONLY : lnam_read
59 
60 USE modi_diag_ideal_init_n
61 USE modi_read_ideal_conf_n
62 USE modi_read_default_ideal_n
63 USE modi_prep_ctrl
64 USE modi_default_diag_ideal
65 USE modi_abor1_sfx
66 USE modi_get_luout
67 !
68 USE yomhook ,ONLY : lhook, dr_hook
69 USE parkind1 ,ONLY : jprb
70 !
71 IMPLICIT NONE
72 !
73 !* 0.1 declarations of arguments
74 !
75 !
76 TYPE(diag_options_t), INTENT(INOUT) :: DGO
77 TYPE(diag_t), INTENT(INOUT) :: D
78 TYPE(diag_t), INTENT(INOUT) :: DC
79 !
80 LOGICAL, INTENT(IN) :: OREAD_BUDGETC
81 !
82  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
83  CHARACTER(LEN=3), INTENT(IN) :: HINIT ! choice of fields to initialize
84 INTEGER, INTENT(IN) :: KI ! number of points
85 INTEGER, INTENT(IN) :: KSV ! number of scalars
86 INTEGER, INTENT(IN) :: KSW ! number of short-wave spectral bands
87  CHARACTER(LEN=6), DIMENSION(KSV), INTENT(IN) :: HSV ! name of all scalar variables
88 REAL, DIMENSION(KI,KSW),INTENT(OUT) :: PDIR_ALB ! direct albedo for each band
89 REAL, DIMENSION(KI,KSW),INTENT(OUT) :: PSCA_ALB ! diffuse albedo for each band
90 REAL, DIMENSION(KI), INTENT(OUT) :: PEMIS ! emissivity
91 REAL, DIMENSION(KI), INTENT(OUT) :: PTSRAD ! radiative temperature
92 REAL, DIMENSION(KI), INTENT(OUT) :: PTSURF ! surface effective temperature (K)
93 !
94  CHARACTER(LEN=2), INTENT(IN) :: HTEST ! must be equal to 'OK'
95 !
96 !* 0.2 declarations of local variables
97 !
98 INTEGER :: ISV ! number of scalar variables
99 INTEGER :: ILUOUT ! unit of output listing fie
100 REAL(KIND=JPRB) :: ZHOOK_HANDLE
101 !
102 !-------------------------------------------------------------------------------
103 !
104 ! Initialisation for IO
105 !
106 IF (lhook) CALL dr_hook('INIT_IDEAL_FLUX',0,zhook_handle)
107  CALL get_luout(hprogram,iluout)
108 !
109 !----------------------------------------------------------------------------------
110 IF (htest/='OK') THEN
111  CALL abor1_sfx('INIT_IDEAL_FLUX: FATAL ERROR DURING ARGUMENT TRANSFER')
112 END IF
113 !
114 !----------------------------------------------------------------------------------
115 IF (lnam_read) THEN
116  !
117  !* 0.1 defaults
118  ! --------
119  !
120  CALL default_diag_ideal(dgo%N2M, dgo%LSURF_BUDGET, dgo%L2M_MIN_ZS, dgo%LRAD_BUDGET,&
121  dgo%LCOEF, dgo%LSURF_VARS, dgo%LSURF_BUDGETC, &
122  dgo%LRESET_BUDGETC,dgo%XDIAG_TSTEP )
123 
124 ENDIF
125 !----------------------------------------------------------------------------------
126 !
127 !* 0.2 configuration
128 ! -------------
129 !
130  CALL read_default_ideal_n(dgo, hprogram)
131  CALL read_ideal_conf_n(dgo, hprogram)
132 !
133 IF (.NOT.ALLOCATED(xtimef_f)) THEN
134 
135  ALLOCATE(xtimef_f(nforcf+1))
136  ALLOCATE(xsfth_f(nforcf+1))
137  ALLOCATE(xsftq_f(nforcf+1))
138  ALLOCATE(xsfco2_f(nforcf+1))
139  IF (custartype=='USTAR') ALLOCATE(xustar_f(nforcf+1))
140 !
141  ALLOCATE(xtimet_t(nforct+1))
142  ALLOCATE(xtsrad_t(nforct+1))
143 !
144  xtimef_f(1:nforcf) = xtimef(1:nforcf)
145  xsfth_f(1:nforcf) = xsfth(1:nforcf)
146  xsftq_f(1:nforcf) = xsftq(1:nforcf)
147  xsfco2_f(1:nforcf) = xsfco2(1:nforcf)
148  IF (custartype=='USTAR') xustar_f(1:nforcf) = xustar(1:nforcf)
149 !
150  xtimet_t(1:nforct) = xtimet(1:nforct)
151  xtsrad_t(1:nforct) = xtsrad(1:nforct)
152 !
153  xtimef_f(nforcf+1) = xtimef_f(nforcf)+1
154  xsfth_f(nforcf+1) = xsfth_f(nforcf)
155  xsftq_f(nforcf+1) = xsftq_f(nforcf)
156  xsfco2_f(nforcf+1) = xsfco2_f(nforcf)
157  IF (custartype=='USTAR') xustar_f(nforcf+1) = xustar_f(nforcf)
158 !
159  xtimet_t(nforct+1) = xtimet(nforct)+1
160  xtsrad_t(nforct+1) = xtsrad(nforct)
161 !
162 !----------------------------------------------------------------------------------
163 !
164 !* 0.3 control
165 ! -------
166 !
167  IF (hinit=='PRE') THEN
168  CALL prep_ctrl(dgo,iluout)
169  ENDIF
170 !
171 !----------------------------------------------------------------------------------
172 !i
173 !* 3. HOURLY surface scalar mixing ratio fluxes (NFORCF+1 values per scalar from 00UTC to 24UTC)
174 ! -----------------------------------------
175 !
176  isv = SIZE(hsv)
177 !
178  IF(.NOT. ALLOCATED (xsfts) )ALLOCATE(xsfts(nforcf+1,isv))
179 !
180 !* unit: kg/m2/s
181 !
182  xsfts = 0.
183 !
184  CALL diag_ideal_init_n(dgo, d, dc, hprogram, oread_budgetc, ki, ksw)
185 !
186 ENDIF
187 !-------------------------------------------------------------------------------
188 !
189 !* 8. Radiative outputs
190 ! -----------------
191 !
192 ptsrad = xtsrad_t(1)
193 !
194 pdir_alb = xalb
195 psca_alb = xalb
196 pemis = xemis
197 !
198 ptsurf = ptsrad
199 !
200 !-------------------------------------------------------------------------------
201 !
202 !* 9. Fluxes as diagnostics
203 ! ---------------------
204 !
205 IF (lhook) CALL dr_hook('INIT_IDEAL_FLUX',1,zhook_handle)
206 !
207 !-------------------------------------------------------------------------------
208 !
209 END SUBROUTINE init_ideal_flux
subroutine read_default_ideal_n(DGO, HPROGRAM)
real, dimension(:,:), allocatable xsfts
real, dimension(nforc_max) xsftq
subroutine prep_ctrl(DGO, KLUOUT)
Definition: prep_ctrl.F90:7
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:7
subroutine init_ideal_flux(DGO, D, DC, OREAD_BUDGETC, HPROGRAM, HINIT, KI, KSV, KSW, HSV, PDIR_ALB, PSCA_ALB, PEMIS, PTSRAD, PTSURF, HTEST)
integer, parameter jprb
Definition: parkind1.F90:32
subroutine read_ideal_conf_n(DGO, HPROGRAM)
real, dimension(nforc_max) xtsrad
subroutine diag_ideal_init_n(DGO, D, DC, HPROGRAM, OREAD_BUDGETC,
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:7
logical lhook
Definition: yomhook.F90:15
real, dimension(nforc_max) xtimef
real, dimension(nforc_max) xustar
subroutine default_diag_ideal(K2M, OSURF_BUDGET, O2M_MIN_ZS, ORAD_BUD
real, dimension(nforc_max) xsfco2
real, dimension(nforc_max) xsfth
real, dimension(nforc_max) xtimet