SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
write_tebn.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 write_teb_n (DTCO, DGU, U, TM, GDM, GRM, &
7  hprogram,hwrite)
8 ! ####################################
9 !
10 !!**** *WRITE_TEB_n* - routine to write surface variables in their respective files
11 !!
12 !! PURPOSE
13 !! -------
14 !!
15 !!** METHOD
16 !! ------
17 !!
18 !! EXTERNAL
19 !! --------
20 !!
21 !!
22 !! IMPLICIT ARGUMENTS
23 !! ------------------
24 !!
25 !! REFERENCE
26 !! ---------
27 !!
28 !!
29 !! AUTHOR
30 !! ------
31 !! V. Masson *Meteo France*
32 !!
33 !! MODIFICATIONS
34 !! -------------
35 !! Original 01/2003
36 !! B. Decharme 07/2011 : Suppress pgd output
37 !-------------------------------------------------------------------------------
38 !
39 !* 0. DECLARATIONS
40 ! ------------
41 !
42 !
45 USE modd_surf_atm_n, ONLY : surf_atm_t
46 USE modd_surfex_n, ONLY : teb_model_t
49 !
50 USE modd_write_surf_atm, ONLY : lnowrite_canopy
51 !
52 USE modi_init_io_surf_n
53 USE modi_writesurf_teb_n
54 USE modi_writesurf_teb_conf_n
55 USE modi_end_io_surf_n
56 USE modi_writesurf_teb_canopy_n
57 USE modi_goto_wrapper_teb_patch
58 !
59 USE yomhook ,ONLY : lhook, dr_hook
60 USE parkind1 ,ONLY : jprb
61 !
62 IMPLICIT NONE
63 !
64 !* 0.1 Declarations of arguments
65 ! -------------------------
66 !
67 !
68 TYPE(data_cover_t), INTENT(INOUT) :: dtco
69 TYPE(diag_surf_atm_t), INTENT(INOUT) :: dgu
70 TYPE(surf_atm_t), INTENT(INOUT) :: u
71 TYPE(teb_model_t), INTENT(INOUT) :: tm
72 TYPE(teb_garden_model_t), INTENT(INOUT) :: gdm
73 TYPE(teb_greenroof_model_t), INTENT(INOUT) :: grm
74 !
75  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
76  CHARACTER(LEN=3), INTENT(IN) :: hwrite ! 'PREP' : does not write SBL XUNDEF fields
77 ! ! 'ALL' : all fields are written
78 !* 0.2 Declarations of local variables
79 ! -------------------------------
80 !
81 INTEGER :: jpatch
82 REAL(KIND=JPRB) :: zhook_handle
83 !-------------------------------------------------------------------------------
84 !
85 !
86 ! Initialisation for IO
87 !
88 IF (lhook) CALL dr_hook('WRITE_TEB_N',0,zhook_handle)
89  CALL init_io_surf_n(dtco, dgu, u, &
90  hprogram,'TOWN ','TEB ','WRITE')
91 !
92 !* 1. Selection of surface scheme
93 ! ---------------------------
94 !
95  CALL writesurf_teb_conf_n(tm%CHT, tm%DGMTO, tm%DGT, tm%DGUT, tm%T, tm%TOP, &
96  hprogram)
97 !
98 DO jpatch=1,tm%TOP%NTEB_PATCH
99  CALL goto_wrapper_teb_patch(tm%B, tm%DGCT, tm%DGMT, tm%T, &
100  gdm%TGD, gdm%TGDPE, grm%TGR, grm%TGRPE, jpatch)
101  CALL writesurf_teb_n(dgu, u, tm, gdm, grm, &
102  hprogram,jpatch,hwrite)
103 END DO
104 !
105  CALL goto_wrapper_teb_patch(tm%B, tm%DGCT, tm%DGMT, tm%T, &
106  gdm%TGD, gdm%TGDPE, grm%TGR, grm%TGRPE, 1)
107 IF ((.NOT.lnowrite_canopy).OR.dgu%LSELECT) CALL writesurf_teb_canopy_n(dgu, u, &
108  tm%TCP, tm%TOP, &
109  hprogram,hwrite)
110 !
111 !-------------------------------------------------------------------------------
112 !
113 ! End of IO
114 !
115  CALL end_io_surf_n(hprogram)
116 IF (lhook) CALL dr_hook('WRITE_TEB_N',1,zhook_handle)
117 !
118 END SUBROUTINE write_teb_n
subroutine init_io_surf_n(DTCO, DGU, U, HPROGRAM, HMASK, HSCHEME, HACTION)
subroutine writesurf_teb_conf_n(CHT, DGMTO, DGT, DGUT, T, TOP, HPROGRAM)
subroutine goto_wrapper_teb_patch(B, DGCT, DGMT, T, TGD, TGDPE, TGR, TGRPE, KTO_PATCH)
subroutine end_io_surf_n(HPROGRAM)
Definition: end_io_surfn.F90:6
subroutine writesurf_teb_n(DGU, U, TM, GDM, GRM, HPROGRAM, KPATCH, HWRITE)
subroutine write_teb_n(DTCO, DGU, U, TM, GDM, GRM, HPROGRAM, HWRITE)
Definition: write_tebn.F90:6
subroutine writesurf_teb_canopy_n(DGU, U, TCP, TOP, HPROGRAM, HWRITE)