SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
flag_gr_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 flag_gr_snow(KFLAG,OMASK,TPSNOW)
7 ! ##########################################################
8 !
9 !!**** *FLAG_GR_SNOW* - routine to flag snow surface fields
10 !!
11 !! PURPOSE
12 !! -------
13 ! Initialize snow surface fields.
14 !
15 !!** METHOD
16 !! ------
17 !!
18 !!
19 !!
20 !! EXTERNAL
21 !! --------
22 !!
23 !!
24 !! IMPLICIT ARGUMENTS
25 !! ------------------
26 !!
27 !! REFERENCE
28 !! ---------
29 !!
30 !!
31 !!
32 !! AUTHOR
33 !! ------
34 !! V. Masson * Meteo France *
35 !!
36 !! MODIFICATIONS
37 !! -------------
38 !! Original 10/2011
39 !! P. Samuelsson 07/2014 Added snow albedos
40 !-----------------------------------------------------------------------------
41 !
42 !* 0. DECLARATIONS
43 !
45 !
46 !
47 USE modd_surf_par, ONLY : xundef
48 !
49 USE yomhook ,ONLY : lhook, dr_hook
50 USE parkind1 ,ONLY : jprb
51 !
52 IMPLICIT NONE
53 !
54 !* 0.1 declarations of arguments
55 !
56 INTEGER, INTENT(IN) :: kflag ! 1 : to put physical values to run ISBA afterwards
57 ! ! 2 : to flag with XUNDEF value for points wihtout
58 LOGICAL, DIMENSION(:), INTENT(IN) :: omask ! T: points where snow values
59 ! ! must be flagged
60 TYPE(surf_snow), INTENT(INOUT) :: tpsnow ! snow characteristics
61 !
62 !* 0.2 declarations of local variables
63 !
64 REAL :: zval
65 INTEGER :: jlayer, jpatch
66 REAL(KIND=JPRB) :: zhook_handle
67 !-------------------------------------------------------------------------------
68 IF (lhook) CALL dr_hook('FLAG_GR_SNOW',0,zhook_handle)
69 !
70 IF (kflag==1) THEN
71  zval = 0.
72 ELSEIF (kflag==2) THEN
73  zval = xundef
74 ENDIF
75 !
76 DO jpatch = 1,SIZE(tpsnow%WSNOW,3)
77  !
78  DO jlayer = 1,tpsnow%NLAYER
79  !
80  WHERE(omask(:)) tpsnow%WSNOW(:,jlayer,jpatch) = zval
81  !
82  IF (kflag==1) THEN
83  !
84  WHERE(omask(:)) tpsnow%RHO (:,jlayer,jpatch) = xundef
85  !
86  IF (SIZE(tpsnow%TEMP ) >0) THEN
87  WHERE(omask(:))
88  tpsnow%TEMP (:,jlayer,jpatch) = xundef
89  tpsnow%HEAT (:,jlayer,jpatch) = xundef
90  END WHERE
91  ENDIF
92  !
93  IF (SIZE(tpsnow%T ) >0) WHERE(omask(:)) tpsnow%T(:,jlayer,jpatch) = xundef
94  !
95  IF (SIZE(tpsnow%GRAN1) >0) THEN
96  WHERE(omask(:))
97  tpsnow%GRAN1(:,jlayer,jpatch) = xundef
98  tpsnow%GRAN2(:,jlayer,jpatch) = xundef
99  tpsnow%HIST (:,jlayer,jpatch) = xundef
100  tpsnow%AGE (:,jlayer,jpatch) = xundef
101  END WHERE
102  END IF
103  !
104  ENDIF
105  !
106  ENDDO
107  !
108  IF (kflag==1) THEN
109  !
110  WHERE(omask(:)) tpsnow%ALB (:,jpatch) = xundef
111  WHERE(omask(:)) tpsnow%ALBVIS (:,jpatch) = xundef
112  WHERE(omask(:)) tpsnow%ALBNIR (:,jpatch) = xundef
113  WHERE(omask(:)) tpsnow%ALBFIR (:,jpatch) = xundef
114  !
115  IF (SIZE(tpsnow%EMIS ) >0) THEN
116  WHERE(omask(:))
117  tpsnow%EMIS (:,jpatch) = xundef
118  tpsnow%TS (:,jpatch) = xundef
119  END WHERE
120  END IF
121  !
122  ENDIF
123  !
124 END DO
125 !
126 IF (lhook) CALL dr_hook('FLAG_GR_SNOW',1,zhook_handle)
127 !
128 !-------------------------------------------------------------------------------
129 !
130 END SUBROUTINE flag_gr_snow
subroutine flag_gr_snow(KFLAG, OMASK, TPSNOW)
Definition: flag_gr_snow.F90:6