1 | module lmdz_call_atke |
---|
2 | |
---|
3 | USE lmdz_atke_exchange_coeff, ONLY: atke_compute_km_kh |
---|
4 | |
---|
5 | IMPLICIT NONE |
---|
6 | |
---|
7 | |
---|
8 | CONTAINS |
---|
9 | |
---|
10 | SUBROUTINE call_atke(dtime,ngrid,nlay,nsrf,ni,cdrag_uv,cdrag_t,u_surf,v_surf,temp_surf, & |
---|
11 | wind_u,wind_v,temp,qvap,play,pinterf, & |
---|
12 | tke,eps,Km_out,Kh_out) |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | USE lmdz_atke_turbulence_ini, ONLY: iflag_num_atke, rg, rd |
---|
18 | USE phys_local_var_mod, ONLY: tke_shear, tke_buoy, tke_trans |
---|
19 | |
---|
20 | IMPLICIT NONE |
---|
21 | |
---|
22 | |
---|
23 | ! Declarations: |
---|
24 | !============= |
---|
25 | |
---|
26 | REAL, INTENT(IN) :: dtime ! timestep (s) |
---|
27 | INTEGER, INTENT(IN) :: ngrid ! number of horizontal index (flat grid) |
---|
28 | INTEGER, INTENT(IN) :: nlay ! number of vertical index |
---|
29 | INTEGER, INTENT(IN) :: nsrf ! surface tile index |
---|
30 | INTEGER, DIMENSION(ngrid), INTENT(IN) :: ni ! array of indices to move from knon to klon arrays |
---|
31 | |
---|
32 | |
---|
33 | REAL, DIMENSION(ngrid), INTENT(IN) :: cdrag_uv ! drag coefficient for wind |
---|
34 | REAL, DIMENSION(ngrid), INTENT(IN) :: cdrag_t ! drag coefficient for temperature |
---|
35 | |
---|
36 | REAL, DIMENSION(ngrid), INTENT(IN) :: u_surf ! x wind velocity at the surface |
---|
37 | REAL, DIMENSION(ngrid), INTENT(IN) :: v_surf ! y wind velocity at the surface |
---|
38 | REAL, DIMENSION(ngrid), INTENT(IN) :: temp_surf ! surface temperature |
---|
39 | |
---|
40 | REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: wind_u ! zonal velocity (m/s) |
---|
41 | REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: wind_v ! meridional velocity (m/s) |
---|
42 | REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: temp ! temperature (K) |
---|
43 | REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: qvap ! specific humidity (kg/kg) |
---|
44 | REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: play ! pressure (Pa) |
---|
45 | REAL, DIMENSION(ngrid,nlay+1), INTENT(IN) :: pinterf ! pressure at interfaces(Pa) |
---|
46 | |
---|
47 | |
---|
48 | REAL, DIMENSION(ngrid,nlay+1), INTENT(INOUT) :: tke ! turbulent kinetic energy at interface between layers |
---|
49 | |
---|
50 | REAL, DIMENSION(ngrid,nlay+1), INTENT(OUT) :: eps ! output: tke dissipation rate at interface between layers |
---|
51 | REAL, DIMENSION(ngrid,nlay), INTENT(OUT) :: Km_out ! output: Exchange coefficient for momentum at interface between layers |
---|
52 | REAL, DIMENSION(ngrid,nlay), INTENT(OUT) :: Kh_out ! output: Exchange coefficient for heat flux at interface between layers |
---|
53 | |
---|
54 | |
---|
55 | REAL, DIMENSION(ngrid,nlay+1) :: tke_shear_term,tke_buoy_term,tke_trans_term |
---|
56 | REAL, DIMENSION(ngrid,nlay) :: wind_u_predict, wind_v_predict |
---|
57 | REAL, DIMENSION(ngrid) :: wind1 |
---|
58 | INTEGER i,j,k |
---|
59 | |
---|
60 | |
---|
61 | CALL atke_compute_km_kh(ngrid,nlay,dtime,& |
---|
62 | wind_u,wind_v,temp,qvap,play,pinterf,cdrag_uv,& |
---|
63 | tke,eps,tke_shear_term,tke_buoy_term,tke_trans_term,Km_out,Kh_out) |
---|
64 | |
---|
65 | |
---|
66 | |
---|
67 | IF (iflag_num_atke == 1) THEN |
---|
68 | !! In this case, we make an explicit prediction of the wind shear to calculate the tke in a |
---|
69 | !! forward backward way |
---|
70 | !! pay attention that the treatment of the TKE |
---|
71 | !! has to be adapted when solving the TKE with a prognostic equation |
---|
72 | |
---|
73 | DO i=1,ngrid |
---|
74 | wind1(i)=sqrt(wind_u(i,1)**2+wind_v(i,1)**2) |
---|
75 | enddo |
---|
76 | CALL atke_explicit_prediction(ngrid,nlay,rg,rd,dtime,pinterf,play,temp,wind1,wind_u,Km_out,u_surf,cdrag_uv,wind_u_predict) |
---|
77 | CALL atke_explicit_prediction(ngrid,nlay,rg,rd,dtime,pinterf,play,temp,wind1,wind_v,Km_out,v_surf,cdrag_uv,wind_v_predict) |
---|
78 | |
---|
79 | |
---|
80 | CALL atke_compute_km_kh(ngrid,nlay,dtime,& |
---|
81 | wind_u_predict,wind_v_predict,temp,qvap,play,pinterf,cdrag_uv, & |
---|
82 | tke,eps,tke_shear_term,tke_buoy_term,tke_trans_term,Km_out,Kh_out) |
---|
83 | |
---|
84 | end if |
---|
85 | |
---|
86 | |
---|
87 | ! Diagnostics of tke loss/source terms |
---|
88 | |
---|
89 | DO k=1,nlay+1 |
---|
90 | DO i=1,ngrid |
---|
91 | j=ni(i) |
---|
92 | tke_shear(j,k,nsrf)=tke_shear_term(i,k) |
---|
93 | tke_buoy(j,k,nsrf)=tke_buoy_term(i,k) |
---|
94 | tke_trans(j,k,nsrf)=tke_trans_term(i,k) |
---|
95 | ENDDO |
---|
96 | ENDDO |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | END SUBROUTINE call_atke |
---|
101 | |
---|
102 | !---------------------------------------------------------------------------------------- |
---|
103 | |
---|
104 | SUBROUTINE atke_explicit_prediction(ngrid,nlay,rg,rd,dtime,pinterf,play,temp,wind1,x_in,K_in,x_surf,cdrag,x_predict) |
---|
105 | |
---|
106 | INTEGER, INTENT(IN) :: ngrid ! number of horizontal index (flat grid) |
---|
107 | INTEGER, INTENT(IN) :: nlay ! number of vertical index |
---|
108 | REAL, INTENT(IN) :: rg,rd,dtime ! gravity, R dry air and timestep |
---|
109 | REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: play ! pressure middle of layers (Pa) |
---|
110 | REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: temp ! temperature (K) |
---|
111 | REAL, DIMENSION(ngrid), INTENT(IN) :: wind1 ! wind speed first level (m/s) |
---|
112 | REAL, DIMENSION(ngrid,nlay+1), INTENT(IN) :: pinterf ! pressure at interfaces(Pa) |
---|
113 | REAL, DIMENSION(ngrid,nlay), INTENT(IN) :: x_in ! variable at the beginning of timestep |
---|
114 | REAL, DIMENSION(ngrid,nlay+1), INTENT(IN) :: K_in ! eddy diffusivity coef at the beginning of time step |
---|
115 | REAL, DIMENSION(ngrid), INTENT(IN) :: x_surf ! surface variable |
---|
116 | REAL, DIMENSION(ngrid), INTENT(IN) :: cdrag ! drag coefficient |
---|
117 | REAL, DIMENSION(ngrid,nlay), INTENT(OUT) :: x_predict ! variable at the end of time step after explicit prediction |
---|
118 | |
---|
119 | |
---|
120 | INTEGER i,k |
---|
121 | REAL ml,F1,rho |
---|
122 | REAL, DIMENSION(ngrid) :: play1,temp1 |
---|
123 | REAL, DIMENSION(ngrid,nlay+1) :: K_big |
---|
124 | |
---|
125 | ! computation of K_big |
---|
126 | |
---|
127 | play1(:)=play(:,1) |
---|
128 | temp1(:)=temp(:,1) |
---|
129 | |
---|
130 | ! "big K" calculation |
---|
131 | DO k=2,nlay-1 |
---|
132 | DO i=1,ngrid |
---|
133 | rho=pinterf(i,k)/rd/(0.5*(temp(i,k-1)+temp(i,k))) |
---|
134 | K_big(i,k)=rg*K_in(i,k)/(play(i,k)-play(i,k+1))*(rho**2) |
---|
135 | enddo |
---|
136 | END DO |
---|
137 | ! speficic treatment for k=nlay |
---|
138 | DO i=1,ngrid |
---|
139 | rho=pinterf(i,nlay)/rd/temp(i,nlay) |
---|
140 | K_big(i,nlay)=rg*K_in(i,nlay)/(2*(play(i,nlay)-pinterf(i,nlay+1)))*(rho**2) |
---|
141 | END DO |
---|
142 | |
---|
143 | |
---|
144 | |
---|
145 | ! x_predict calculation for 2<=k<=nlay-1 |
---|
146 | DO k=2,nlay-1 |
---|
147 | DO i=1,ngrid |
---|
148 | ml=(pinterf(i,k)-pinterf(i,k+1))/rg |
---|
149 | x_predict(i,k)=x_in(i,k)-dtime/ml*(-K_big(i,k+1)*x_in(i,k+1) & |
---|
150 | + (K_big(i,k)+K_big(i,k+1))*x_in(i,k) & |
---|
151 | - K_big(i,k)*x_in(i,k-1)) |
---|
152 | enddo |
---|
153 | END DO |
---|
154 | |
---|
155 | ! Specific treatment for k=1 |
---|
156 | DO i=1,ngrid |
---|
157 | ml=(pinterf(i,1)-pinterf(i,2))/rg |
---|
158 | F1=-play1(i)/rd/temp1(i)*wind1(i)*cdrag(i)*(x_in(i,1)-x_surf(i)) ! attention convention sens du flux |
---|
159 | x_predict(i,1)=x_in(i,1)-dtime/ml*(-K_big(i,2)*(x_in(i,2) - x_in(i,1))-F1) |
---|
160 | END DO |
---|
161 | |
---|
162 | ! Specific treatment for k=nlay |
---|
163 | ! flux at the top of the atmosphere=0 |
---|
164 | DO i=1,ngrid |
---|
165 | ml=0.5*(pinterf(i,nlay)-pinterf(i,nlay+1))/rg |
---|
166 | x_predict(i,nlay)=x_in(i,nlay)+dtime/ml*(K_big(i,nlay)*(x_in(i,nlay)-x_in(i,nlay-1))) |
---|
167 | END DO |
---|
168 | |
---|
169 | |
---|
170 | END SUBROUTINE atke_explicit_prediction |
---|
171 | |
---|
172 | |
---|
173 | |
---|
174 | END MODULE lmdz_call_atke |
---|