SURFEX v8.1
General documentation of Surfex
isba_budget_init.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 isba_budget_init (OWATER_BUDGET, HISBA, PEK, PDG, PDZG, &
7  PWG_INI, PWGI_INI, PWR_INI, PSWE_INI )
8 ! ###############################################################################
9 !
10 !!**** *ISBA_BUDGET_INIT * - initialize water and energy budget for ISBA
11 !!
12 !! PURPOSE
13 !! -------
14 !
15 !!** METHOD
16 !! ------
17 !!
18 !! REFERENCE
19 !! ---------
20 !!
21 !!
22 !! AUTHOR
23 !! ------
24 !! B. Decharme
25 !!
26 !! MODIFICATIONS
27 !! -------------
28 !! Original 10/2012
29 !!
30 !!------------------------------------------------------------------
31 !
32 !
34 USE modd_isba_n, ONLY : isba_pe_t
35 !
36 USE modd_surf_par, ONLY : xundef
37 USE modd_csts, ONLY : xrholw
38 !
39 !
40 USE yomhook ,ONLY : lhook, dr_hook
41 USE parkind1 ,ONLY : jprb
42 !
43 IMPLICIT NONE
44 !
45 !* 0.1 declarations of arguments
46 !
47 !
48 LOGICAL, INTENT(IN) :: OWATER_BUDGET
49 !
50  CHARACTER(LEN=*), INTENT(IN) :: HISBA ! type of ISBA version:
51 ! ! '2-L' (default)
52 ! ! '3-L'
53 ! ! 'DIF'
54 TYPE(isba_pe_t), INTENT(INOUT) :: PEK
55 !
56 REAL, DIMENSION(:,:), INTENT(IN) :: PDG ! soil layer depth (m)
57 REAL, DIMENSION(:,:), INTENT(IN) :: PDZG ! soil layer thickness (m)
58 !
59 REAL, DIMENSION(:), INTENT(OUT) :: PWG_INI ! total wg at t-1 (kg m-2)
60 REAL, DIMENSION(:), INTENT(OUT) :: PWGI_INI ! total wgi at t-1 (kg m-2)
61 REAL, DIMENSION(:), INTENT(OUT) :: PWR_INI ! total wr at t-1 (kg m-2)
62 REAL, DIMENSION(:), INTENT(OUT) :: PSWE_INI ! total swe at t-1 (kg m-2)
63 !
64 !* 0.2 declarations of local variables
65 !
66 INTEGER :: INI, INL, INLS
67 INTEGER :: JI, JL
68 REAL(KIND=JPRB) :: ZHOOK_HANDLE
69 !
70 !-------------------------------------------------------------------------------------
71 !
72 IF (lhook) CALL dr_hook('ISBA_BUDGET_INIT',0,zhook_handle)
73 !
74 ini =SIZE(pek%XWG,1)
75 inl =SIZE(pek%XWG,2)
76 inls=SIZE(pek%TSNOW%WSNOW,2)
77 !
78 pwg_ini(:) = xundef
79 pwgi_ini(:) = xundef
80 pswe_ini(:) = xundef
81 pwr_ini(:) = xundef
82 !
83 !
84 ! * Water budget
85 ! ------------
86 !
87 IF(owater_budget)THEN
88 !
89 ! total wr at t-1
90  pwr_ini(:)=pek%XWR(:)
91 !
92 ! total swe at t-1
93  pswe_ini(:)=0.0
94  DO jl=1,inls
95  DO ji=1,ini
96  pswe_ini(ji)=pswe_ini(ji)+pek%TSNOW%WSNOW(ji,jl)
97  ENDDO
98  ENDDO
99 !
100 ! total wg and wgi at t-1
101  pwg_ini(:)= 0.0
102  pwgi_ini(:)= 0.0
103  IF(hisba=='DIF')THEN
104  DO jl=1,inl
105  DO ji=1,ini
106  IF(pek%XWG(ji,jl)/=xundef)THEN
107  pwg_ini(ji)=pwg_ini(ji)+pek%XWG (ji,jl)*pdzg(ji,jl)*xrholw
108  pwgi_ini(ji)=pwgi_ini(ji)+pek%XWGI(ji,jl)*pdzg(ji,jl)*xrholw
109  ENDIF
110  ENDDO
111  ENDDO
112  ELSE
113  pwg_ini(:)=pek%XWG (:,2)*pdg(:,2)*xrholw
114  pwgi_ini(:)=pek%XWGI(:,2)*pdg(:,2)*xrholw
115  IF(hisba=='3-L')THEN
116  pwg_ini(:)=pwg_ini(:)+pek%XWG(:,3)*(pdg(:,3)-pdg(:,2))*xrholw
117  ENDIF
118  ENDIF
119 !
120 ENDIF
121 !
122 ! * Energy budget
123 ! -------------
124 !
125 ! not yet implemented
126 !
127 !
128 IF (lhook) CALL dr_hook('ISBA_BUDGET_INIT',1,zhook_handle)
129 !-------------------------------------------------------------------------------------
130 !
131 END SUBROUTINE isba_budget_init
subroutine isba_budget_init(OWATER_BUDGET, HISBA, PEK, PDG, PDZG, PWG_INI, PWGI_INI, PWR_INI, PSWE_INI)
real, parameter xundef
integer, parameter jprb
Definition: parkind1.F90:32
logical lhook
Definition: yomhook.F90:15
real, save xrholw
Definition: modd_csts.F90:64