SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
comput_cold_layers_thick.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 comput_cold_layers_thick(PDG,PTG,PALT,PFLT)
6 ! ###############################################################################
7 !
8 !!**** *COMPUT_COLD_LAYERS_THICK* - additional diagnostics for ISBA
9 !!
10 !! PURPOSE
11 !! -------
12 !! Comput active layer (ALT) and frozen layer (FLT) theaknesses
13 !! using linear interpolation between two nodes :
14 !! ALT = depth to zero centigrade isotherm in permafrost
15 !! FLT = depth to zero centigrade isotherm in non-permafrost
16 !!
17 !!** METHOD
18 !! ------
19 !!
20 !! REFERENCE
21 !! ---------
22 !!
23 !!
24 !! AUTHOR
25 !! ------
26 !! B. Decharme
27 !!
28 !! MODIFICATIONS
29 !! -------------
30 !! Original 07/2014
31 !!
32 !!------------------------------------------------------------------
33 !
34 USE modd_csts, ONLY : xtt
35 USE modd_surf_par, ONLY : nundef
36 !
37 USE yomhook ,ONLY : lhook, dr_hook
38 USE parkind1 ,ONLY : jprb
39 !
40 IMPLICIT NONE
41 !
42 !* 0.1 declarations of arguments
43 !
44 REAL, DIMENSION(:,:), INTENT(IN) :: pdg ! soil layer depth
45 REAL, DIMENSION(:,:), INTENT(IN) :: ptg ! soil temperature
46 REAL, DIMENSION(:), INTENT(OUT) :: palt ! active layer theakness
47 REAL, DIMENSION(:), INTENT(OUT) :: pflt ! frozen layer theakness
48 !
49 !* 0.2 declarations of local variables
50 !
51 REAL, DIMENSION(SIZE(PDG,1),SIZE(PDG,2)) :: znode
52 INTEGER, DIMENSION(SIZE(PDG,1)) :: iup_alt, idown_alt
53 INTEGER, DIMENSION(SIZE(PDG,1)) :: iup_flt, idown_flt
54 !
55 REAL :: ztg_up, ztg_down
56 REAL :: zup, zdown
57 REAL :: zalt, zflt, zslope
58 !
59 INTEGER :: ji, jl, ini, inl
60 !
61 REAL(KIND=JPRB) :: zhook_handle
62 !
63 !-------------------------------------------------------------------------------------
64 !
65 IF (lhook) CALL dr_hook('COMPUT_COLD_LAYERS_THICK',0,zhook_handle)
66 !
67 ini=SIZE(pdg,1)
68 inl=SIZE(pdg,2)
69 !
70 iup_alt(:)=0
71 idown_alt(:)=0
72 iup_flt(:)=0
73 idown_flt(:)=0
74 !
75 !Surface soil layer
76 !
77 znode(:,1)=0.5*pdg(:,1)
78 WHERE(ptg(:,1)>xtt.AND.ptg(:,2)<=xtt.AND.ptg(:,3)<=xtt)
79  iup_alt(:)=1
80  idown_alt(:)=2
81 ENDWHERE
82 WHERE(ptg(:,1)<xtt.AND.ptg(:,2)>=xtt.AND.ptg(:,3)>=xtt)
83  iup_flt(:)=1
84  idown_flt(:)=2
85 ENDWHERE
86 !
87 !Middle soil layer
88 !
89 DO jl=2,inl-1
90  DO ji=1,ini
91  znode(ji,jl)=0.5*(pdg(ji,jl)+pdg(ji,jl-1))
92  IF(ptg(ji,jl-1)>xtt.AND.ptg(ji,jl)>xtt.AND.ptg(ji,jl+1)<=xtt)THEN
93  iup_alt(ji)=jl
94  idown_alt(ji)=jl+1
95  ENDIF
96  IF(ptg(ji,jl-1)<xtt.AND.ptg(ji,jl)<xtt.AND.ptg(ji,jl+1)>=xtt)THEN
97  iup_flt(ji)=jl
98  idown_flt(ji)=jl+1
99  ENDIF
100  ENDDO
101 ENDDO
102 !
103 !Last soil layer
104 !
105 znode(:,inl)=0.5*(pdg(:,inl)+pdg(:,inl-1))
106 WHERE(ptg(:,inl)>xtt)idown_alt(:)=nundef
107 WHERE(ptg(:,inl)<xtt)idown_flt(:)=nundef
108 !
109 DO ji=1,ini
110 !
111  palt(ji)=0.0
112  IF(idown_alt(ji)>0.AND.idown_alt(ji)<=inl)THEN
113  ztg_up = ptg(ji,iup_alt(ji))
114  ztg_down = ptg(ji,idown_alt(ji))
115  zup = znode(ji,iup_alt(ji))
116  zdown = znode(ji,idown_alt(ji))
117  zslope = (zup-zdown)/(ztg_up-ztg_down)
118  palt(ji) = zdown+(xtt-ztg_down)*zslope
119  ENDIF
120 !
121  pflt(ji)=0.0
122  IF(idown_flt(ji)>0.AND.idown_flt(ji)<=inl)THEN
123  ztg_up = ptg(ji,iup_flt(ji))
124  ztg_down = ptg(ji,idown_flt(ji))
125  zup = znode(ji,iup_flt(ji))
126  zdown = znode(ji,idown_flt(ji))
127  zslope = (zup-zdown)/(ztg_up-ztg_down)
128  pflt(ji) = zdown+(xtt-ztg_down)*zslope
129  ENDIF
130 !
131 ENDDO
132 !
133 IF (lhook) CALL dr_hook('COMPUT_COLD_LAYERS_THICK',1,zhook_handle)
134 !
135 !-------------------------------------------------------------------------------------
136 !
137 END SUBROUTINE comput_cold_layers_thick
138 
subroutine comput_cold_layers_thick(PDG, PTG, PALT, PFLT)