SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
mkflag_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 ! #########
6 SUBROUTINE mkflag_snow(TPSNOW)
7 ! ###################
8 !
9 !!**** *MKFLAG_SNOW* - puts undefined value on some snow quantities
10 !! where snow is not present
11 !!
12 !! PURPOSE
13 !! -------
14 !
15 !!** METHOD
16 !! ------
17 !!
18 !! REFERENCE
19 !! ---------
20 !!
21 !!
22 !! AUTHOR
23 !! ------
24 !! V. Masson
25 !!
26 !! MODIFICATIONS
27 !! -------------
28 !! Original 01/2004
29 !! A. Bogatchev 09/2005 EBA snow option
30 !! B. Decharme 01/2009 Limit snow mass if Density=undef
31 !! P. Samuelsson 10/2014 Additional snow albedos
32 !!------------------------------------------------------------------
33 !
35 USE modd_surf_par, ONLY : xundef
36 !
37 USE yomhook ,ONLY : lhook, dr_hook
38 USE parkind1 ,ONLY : jprb
39 !
40 IMPLICIT NONE
41 !
42 TYPE(surf_snow) :: tpsnow ! snow state vector
43 !
44 INTEGER :: jlayer
45 INTEGER :: jpatch
46 REAL(KIND=JPRB) :: zhook_handle
47 !
48 !--------------------------------------------------
49 !
50 IF (lhook) CALL dr_hook('MKFLAG_SNOW',0,zhook_handle)
51 IF (tpsnow%SCHEME=='NON' .AND. lhook) CALL dr_hook('MKFLAG_SNOW',1,zhook_handle)
52 IF (tpsnow%SCHEME=='NON') RETURN
53 !
54 DO jpatch =1,SIZE(tpsnow%WSNOW,3)
55 !
56  IF (tpsnow%SCHEME=='D95' .OR. tpsnow%SCHEME=='EBA' .OR. tpsnow%SCHEME=='1-L' .OR. tpsnow%SCHEME=='3-L' &
57  .OR. tpsnow%SCHEME=='CRO') THEN
58  DO jlayer=1,tpsnow%NLAYER
59  WHERE ( tpsnow%RHO(:,1,jpatch)== xundef .AND. tpsnow%WSNOW(:,jlayer,jpatch) > 0.0 .AND. tpsnow%WSNOW(:,1,jpatch)/= xundef )
60  tpsnow%WSNOW(:,jlayer,jpatch) = 0.0
61  END WHERE
62  END DO
63  END IF
64 !
65  IF (tpsnow%SCHEME=='1-L') THEN
66  DO jlayer=1,tpsnow%NLAYER
67  WHERE ( tpsnow%WSNOW(:,1,jpatch)==0. .OR. tpsnow%WSNOW(:,1,jpatch)== xundef )
68  tpsnow%T(:,jlayer,jpatch) = xundef
69  END WHERE
70  END DO
71  END IF
72 !
73  IF (tpsnow%SCHEME=='D95' .OR. tpsnow%SCHEME=='EBA' .OR. tpsnow%SCHEME=='1-L' .OR. tpsnow%SCHEME=='3-L' &
74  .OR. tpsnow%SCHEME=='CRO') THEN
75  DO jlayer=1,tpsnow%NLAYER
76  WHERE ( tpsnow%WSNOW(:,1,jpatch)==0. .OR. tpsnow%WSNOW(:,1,jpatch)== xundef )
77  tpsnow%RHO(:,jlayer,jpatch) = xundef
78  END WHERE
79  END DO
80  END IF
81 !
82  IF (tpsnow%SCHEME=='3-L' .OR. tpsnow%SCHEME=='CRO') THEN
83  DO jlayer=1,tpsnow%NLAYER
84  WHERE ( tpsnow%WSNOW(:,1,jpatch)==0. .OR. tpsnow%WSNOW(:,1,jpatch)== xundef )
85  tpsnow%HEAT(:,jlayer,jpatch) = xundef
86  tpsnow%AGE (:,jlayer,jpatch) = xundef
87  END WHERE
88  END DO
89  END IF
90 !
91 IF (tpsnow%SCHEME=='CRO') THEN
92  DO jlayer=1,tpsnow%NLAYER
93  WHERE ( tpsnow%WSNOW(:,1,jpatch)==0. .OR. tpsnow%WSNOW(:,1,jpatch)== xundef )
94  tpsnow%GRAN1(:,jlayer,jpatch) = xundef
95  tpsnow%GRAN2(:,jlayer,jpatch) = xundef
96  tpsnow%HIST(:,jlayer,jpatch) = xundef
97  END WHERE
98  END DO
99  END IF
100 !
101  IF (tpsnow%SCHEME=='D95' .OR. tpsnow%SCHEME=='EBA' .OR. tpsnow%SCHEME=='1-L' .OR. tpsnow%SCHEME=='3-L' &
102  .OR. tpsnow%SCHEME=='CRO') THEN
103  WHERE ( tpsnow%WSNOW(:,1,jpatch)==0. .OR. tpsnow%WSNOW(:,1,jpatch)== xundef )
104  tpsnow%ALB(:,jpatch) = xundef
105  tpsnow%ALBVIS(:,jpatch) = xundef
106  tpsnow%ALBNIR(:,jpatch) = xundef
107  tpsnow%ALBFIR(:,jpatch) = xundef
108  END WHERE
109  END IF
110 !
111  IF (tpsnow%SCHEME=='1-L') THEN
112  WHERE ( tpsnow%WSNOW(:,1,jpatch)==0. .OR. tpsnow%WSNOW(:,1,jpatch)== xundef )
113  tpsnow%EMIS(:,jpatch) = xundef
114  END WHERE
115  END IF
116 !
117  IF (tpsnow%SCHEME=='1-L') THEN
118  WHERE ( tpsnow%WSNOW(:,1,jpatch)==0. .OR. tpsnow%WSNOW(:,1,jpatch)== xundef )
119  tpsnow%TS(:,jpatch) = xundef
120  END WHERE
121  END IF
122 
123 END DO
124 IF (lhook) CALL dr_hook('MKFLAG_SNOW',1,zhook_handle)
125 !
126 !--------------------------------------------------
127 !
128 END SUBROUTINE mkflag_snow
subroutine mkflag_snow(TPSNOW)
Definition: mkflag_snow.F90:6