SURFEX v8.1
General documentation of Surfex
diag_townn.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 diag_town_n (DLO, DL, DLC, TD, HTOWN, HPROGRAM, DUP, DUPC, KMASK )
7 ! ######################################################################
8 !
9 !!**** *DIAG_TOWN_n * - Chooses the surface schemes for town diagnostics
10 !!
11 !! PURPOSE
12 !! -------
13 !
14 !!** METHOD
15 !! ------
16 !!
17 !! REFERENCE
18 !! ---------
19 !!
20 !!
21 !! AUTHOR
22 !! ------
23 !! V. Masson
24 !!
25 !! MODIFICATIONS
26 !! -------------
27 !! Original 01/2004
28 !! Modified 01/2006 : sea flux parameterization.
29 !! Modified 08/2009 : new diag
30 !! Modified 09/2012 : new PLEI diag required by atmospheric model
31 ! B. decharme 04/2013 : Add EVAP and SUBL diag
32 !!------------------------------------------------------------------
33 !
34 USE mode_diag
35 !
37 USE modd_surfex_n, ONLY : teb_diag_t
38 !
39 USE modd_surf_par, ONLY : xundef
40 USE modd_csts, ONLY : xtt, xlstt, xlvtt
41 !
42 USE yomhook ,ONLY : lhook, dr_hook
43 USE parkind1 ,ONLY : jprb
44 !
45 IMPLICIT NONE
46 !
47 !* 0.1 declarations of arguments
48 !
49 !
50 TYPE(diag_options_t), INTENT(INOUT) :: DLO
51 TYPE(diag_t), INTENT(INOUT) :: DL
52 TYPE(diag_t), INTENT(INOUT) :: DLC
53 TYPE(teb_diag_t), INTENT(INOUT) :: TD
54 !
55  CHARACTER(LEN=*), INTENT(IN) :: HTOWN
56  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
57 !
58 TYPE(diag_t), INTENT(INOUT) :: DUP
59 TYPE(diag_t), INTENT(INOUT) :: DUPC
60 !
61 INTEGER, DIMENSION(:), INTENT(IN) :: KMASK
62 !
63 !* 0.2 declarations of local variables
64 !
65 REAL, DIMENSION(SIZE(DUP%XRN)) :: ZDELTA
66 !
67 REAL(KIND=JPRB) :: ZHOOK_HANDLE
68 !-------------------------------------------------------------------------------------
69 !
70 IF (lhook) CALL dr_hook('DIAG_TOWN_N',0,zhook_handle)
71 IF (htown=='TEB ') THEN
72 
73  CALL diag(td%O, td%D, hprogram, dup, kmask)
74 !
75 !!!!! important, diagd should be computed in teb !!!!!!
76 !
77 ! diag not yet inplemeted for TEB (these diag are required for the climate model)
78 !
79 ! Ok with atmospheric model but LEI (latent heat of sublimation w/m2), EVAP (total evapotranspiration kg/m2/s),
80 ! and SUBL (sublimation kg/m2/s) must by implemented in TEB as well as theirs cumulative values
81 ! Not good if LCPL_ARP = TRUE in ISBA (ALARO)
82 !
83  IF (SIZE(dup%XLEI)>0) THEN
84  dup%XLEI (:) = xundef
85  dup%XEVAP(:) = xundef
86  dup%XSUBL(:) = xundef
87  WHERE(dup%XLE(:)/=xundef)
88  zdelta(:) = max(0.0,sign(1.0,xtt-dup%XTS(:)))
89  dup%XEVAP (:) = (dup%XLE(:) * zdelta(:))/xlstt + (dup%XLE(:) * (1.0-zdelta(:)))/xlvtt
90  dup%XLEI (:) = dup%XLE(:) * zdelta(:)
91  dup%XSUBL (:) = dup%XLEI(:)/xlstt
92  ENDWHERE
93  ENDIF
94 !
95  IF (td%O%LSURF_BUDGETC) THEN
96  CALL init_surf_bud(dupc,xundef)
97  dupc%XEVAP = xundef
98  dupc%XSUBL = xundef
99  ENDIF
100 !
101 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
102 !
103 ELSE IF (htown=='FLUX ') THEN
104  CALL diag_evap(dlo, dl, dlc, hprogram, dup, dupc, kmask)
105 ELSE IF (htown=='NONE ') THEN
106  CALL init_bud(td%O, dup, dupc, xundef)
107 END IF
108 IF (lhook) CALL dr_hook('DIAG_TOWN_N',1,zhook_handle)
109 !
110 !-------------------------------------------------------------------------------------
111 !
112 END SUBROUTINE diag_town_n
subroutine init_surf_bud(DA, PVAL)
Definition: mode_diag.F90:213
subroutine init_bud(DGO, DA, DAC, PVAL)
Definition: mode_diag.F90:185
real, save xlvtt
Definition: modd_csts.F90:70
real, save xlstt
Definition: modd_csts.F90:71
subroutine diag(DGO, DA, HPROGRAM, DAUP, KMASK)
Definition: mode_diag.F90:363
real, parameter xundef
integer, parameter jprb
Definition: parkind1.F90:32
subroutine diag_evap(DGO, DA, DAC, HPROGRAM, DAUP, DAUPC, KMASK)
Definition: mode_diag.F90:288
logical lhook
Definition: yomhook.F90:15
real, save xtt
Definition: modd_csts.F90:66
subroutine diag_town_n(DLO, DL, DLC, TD, HTOWN, HPROGRAM, DUP, DUPC, KMASK)
Definition: diag_townn.F90:7