SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
routing.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 routing(PRO,PDR,KSTEP)
8 ! ####################
9 !
10 !!**** *ROUTING*
11 !!
12 !! PURPOSE
13 !! -------
14 ! To route the runoff and the exfiltration discharge to the catchment outlet
15 !
16 !
17 !!** METHOD
18 !! ------
19 !
20 !! EXTERNAL
21 !! --------
22 !!
23 !! none
24 !!
25 !! IMPLICIT ARGUMENTS
26 !! ------------------
27 !!
28 !!
29 !!
30 !! REFERENCE
31 !! ---------
32 !!
33 !!
34 !!
35 !! AUTHOR
36 !! ------
37 !!
38 !! K. Chancibault * Meteo-France *
39 !! G-M. Saulnier * LTHE *
40 !!
41 !! MODIFICATIONS
42 !! -------------
43 !!
44 !! Original 23/11/2005
45 !! M. Le Lay 02/2008 Compatibility with the RESTART option (to update the
46 !! discharge between two runs)
47 !! Modif B Vincendon 11/2011 : stock managed in three distinct variables
48 !! Modif B Vincendon 03/2014 : correction of a bug on drainage still in the
49 ! river
50 !-------------------------------------------------------------------------------
51 !
52 !* 0. DECLARATIONS
53 ! ------------
54 !
55 USE modd_surf_par, ONLY:xundef
56 !
57 USE modd_topodyn, ONLY : xtopd_step, nncat, xqtot, nnmc, &
58  xtime_topd, xqb_run, xqb_dr, xtime_topd_drain, nnb_topd_step
59 USE modd_coupling_topd, ONLY: xrun_torout, xdr_torout, nnb_stp_restart
60 !
61 USE modi_get_luout
62 USE modi_open_file
63 USE modi_close_file
64 !
65 USE yomhook ,ONLY : lhook, dr_hook
66 USE parkind1 ,ONLY : jprb
67 !
68 IMPLICIT NONE
69 !
70 !* 0.1 declarations of arguments
71 !
72 REAL, DIMENSION(:,:), INTENT(IN) :: pro ! Total water for runoff for each pixel (m3/s)
73 !ludo
74 REAL, DIMENSION(:,:), INTENT(IN) :: pdr ! Total water for drainage for each pixel
75 INTEGER, INTENT(IN) :: kstep ! current integration step
76 !
77 !
78 !* 0.2 declarations of local variables
79 !
80 !
81 INTEGER :: jcat, jj, ji ! Loop variables
82 INTEGER :: jstep ! current or future integration steps
83 REAL, DIMENSION(NNCAT,NNB_TOPD_STEP+NNB_STP_RESTART) :: zrun_torout,zdr_torout ! Kg/m2
84  ! water of runoff and drainage resp. still in the river
85  ! and added to the discharge for the current simulation
86  CHARACTER(LEN=3) :: ystep
87 REAL(KIND=JPRB) :: zhook_handle
88 !-------------------------------------------------------------------------------
89 IF (lhook) CALL dr_hook('ROUTING',0,zhook_handle)
90 !
91 !* 1.0. Initialization :
92 ! --------------
93 !
94 zrun_torout(:,:) = 0.
95 zdr_torout(:,:) = 0.
96 !
97 DO jcat=1,nncat
98  !
99  !* 2.0 Runoff by geomorpho transfer function
100  ! -------------------------------------
101  DO jj=1,nnmc(jcat)
102  !
103  IF ( pro(jcat,jj) > 0.0 .AND. pro(jcat,jj) < xundef ) THEN
104  !
105  jstep = int(xtime_topd(jcat,jj) / xtopd_step) + kstep
106  !
107  IF ( jstep.LE.nnb_topd_step ) THEN
108  !
109  xqb_run(jcat,jstep) = xqb_run(jcat,jstep) + pro(jcat,jj)
110  xqtot(jcat,jstep) = xqtot(jcat,jstep) + pro(jcat,jj)
111  !
112  ELSEIF (jstep.LE.nnb_topd_step+nnb_stp_restart) THEN
113  !
114  zrun_torout(jcat,jstep) = zrun_torout(jcat,jstep) + pro(jcat,jj) !m3
115  !
116  ENDIF
117  !
118  ENDIF
119  !
120  !
121  !* 3.0 Drainage by geomorpho transfer function
122  ! -------------------------------------
123  !
124  IF ((pdr(jcat,jj) > 0.0).AND.(pdr(jcat,jj)<xundef)) THEN
125  !
126  jstep = int(xtime_topd_drain(jcat,jj) / xtopd_step) + kstep
127  !
128  IF (jstep.LE.nnb_topd_step) THEN
129  !
130  xqb_dr(jcat,jstep) = xqb_dr(jcat,jstep) + pdr(jcat,jj)
131  xqtot(jcat,jstep) = xqtot(jcat,jstep) + pdr(jcat,jj)
132  !
133  ELSEIF (jstep.LE.nnb_topd_step+nnb_stp_restart) THEN
134  !
135  zdr_torout(jcat,jstep) = zdr_torout(jcat,jstep) + pdr(jcat,jj) !m3
136  !
137  ENDIF
138  ENDIF
139  !
140  ENDDO
141  !
142  xqb_run(jcat,kstep) = xqb_run(jcat,kstep) + xrun_torout(jcat,kstep)
143  xqb_dr(jcat,kstep) = xqb_dr(jcat,kstep) + xdr_torout(jcat,kstep)
144  xqtot(jcat,kstep) = xqtot(jcat,kstep) + xrun_torout(jcat,kstep) + xdr_torout(jcat,kstep)
145  !
146  xrun_torout(jcat,:) = xrun_torout(jcat,:) + zrun_torout(jcat,:)
147  xdr_torout(jcat,:) = xdr_torout(jcat,:) + zdr_torout(jcat,:)
148  !
149 ENDDO
150 !
151 IF (lhook) CALL dr_hook('ROUTING',1,zhook_handle)
152 !
153 END SUBROUTINE routing
subroutine routing(PRO, PDR, KSTEP)
Definition: routing.F90:7