SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
assim_isba_update_snow.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 SUBROUTINE assim_isba_update_snow (I, &
6  hprogram, ki, pswe, pswe_orig, oinitsnow, oinc, htest )
7 
8 ! ------------------------------------------------------------------------------------------
9 ! *****************************************************************************************
10 !
11 ! Routine to update snow field for ISBA
12 ! Trygve Aspelien, Separating IO 06/2013
13 !
14 !
15 ! ******************************************************************************************
16 ! ------------------------------------------------------------------------------------------
17 !
18 USE modd_isba_n, ONLY : isba_t
19 !
20 USE modd_csts, ONLY : xtt
21 USE modd_surf_par, ONLY : xundef
22 USE modd_snow_par, ONLY : xansmin, xansmax, xrhosmin, xrhosmax
23 !
24 !
25 USE modi_abor1_sfx
26 !
27 USE yomhook, ONLY : lhook,dr_hook
28 USE parkind1, ONLY : jprb
29 !
30 IMPLICIT NONE
31 !
32 TYPE(isba_t), INTENT(INOUT) :: i
33 !
34  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling surf. schemes
35 INTEGER, INTENT(IN) :: ki
36 REAL, DIMENSION(KI), INTENT(IN) :: pswe
37 REAL, DIMENSION(KI), INTENT(INOUT) :: pswe_orig
38 LOGICAL, INTENT(IN) :: oinitsnow
39 LOGICAL, INTENT(IN) :: oinc
40  CHARACTER(LEN=2), INTENT(IN) :: htest ! must be equal to 'OK'
41 !
42 ! Declarations of local variables
43 !
44 REAL, DIMENSION(KI) :: zswe ! Snow before update
45 REAL, DIMENSION(KI) :: zsweinc
46 REAL, DIMENSION(KI) :: zts
47 ! Addtional snow fields with D95 snow scheme
48 REAL, DIMENSION(KI) :: zsnr ! Snow density
49 REAL, DIMENSION(KI) :: zsna ! Snow albedo
50 INTEGER :: jl,jp
51 REAL(KIND=JPRB) :: zhook_handle
52 !
53 ! ----------------------------------------------------------------------------------
54 !
55 IF (lhook) CALL dr_hook('ASSIM_ISBA_UPDATE_SNOW',0,zhook_handle)
56 !
57 IF (htest/='OK') THEN
58  CALL abor1_sfx('ASSIM_ISBA_n: FATAL ERROR DURING ARGUMENT TRANSFER')
59 END IF
60 !
61 IF ( i%TSNOW%SCHEME=='D95' ) THEN
62  jl = 1
63  jp = 1
64  IF ( i%NPATCH > 1 ) CALL abor1_sfx("Update of snow is only implemented for D95 and one patch")
65 ELSE
66  CALL abor1_sfx("Update of snow is only implemented for D95")
67 ENDIF
68 !
69 IF ( oinitsnow ) THEN
70  !
71  pswe_orig(:) = i%TSNOW%WSNOW(:,jl,jp)
72  !
73  zts(:) = i%XTG(:,1,jp)
74  !
75  zswe(:) = pswe(:)
76  ! Set snow=0 where 1. guess = 0 and Ts>0, to avoid that the snow analysis introduce snow where it is no snow.
77  WHERE ( pswe(:)/=xundef .AND. pswe(:)<1.0e-10 .AND. zts(:)>xtt )
78  zswe(:) = 0.0
79  END WHERE
80  !
81  i%TSNOW%WSNOW(:,jl,jp) = zswe(:)
82  !
83 ENDIF
84 
85 
86 ! Update snow
87 IF ( oinc ) THEN
88 
89  zswe(:) = i%TSNOW%WSNOW(:,jl,jp)
90  zsna(:) = i%TSNOW%ALB (:,jp)
91  zsnr(:) = i%TSNOW%RHO (:,jl,jp)
92 
93  ! If we only do second step, we must set working SWE as input SWE
94  IF ( .NOT. oinitsnow ) zswe(:) = pswe(:)
95 
96  ! Calculate increments
97  zsweinc(:) = zswe(:) - pswe_orig(:)
98  WRITE(*,'(" SURFRESERV.NEIGE - min, mean, max: ",3E13.4)') minval(zswe),maxval(zswe),sum(zswe)/ki
99  WRITE(*,*) 'Mean SN increments over NATURE ',sum(zsweinc)/ki
100 
101  ! Snow albedo and density are given initial values in points
102  ! which get initial snow in the snow analysis
103  WHERE ( pswe_orig(:) < 1.0e-10 .AND. zswe(:)>= 1.0e-10 )
104  zsna(:) = 0.5 * ( xansmin + xansmax )
105  zsnr(:) = 0.5 * ( xrhosmin + xrhosmax )
106  END WHERE
107  !
108  i%TSNOW%WSNOW(:,jl,jp) = zswe(:)
109  i%TSNOW%ALB (:,jp) = zsna(:)
110  i%TSNOW%RHO (:,jl,jp) = zsnr(:)
111  !
112 ENDIF
113 !
114 ! -------------------------------------------------------------------------------------
115  IF (lhook) CALL dr_hook('ASSIM_ISBA_UPDATE_SNOW',1,zhook_handle)
116  END SUBROUTINE assim_isba_update_snow
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:6
subroutine assim_isba_update_snow(I, HPROGRAM, KI, PSWE, PSWE_ORIG, OINITSNOW, OINC, HTEST)