SURFEX v8.1
General documentation of Surfex
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, HSELECT, OSNOWDIMNC, U, TM, GDM, GRM, HPROGRAM,HWRITE)
7 ! ####################################
8 !
9 !!**** *WRITE_TEB_n* - routine to write surface variables in their respective files
10 !!
11 !! PURPOSE
12 !! -------
13 !!
14 !!** METHOD
15 !! ------
16 !!
17 !! EXTERNAL
18 !! --------
19 !!
20 !!
21 !! IMPLICIT ARGUMENTS
22 !! ------------------
23 !!
24 !! REFERENCE
25 !! ---------
26 !!
27 !!
28 !! AUTHOR
29 !! ------
30 !! V. Masson *Meteo France*
31 !!
32 !! MODIFICATIONS
33 !! -------------
34 !! Original 01/2003
35 !! B. Decharme 07/2011 : Suppress pgd output
36 !-------------------------------------------------------------------------------
37 !
38 !* 0. DECLARATIONS
39 ! ------------
40 !
41 !
43 USE modd_surf_atm_n, ONLY : surf_atm_t
44 USE modd_surfex_n, ONLY : teb_model_t
47 !
49 !
50 USE modi_end_io_surf_n
51 USE modi_init_io_surf_n
52 USE modi_writesurf_teb_n
53 USE modi_writesurf_teb_conf_n
54 USE modi_writesurf_sbl_n
55 !
56 USE yomhook ,ONLY : lhook, dr_hook
57 USE parkind1 ,ONLY : jprb
58 !
59 IMPLICIT NONE
60 !
61 !* 0.1 Declarations of arguments
62 ! -------------------------
63 !
64 !
65 TYPE(data_cover_t), INTENT(INOUT) :: DTCO
66  CHARACTER(LEN=*), DIMENSION(:), INTENT(IN) :: HSELECT
67 LOGICAL, INTENT(IN) :: OSNOWDIMNC
68 TYPE(surf_atm_t), INTENT(INOUT) :: U
69 TYPE(teb_model_t), INTENT(INOUT) :: TM
70 TYPE(teb_garden_model_t), INTENT(INOUT) :: GDM
71 TYPE(teb_greenroof_model_t), INTENT(INOUT) :: GRM
72 !
73  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
74  CHARACTER(LEN=3), INTENT(IN) :: HWRITE ! 'PREP' : does not write SBL XUNDEF fields
75 ! ! 'ALL' : all fields are written
76 !* 0.2 Declarations of local variables
77 ! -------------------------------
78 !
79 INTEGER :: JP
80 REAL(KIND=JPRB) :: ZHOOK_HANDLE
81 !-------------------------------------------------------------------------------
82 !
83 !
84 ! Initialisation for IO
85 !
86 IF (lhook) CALL dr_hook('WRITE_TEB_N',0,zhook_handle)
87 !
88  CALL init_io_surf_n(dtco, u, hprogram,'TOWN ','TEB ','WRITE','TEB_PROGNOSTIC.OUT.nc')
89 !
90 !* 1. Selection of surface scheme
91 ! ---------------------------
92 !
93  CALL writesurf_teb_conf_n(tm%CHT, tm%TD%MTO, tm%TD%O, tm%TD%DUT, tm%NT%AL(1), tm%TOP,hprogram)
94 !
95 DO jp=1,tm%TOP%NTEB_PATCH
96  CALL writesurf_teb_n(hselect, osnowdimnc, dtco, u, tm%TOP, tm%BOP, tm%NT%AL(jp), tm%NB%AL(jp), &
97  tm%DTT%LDATA_ROAD_DIR, tm%TPN, gdm%O, gdm%S, gdm%NPE%AL(jp), grm%O, grm%S, &
98  grm%NPE%AL(jp), hprogram, jp, hwrite)
99 END DO
100 !
101 IF ((.NOT.lnowrite_canopy).OR.SIZE(hselect)>0) THEN
102  CALL end_io_surf_n(hprogram)
103  CALL init_io_surf_n(dtco, u, hprogram,'TOWN ','TEB ','WRITE','TEB_CANOPY.OUT.nc')
104  CALL writesurf_sbl_n(hselect, tm%TOP%LCANOPY, tm%SB, hprogram, hwrite, "TOWN ")
105 ENDIF
106 !
107 !-------------------------------------------------------------------------------
108 !
109 ! End of IO
110 !
111  CALL end_io_surf_n(hprogram)
112 IF (lhook) CALL dr_hook('WRITE_TEB_N',1,zhook_handle)
113 !
114 END SUBROUTINE write_teb_n
subroutine writesurf_teb_n(HSELECT, OSNOWDIMNC, DTCO, U, TOP, BOP
integer, parameter jprb
Definition: parkind1.F90:32
subroutine end_io_surf_n(HPROGRAM)
Definition: end_io_surfn.F90:7
subroutine writesurf_teb_conf_n(CHT, DMTO, DGO, DUT, T, TOP, HPRO
logical lhook
Definition: yomhook.F90:15
subroutine writesurf_sbl_n(HSELECT, OSBL, SB, HPROGRAM, HWRITE, H
subroutine init_io_surf_n(DTCO, U, HPROGRAM, HMASK, HSCHEME, HACTION
subroutine write_teb_n(DTCO, HSELECT, OSNOWDIMNC, U, TM, GDM, GRM
Definition: write_tebn.F90:7