GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: phylmd/freinage.F90 Lines: 0 31 0.0 %
Date: 2023-06-30 12:56:34 Branches: 0 66 0.0 %

Line Branch Exec Source
1
!
2
! $Id$
3
!
4
  SUBROUTINE freinage(knon, uu, vv,  &
5
       tt,veget,lai, height,ypaprs,ypplay,drag_pro,d_u,d_v)
6
7
    !ONLINE:
8
    use dimphy, only: klon, klev
9
!    USE control, ONLY: nvm
10
!    USE indice_sol_mod, only : nvm_orch
11
12
    IMPLICIT NONE
13
14
15
    include "YOMCST.h"
16
    include "clesphys.h"
17
    include "YOEGWD.h"
18
!FC
19
    include "dimpft.h"
20
    include "compbl.h"
21
22
    ! 0. DECLARATIONS:
23
24
    ! 0.1 INPUTS
25
26
    REAL, DIMENSION(klon,klev), INTENT(IN)         :: ypplay
27
    REAL, DIMENSION(klon,klev+1), INTENT(IN)       :: ypaprs
28
29
30
     REAL, DIMENSION(klon, klev), INTENT(IN)     :: uu
31
     REAL, DIMENSION(klon, klev), INTENT(IN)     :: vv
32
     REAL, DIMENSION(klon, klev), INTENT(IN)     :: tt
33
     REAL, DIMENSION(klon,nvm_lmdz), INTENT(IN)          :: veget,lai
34
     REAL, DIMENSION(klon,nvm_lmdz), INTENT(IN)          :: height
35
36
     REAL, DIMENSION(klon,klev)         :: wind
37
     REAL, DIMENSION(klon, klev)        :: yzlay
38
     INTEGER knon
39
40
    ! 0.2 OUTPUTS
41
42
      REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: d_v        ! change in v
43
      REAL, DIMENSION(klon, klev),  INTENT(OUT)       :: d_u        ! change in v
44
    !knon nombre de points concernes
45
      REAL, DIMENSION(klon,klev)         :: sumveg        ! change in v
46
47
     REAL,  DIMENSION(klon,klev), INTENT(OUT)          :: drag_pro
48
    ! (KLON, KLEV) tendencies on winds
49
50
51
    INTEGER k,jv,i
52
53
54
!FCCCC    REAL Cd_frein
55
56
    ! 0.3.1 LOCAL VARIABLE
57
58
59
    !-----------------------------------------------------------------
60
61
    ! 1. INITIALISATIONS
62
63
64
!    Cd_frein = 7.5E-2 ! (0.075) ! Drag from MASSON 2009
65
!FC ESSAI
66
!    Cd_frein = 1.5E-2 ! (0.075) ! Drag from MASSON 2009
67
!    Cd_frein = 0.005 ! (0.075) ! Drag from MASSON 2009
68
69
! initialisation
70
      d_u(:,:) =0.
71
      d_v(:,:) =0.
72
      drag_pro(:,:) =0.
73
      sumveg(:,:) =0.
74
!!        print*, "Cd_frein" , Cd_frein
75
76
       wind(:,:)= sqrt(uu(:,:)*uu(:,:)+vv(:,:)*vv(:,:))
77
78
       yzlay(1:knon,1)= &
79
            RD*tt(1:knon,1)/(0.5*(ypaprs(1:knon,1)+ypplay(1:knon,1))) &
80
            *(ypaprs(1:knon,1)-ypplay(1:knon,1))/RG
81
       DO k=2,klev
82
             yzlay(1:knon,k)= &
83
                  yzlay(1:knon,k-1)+RD*0.5*(tt(1:knon,k-1)+tt(1:knon,k)) &
84
                  /ypaprs(1:knon,k)*(ypplay(1:knon,k-1)-ypplay(1:knon,k))/RG
85
       END DO
86
87
!    verifier les indexes .....
88
!!       print*, " calcul de drag_pro FC "
89
90
      do k= 1,klev
91
92
      do jv=2,nvm_lmdz   !   (on peut faire 9 ?)
93
94
      do i=1,knon
95
96
      sumveg(i,k)= sumveg(i,k)+ veget(i,jv)
97
98
!      if  ( (height(i,jv) .gt. yzlay(i,k)) .AND. (height(i,jv) .gt. 0.1) .and. LAI(i,jv).gt.0. ) then
99
      if  ( (height(i,jv) .gt. yzlay(i,k)) .AND. (height(i,jv) .gt. 0.1) ) then
100
!FC attention veut on le test sur le LAI ?
101
         if (ifl_pbltree.eq.1) then
102
      drag_pro(i,k)= drag_pro(i,k)+ &
103
      veget(i,jv)
104
          elseif (ifl_pbltree.eq.2) then
105
      drag_pro(i,k)= drag_pro(i,k)+ &
106
      6*LAI(i,jv)*veget(i,jv)*( yzlay(i,k)*(height(i,jv)-yzlay(i,k))/(height(i,jv)*height(i,jv)+ 0.01))
107
          elseif (ifl_pbltree.eq.3) then
108
      drag_pro(i,k)= drag_pro(i,k)+ &
109
      veget(i,jv)*( yzlay(i,k)*(height(i,jv)-yzlay(i,k))/(height(i,jv)*height(i,jv)+ 0.01))
110
          elseif (ifl_pbltree.eq.0) then
111
          drag_pro(i,k)=0.0
112
           endif
113
      else
114
      drag_pro(i,k)= drag_pro(i,k)
115
      endif
116
117
118
      enddo
119
      enddo
120
     enddo
121
      do k=1,klev
122
        where (sumveg(1:knon,k) > 0.05 )
123
!        drag_pro(1:knon,k)=Cd_frein*drag_pro(1:knon,k)/sumveg(1:knon,k)
124
        drag_pro(1:knon,k)=Cd_frein*drag_pro(1:knon,k)
125
        elsewhere
126
        drag_pro(1:knon,k)=0.0
127
       endwhere
128
        d_u(1:knon,k) =(-1)*drag_pro(1:knon,k)*uu(1:knon,k)*wind(1:knon,k)
129
        d_v(1:knon,k) =(-1)*drag_pro(1:knon,k)*vv(1:knon,k)*wind(1:knon,k)
130
      enddo
131
      return
132
133
 END SUBROUTINE freinage
134