120 type(model_state_type),
target,
intent(inout) :: current_state
124 if (current_state%first_timestep_column) then
125 uwsg_tot(:) = 0.0_default_precision
126 vwsg_tot(:) = 0.0_default_precision
127 uusg_tot(:) = 0.0_default_precision
128 vvsg_tot(:) = 0.0_default_precision
129 wwsg_tot(:) = 0.0_default_precision
130 tkesg_tot(:) = 0.0_default_precision
131 wtsg_tot(:) = 0.0_default_precision
132 th2sg_tot(:) = 0.0_default_precision
133 wqsg_tot(:) = 0.0_default_precision
136 if (.not. current_state%halo_column) then
138 do k=1, current_state%local_grid%size(z_index)-1
142 uwsg_tot(k) = uwsg_tot(k) - 0.5 * &
143 current_state%vis_coefficient%data(k,current_state%column_local_y,current_state%column_local_x-1) * &
144 ( current_state%u%data(k+1,current_state%column_local_y,current_state%column_local_x-1) - &
145 current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1) ) * &
146 current_state%global_grid%configuration%vertical%rdzn(k+1)
147 uwsg_tot(k) = uwsg_tot(k) - 0.5 * &
148 current_state%vis_coefficient%data(k,current_state%column_local_y,current_state%column_local_x) * &
149 ( current_state%u%data(k+1,current_state%column_local_y,current_state%column_local_x) - &
150 current_state%u%data(k,current_state%column_local_y,current_state%column_local_x) ) * &
151 current_state%global_grid%configuration%vertical%rdzn(k+1)
155 vwsg_tot(k) = vwsg_tot(k) - 0.5 * &
156 current_state%vis_coefficient%data(k,current_state%column_local_y-1,current_state%column_local_x) * &
157 ( current_state%v%data(k+1,current_state%column_local_y-1,current_state%column_local_x) - &
158 current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x) ) * &
159 current_state%global_grid%configuration%vertical%rdzn(k+1)
160 vwsg_tot(k) = vwsg_tot(k) - 0.5 * &
161 current_state%vis_coefficient%data(k,current_state%column_local_y,current_state%column_local_x) * &
162 ( current_state%v%data(k+1,current_state%column_local_y,current_state%column_local_x) - &
163 current_state%v%data(k,current_state%column_local_y,current_state%column_local_x) ) * &
164 current_state%global_grid%configuration%vertical%rdzn(k+1)
169 if (current_state%th%active) then
170 do k=1, current_state%local_grid%size(z_index)-1
171 wtsg_tot(k) = wtsg_tot(k) - &
172 current_state%diff_coefficient%data(k,current_state%column_local_y,current_state%column_local_x) * &
173 ( current_state%th%data(k+1,current_state%column_local_y,current_state%column_local_x) + &
174 current_state%global_grid%configuration%vertical%thref(k+1) - &
175 current_state%th%data(k,current_state%column_local_y,current_state%column_local_x) - &
176 current_state%global_grid%configuration%vertical%thref(k) ) * &
177 current_state%global_grid%configuration%vertical%rdzn(k+1)
182 if (current_state%th%active .and. .not. current_state%passive_q .and. current_state%number_q_fields .gt. 0) then
184 do k=1, current_state%local_grid%size(z_index)-1
193 ri_crit = 0.25_default_precision
195 ssq=calculate_half_squared_strain_rate(current_state, current_state%u, current_state%v, current_state%w)
196 richardson_number=calculate_richardson_number(current_state, ssq, current_state%th, current_state%q)
198 do k=2, current_state%local_grid%size(z_index)-1
202 current_state%vis_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) &
203 > 0.0) .and. (richardson_number(k) < ri_crit) ) then
205 current_state%vis_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) / &
206 sqrt( 1.0 - richardson_number(k) * &
207 current_state%diff_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) / &
208 current_state%vis_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) )
212 dissipation(k) = ssq(k) * ( &
213 current_state%vis_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) - &
214 richardson_number(k) * &
215 current_state%diff_coefficient%data(k, current_state%column_local_y, current_state%column_local_x) )
220 subgrid_tke(k) = ( dissipation(k) * dissipation(k) * elamr_sq(k) ) ** (1.0/3.0) / a2_n
223 tkesg_tot(k) = tkesg_tot(k) + subgrid_tke(k)
224 uusg_tot(k) = uusg_tot(k) + (2.0/3.0) * subgrid_tke(k)
225 vvsg_tot(k) = vvsg_tot(k) + (2.0/3.0) * subgrid_tke(k)
226 wwsg_tot(k) = wwsg_tot(k) + (2.0/3.0) * subgrid_tke(k)
233 if (current_state%th%active)
then 234 epsth=calculate_thermal_dissipation_rate(current_state, current_state%th)
237 do k=2, current_state%local_grid%size(z_index)-1
238 if (subgrid_tke(k) > 0.0) &
239 th2sg_tot(k) = th2sg_tot(k) + sqrt( a2_n * elamr_sq(k) / subgrid_tke(k) ) * &
240 epsth(k) / ( ath2_n**2 * pr_n)