100 type(model_state_type),
target,
intent(inout) :: current_state
105 if (.not. is_component_enabled(current_state%options_database,
"mean_profiles"))
then
106 call log_master_log(log_error,
"Damping requires the mean profiles component to be enabled")
109 dmptim=options_get_real(current_state%options_database,
"dmptim")
110 zdmp=options_get_real(current_state%options_database,
"zdmp")
111 hdmp=options_get_real(current_state%options_database,
"hdmp")
113 allocate(current_state%global_grid%configuration%vertical%dmpco(current_state%local_grid%size(z_index)), &
114 current_state%global_grid%configuration%vertical%dmpcoz(current_state%local_grid%size(z_index)))
115 current_state%global_grid%configuration%vertical%dmpco(:)=0.
116 current_state%global_grid%configuration%vertical%dmpcoz(:)=0.
117 do k=current_state%local_grid%size(z_index),1,-1
118 current_state%global_grid%configuration%vertical%kdmpmin=k
119 if (current_state%global_grid%configuration%vertical%zn(k) .ge.
zdmp)
then
120 current_state%global_grid%configuration%vertical%dmpco(k)=
dmptim*(exp((&
121 current_state%global_grid%configuration%vertical%zn(k)-
zdmp)/
hdmp)-1.0)
123 if (current_state%global_grid%configuration%vertical%z(k) .ge.
zdmp)
then
124 current_state%global_grid%configuration%vertical%dmpcoz(k)=
dmptim*(exp((&
125 current_state%global_grid%configuration%vertical%z(k)-
zdmp)/
hdmp)-1.0)
127 if(current_state%global_grid%configuration%vertical%zn(k).lt.
zdmp)
exit
133 l_qdiag = (.not. current_state%passive_q .and. current_state%number_q_fields .gt. 0)
159 l_tend_pr_tot_tke = current_state%u%active .and. current_state%v%active .and. current_state%w%active
163 allocate(
tend_3d_u(current_state%local_grid%size(z_index), &
164 current_state%local_grid%size(y_index), &
165 current_state%local_grid%size(x_index) ) )
168 allocate(
tend_3d_v(current_state%local_grid%size(z_index), &
169 current_state%local_grid%size(y_index), &
170 current_state%local_grid%size(x_index) ) )
173 allocate(
tend_3d_w(current_state%local_grid%size(z_index), &
174 current_state%local_grid%size(y_index), &
175 current_state%local_grid%size(x_index) ) )
178 allocate(
tend_3d_th(current_state%local_grid%size(z_index), &
179 current_state%local_grid%size(y_index), &
180 current_state%local_grid%size(x_index) ) )
183 iqv=get_q_index(standard_q_names%VAPOUR,
'damping')
184 allocate(
tend_3d_qv(current_state%local_grid%size(z_index), &
185 current_state%local_grid%size(y_index), &
186 current_state%local_grid%size(x_index) ) )
189 iql=get_q_index(standard_q_names%CLOUD_LIQUID_MASS,
'damping')
190 allocate(
tend_3d_ql(current_state%local_grid%size(z_index), &
191 current_state%local_grid%size(y_index), &
192 current_state%local_grid%size(x_index) ) )
195 iqi=get_q_index(standard_q_names%ICE_MASS,
'damping')
196 allocate(
tend_3d_qi(current_state%local_grid%size(z_index), &
197 current_state%local_grid%size(y_index), &
198 current_state%local_grid%size(x_index) ) )
201 iqr=get_q_index(standard_q_names%RAIN_MASS,
'damping')
202 allocate(
tend_3d_qr(current_state%local_grid%size(z_index), &
203 current_state%local_grid%size(y_index), &
204 current_state%local_grid%size(x_index) ) )
207 iqs=get_q_index(standard_q_names%SNOW_MASS,
'damping')
208 allocate(
tend_3d_qs(current_state%local_grid%size(z_index), &
209 current_state%local_grid%size(y_index), &
210 current_state%local_grid%size(x_index) ) )
213 iqg=get_q_index(standard_q_names%GRAUPEL_MASS,
'damping')
214 allocate(
tend_3d_qg(current_state%local_grid%size(z_index), &
215 current_state%local_grid%size(y_index), &
216 current_state%local_grid%size(x_index) ) )
219 allocate(
tend_3d_tabs(current_state%local_grid%size(z_index), &
220 current_state%local_grid%size(y_index), &
221 current_state%local_grid%size(x_index) ) )
226 allocate(
tend_pr_tot_u(current_state%local_grid%size(z_index)) )
229 allocate(
tend_pr_tot_v(current_state%local_grid%size(z_index)) )
232 allocate(
tend_pr_tot_w(current_state%local_grid%size(z_index)) )
235 allocate(
tend_pr_tot_th(current_state%local_grid%size(z_index)) )
238 allocate(
tend_pr_tot_qv(current_state%local_grid%size(z_index)) )
241 allocate(
tend_pr_tot_ql(current_state%local_grid%size(z_index)) )
244 allocate(
tend_pr_tot_qi(current_state%local_grid%size(z_index)) )
247 allocate(
tend_pr_tot_qr(current_state%local_grid%size(z_index)) )
250 allocate(
tend_pr_tot_qs(current_state%local_grid%size(z_index)) )
253 allocate(
tend_pr_tot_qg(current_state%local_grid%size(z_index)) )
272 type(model_state_type),
target,
intent(inout) :: current_state
308 type(model_state_type),
target,
intent(inout) :: current_state
311 integer :: current_x_index, current_y_index, target_x_index, target_y_index
313 current_x_index=current_state%column_local_x
314 current_y_index=current_state%column_local_y
315 target_y_index=current_y_index-current_state%local_grid%halo_size(y_index)
316 target_x_index=current_x_index-current_state%local_grid%halo_size(x_index)
320 if (current_state%first_timestep_column)
then
361 if (current_state%halo_column .and. current_state%timestep <3)
return
367 do k=current_state%global_grid%configuration%vertical%kdmpmin,current_state%local_grid%size(z_index)
369 current_state%su%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%su%data(k, &
370 current_state%column_local_y, current_state%column_local_x)-&
371 current_state%global_grid%configuration%vertical%dmpco(k)*(current_state%zu%data(k, current_state%column_local_y, &
372 current_state%column_local_x)- (current_state%global_grid%configuration%vertical%olzubar(k)-current_state%ugal))
375 current_state%sv%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%sv%data(k, &
376 current_state%column_local_y, current_state%column_local_x)-&
377 current_state%global_grid%configuration%vertical%dmpco(k)*(current_state%zv%data(k, current_state%column_local_y, &
378 current_state%column_local_x)-(current_state%global_grid%configuration%vertical%olzvbar(k)-current_state%vgal))
380 if (current_state%th%active)
then
381 current_state%sth%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%sth%data(k, &
382 current_state%column_local_y, current_state%column_local_x)-&
383 current_state%global_grid%configuration%vertical%dmpco(k)*(current_state%zth%data(k, current_state%column_local_y, &
384 current_state%column_local_x)-current_state%global_grid%configuration%vertical%olzthbar(k))
387 do i=1,current_state%number_q_fields
388 if (current_state%q(i)%active)
then
389 current_state%sq(i)%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%sq(i)%data(k, &
390 current_state%column_local_y, current_state%column_local_x)-&
391 current_state%global_grid%configuration%vertical%dmpco(k)*&
392 (current_state%zq(i)%data(k, current_state%column_local_y, current_state%column_local_x)-&
393 current_state%global_grid%configuration%vertical%olzqbar(k,i))
398 do k=current_state%global_grid%configuration%vertical%kdmpmin,current_state%local_grid%size(z_index)-1
399 current_state%sw%data(k, current_state%column_local_y, current_state%column_local_x)=current_state%sw%data(k, &
400 current_state%column_local_y, current_state%column_local_x)-&
401 current_state%global_grid%configuration%vertical%dmpcoz(k)*&
402 current_state%zw%data(k, current_state%column_local_y, current_state%column_local_x)
420 type(model_state_type),
target,
intent(in) :: current_state
421 integer,
intent(in) :: cxn, cyn, txn, tyn
425 tend_3d_u(:,tyn,txn)=current_state%su%data(:,cyn,cxn)
428 tend_3d_v(:,tyn,txn)=current_state%sv%data(:,cyn,cxn)
431 tend_3d_w(:,tyn,txn)=current_state%sw%data(:,cyn,cxn)
434 tend_3d_th(:,tyn,txn)=current_state%sth%data(:,cyn,cxn)
455 tend_3d_tabs(:,tyn,txn)=current_state%sth%data(:,cyn,cxn) * current_state%global_grid%configuration%vertical%rprefrcp(:)
468 type(model_state_type),
target,
intent(inout) :: current_state
469 integer,
intent(in) :: cxn, cyn, txn, tyn
471 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: &
472 uu_tendency, vv_tendency, ww_tendency
508 current_state%sth%data(:,cyn,cxn) * current_state%global_grid%configuration%vertical%rprefrcp(:) &
552 do k=2, current_state%local_grid%size(z_index)
554 uu_tendency(k) = ((current_state%zu%data(k,cyn,cxn) &
555 +
tend_3d_u(k,tyn,txn)*current_state%dtm * 2.0_default_precision &
556 - current_state%global_grid%configuration%vertical%olzubar(k) )**2 &
558 (current_state%zu%data(k,cyn,cxn) &
559 - current_state%global_grid%configuration%vertical%olzubar(k) )**2 &
560 ) / (current_state%dtm * 2.0_default_precision)
562 vv_tendency(k) = ((current_state%zv%data(k,cyn,cxn) &
563 +
tend_3d_v(k,tyn,txn)*current_state%dtm * 2.0_default_precision &
564 - current_state%global_grid%configuration%vertical%olzvbar(k) )**2 &
566 (current_state%zv%data(k,cyn,cxn) &
567 - current_state%global_grid%configuration%vertical%olzvbar(k) )**2 &
568 ) / (current_state%dtm * 2.0_default_precision)
570 ww_tendency(k) = ((current_state%zw%data(k,cyn,cxn) &
571 +
tend_3d_w(k,tyn,txn)*current_state%dtm * 2.0_default_precision )**2 &
573 current_state%zw%data(k,cyn,cxn)**2 &
574 ) / (current_state%dtm * 2.0_default_precision)
580 uu_tendency(1) = -uu_tendency(2)
581 vv_tendency(1) = -vv_tendency(2)
584 do k=2, current_state%local_grid%size(z_index)-1
586 0.5_default_precision * (uu_tendency(k)+uu_tendency(k+1)) + &
587 0.5_default_precision * (vv_tendency(k)+vv_tendency(k+1)) + &
602 type(model_state_type),
target,
intent(inout) :: current_state
603 character(len=*),
intent(in) :: name
604 type(component_field_information_type),
intent(out) :: field_information
608 strcomp=index(name,
"_damping_3d_local")
609 if (strcomp .ne. 0)
then
610 field_information%field_type=component_array_field_type
611 field_information%number_dimensions=3
612 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
613 field_information%dimension_sizes(2)=current_state%local_grid%size(y_index)
614 field_information%dimension_sizes(3)=current_state%local_grid%size(x_index)
615 field_information%data_type=component_double_data_type
617 if (name .eq.
"tend_u_damping_3d_local")
then
619 else if (name .eq.
"tend_v_damping_3d_local")
then
621 else if (name .eq.
"tend_w_damping_3d_local")
then
623 else if (name .eq.
"tend_th_damping_3d_local")
then
625 else if (name .eq.
"tend_qv_damping_3d_local")
then
627 else if (name .eq.
"tend_ql_damping_3d_local")
then
629 else if (name .eq.
"tend_qi_damping_3d_local")
then
631 else if (name .eq.
"tend_qr_damping_3d_local")
then
633 else if (name .eq.
"tend_qs_damping_3d_local")
then
635 else if (name .eq.
"tend_qg_damping_3d_local")
then
637 else if (name .eq.
"tend_tabs_damping_3d_local")
then
640 field_information%enabled=.true.
646 strcomp=index(name,
"_damping_profile_total_local")
647 if (strcomp .ne. 0)
then
648 field_information%field_type=component_array_field_type
649 field_information%number_dimensions=1
650 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
651 field_information%data_type=component_double_data_type
653 if (name .eq.
"tend_u_damping_profile_total_local")
then
655 else if (name .eq.
"tend_v_damping_profile_total_local")
then
657 else if (name .eq.
"tend_w_damping_profile_total_local")
then
659 else if (name .eq.
"tend_th_damping_profile_total_local")
then
661 else if (name .eq.
"tend_qv_damping_profile_total_local")
then
663 else if (name .eq.
"tend_ql_damping_profile_total_local")
then
665 else if (name .eq.
"tend_qi_damping_profile_total_local")
then
667 else if (name .eq.
"tend_qr_damping_profile_total_local")
then
669 else if (name .eq.
"tend_qs_damping_profile_total_local")
then
671 else if (name .eq.
"tend_qg_damping_profile_total_local")
then
673 else if (name .eq.
"tend_tabs_damping_profile_total_local")
then
676 else if (name .eq.
"tend_tke_damping_profile_total_local")
then
680 field_information%enabled=.true.
693 type(model_state_type),
target,
intent(inout) :: current_state
694 character(len=*),
intent(in) :: name
695 type(component_field_value_type),
intent(out) :: field_value
698 if (name .eq.
"tend_u_damping_3d_local" .and.
allocated(
tend_3d_u))
then
700 else if (name .eq.
"tend_v_damping_3d_local" .and.
allocated(
tend_3d_v))
then
702 else if (name .eq.
"tend_w_damping_3d_local" .and.
allocated(
tend_3d_w))
then
704 else if (name .eq.
"tend_th_damping_3d_local" .and.
allocated(
tend_3d_th))
then
706 else if (name .eq.
"tend_qv_damping_3d_local" .and.
allocated(
tend_3d_qv))
then
708 else if (name .eq.
"tend_ql_damping_3d_local" .and.
allocated(
tend_3d_ql))
then
710 else if (name .eq.
"tend_qi_damping_3d_local" .and.
allocated(
tend_3d_qi))
then
712 else if (name .eq.
"tend_qr_damping_3d_local" .and.
allocated(
tend_3d_qr))
then
714 else if (name .eq.
"tend_qs_damping_3d_local" .and.
allocated(
tend_3d_qs))
then
716 else if (name .eq.
"tend_qg_damping_3d_local" .and.
allocated(
tend_3d_qg))
then
718 else if (name .eq.
"tend_tabs_damping_3d_local" .and.
allocated(
tend_3d_tabs))
then
722 else if (name .eq.
"tend_u_damping_profile_total_local" .and.
allocated(
tend_pr_tot_u))
then
724 else if (name .eq.
"tend_v_damping_profile_total_local" .and.
allocated(
tend_pr_tot_v))
then
726 else if (name .eq.
"tend_w_damping_profile_total_local" .and.
allocated(
tend_pr_tot_w))
then
728 else if (name .eq.
"tend_th_damping_profile_total_local" .and.
allocated(
tend_pr_tot_th))
then
730 else if (name .eq.
"tend_qv_damping_profile_total_local" .and.
allocated(
tend_pr_tot_qv))
then
732 else if (name .eq.
"tend_ql_damping_profile_total_local" .and.
allocated(
tend_pr_tot_ql))
then
734 else if (name .eq.
"tend_qi_damping_profile_total_local" .and.
allocated(
tend_pr_tot_qi))
then
736 else if (name .eq.
"tend_qr_damping_profile_total_local" .and.
allocated(
tend_pr_tot_qr))
then
738 else if (name .eq.
"tend_qs_damping_profile_total_local" .and.
allocated(
tend_pr_tot_qs))
then
740 else if (name .eq.
"tend_qg_damping_profile_total_local" .and.
allocated(
tend_pr_tot_qg))
then
742 else if (name .eq.
"tend_tabs_damping_profile_total_local" .and.
allocated(
tend_pr_tot_tabs))
then
745 else if (name .eq.
"tend_tke_damping_profile_total_local" .and.
allocated(
tend_pr_tot_tke))
then
758 type(component_field_value_type),
intent(inout) :: field_value
759 real(kind=default_precision),
dimension(:),
optional :: real_1d_field
760 real(kind=default_precision),
dimension(:,:),
optional :: real_2d_field
761 real(kind=default_precision),
dimension(:,:,:),
optional :: real_3d_field
763 if (
present(real_1d_field))
then
764 allocate(field_value%real_1d_array(
size(real_1d_field)), source=real_1d_field)
765 else if (
present(real_2d_field))
then
766 allocate(field_value%real_2d_array(
size(real_2d_field, 1),
size(real_2d_field, 2)), source=real_2d_field)
767 else if (
present(real_3d_field))
then
768 allocate(field_value%real_3d_array(
size(real_3d_field, 1),
size(real_3d_field, 2),
size(real_3d_field, 3)), &
769 source=real_3d_field)