10 use mpi,
only : mpi_sum, mpi_in_place, mpi_int, mpi_real, mpi_double, mpi_comm
60 type(model_state_type),
target,
intent(inout) :: current_state
63 tpts = current_state%global_grid%size(x_index)*current_state%global_grid%size(y_index)
65 start_x = current_state%local_grid%local_domain_start_index(x_index)
66 end_x = current_state%local_grid%local_domain_end_index(x_index)
67 start_y = current_state%local_grid%local_domain_start_index(y_index)
68 end_y = current_state%local_grid%local_domain_end_index(y_index)
75 uppercrit = options_get_real(current_state%options_database,
"uppercrit")
76 dwnpercrit = options_get_real(current_state%options_database,
"dwnpercrit")
78 show_critical_w = options_get_logical(current_state%options_database,
"show_critical_w")
89 call mpi_allgather(
lpts, 1, mpi_int,
gpts_on_proc, 1, mpi_int, current_state%parallel%monc_communicator, ierr)
94 do inc = 2, current_state%parallel%processes
99 if (.not. current_state%continuation_run)
then
100 allocate(current_state%global_grid%configuration%vertical%w_dwn(current_state%local_grid%size(z_index)),&
101 current_state%global_grid%configuration%vertical%w_up(current_state%local_grid%size(z_index)))
113 type(model_state_type),
target,
intent(inout) :: current_state
128 type(model_state_type),
target,
intent(inout) :: current_state
137 type(model_state_type),
target,
intent(inout) :: current_state
138 real(kind=default_precision),
dimension(lpts) :: tmp_var
140 integer :: i, j, k, num_neg, num_pos, dd_thresh_pos, ud_thresh_pos
141 integer :: max_up_k, min_dwn_k
142 real(kind=default_precision),
dimension((lpts+1)/2) :: t
143 real(kind=default_precision),
dimension((tpts+1)/2) :: tall
144 real(kind=default_precision) :: max_up, min_dwn, &
145 max_up_th, min_dwn_th
147 real(kind=default_precision),
dimension(ysize,xsize) :: l2d
150 max_up_th = 0.0_default_precision
151 min_dwn_th = 0.0_default_precision
158 current_state%global_grid%configuration%vertical%w_dwn(:) = 0.0_default_precision
159 current_state%global_grid%configuration%vertical%w_up(:) = 0.0_default_precision
162 do k = 2, current_state%local_grid%size(z_index)
169 tmp_var=pack(l2d,.true.)
176 0, current_state%parallel%monc_communicator, ierr )
179 if (current_state%parallel%my_rank == 0)
then
185 num_neg = count(
tmp_all < 0.0_default_precision)
186 num_pos = count(
tmp_all > 0.0_default_precision)
191 if ( dd_thresh_pos == 0 ) dd_thresh_pos = 1
192 if ( ud_thresh_pos == 0 .or. num_pos == 0 ) ud_thresh_pos =
tpts
194 current_state%global_grid%configuration%vertical%w_dwn(k) =
tmp_all(dd_thresh_pos)
195 current_state%global_grid%configuration%vertical%w_up(k) =
tmp_all(ud_thresh_pos)
199 if (
tmp_all(dd_thresh_pos) < min_dwn_th )
then
200 min_dwn_th =
tmp_all(dd_thresh_pos)
204 if (
tmp_all(ud_thresh_pos) > max_up_th )
then
205 max_up_th =
tmp_all(ud_thresh_pos)
216 call mpi_bcast(current_state%global_grid%configuration%vertical%w_dwn(:), current_state%local_grid%size(z_index), &
217 precision_type, 0, current_state%parallel%monc_communicator, ierr)
218 call mpi_bcast(current_state%global_grid%configuration%vertical%w_up(:), current_state%local_grid%size(z_index), &
219 precision_type, 0, current_state%parallel%monc_communicator, ierr)
224 call log_master_log(log_info,
'Time: '//trim(conv_to_string(current_state%time))//
' s')
225 call log_master_log(log_info,
'Maximum updraft threshold: '&
226 //trim(conv_to_string(max_up_th))//
' found at level '//trim(conv_to_string(max_up_k)) )
227 call log_master_log(log_info,
'Maximum updraft: '&
228 //trim(conv_to_string(max_up))//
' at level '//trim(conv_to_string(max_up_k)) )
229 call log_master_log(log_info,
'Minimum downdraft threshold: '&
230 //trim(conv_to_string(min_dwn_th))//
' found at level '//trim(conv_to_string(min_dwn_k)) )
231 call log_master_log(log_info,
'Minimum downdraft: '&
232 //trim(conv_to_string(min_dwn))//
' at level '//trim(conv_to_string(min_dwn_k)) )
244 integer,
intent(in) :: NA,NB,NC
245 real(kind=default_precision),
intent(in out) :: a(na)
246 real(kind=default_precision),
intent(in) :: b(nb)
247 real(kind=default_precision),
intent(in out) :: c(nc)
252 do while(i <= na .and. j <= nb)
253 if (a(i) <= b(j))
then
279 integer,
intent(in) :: n
280 real(kind=default_precision),
dimension(N),
intent(in out) :: a
281 real(kind=default_precision),
dimension((N+1)/2),
intent (out) :: t
284 real(kind=default_precision) :: v
288 if (a(1) > a(2))
then
301 if (a(na) > a(na+1))
then
315 type(model_state_type),
target,
intent(inout) :: current_state
316 character(len=*),
intent(in) :: name
317 type(component_field_information_type),
intent(out) :: field_information
319 field_information%field_type=component_array_field_type
320 field_information%number_dimensions=1
321 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
322 field_information%data_type=component_double_data_type
323 field_information%enabled=.true.
334 type(model_state_type),
target,
intent(inout) :: current_state
335 character(len=*),
intent(in) :: name
336 type(component_field_value_type),
intent(out) :: field_value
338 if (name .eq.
"critical_updraft_local")
then
339 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)), &
340 source=current_state%global_grid%configuration%vertical%w_up(:))
341 else if (name .eq.
"critical_downdraft_local")
then
342 allocate(field_value%real_1d_array(current_state%local_grid%size(z_index)), &
343 source=current_state%global_grid%configuration%vertical%w_dwn(:))