source: LMDZ6/branches/Amaury_dev/libf/phylmd/tend_to_tke.F90

Last change on this file was 5144, checked in by abarral, 3 months ago

Put YOMCST.h into modules

File size: 5.3 KB
RevLine 
[2728]1!***************************************************************************************
2! tend_to_tke.F90
3!*************
[5099]4
[2728]5! Subroutine that adds a tendency on the TKE created by the
6! fluxes of momentum retrieved from the wind speed tendencies
7! of the physics.
[5099]8
[2728]9! The basic concept is the following:
10! the TKE equation writes  de/dt = -u'w' du/dz -v'w' dv/dz +g/theta dtheta/dz +......
[5099]11
12
[2728]13! We expect contributions to the term u'w' and v'w' that do not come from the Yamada
14! scheme, for instance: gravity waves, drag from high vegetation..... These contributions
15! need to be accounted for.
16! we explicitely calculate the fluxes, integrating the wind speed
17!                        tendency from the top of the atmospher
[5099]18
19
20
[2728]21! contacts: Frederic Hourdin, Etienne Vignon
[5099]22
[2728]23! History:
24!---------
25! - 1st redaction, Etienne, 15/10/2016
26! Ajout des 4 sous surfaces pour la tke
27! on sort l'ajout des tendances du if sur les deux cas, pour ne pas
28! dupliuqer les lignes
29! on enleve le pas de temps qui disprait dans les calculs
[5099]30
31
[2728]32!**************************************************************************************
33
[5144]34SUBROUTINE tend_to_tke(dt, plev, exner, temp, windu, windv, dt_a, du_a, dv_a, pctsrf, tke)
[2728]35
[5144]36  USE dimphy, ONLY: klon, klev
37  USE indice_sol_mod, ONLY: nbsrf
38  USE lmdz_yomcst
[3210]39
[5144]40  IMPLICIT NONE
[2728]41
[5144]42  ! Declarations
43  !==============
[2728]44
45
[5144]46  ! Inputs
47  !-------
[2728]48  REAL dt                   ! Time step [s]
[5144]49  REAL plev(klon, klev + 1)    ! inter-layer pressure [Pa]
50  REAL temp(klon, klev)      ! temperature [K], grid-cell average or for a one subsurface
51  REAL windu(klon, klev)     ! zonal wind [m/s], grid-cell average or for a one subsurface
52  REAL windv(klon, klev)     ! meridonal wind [m/s], grid-cell average or for a one subsurface
53  REAL exner(klon, klev)     ! Fonction d'Exner = T/theta
54  REAL dt_a(klon, klev)      ! Temperature tendency [K], grid-cell average or for a one subsurface
55  REAL du_a(klon, klev)      ! Zonal wind speed tendency [m/s], grid-cell average or for a one subsurface
56  REAL dv_a(klon, klev)      ! Meridional wind speed tendency [m/s], grid-cell average or for a one subsurface
57  REAL pctsrf(klon, nbsrf + 1)       ! Turbulent Kinetic energy [m2/s2], grid-cell average or for a subsurface
[2728]58
[5144]59  ! Inputs/Outputs
60  !---------------
61  REAL tke(klon, klev + 1, nbsrf + 1)       ! Turbulent Kinetic energy [m2/s2], grid-cell average or for a subsurface
[2728]62
63
[5144]64  ! Local
65  !-------
[2728]66
[5144]67  INTEGER i, k, isrf                 ! indices
68  REAL    masse(klon, klev)          ! mass in the layers [kg/m2]
69  REAL    unsmasse(klon, klev + 1)     ! linear mass in the layers [kg/m2]
70  REAL    flux_rhotw(klon, klev + 1)   ! flux massique de tempe. pot. rho*u'*theta'
71  REAL    flux_rhouw(klon, klev + 1)   ! flux massique de quantit?? de mouvement rho*u'*w' [kg/m/s2]
72  REAL    flux_rhovw(klon, klev + 1)   ! flux massique de quantit?? de mouvement rho*v'*w' [kg/m/s2]
73  REAL    tendt(klon, klev)        ! new temperature tke tendency [m2/s2/s]
74  REAL    tendu(klon, klev)        ! new zonal tke tendency [m2/s2/s]
75  REAL    tendv(klon, klev)        ! new meridonal tke tendency [m2/s2/s]
[2728]76
77
78
79
[5144]80  ! First calculations:
81  !=====================
[2728]82
[5144]83  unsmasse(:, :) = 0.
84  DO k = 1, klev
85    masse(:, k) = (plev(:, k) - plev(:, k + 1)) / RG
86    unsmasse(:, k) = unsmasse(:, k) + 0.5 / masse(:, k)
87    unsmasse(:, k + 1) = unsmasse(:, k + 1) + 0.5 / masse(:, k)
88  END DO
[2728]89
[5144]90  tendu(:, :) = 0.0
91  tendv(:, :) = 0.0
[2728]92
[5144]93  ! Method 1: Calculation of fluxes using a downward integration
94  !============================================================
[2728]95
96
97
[5144]98  ! Flux calculation
[2728]99
[5144]100  flux_rhotw(:, klev + 1) = 0.
101  flux_rhouw(:, klev + 1) = 0.
102  flux_rhovw(:, klev + 1) = 0.
[2728]103
[5144]104  DO k = klev, 1, -1
105    flux_rhotw(:, k) = flux_rhotw(:, k + 1) + masse(:, k) * dt_a(:, k) / exner(:, k)
106    flux_rhouw(:, k) = flux_rhouw(:, k + 1) + masse(:, k) * du_a(:, k)
107    flux_rhovw(:, k) = flux_rhovw(:, k + 1) + masse(:, k) * dv_a(:, k)
108  ENDDO
[2728]109
110
[5144]111  ! TKE update:
[2728]112
[5144]113  DO k = 2, klev
114    tendt(:, k) = -flux_rhotw(:, k) * (exner(:, k) - exner(:, k - 1)) * unsmasse(:, k) * RCPD
115    tendu(:, k) = -flux_rhouw(:, k) * (windu(:, k) - windu(:, k - 1)) * unsmasse(:, k)
116    tendv(:, k) = -flux_rhovw(:, k) * (windv(:, k) - windv(:, k - 1)) * unsmasse(:, k)
117  ENDDO
118  tendt(:, 1) = -flux_rhotw(:, 1) * (exner(:, 1) - 1.) * unsmasse(:, 1) * RCPD
119  tendu(:, 1) = -1. * flux_rhouw(:, 1) * windu(:, 1) * unsmasse(:, 1)
120  tendv(:, 1) = -1. * flux_rhovw(:, 1) * windv(:, 1) * unsmasse(:, 1)
[2728]121
[5144]122  DO isrf = 1, nbsrf
123    DO k = 1, klev
124      DO i = 1, klon
125        IF (pctsrf(i, isrf)>0.) THEN
126          tke(i, k, isrf) = tke(i, k, isrf) + tendu(i, k) + tendv(i, k) + tendt(i, k)
127          tke(i, k, isrf) = max(tke(i, k, isrf), 1.e-10)
128        ENDIF
129      ENDDO
[2728]130    ENDDO
[5144]131  ENDDO
[2728]132
133
[5144]134  !  IF (klon==1) THEN
135  !  CALL iophys_ecrit('u',klev,'u','',windu)
136  !  CALL iophys_ecrit('v',klev,'v','',windu)
137  !  CALL iophys_ecrit('t',klev,'t','',temp)
138  !  CALL iophys_ecrit('tke1',klev,'tke1','',tke(:,1:klev,1))
139  !  CALL iophys_ecrit('tke2',klev,'tke2','',tke(:,1:klev,2))
140  !  CALL iophys_ecrit('tke3',klev,'tke3','',tke(:,1:klev,3))
141  !  CALL iophys_ecrit('tke4',klev,'tke4','',tke(:,1:klev,4))
142  !  CALL iophys_ecrit('theta',klev,'theta','',temp/exner)
143  !  CALL iophys_ecrit('Duv',klev,'Duv','',tendu(:,1:klev)+tendv(:,1:klev))
144  !  CALL iophys_ecrit('Dt',klev,'Dt','',tendt(:,1:klev))
145  !  ENDIF
[2728]146
[5144]147END SUBROUTINE tend_to_tke
Note: See TracBrowser for help on using the repository browser.