SURFEX v8.1
General documentation of Surfex
rout_data_isba.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 ! #####################
7  SUBROUTINE rout_data_isba (DEC, DC, DMI, PMESH_SIZE, IO, NP, NPE, UG, U, HPROGRAM,KI,KSTEP)
8 ! #####################
9 !
10 !!**** *ROUT_DATA_ISBA*
11 !!
12 !! PURPOSE
13 !! -------
14 !
15 ! Routes runoff and drainage of ISBA with coupling with Topmodel
16 !
17 !
18 !!** METHOD
19 !! ------
20 !
21 !! EXTERNAL
22 !! --------
23 !!
24 !! none
25 !!
26 !! IMPLICIT ARGUMENTS
27 !! ------------------
28 !!
29 !!
30 !!
31 !!
32 !!
33 !! REFERENCE
34 !! ---------
35 !!
36 !!
37 !!
38 !! AUTHOR
39 !! ------
40 !!
41 !! B. Vincendon * Meteo-France *
42 !!
43 !! MODIFICATIONS
44 !! -------------
45 !!
46 !! Original 15/06/2007
47 !! 03/2014 (B. Vincendon) call of initialisation for budget on watersheds
48 !-------------------------------------------------------------------------------
49 !
50 !* 0. DECLARATIONS
51 ! ------------
52 !
53 !
54 !
55 USE modd_diag_n, ONLY : diag_t
59 USE modd_isba_n, ONLY : isba_np_t, isba_npe_t
61 USE modd_surf_atm_n, ONLY : surf_atm_t
62 !
63 USE modi_get_luout
65 USE modi_diag_isba_to_rout
66 USE modi_isba_to_topd
67 USE modi_init_budget_coupl_rout
68 USE modi_routing
69 !
70 USE modd_topodyn, ONLY : nncat, nmesht, nnmc
73 !
74 USE modd_surf_par, ONLY : xundef
75 !
76 USE yomhook ,ONLY : lhook, dr_hook
77 USE parkind1 ,ONLY : jprb
78 !
79 IMPLICIT NONE
80 !
81 !* 0.1 declarations of arguments
82 !
83 !
84 TYPE(diag_evap_isba_t), INTENT(INOUT) :: DEC
85 TYPE(diag_t), INTENT(INOUT) :: DC
86 TYPE(diag_misc_isba_t), INTENT(INOUT) :: DMI
87 REAL, DIMENSION(:), INTENT(IN) :: PMESH_SIZE
88 TYPE(isba_options_t), INTENT(INOUT) :: IO
89 TYPE(isba_np_t), INTENT(INOUT) :: NP
90 TYPE(isba_npe_t), INTENt(INOUT) :: NPE
91 TYPE(surf_atm_grid_t), INTENT(INOUT) :: UG
92 TYPE(surf_atm_t), INTENT(INOUT) :: U
93 !
94  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! program calling surf. schemes
95 INTEGER, INTENT(IN) :: KI ! Grid dimensions
96 INTEGER, INTENT(IN) :: KSTEP ! current time step
97 !
98 !* 0.2 declarations of local variables
99 !
100 INTEGER :: JJ,JI ! loop control
101 INTEGER :: ILUOUT ! unit number of listing file
102  CHARACTER(LEN=30) :: YVAR
103 REAL, DIMENSION(KI) :: ZRUNOFFC_FULL ! Cumulated runoff from isba on the full domain (kg/m2)
104 REAL, DIMENSION(KI) :: ZRUNOFFC_FULLM ! Cumulated runoff from isba on the full domain (kg/m2) at t-dt
105 REAL, DIMENSION(KI) :: ZRUNOFF_ISBA ! Runoff from Isba (kg/m2)
106 REAL, DIMENSION(KI) :: ZDRAINC_FULL ! Cumulated drainage from Isba on the full domain (kg/m2)
107 REAL, DIMENSION(KI) :: ZDRAINC_FULLM ! Cumulated drainage from Isba on the full domain (kg/m2) at t-dt
108 REAL, DIMENSION(KI) :: ZDRAIN_ISBA ! Drainage from Isba (m3/s)
109 REAL, DIMENSION(NNCAT,NMESHT) :: ZRUNOFF_TOPD ! Runoff on the Topodyn grid (m3/s)
110 REAL, DIMENSION(NNCAT,NMESHT) :: ZDRAIN_TOPD ! Drainage from Isba on Topodyn grid (m3/s)
111 REAL(KIND=JPRB) :: ZHOOK_HANDLE
112 !-------------------------------------------------------------------------------
113 IF (lhook) CALL dr_hook('ROUT_DATA_ISBA',0,zhook_handle)
114 !
115  CALL get_luout(hprogram,iluout)
116 !
117 zrunoffc_full(:) = 0.
118 zrunoffc_fullm(:) = 0.
119 zrunoff_isba(:) = 0.
120 zrunoff_topd(:,:) = 0.
121 zdrainc_full(:) = 0.
122 zdrainc_fullm(:) = 0.
123 zdrain_isba(:) = 0.
124 zdrain_topd(:,:) = 0.
125 IF (kstep==1 .AND. lbudget_topd) CALL init_budget_coupl_rout(dec, dc, dmi, pmesh_size, &
126  io, np, npe, u, ki)
127 !
128 ! Runoff on TOPODYN grid
129 ! ---------------------------------------
130 !
131  CALL unpack_same_rank(u%NR_NATURE,dec%XRUNOFF,zrunoffc_full)
132  CALL unpack_same_rank(u%NR_NATURE,xavg_runoffcm,zrunoffc_fullm)
133 !
134  CALL diag_isba_to_rout(ug%G%XMESH_SIZE,zrunoffc_full,zrunoffc_fullm,zrunoff_isba)
135 !
136 xavg_runoffcm(:) = dec%XRUNOFF(:)
137 zrunoff_topd(:,:) = 0.0
138 !
139  CALL isba_to_topd(zrunoff_isba,zrunoff_topd)
140 !
141 DO jj=1,nncat
142  DO ji=1,nnmc(jj)
143  zrunoff_topd(jj,ji) = zrunoff_topd(jj,ji) / nnpix(nmaskt(jj,ji))
144  ENDDO
145 ENDDO
146 !
147 ! Drainage treatment
148 ! ----------------------------------------
149 !
150  CALL unpack_same_rank(u%NR_NATURE,dec%XDRAIN*xatop,zdrainc_full)
151  CALL unpack_same_rank(u%NR_NATURE,xavg_draincm*xatop,zdrainc_fullm)
152 !
153  CALL diag_isba_to_rout(ug%G%XMESH_SIZE,zdrainc_full,zdrainc_fullm,zdrain_isba)
154 !
155 xavg_draincm(:) = dec%XDRAIN(:)
156 zdrain_topd(:,:) = 0.0
157 !
158  CALL isba_to_topd(zdrain_isba,zdrain_topd)
159 !
160 DO jj=1,nncat
161  DO ji=1,nnmc(jj)
162  zdrain_topd(jj,ji) = zdrain_topd(jj,ji) / nnpix(nmaskt(jj,ji))
163  ENDDO
164 ENDDO
165 !* Routing (runoff + drainage)
166 ! ----------------------------------------
167 !
168  CALL routing(zrunoff_topd,zdrain_topd,kstep)
169 !
170 IF (lhook) CALL dr_hook('ROUT_DATA_ISBA',1,zhook_handle)
171 !
172 END SUBROUTINE rout_data_isba
subroutine diag_isba_to_rout(PMESH_SIZE, PVARC, PVARCP, PVARROUT)
subroutine routing(PRO, PDR, KSTEP)
Definition: routing.F90:8
integer, dimension(:), allocatable nnpix
real, dimension(:), allocatable xrunoff_top
real, parameter xundef
integer nmesht
subroutine init_budget_coupl_rout(DEC, DC, DMI, PMESH_SIZE, IO, N
integer, parameter jprb
Definition: parkind1.F90:32
real, dimension(:), allocatable xavg_draincm
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:7
logical lhook
Definition: yomhook.F90:15
subroutine rout_data_isba(DEC, DC, DMI, PMESH_SIZE, IO, NP, NPE,
real, dimension(:), allocatable xavg_runoffcm
real, dimension(:), allocatable xatop
subroutine isba_to_topd(PVARI, PVART)
Definition: isba_to_topd.F90:8
integer, dimension(:,:), allocatable nmaskt
integer, dimension(:), allocatable nnmc