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