21 vw_w,
tu_su,
uu_advection,
uu_viscosity,
wu_u,
tv_sv,
vv_advection,
vv_viscosity,
wv_v,
tw_sw,
ww_advection, &
30 ww_qt,
qt_qt,
sqt_qt,
qt_qt_advection,
qt_qt_diffusion,
wqt_qt,
sres,
wke,
buoy,
wp,
tend
50 integer :: current_index, total_number_published_fields
71 current_index=current_index+1
77 current_index=current_index+1
83 current_index=current_index+1
89 current_index=current_index+1
95 current_index=current_index+1
101 current_index=current_index+1
107 current_index=current_index+1
113 current_index=current_index+1
119 current_index=current_index+1
126 type(model_state_type),
target,
intent(inout) :: current_state
143 type(model_state_type),
target,
intent(inout) :: current_state
146 if (current_state%first_timestep_column)
then
157 if (.not. current_state%halo_column)
then
174 type(model_state_type),
target,
intent(inout) :: current_state
195 if (
allocated(
uw_w))
deallocate(
uw_w)
196 if (
allocated(
vw_w))
deallocate(
vw_w)
198 if (
allocated(
sres))
deallocate(
sres)
199 if (
allocated(
buoy))
deallocate(
buoy)
200 if (
allocated(
wke))
deallocate(
wke)
201 if (
allocated(
wp))
deallocate(
wp)
202 if (
allocated(
tend))
deallocate(
tend)
207 if (
allocated(
wu_u))
deallocate(
wu_u)
211 if (
allocated(
wv_v))
deallocate(
wv_v)
269 if (
allocated(
w_qt))
deallocate(
w_qt)
398 type(model_state_type),
target,
intent(inout) :: current_state
399 character(len=*),
intent(in) :: name
400 type(component_field_information_type),
intent(out) :: field_information
403 field_information%field_type=component_array_field_type
404 field_information%data_type=component_double_data_type
409 field_information%number_dimensions=1
410 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
429 field_information%number_dimensions=2
430 field_information%dimension_sizes(1)=current_state%local_grid%size(z_index)
431 field_information%dimension_sizes(2)=current_state%number_q_fields
439 type(model_state_type),
target,
intent(inout) :: current_state
441 wmfcrit=options_get_real(current_state%options_database,
"wmfcrit")
448 type(model_state_type),
target,
intent(inout) :: current_state
450 integer :: column_size
451 logical :: us_qt_enabled, u_qt_advection_enabled, u_qt_viscosity_diffusion_enabled, &
452 wu_qt_enabled, vs_qt_enabled, v_qt_advection_enabled, &
453 v_qt_viscosity_diffusion_enabled, wv_qt_enabled, w_qt_enabled, ws_qt_enabled, &
454 w_qt_advection_enabled, w_qt_viscosity_diffusion_enabled, w_qt_buoyancy_enabled, ww_qt_enabled, &
455 qt_qt_enabled, sqt_qt_enabled, qt_qt_advection_enabled, &
456 qt_qt_diffusion_enabled, wqt_qt_enabled
458 column_size=current_state%local_grid%size(z_index)
460 us_qt_enabled=current_state%u%active .and. current_state%th%active
461 u_qt_advection_enabled=is_component_field_available(
"u_advection") .and. &
462 is_component_field_available(
"th_advection") .and. us_qt_enabled
463 u_qt_viscosity_diffusion_enabled=is_component_field_available(
"u_viscosity") .and. &
464 is_component_field_available(
"th_diffusion") .and. us_qt_enabled
465 wu_qt_enabled=current_state%w%active .and. us_qt_enabled
469 if (us_qt_enabled)
then
471 allocate(
us_qt(column_size))
473 if (u_qt_advection_enabled)
then
477 if (u_qt_viscosity_diffusion_enabled)
then
481 if (wu_qt_enabled)
then
483 allocate(
wu_qt(column_size))
486 vs_qt_enabled=current_state%v%active .and. current_state%th%active
487 v_qt_advection_enabled=is_component_field_available(
"v_advection") .and. &
488 is_component_field_available(
"th_advection") .and. vs_qt_enabled
489 v_qt_viscosity_diffusion_enabled=is_component_field_available(
"v_viscosity") .and. &
490 is_component_field_available(
"th_diffusion") .and. vs_qt_enabled
491 wv_qt_enabled=current_state%w%active .and. vs_qt_enabled
495 if (vs_qt_enabled)
then
497 allocate(
vs_qt(column_size))
499 if (v_qt_advection_enabled)
then
503 if (v_qt_viscosity_diffusion_enabled)
then
507 if (wv_qt_enabled)
then
509 allocate(
wv_qt(column_size))
512 w_qt_enabled=current_state%w%active .and. current_state%th%active
513 ws_qt_enabled=w_qt_enabled
514 w_qt_advection_enabled=is_component_field_available(
"w_advection") .and. &
515 is_component_field_available(
"th_advection") .and. w_qt_enabled
516 w_qt_viscosity_diffusion_enabled=is_component_field_available(
"w_viscosity") .and. &
517 is_component_field_available(
"th_diffusion") .and. w_qt_enabled
518 w_qt_buoyancy_enabled=current_state%th%active .and. is_component_field_available(
"w_buoyancy")
519 ww_qt_enabled=w_qt_enabled
523 if (w_qt_enabled)
then
525 allocate(
w_qt(column_size))
527 if (ws_qt_enabled)
then
529 allocate(
ws_qt(column_size))
531 if (w_qt_advection_enabled)
then
535 if (w_qt_viscosity_diffusion_enabled)
then
539 if (w_qt_buoyancy_enabled)
then
543 if (ww_qt_enabled)
then
545 allocate(
ww_qt(column_size))
548 qt_qt_enabled=current_state%th%active
549 sqt_qt_enabled=qt_qt_enabled
550 qt_qt_advection_enabled=is_component_field_available(
"qt_advection") .and. qt_qt_enabled
551 qt_qt_diffusion_enabled=is_component_field_available(
"qt_diffusion") .and. qt_qt_enabled
552 wqt_qt_enabled=current_state%w%active .and. qt_qt_enabled
556 if (qt_qt_enabled)
then
558 allocate(
qt_qt(column_size))
560 if (sqt_qt_enabled)
then
562 allocate(
sqt_qt(column_size))
564 if (qt_qt_advection_enabled)
then
568 if (qt_qt_diffusion_enabled)
then
572 if (wqt_qt_enabled)
then
574 allocate(
wqt_qt(column_size))
582 type(model_state_type),
target,
intent(inout) :: current_state
584 integer :: column_size
585 logical :: u_mse_enabled, us_mse_enabled, u_mse_advection_enabled, u_mse_viscosity_diffusion_enabled, &
586 wu_mse_enabled, v_mse_enabled, vs_mse_enabled, v_mse_advection_enabled, &
587 v_mse_viscosity_diffusion_enabled, wv_mse_enabled, w_mse_enabled, ws_mse_enabled, &
588 w_mse_advection_enabled, w_mse_viscosity_diffusion_enabled, w_mse_buoyancy_enabled, ww_mse_enabled, &
589 mse_mse_enabled, smse_mse_enabled, mse_mse_advection_enabled, &
590 mse_mse_diffusion_enabled, wmse_mse_enabled
592 column_size=current_state%local_grid%size(z_index)
594 u_mse_enabled=current_state%u%active .and. current_state%th%active
595 us_mse_enabled=u_mse_enabled
596 u_mse_advection_enabled=is_component_field_available(
"u_advection") .and. &
597 is_component_field_available(
"th_advection") .and. u_mse_enabled
598 u_mse_viscosity_diffusion_enabled=is_component_field_available(
"u_viscosity") .and. &
599 is_component_field_available(
"th_diffusion") .and. u_mse_enabled
600 wu_mse_enabled=current_state%w%active .and. u_mse_enabled
604 if (u_mse_enabled)
then
606 allocate(
u_mse(column_size))
608 if (us_mse_enabled)
then
610 allocate(
us_mse(column_size))
612 if (u_mse_advection_enabled)
then
616 if (u_mse_viscosity_diffusion_enabled)
then
620 if (wu_mse_enabled)
then
622 allocate(
wu_mse(column_size))
625 v_mse_enabled=current_state%v%active .and. current_state%th%active
626 vs_mse_enabled=v_mse_enabled
627 v_mse_advection_enabled=is_component_field_available(
"v_advection") .and. &
628 is_component_field_available(
"th_advection") .and. v_mse_enabled
629 v_mse_viscosity_diffusion_enabled=is_component_field_available(
"v_viscosity") .and. &
630 is_component_field_available(
"th_diffusion") .and. v_mse_enabled
631 wv_mse_enabled=current_state%w%active .and. v_mse_enabled
635 if (v_mse_enabled)
then
637 allocate(
v_mse(column_size))
639 if (vs_mse_enabled)
then
641 allocate(
vs_mse(column_size))
643 if (v_mse_advection_enabled)
then
647 if (v_mse_viscosity_diffusion_enabled)
then
651 if (wv_mse_enabled)
then
653 allocate(
wv_mse(column_size))
656 w_mse_enabled=current_state%w%active .and. current_state%th%active
657 ws_mse_enabled=w_mse_enabled
658 w_mse_advection_enabled=is_component_field_available(
"w_advection") .and. &
659 is_component_field_available(
"th_advection") .and. w_mse_enabled
660 w_mse_viscosity_diffusion_enabled=is_component_field_available(
"w_viscosity") .and. &
661 is_component_field_available(
"th_diffusion") .and. w_mse_enabled
662 w_mse_buoyancy_enabled=current_state%th%active .and. is_component_field_available(
"w_buoyancy")
663 ww_mse_enabled=w_mse_enabled
667 if (w_mse_enabled)
then
669 allocate(
w_mse(column_size))
671 if (ws_mse_enabled)
then
673 allocate(
ws_mse(column_size))
675 if (w_mse_advection_enabled)
then
679 if (w_mse_viscosity_diffusion_enabled)
then
683 if (w_mse_buoyancy_enabled)
then
687 if (ww_mse_enabled)
then
689 allocate(
ww_mse(column_size))
692 mse_mse_enabled=current_state%th%active
693 smse_mse_enabled=mse_mse_enabled
694 mse_mse_advection_enabled=is_component_field_available(
"mse_advection") .and. mse_mse_enabled
695 mse_mse_diffusion_enabled=is_component_field_available(
"mse_diffusion") .and. mse_mse_enabled
696 wmse_mse_enabled=current_state%w%active .and. mse_mse_enabled
700 if (mse_mse_enabled)
then
704 if (smse_mse_enabled)
then
708 if (mse_mse_advection_enabled)
then
712 if (mse_mse_diffusion_enabled)
then
716 if (wmse_mse_enabled)
then
725 type(model_state_type),
target,
intent(inout) :: current_state
727 integer :: column_size
728 logical :: u_thetal_enabled, us_thetal_enabled, u_thetal_advection_enabled, u_thetal_viscosity_diffusion_enabled, &
729 wu_thetal_enabled, v_thetal_enabled, vs_thetal_enabled, v_thetal_advection_enabled, &
730 v_thetal_viscosity_diffusion_enabled, wv_thetal_enabled, w_thetal_enabled, ws_thetal_enabled, &
731 w_thetal_advection_enabled, w_thetal_viscosity_diffusion_enabled, w_thetal_buoyancy_enabled, ww_thetal_enabled, &
732 thetal_thetal_enabled, sthetal_thetal_enabled, thetal_thetal_advection_enabled, &
733 thetal_thetal_diffusion_enabled, wthetal_thetal_enabled
735 column_size=current_state%local_grid%size(z_index)
737 u_thetal_enabled=current_state%u%active .and. current_state%th%active
738 us_thetal_enabled=u_thetal_enabled
739 u_thetal_advection_enabled=is_component_field_available(
"u_advection") .and. &
740 is_component_field_available(
"th_advection") .and. u_thetal_enabled
741 u_thetal_viscosity_diffusion_enabled=is_component_field_available(
"u_viscosity") .and. &
742 is_component_field_available(
"th_diffusion") .and. u_thetal_enabled
743 wu_thetal_enabled=current_state%w%active .and. u_thetal_enabled
747 if (u_thetal_enabled)
then
751 if (us_thetal_enabled)
then
755 if (u_thetal_advection_enabled)
then
759 if (u_thetal_viscosity_diffusion_enabled)
then
763 if (wu_thetal_enabled)
then
768 v_thetal_enabled=current_state%v%active .and. current_state%th%active
769 vs_thetal_enabled=v_thetal_enabled
770 v_thetal_advection_enabled=is_component_field_available(
"v_advection") .and. &
771 is_component_field_available(
"th_advection") .and. v_thetal_enabled
772 v_thetal_viscosity_diffusion_enabled=is_component_field_available(
"v_viscosity") .and. &
773 is_component_field_available(
"th_diffusion") .and. v_thetal_enabled
774 wv_thetal_enabled=current_state%w%active .and. v_thetal_enabled
778 if (v_thetal_enabled)
then
782 if (vs_thetal_enabled)
then
786 if (v_thetal_advection_enabled)
then
790 if (v_thetal_viscosity_diffusion_enabled)
then
794 if (wv_thetal_enabled)
then
799 w_thetal_enabled=current_state%w%active .and. current_state%th%active
800 ws_thetal_enabled=w_thetal_enabled
801 w_thetal_advection_enabled=is_component_field_available(
"w_advection") .and. &
802 is_component_field_available(
"th_advection") .and. w_thetal_enabled
803 w_thetal_viscosity_diffusion_enabled=is_component_field_available(
"w_viscosity") .and. &
804 is_component_field_available(
"th_diffusion") .and. w_thetal_enabled
805 w_thetal_buoyancy_enabled=current_state%th%active .and. is_component_field_available(
"w_buoyancy")
806 ww_thetal_enabled=w_thetal_enabled
810 if (w_thetal_enabled)
then
814 if (ws_thetal_enabled)
then
818 if (w_thetal_advection_enabled)
then
822 if (w_thetal_viscosity_diffusion_enabled)
then
826 if (w_thetal_buoyancy_enabled)
then
830 if (ww_thetal_enabled)
then
835 thetal_thetal_enabled=current_state%th%active
836 sthetal_thetal_enabled=thetal_thetal_enabled
837 thetal_thetal_advection_enabled=is_component_field_available(
"th_advection") .and. thetal_thetal_enabled
838 thetal_thetal_diffusion_enabled=is_component_field_available(
"th_diffusion") .and. thetal_thetal_enabled
839 wthetal_thetal_enabled=current_state%w%active .and. thetal_thetal_enabled
843 if (thetal_thetal_enabled)
then
847 if (sthetal_thetal_enabled)
then
851 if (thetal_thetal_advection_enabled)
then
855 if (thetal_thetal_diffusion_enabled)
then
859 if (wthetal_thetal_enabled)
then
868 type(model_state_type),
target,
intent(inout) :: current_state
870 integer :: column_size
871 logical :: tu_su_enabled, uu_advection_enabled, uu_viscosity_enabled, wu_u_enabled, tv_sv_enabled, vv_advection_enabled, &
872 vv_viscosity_enabled, wv_v_enabled, tw_sw_enabled, ww_advection_enabled, ww_viscosity_enabled, ww_buoyancy_enabled
874 tu_su_enabled=current_state%u%active
875 uu_advection_enabled=is_component_field_available(
"u_advection") .and. current_state%u%active
876 uu_viscosity_enabled=is_component_field_available(
"u_viscosity") .and. current_state%u%active
877 wu_u_enabled=current_state%u%active .and. current_state%w%active
878 tv_sv_enabled=current_state%v%active
879 vv_advection_enabled=is_component_field_available(
"v_advection") .and. current_state%v%active
880 vv_viscosity_enabled=is_component_field_available(
"v_viscosity") .and. current_state%v%active
881 wv_v_enabled=current_state%v%active .and. current_state%w%active
882 tw_sw_enabled=current_state%w%active
883 ww_advection_enabled=is_component_field_available(
"w_advection") .and. current_state%w%active
884 ww_viscosity_enabled=is_component_field_available(
"w_viscosity") .and. current_state%w%active
885 ww_buoyancy_enabled=is_component_field_available(
"w_buoyancy") .and. current_state%w%active
889 column_size=current_state%local_grid%size(z_index)
891 if (tu_su_enabled)
then
893 allocate(
tu_su(column_size))
895 if (uu_advection_enabled)
then
899 if (uu_viscosity_enabled)
then
903 if (wu_u_enabled)
then
905 allocate(
wu_u(column_size))
907 if (tv_sv_enabled)
then
909 allocate(
tv_sv(column_size))
911 if (vv_advection_enabled)
then
915 if (vv_viscosity_enabled)
then
919 if (wv_v_enabled)
then
921 allocate(
wv_v(column_size))
923 if (tw_sw_enabled)
then
925 allocate(
tw_sw(column_size))
927 if (ww_advection_enabled)
then
931 if (ww_viscosity_enabled)
then
935 if (ww_buoyancy_enabled)
then
944 type(model_state_type),
target,
intent(inout) :: current_state
946 integer :: column_size
947 logical :: uw_advection_term_enabled, vw_advection_term_enabled, uw_viscosity_term_enabled, &
948 vw_viscosity_term_enabled, uw_buoyancy_term_enabled, vw_buoyancy_term_enabled, uw_tendency_term_enabled, &
949 vw_tendency_term_enabled, uw_w_term_enabled, vw_w_term_enabled
951 uw_advection_term_enabled=is_component_field_available(
"w_advection") .and. is_component_field_available(
"u_advection") &
952 .and. current_state%w%active
953 vw_advection_term_enabled=is_component_field_available(
"w_advection") .and. is_component_field_available(
"v_advection") &
954 .and. current_state%w%active
955 uw_viscosity_term_enabled=is_component_field_available(
"w_viscosity") .and. is_component_field_available(
"u_viscosity") &
956 .and. current_state%w%active
957 vw_viscosity_term_enabled=is_component_field_available(
"w_viscosity") .and. is_component_field_available(
"v_viscosity") &
958 .and. current_state%w%active
959 uw_buoyancy_term_enabled=is_component_field_available(
"w_buoyancy")
960 vw_buoyancy_term_enabled=is_component_field_available(
"w_buoyancy")
961 uw_tendency_term_enabled=current_state%w%active .and. current_state%u%active
962 vw_tendency_term_enabled=current_state%w%active .and. current_state%v%active
963 uw_w_term_enabled=current_state%w%active .and. current_state%u%active
964 vw_w_term_enabled=current_state%w%active .and. current_state%v%active
967 .or. vw_w_term_enabled .or. uw_advection_term_enabled .or. vw_advection_term_enabled .or. uw_viscosity_term_enabled .or. &
968 vw_viscosity_term_enabled
970 column_size=current_state%local_grid%size(z_index)
972 if (uw_advection_term_enabled)
then
976 if (vw_advection_term_enabled)
then
980 if (uw_viscosity_term_enabled)
then
984 if (vw_viscosity_term_enabled)
then
988 if (uw_buoyancy_term_enabled)
then
992 if (vw_buoyancy_term_enabled)
then
996 if (uw_tendency_term_enabled)
then
1000 if (vw_tendency_term_enabled)
then
1004 if (uw_w_term_enabled)
then
1006 allocate(
uw_w(column_size))
1008 if (vw_w_term_enabled)
then
1010 allocate(
vw_w(column_size))
1017 type(model_state_type),
target,
intent(inout) :: current_state
1018 integer :: column_size
1019 logical :: sres_enabled, wp_enabled, wke_enabled, buoy_enabled, tend_enabled
1021 column_size=current_state%local_grid%size(z_index)
1023 sres_enabled=current_state%u%active .and. current_state%v%active
1024 wke_enabled=current_state%w%active
1025 buoy_enabled=current_state%w%active
1026 wp_enabled=current_state%w%active
1027 tend_enabled=current_state%w%active
1031 if (wp_enabled)
then
1033 allocate(
wp(column_size))
1035 if (tend_enabled)
then
1037 allocate(
tend(column_size))
1039 if (sres_enabled)
then
1041 allocate(
sres(column_size))
1043 if (wke_enabled)
then
1045 allocate(
wke(column_size))
1047 if (buoy_enabled)
then
1049 allocate(
buoy(column_size))
1057 type(model_state_type),
target,
intent(inout) :: current_state
1059 logical :: q_flux_term_enabled, q_tendency_term_enabled, q_gradient_term_enabled, q_diff_enabled, &
1062 q_flux_term_enabled=current_state%number_q_fields .gt. 0 .and. current_state%w%active
1063 q_tendency_term_enabled=current_state%number_q_fields .gt. 0 .and. current_state%w%active
1064 q_gradient_term_enabled=is_component_field_available(
"w_advection") .and. is_component_field_available(
"q_advection") &
1065 .and. current_state%w%active .and. current_state%number_q_fields .gt. 0
1066 q_diff_enabled=is_component_field_available(
"q_diffusion") .and. is_component_field_available(
"w_viscosity") &
1067 .and. current_state%w%active .and. current_state%number_q_fields .gt. 0
1068 q_buoyancy_enabled=is_component_field_available(
"w_buoyancy") .and. current_state%number_q_fields .gt. 0
1072 if (q_flux_term_enabled)
then
1074 allocate(
q_flux_values(current_state%local_grid%size(z_index), current_state%number_q_fields))
1076 if (q_tendency_term_enabled)
then
1078 allocate(
q_tendency(current_state%local_grid%size(z_index), current_state%number_q_fields))
1080 if (q_gradient_term_enabled)
then
1082 allocate(
q_gradient(current_state%local_grid%size(z_index), current_state%number_q_fields))
1084 if (q_diff_enabled)
then
1086 allocate(
q_diff(current_state%local_grid%size(z_index), current_state%number_q_fields))
1088 if (q_buoyancy_enabled)
then
1090 allocate(
q_buoyancy(current_state%local_grid%size(z_index), current_state%number_q_fields))
1097 type(model_state_type),
target,
intent(inout) :: current_state
1099 logical :: th_flux_term_enabled, th_tendency_term_enabled, th_diff_enabled, th_gradient_term_enabled, th_buoyancy_enabled
1101 th_flux_term_enabled=current_state%th%active .and. current_state%w%active
1102 th_tendency_term_enabled=current_state%th%active .and. current_state%w%active
1103 th_gradient_term_enabled=is_component_field_available(
"w_advection") .and. is_component_field_available(
"th_advection") &
1104 .and. current_state%w%active .and. current_state%th%active
1105 th_diff_enabled=is_component_field_available(
"th_diffusion") .and. is_component_field_available(
"w_viscosity") &
1106 .and. current_state%w%active .and. current_state%th%active
1107 th_buoyancy_enabled=is_component_field_available(
"w_buoyancy") .and. current_state%th%active
1111 if (th_flux_term_enabled)
then
1115 if (th_tendency_term_enabled)
then
1117 allocate(
th_tendency(current_state%local_grid%size(z_index)))
1119 if (th_diff_enabled)
then
1121 allocate(
th_diff(current_state%local_grid%size(z_index)))
1123 if (th_gradient_term_enabled)
then
1125 allocate(
th_gradient(current_state%local_grid%size(z_index)))
1127 if (th_buoyancy_enabled)
then
1129 allocate(
th_buoyancy(current_state%local_grid%size(z_index)))
1135 if (
allocated(
us_qt))
us_qt=0.0_default_precision
1138 if (
allocated(
wu_qt))
wu_qt=0.0_default_precision
1139 if (
allocated(
vs_qt))
vs_qt=0.0_default_precision
1142 if (
allocated(
wv_qt))
wv_qt=0.0_default_precision
1143 if (
allocated(
w_qt))
w_qt=0.0_default_precision
1144 if (
allocated(
ws_qt))
ws_qt=0.0_default_precision
1148 if (
allocated(
ww_qt))
ww_qt=0.0_default_precision
1149 if (
allocated(
qt_qt))
qt_qt=0.0_default_precision
1160 type(model_state_type),
target,
intent(inout) :: current_state
1162 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: upr, vpr, uprm1, vprm1, qtpr, qtprp1
1163 type(component_field_value_type) :: u_advection, u_viscosity, th_advection, th_diffusion, v_advection, v_viscosity, &
1164 w_advection, w_viscosity, w_buoyancy
1167 if (is_component_field_available(
"u_advection")) u_advection=get_component_field_value(current_state,
"u_advection")
1168 if (is_component_field_available(
"u_viscosity")) u_viscosity=get_component_field_value(current_state,
"u_viscosity")
1169 if (is_component_field_available(
"th_advection")) th_advection=get_component_field_value(current_state,
"th_advection")
1170 if (is_component_field_available(
"th_diffusion")) th_diffusion=get_component_field_value(current_state,
"th_diffusion")
1171 if (is_component_field_available(
"v_advection")) v_advection=get_component_field_value(current_state,
"v_advection")
1172 if (is_component_field_available(
"v_viscosity")) v_viscosity=get_component_field_value(current_state,
"v_viscosity")
1173 if (is_component_field_available(
"w_advection")) w_advection=get_component_field_value(current_state,
"w_advection")
1174 if (is_component_field_available(
"w_viscosity")) w_viscosity=get_component_field_value(current_state,
"w_viscosity")
1175 if (is_component_field_available(
"w_buoyancy")) w_buoyancy=get_component_field_value(current_state,
"w_buoyancy")
1177 do k=1, current_state%local_grid%size(z_index)
1178 upr(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x)
1179 uprm1(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1)
1180 if (
allocated(current_state%global_grid%configuration%vertical%olubar))
then
1181 upr(k)=upr(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1182 uprm1(k)=uprm1(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1184 vpr(k)=current_state%v%data(k,current_state%column_local_y,current_state%column_local_x)
1185 vprm1(k)=current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x)
1186 if (
allocated(current_state%global_grid%configuration%vertical%olvbar))
then
1187 vpr(k)=vpr(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1188 vprm1(k)=vprm1(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1191 qtpr(k)=current_state%th%data(k,current_state%column_local_y,current_state%column_local_x)
1192 qtprp1(k)=current_state%th%data(k,current_state%column_local_y,current_state%column_local_x+1)
1193 if (
allocated(current_state%global_grid%configuration%vertical%olthbar))
then
1194 qtpr(k)=qtpr(k)-current_state%global_grid%configuration%vertical%olthbar(k)
1195 qtprp1(k)=qtprp1(k)-current_state%global_grid%configuration%vertical%olthbar(k)
1198 do k=2, current_state%local_grid%size(z_index)-1
1200 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*(qtpr(k)+qtprp1(k))*&
1201 current_state%su%data(k,current_state%column_local_y,current_state%column_local_x)
1203 th_advection%real_1d_array(k)+0.5*(qtpr(k)+qtprp1(k))*u_advection%real_1d_array(k)
1205 (qtpr(k)+qtprp1(k))*u_viscosity%real_1d_array(k)+0.5*(upr(k)+uprm1(k))*th_diffusion%real_1d_array(k)
1207 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.25*(upr(k+1)+upr(k)+&
1208 uprm1(k+1)+uprm1(k))*0.5*(qtpr(k+1)+qtpr(k))
1211 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*(qtpr(k)+qtprp1(k))*&
1212 current_state%sv%data(k,current_state%column_local_y,current_state%column_local_x)
1214 th_advection%real_1d_array(k)+0.5*(qtpr(k)+qtprp1(k))*v_advection%real_1d_array(k)
1216 (qtpr(k)+qtprp1(k))*v_viscosity%real_1d_array(k)+0.5*(vpr(k)+vprm1(k))*th_diffusion%real_1d_array(k)
1218 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.25*(vpr(k+1)+vpr(k)+&
1219 vprm1(k+1)+vprm1(k))*0.5*(qtpr(k+1)+qtpr(k))
1222 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(qtpr(k)+qtpr(k+1))
1224 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*&
1225 (current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+&
1226 current_state%sth%data(k+1,current_state%column_local_y,current_state%column_local_x))+0.5*(qtpr(k)+qtpr(k+1))*&
1227 current_state%sw%data(k,current_state%column_local_y,current_state%column_local_x)
1229 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(th_advection%real_1d_array(k)+&
1230 th_advection%real_1d_array(k+1))+0.5*(qtpr(k)+qtpr(k+1))*w_advection%real_1d_array(k)
1232 (qtpr(k)+qtpr(k+1))*w_viscosity%real_1d_array(k)+&
1233 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*&
1234 (th_diffusion%real_1d_array(k)+th_diffusion%real_1d_array(k+1))
1236 w_buoyancy%real_1d_array(k)
1238 (current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1239 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*0.5*(&
1240 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1241 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*qtpr(k)
1245 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)
1247 th_advection%real_1d_array(k)
1249 th_diffusion%real_1d_array(k)
1251 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(qtpr(k+1)+qtpr(k))*0.5*(&
1255 if (
allocated(u_advection%real_1d_array))
deallocate(u_advection%real_1d_array)
1256 if (
allocated(u_viscosity%real_1d_array))
deallocate(u_viscosity%real_1d_array)
1257 if (
allocated(th_advection%real_1d_array))
deallocate(th_advection%real_1d_array)
1258 if (
allocated(th_diffusion%real_1d_array))
deallocate(th_diffusion%real_1d_array)
1259 if (
allocated(v_advection%real_1d_array))
deallocate(v_advection%real_1d_array)
1260 if (
allocated(v_viscosity%real_1d_array))
deallocate(v_viscosity%real_1d_array)
1261 if (
allocated(w_advection%real_1d_array))
deallocate(w_advection%real_1d_array)
1262 if (
allocated(w_viscosity%real_1d_array))
deallocate(w_viscosity%real_1d_array)
1263 if (
allocated(w_buoyancy%real_1d_array))
deallocate(w_buoyancy%real_1d_array)
1268 mflux=0.0_default_precision
1274 type(model_state_type),
target,
intent(inout) :: current_state
1278 do k=2, current_state%local_grid%size(z_index)-1
1279 if (current_state%w%data(k, current_state%column_local_y,current_state%column_local_x) .gt.
wmfcrit)
then
1280 mflux=
mflux+current_state%global_grid%configuration%vertical%rho(k)*&
1281 current_state%global_grid%configuration%vertical%dzn(k)*&
1282 current_state%w%data(k, current_state%column_local_y,current_state%column_local_x)
1289 if (
allocated(
u_mse))
u_mse=0.0_default_precision
1294 if (
allocated(
v_mse))
v_mse=0.0_default_precision
1299 if (
allocated(
w_mse))
w_mse=0.0_default_precision
1316 type(model_state_type),
target,
intent(inout) :: current_state
1318 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: upr, vpr, uprm1, vprm1, msepr, mseprp1
1319 type(component_field_value_type) :: u_advection, u_viscosity, th_advection, th_diffusion, v_advection, v_viscosity, &
1320 w_advection, w_viscosity, w_buoyancy
1323 if (is_component_field_available(
"u_advection")) u_advection=get_component_field_value(current_state,
"u_advection")
1324 if (is_component_field_available(
"u_viscosity")) u_viscosity=get_component_field_value(current_state,
"u_viscosity")
1325 if (is_component_field_available(
"th_advection")) th_advection=get_component_field_value(current_state,
"th_advection")
1326 if (is_component_field_available(
"th_diffusion")) th_diffusion=get_component_field_value(current_state,
"th_diffusion")
1327 if (is_component_field_available(
"v_advection")) v_advection=get_component_field_value(current_state,
"v_advection")
1328 if (is_component_field_available(
"v_viscosity")) v_viscosity=get_component_field_value(current_state,
"v_viscosity")
1329 if (is_component_field_available(
"w_advection")) w_advection=get_component_field_value(current_state,
"w_advection")
1330 if (is_component_field_available(
"w_viscosity")) w_viscosity=get_component_field_value(current_state,
"w_viscosity")
1331 if (is_component_field_available(
"w_buoyancy")) w_buoyancy=get_component_field_value(current_state,
"w_buoyancy")
1333 do k=1, current_state%local_grid%size(z_index)
1334 upr(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x)
1335 uprm1(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1)
1336 if (
allocated(current_state%global_grid%configuration%vertical%olubar))
then
1337 upr(k)=upr(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1338 uprm1(k)=uprm1(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1340 vpr(k)=current_state%v%data(k,current_state%column_local_y,current_state%column_local_x)
1341 vprm1(k)=current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x)
1342 if (
allocated(current_state%global_grid%configuration%vertical%olvbar))
then
1343 vpr(k)=vpr(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1344 vprm1(k)=vprm1(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1346 msepr(k)=current_state%th%data(k,current_state%column_local_y,current_state%column_local_x)
1347 mseprp1(k)=current_state%th%data(k,current_state%column_local_y,current_state%column_local_x+1)
1348 if (
allocated(current_state%global_grid%configuration%vertical%olthbar))
then
1349 msepr(k)=msepr(k)-current_state%global_grid%configuration%vertical%olthbar(k)
1350 mseprp1(k)=mseprp1(k)-current_state%global_grid%configuration%vertical%olthbar(k)
1353 do k=2, current_state%local_grid%size(z_index)-1
1354 if (
allocated(
u_mse))
u_mse(k)=
u_mse(k)+0.5*(upr(k)+uprm1(k))*msepr(k)
1356 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*(msepr(k)+mseprp1(k))*&
1357 current_state%su%data(k,current_state%column_local_y,current_state%column_local_x)
1359 th_advection%real_1d_array(k)+0.5*(msepr(k)+mseprp1(k))*u_advection%real_1d_array(k)
1361 (msepr(k)+mseprp1(k))*u_viscosity%real_1d_array(k)+0.5*(upr(k)+uprm1(k))*th_diffusion%real_1d_array(k)
1363 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.25*(upr(k+1)+upr(k)+&
1364 uprm1(k+1)+uprm1(k))*0.5*(msepr(k+1)+msepr(k))
1366 if (
allocated(
v_mse))
v_mse(k)=
v_mse(k)+0.5*(vpr(k)+vprm1(k))*msepr(k)
1368 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*(msepr(k)+mseprp1(k))*&
1369 current_state%sv%data(k,current_state%column_local_y,current_state%column_local_x)
1371 th_advection%real_1d_array(k)+0.5*(msepr(k)+mseprp1(k))*v_advection%real_1d_array(k)
1373 (msepr(k)+mseprp1(k))*v_viscosity%real_1d_array(k)+0.5*(vpr(k)+vprm1(k))*th_diffusion%real_1d_array(k)
1375 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.25*(vpr(k+1)+vpr(k)+&
1376 vprm1(k+1)+vprm1(k))*0.5*(msepr(k+1)+msepr(k))
1379 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(msepr(k)+msepr(k+1))
1381 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*&
1382 (current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+&
1383 current_state%sth%data(k+1,current_state%column_local_y,current_state%column_local_x))+0.5*(msepr(k)+msepr(k+1))*&
1384 current_state%sw%data(k,current_state%column_local_y,current_state%column_local_x)
1386 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(th_advection%real_1d_array(k)+&
1387 th_advection%real_1d_array(k+1))+0.5*(msepr(k)+msepr(k+1))*w_advection%real_1d_array(k)
1389 (msepr(k)+msepr(k+1))*w_viscosity%real_1d_array(k)+&
1390 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*&
1391 (th_diffusion%real_1d_array(k)+th_diffusion%real_1d_array(k+1))
1393 w_buoyancy%real_1d_array(k)
1395 (current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1396 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*0.5*(&
1397 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1398 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*msepr(k)
1402 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)
1404 th_advection%real_1d_array(k)
1406 th_diffusion%real_1d_array(k)
1408 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(msepr(k+1)+msepr(k))*0.5*(&
1409 msepr(k+1)+msepr(k))
1412 if (
allocated(u_advection%real_1d_array))
deallocate(u_advection%real_1d_array)
1413 if (
allocated(u_viscosity%real_1d_array))
deallocate(u_viscosity%real_1d_array)
1414 if (
allocated(th_advection%real_1d_array))
deallocate(th_advection%real_1d_array)
1415 if (
allocated(th_diffusion%real_1d_array))
deallocate(th_diffusion%real_1d_array)
1416 if (
allocated(v_advection%real_1d_array))
deallocate(v_advection%real_1d_array)
1417 if (
allocated(v_viscosity%real_1d_array))
deallocate(v_viscosity%real_1d_array)
1418 if (
allocated(w_advection%real_1d_array))
deallocate(w_advection%real_1d_array)
1419 if (
allocated(w_viscosity%real_1d_array))
deallocate(w_viscosity%real_1d_array)
1420 if (
allocated(w_buoyancy%real_1d_array))
deallocate(w_buoyancy%real_1d_array)
1451 type(model_state_type),
target,
intent(inout) :: current_state
1453 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: upr, vpr, uprm1, vprm1, thlpr, thlprp1
1454 type(component_field_value_type) :: u_advection, u_viscosity, th_advection, th_diffusion, v_advection, v_viscosity, &
1455 w_advection, w_viscosity, w_buoyancy
1458 if (is_component_field_available(
"u_advection")) u_advection=get_component_field_value(current_state,
"u_advection")
1459 if (is_component_field_available(
"u_viscosity")) u_viscosity=get_component_field_value(current_state,
"u_viscosity")
1460 if (is_component_field_available(
"th_advection")) th_advection=get_component_field_value(current_state,
"th_advection")
1461 if (is_component_field_available(
"th_diffusion")) th_diffusion=get_component_field_value(current_state,
"th_diffusion")
1462 if (is_component_field_available(
"v_advection")) v_advection=get_component_field_value(current_state,
"v_advection")
1463 if (is_component_field_available(
"v_viscosity")) v_viscosity=get_component_field_value(current_state,
"v_viscosity")
1464 if (is_component_field_available(
"w_advection")) w_advection=get_component_field_value(current_state,
"w_advection")
1465 if (is_component_field_available(
"w_viscosity")) w_viscosity=get_component_field_value(current_state,
"w_viscosity")
1466 if (is_component_field_available(
"w_buoyancy")) w_buoyancy=get_component_field_value(current_state,
"w_buoyancy")
1468 do k=1, current_state%local_grid%size(z_index)
1469 upr(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x)
1470 uprm1(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1)
1471 if (
allocated(current_state%global_grid%configuration%vertical%olubar))
then
1472 upr(k)=upr(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1473 uprm1(k)=uprm1(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1475 vpr(k)=current_state%v%data(k,current_state%column_local_y,current_state%column_local_x)
1476 vprm1(k)=current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x)
1477 if (
allocated(current_state%global_grid%configuration%vertical%olvbar))
then
1478 vpr(k)=vpr(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1479 vprm1(k)=vprm1(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1481 thlpr(k)=current_state%th%data(k,current_state%column_local_y,current_state%column_local_x)
1482 thlprp1(k)=current_state%th%data(k,current_state%column_local_y,current_state%column_local_x+1)
1483 if (
allocated(current_state%global_grid%configuration%vertical%olthbar))
then
1484 thlpr(k)=thlpr(k)-current_state%global_grid%configuration%vertical%olthbar(k)
1485 thlprp1(k)=thlprp1(k)-current_state%global_grid%configuration%vertical%olthbar(k)
1488 do k=2, current_state%local_grid%size(z_index)-1
1491 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*(thlpr(k)+thlprp1(k))*&
1492 current_state%su%data(k,current_state%column_local_y,current_state%column_local_x)
1494 th_advection%real_1d_array(k)+0.5*(thlpr(k)+thlprp1(k))*u_advection%real_1d_array(k)
1496 (thlpr(k)+thlprp1(k))*u_viscosity%real_1d_array(k)+0.5*(upr(k)+uprm1(k))*th_diffusion%real_1d_array(k)
1498 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.25*(upr(k+1)+upr(k)+&
1499 uprm1(k+1)+uprm1(k))*0.5*(thlpr(k+1)+thlpr(k))
1503 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*(thlpr(k)+thlprp1(k))*&
1504 current_state%sv%data(k,current_state%column_local_y,current_state%column_local_x)
1506 th_advection%real_1d_array(k)+0.5*(thlpr(k)+thlprp1(k))*v_advection%real_1d_array(k)
1508 (thlpr(k)+thlprp1(k))*v_viscosity%real_1d_array(k)+0.5*(vpr(k)+vprm1(k))*th_diffusion%real_1d_array(k)
1510 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.25*(vpr(k+1)+vpr(k)+&
1511 vprm1(k+1)+vprm1(k))*0.5*(thlpr(k+1)+thlpr(k))
1514 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(thlpr(k)+thlpr(k+1))
1516 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*&
1517 (current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+&
1518 current_state%sth%data(k+1,current_state%column_local_y,current_state%column_local_x))+0.5*(thlpr(k)+thlpr(k+1))*&
1519 current_state%sw%data(k,current_state%column_local_y,current_state%column_local_x)
1521 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(th_advection%real_1d_array(k)+&
1522 th_advection%real_1d_array(k+1))+0.5*(thlpr(k)+thlpr(k+1))*w_advection%real_1d_array(k)
1524 (thlpr(k)+thlpr(k+1))*w_viscosity%real_1d_array(k)+&
1525 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*&
1526 (th_diffusion%real_1d_array(k)+th_diffusion%real_1d_array(k+1))
1528 w_buoyancy%real_1d_array(k)
1530 (current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1531 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*0.5*(&
1532 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1533 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*thlpr(k)
1537 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)
1539 th_advection%real_1d_array(k)
1541 th_diffusion%real_1d_array(k)
1543 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(thlpr(k+1)+thlpr(k))*0.5*(&
1544 thlpr(k+1)+thlpr(k))
1547 if (
allocated(u_advection%real_1d_array))
deallocate(u_advection%real_1d_array)
1548 if (
allocated(u_viscosity%real_1d_array))
deallocate(u_viscosity%real_1d_array)
1549 if (
allocated(th_advection%real_1d_array))
deallocate(th_advection%real_1d_array)
1550 if (
allocated(th_diffusion%real_1d_array))
deallocate(th_diffusion%real_1d_array)
1551 if (
allocated(v_advection%real_1d_array))
deallocate(v_advection%real_1d_array)
1552 if (
allocated(v_viscosity%real_1d_array))
deallocate(v_viscosity%real_1d_array)
1553 if (
allocated(w_advection%real_1d_array))
deallocate(w_advection%real_1d_array)
1554 if (
allocated(w_viscosity%real_1d_array))
deallocate(w_viscosity%real_1d_array)
1555 if (
allocated(w_buoyancy%real_1d_array))
deallocate(w_buoyancy%real_1d_array)
1560 if (
allocated(
tu_su))
tu_su=0.0_default_precision
1563 if (
allocated(
wu_u))
wu_u=0.0_default_precision
1564 if (
allocated(
tv_sv))
tv_sv=0.0_default_precision
1567 if (
allocated(
wv_v))
wv_v=0.0_default_precision
1568 if (
allocated(
tw_sw))
tw_sw=0.0_default_precision
1577 type(model_state_type),
target,
intent(inout) :: current_state
1579 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: upr, vpr, uprm1, vprm1
1580 type(component_field_value_type) :: u_advection, u_viscosity, v_advection, v_viscosity, w_advection, w_viscosity, w_buoyancy
1583 if (is_component_field_available(
"u_advection")) u_advection=get_component_field_value(current_state,
"u_advection")
1584 if (is_component_field_available(
"u_viscosity")) u_viscosity=get_component_field_value(current_state,
"u_viscosity")
1585 if (is_component_field_available(
"v_advection")) v_advection=get_component_field_value(current_state,
"v_advection")
1586 if (is_component_field_available(
"v_viscosity")) v_viscosity=get_component_field_value(current_state,
"v_viscosity")
1587 if (is_component_field_available(
"w_advection")) w_advection=get_component_field_value(current_state,
"w_advection")
1588 if (is_component_field_available(
"w_viscosity")) w_viscosity=get_component_field_value(current_state,
"w_viscosity")
1589 if (is_component_field_available(
"w_buoyancy")) w_buoyancy=get_component_field_value(current_state,
"w_buoyancy")
1591 do k=1, current_state%local_grid%size(z_index)
1592 upr(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x)
1593 uprm1(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1)
1594 if (
allocated(current_state%global_grid%configuration%vertical%olubar))
then
1595 upr(k)=upr(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1596 uprm1(k)=uprm1(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1598 vpr(k)=current_state%v%data(k,current_state%column_local_y,current_state%column_local_x)
1599 vprm1(k)=current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x)
1600 if (
allocated(current_state%global_grid%configuration%vertical%olvbar))
then
1601 vpr(k)=vpr(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1602 vprm1(k)=vprm1(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1605 do k=2, current_state%local_grid%size(z_index)-1
1606 if (
allocated(
tu_su))
tu_su(k)=
tu_su(k)+2.0*upr(k)*current_state%su%data(k,current_state%column_local_y,&
1607 current_state%column_local_x)
1610 if (
allocated(
wu_u))
wu_u(k)=
wu_u(k)+0.25*(upr(k)+upr(k+1)+uprm1(k)+uprm1(k+1))*0.25*&
1611 (upr(k)+upr(k+1)+uprm1(k)+uprm1(k+1))*current_state%w%data(k,current_state%column_local_y,&
1612 current_state%column_local_x)
1613 if (
allocated(
tv_sv))
tv_sv(k)=
tv_sv(k)+2.0*vpr(k)*current_state%sv%data(k,current_state%column_local_y,&
1614 current_state%column_local_x)
1617 if (
allocated(
wv_v))
wv_v(k)=
wv_v(k)+0.25*(vpr(k)+vpr(k+1)+vprm1(k)+vprm1(k+1))*0.25*&
1618 (vpr(k)+vpr(k+1)+vprm1(k)+vprm1(k+1))*current_state%w%data(k,current_state%column_local_y,&
1619 current_state%column_local_x)
1620 if (
allocated(
tw_sw))
tw_sw(k)=
tw_sw(k)+2.0*current_state%w%data(k,current_state%column_local_y,&
1621 current_state%column_local_x)*current_state%sw%data(k,current_state%column_local_y,&
1622 current_state%column_local_x)
1624 current_state%column_local_x)*w_advection%real_1d_array(k)
1626 current_state%column_local_x)*w_viscosity%real_1d_array(k)
1628 current_state%column_local_x)*w_buoyancy%real_1d_array(k)
1631 if (
allocated(u_advection%real_1d_array))
deallocate(u_advection%real_1d_array)
1632 if (
allocated(u_viscosity%real_1d_array))
deallocate(u_viscosity%real_1d_array)
1633 if (
allocated(v_advection%real_1d_array))
deallocate(v_advection%real_1d_array)
1634 if (
allocated(v_viscosity%real_1d_array))
deallocate(v_viscosity%real_1d_array)
1635 if (
allocated(w_advection%real_1d_array))
deallocate(w_advection%real_1d_array)
1636 if (
allocated(w_viscosity%real_1d_array))
deallocate(w_viscosity%real_1d_array)
1637 if (
allocated(w_buoyancy%real_1d_array))
deallocate(w_buoyancy%real_1d_array)
1651 if (
allocated(
uw_w))
uw_w=0.0_default_precision
1652 if (
allocated(
vw_w))
vw_w=0.0_default_precision
1656 if (
allocated(
sres))
sres=0.0_default_precision
1657 if (
allocated(
wke))
wke=0.0_default_precision
1658 if (
allocated(
wp))
wp=0.0_default_precision
1659 if (
allocated(
buoy))
buoy=0.0_default_precision
1660 if (
allocated(
tend))
tend=0.0_default_precision
1666 type(model_state_type),
target,
intent(inout) :: current_state
1668 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: upr, vpr, uprm1, vprm1
1669 type(component_field_value_type) :: w_advection, v_advection, u_advection, w_viscosity, v_viscosity, u_viscosity, &
1673 if (is_component_field_available(
"w_advection")) w_advection=get_component_field_value(current_state,
"w_advection")
1674 if (is_component_field_available(
"v_advection")) v_advection=get_component_field_value(current_state,
"v_advection")
1675 if (is_component_field_available(
"u_advection")) u_advection=get_component_field_value(current_state,
"u_advection")
1676 if (is_component_field_available(
"w_viscosity")) w_viscosity=get_component_field_value(current_state,
"w_viscosity")
1677 if (is_component_field_available(
"v_viscosity")) v_viscosity=get_component_field_value(current_state,
"v_viscosity")
1678 if (is_component_field_available(
"u_viscosity")) u_viscosity=get_component_field_value(current_state,
"u_viscosity")
1679 if (is_component_field_available(
"w_buoyancy")) w_buoyancy=get_component_field_value(current_state,
"w_buoyancy")
1681 do k=1, current_state%local_grid%size(z_index)
1682 upr(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x)
1683 uprm1(k)=current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1)
1684 if (
allocated(current_state%global_grid%configuration%vertical%olubar))
then
1685 upr(k)=upr(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1686 uprm1(k)=uprm1(k)-(current_state%global_grid%configuration%vertical%olubar(k)-current_state%ugal)
1688 vpr(k)=current_state%v%data(k,current_state%column_local_y,current_state%column_local_x)
1689 vprm1(k)=current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x)
1690 if (
allocated(current_state%global_grid%configuration%vertical%olvbar))
then
1691 vpr(k)=vpr(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1692 vprm1(k)=vprm1(k)-(current_state%global_grid%configuration%vertical%olvbar(k)-current_state%vgal)
1695 do k=2, current_state%local_grid%size(z_index)-1
1697 (w_advection%real_1d_array(k)+w_advection%real_1d_array(k-1))+0.25*(&
1698 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1699 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x)+&
1700 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x+1)+&
1701 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x+1))*u_advection%real_1d_array(k)
1703 (w_advection%real_1d_array(k)+w_advection%real_1d_array(k-1))+0.25*(&
1704 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1705 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x)+&
1706 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x+1)+&
1707 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x+1))*v_advection%real_1d_array(k)
1709 (w_viscosity%real_1d_array(k)+w_viscosity%real_1d_array(k-1))+0.25*(&
1710 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1711 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x)+&
1712 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x+1)+&
1713 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x+1))*u_viscosity%real_1d_array(k)
1715 (w_viscosity%real_1d_array(k)+w_viscosity%real_1d_array(k-1))+0.25*(&
1716 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1717 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x)+&
1718 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x+1)+&
1719 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x+1))*v_viscosity%real_1d_array(k)
1721 w_buoyancy%real_1d_array(k)+w_buoyancy%real_1d_array(k-1))
1723 w_buoyancy%real_1d_array(k)+w_buoyancy%real_1d_array(k-1))
1725 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1726 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x)+&
1727 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x+1)+&
1728 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x+1))*&
1729 current_state%su%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*(&
1730 current_state%sw%data(k,current_state%column_local_y,current_state%column_local_x)+&
1731 current_state%sw%data(k-1,current_state%column_local_y,current_state%column_local_x))*0.5*(upr(k)+uprm1(k))
1733 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
1734 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x)+&
1735 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x+1)+&
1736 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x+1))*&
1737 current_state%sv%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*(&
1738 current_state%sw%data(k,current_state%column_local_y,current_state%column_local_x)+&
1739 current_state%sw%data(k-1,current_state%column_local_y,current_state%column_local_x))*0.5*(vpr(k)+vprm1(k))
1740 if (
allocated(
uw_w))
uw_w(k)=
uw_w(k)+0.25*(upr(k)+upr(k+1)+uprm1(k)+uprm1(k+1))*&
1741 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*&
1742 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)
1743 if (
allocated(
vw_w))
vw_w(k)=
vw_w(k)+0.25*(vpr(k)+vpr(k+1)+vprm1(k)+vprm1(k+1))*&
1744 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*&
1745 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)
1748 if (
allocated(u_advection%real_1d_array))
deallocate(u_advection%real_1d_array)
1749 if (
allocated(u_viscosity%real_1d_array))
deallocate(u_viscosity%real_1d_array)
1750 if (
allocated(v_advection%real_1d_array))
deallocate(v_advection%real_1d_array)
1751 if (
allocated(v_viscosity%real_1d_array))
deallocate(v_viscosity%real_1d_array)
1752 if (
allocated(w_advection%real_1d_array))
deallocate(w_advection%real_1d_array)
1753 if (
allocated(w_viscosity%real_1d_array))
deallocate(w_viscosity%real_1d_array)
1754 if (
allocated(w_buoyancy%real_1d_array))
deallocate(w_buoyancy%real_1d_array)
1761 type(model_state_type),
target,
intent(inout) :: current_state
1763 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: upr, vpr, uprm1, vprm1, &
1764 uu_tendency,vv_tendency,ww_tendency
1765 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: umean, wu_umean, vmean, wv_vmean, &
1766 w_pprime_at_p, rke1, w_qvprime_at_w, w_qclprime_at_w, w_thprime_at_w, wq, rho, rec_rho, rhon, rec_rhon, &
1767 uw_tot, vw_tot,w_upr_at_w,w_vpr_at_w, w_buoyancy
1768 real(kind=default_precision) :: u_at_p, v_at_p, w_at_p
1769 real(kind=default_precision) :: c_virtual
1773 c_virtual = (ratio_mol_wts-1.0_default_precision)
1778 do k=1, current_state%local_grid%size(z_index)
1779 rho(k)=current_state%global_grid%configuration%vertical%rho(k)
1780 rhon(k)=current_state%global_grid%configuration%vertical%rhon(k)
1781 rec_rho(k)=1.0_default_precision/rho(k)
1782 rec_rhon(k)=1.0_default_precision/rhon(k)
1788 do k=2, current_state%local_grid%size(z_index)
1790 uu_tendency(k) = ((current_state%u%data(k,current_state%column_local_y,current_state%column_local_x) - &
1791 current_state%global_grid%configuration%vertical%olubar(k) )**2 - &
1792 (current_state%zu%data(k,current_state%column_local_y,current_state%column_local_x) - &
1793 current_state%global_grid%configuration%vertical%olzubar(k) )**2 ) / &
1796 vv_tendency(k) = ((current_state%v%data(k,current_state%column_local_y,current_state%column_local_x) - &
1797 current_state%global_grid%configuration%vertical%olvbar(k) )**2 - &
1798 (current_state%zv%data(k,current_state%column_local_y,current_state%column_local_x) - &
1799 current_state%global_grid%configuration%vertical%olzvbar(k) )**2 ) / &
1802 ww_tendency(k) = (current_state%w%data(k,current_state%column_local_y,current_state%column_local_x) * &
1803 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x) - &
1804 current_state%zw%data(k,current_state%column_local_y,current_state%column_local_x) * &
1805 current_state%zw%data(k,current_state%column_local_y,current_state%column_local_x)) / &
1810 uu_tendency(1) = -uu_tendency(2)
1811 vv_tendency(1) = -vv_tendency(2)
1813 if (
allocated(
tend))
then
1814 do k=2, current_state%local_grid%size(z_index)-1
1815 tend(k)=
tend(k) + 0.5_default_precision * (&
1816 0.5_default_precision * (uu_tendency(k)+uu_tendency(k+1)) + &
1817 0.5_default_precision * (vv_tendency(k)+vv_tendency(k+1)) + &
1824 do k=2, current_state%local_grid%size(z_index)-1
1826 umean(k)=(current_state%global_grid%configuration%vertical%olubar(k+1) -&
1827 current_state%global_grid%configuration%vertical%olubar(k))* &
1828 current_state%global_grid%configuration%vertical%rdzn(k+1)
1830 w_upr_at_w(k) =current_state%w%data(k,current_state%column_local_y,current_state%column_local_x) * &
1831 (0.25_default_precision * ( &
1832 (current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1) - &
1833 current_state%global_grid%configuration%vertical%olubar(k)) + &
1834 (current_state%u%data(k+1,current_state%column_local_y,current_state%column_local_x) - &
1835 current_state%global_grid%configuration%vertical%olubar(k+1)) + &
1836 (current_state%u%data(k,current_state%column_local_y,current_state%column_local_x) - &
1837 current_state%global_grid%configuration%vertical%olubar(k)) + &
1838 (current_state%u%data(k+1,current_state%column_local_y,current_state%column_local_x-1)- &
1839 current_state%global_grid%configuration%vertical%olubar(k+1)) ) )
1841 vmean(k)=(current_state%global_grid%configuration%vertical%olvbar(k+1) - &
1842 current_state%global_grid%configuration%vertical%olvbar(k)) * &
1843 current_state%global_grid%configuration%vertical%rdzn(k+1)
1845 w_vpr_at_w(k) =current_state%w%data(k,current_state%column_local_y,current_state%column_local_x) * &
1846 (0.25_default_precision * ( &
1847 (current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x) - &
1848 current_state%global_grid%configuration%vertical%olvbar(k)) + &
1849 (current_state%v%data(k+1,current_state%column_local_y,current_state%column_local_x) - &
1850 current_state%global_grid%configuration%vertical%olvbar(k+1)) + &
1851 (current_state%v%data(k,current_state%column_local_y,current_state%column_local_x) - &
1852 current_state%global_grid%configuration%vertical%olvbar(k)) + &
1853 (current_state%v%data(k+1,current_state%column_local_y-1,current_state%column_local_x)- &
1854 current_state%global_grid%configuration%vertical%olvbar(k+1)) ) )
1856 wu_umean(k)=(w_upr_at_w(k)*umean(k))
1857 wv_vmean(k)= (w_vpr_at_w(k)*vmean(k))
1859 if (
allocated(
sres))
then
1860 sres(k)=
sres(k) - (wv_vmean(k) + wu_umean(k))
1864 sres(1)=0.0_default_precision
1865 sres(current_state%local_grid%size(z_index))=0.0_default_precision
1867 do k=2, current_state%local_grid%size(z_index)
1874 w_pprime_at_p(k) = 0.5 * &
1875 (current_state%w%data(k, current_state%column_local_y,current_state%column_local_x) + &
1876 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x)) * &
1877 (current_state%global_grid%configuration%vertical%rhon(k) * &
1878 current_state%p%data(k,current_state%column_local_y,current_state%column_local_x))
1880 u_at_p = 0.5_default_precision * &
1881 ((current_state%u%data(k,current_state%column_local_y,current_state%column_local_x-1)- &
1882 current_state%global_grid%configuration%vertical%olubar(k)) + &
1883 (current_state%u%data(k,current_state%column_local_y,current_state%column_local_x) - &
1884 current_state%global_grid%configuration%vertical%olubar(k)))
1886 v_at_p = 0.5_default_precision * &
1887 ((current_state%v%data(k,current_state%column_local_y-1,current_state%column_local_x)- &
1888 current_state%global_grid%configuration%vertical%olvbar(k)) + &
1889 (current_state%v%data(k,current_state%column_local_y,current_state%column_local_x) - &
1890 current_state%global_grid%configuration%vertical%olvbar(k)))
1892 w_at_p = 0.5_default_precision * &
1893 (current_state%w%data(k, current_state%column_local_y,current_state%column_local_x) + &
1894 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))
1896 rke1(k)= 0.5_default_precision * w_at_p * &
1897 ( u_at_p*u_at_p + v_at_p*v_at_p + w_at_p*w_at_p) * rec_rhon(k)
1901 w_pprime_at_p(current_state%local_grid%size(z_index)) = 0.0_default_precision
1903 w_pprime_at_p(1)=w_pprime_at_p(2)
1904 if (
allocated(
wp))
then
1905 do k=1, current_state%local_grid%size(z_index)-1
1906 wp(k)=
wp(k) - ((w_pprime_at_p(k+1) - w_pprime_at_p(k)) * &
1907 current_state%global_grid%configuration%vertical%rdzn(k+1) * rec_rho(k))
1911 rke1(current_state%local_grid%size(z_index)) = 0.0_default_precision
1915 if (
allocated(
wke))
then
1916 do k=1, current_state%local_grid%size(z_index)-1
1917 wke(k) =
wke(k) -(rho(k) * (rke1(k+1) - rke1(k) ) * &
1918 current_state%global_grid%configuration%vertical%rdzn(k+1))
1926 if (.not. current_state%passive_th .and. current_state%th%active)
then
1927 do k=2,current_state%local_grid%size(z_index)-1
1928 w_buoyancy(k)=(0.5_default_precision*current_state%global_grid%configuration%vertical%buoy_co(k)) * &
1929 ((current_state%th%data(k, current_state%column_local_y, current_state%column_local_x) - &
1930 current_state%global_grid%configuration%vertical%olthbar(k)) + &
1931 (current_state%th%data(k+1, current_state%column_local_y, current_state%column_local_x) - &
1932 current_state%global_grid%configuration%vertical%olthbar(k+1)))
1936 if (.not. current_state%passive_q .and. current_state%number_q_fields .gt. 0)
then
1937 if (current_state%use_anelastic_equations)
then
1938 do n=1,current_state%number_q_fields
1939 do k=2,current_state%local_grid%size(z_index)-1
1940 w_buoyancy(k) = w_buoyancy(k) + &
1941 (0.5_default_precision*current_state%global_grid%configuration%vertical%buoy_co(k)) * &
1942 current_state%cq(n) * &
1943 (current_state%global_grid%configuration%vertical%thref(k)*&
1944 (current_state%q(n)%data(k, current_state%column_local_y, current_state%column_local_x) - &
1945 current_state%global_grid%configuration%vertical%olqbar(k,n)) + &
1946 current_state%global_grid%configuration%vertical%thref(k+1) * &
1947 (current_state%q(n)%data(k+1, current_state%column_local_y, current_state%column_local_x) - &
1948 current_state%global_grid%configuration%vertical%olqbar(k+1,n)))
1952 do n=1,current_state%number_q_fields
1953 do k=2,current_state%local_grid%size(z_index)-1
1954 w_buoyancy(k) = w_buoyancy(k) + &
1955 g*0.5_default_precision*current_state%cq(n)*&
1956 (current_state%q(n)%data(k, current_state%column_local_y, current_state%column_local_x) -&
1957 current_state%global_grid%configuration%vertical%olqbar(k,n) + &
1958 current_state%q(n)%data(k+1, current_state%column_local_y, current_state%column_local_x)- &
1959 current_state%global_grid%configuration%vertical%olqbar(k,n))
1965 do k=2, current_state%local_grid%size(z_index)-1
1966 if (
allocated(
buoy))
then
1968 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x) * &
1975 buoy(1) = 0.0_default_precision
1976 buoy(current_state%local_grid%size(z_index)) = 0.0_default_precision
1992 type(model_state_type),
target,
intent(inout) :: current_state
1995 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: qpr
1996 type(component_field_value_type) :: w_advection_published_value, q_advection_published_value, w_viscosity_published_value, &
1997 q_diffusion_published_value, w_buoyancy_published_value
2000 w_advection_published_value=get_component_field_value(current_state,
"w_advection")
2001 q_advection_published_value=get_component_field_value(current_state,
"q_advection")
2003 if (
allocated(
q_diff))
then
2004 w_viscosity_published_value=get_component_field_value(current_state,
"w_viscosity")
2005 q_diffusion_published_value=get_component_field_value(current_state,
"q_diffusion")
2008 w_buoyancy_published_value=get_component_field_value(current_state,
"w_buoyancy")
2011 do n=1, current_state%number_q_fields
2012 do k=1, current_state%local_grid%size(z_index)
2013 qpr(k)=current_state%q(n)%data(k,current_state%column_local_y,current_state%column_local_x)
2014 if (
allocated(current_state%global_grid%configuration%vertical%olqbar))
then
2015 qpr(k)=qpr(k)-current_state%global_grid%configuration%vertical%olqbar(k,n)
2018 do k=2, current_state%local_grid%size(z_index)-1
2020 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*&
2021 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(qpr(k)+qpr(k+1))
2023 (current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
2024 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*&
2025 current_state%sq(n)%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*&
2026 qpr(k)*(current_state%sw%data(k,current_state%column_local_y,current_state%column_local_x)+&
2027 current_state%sw%data(k-1,current_state%column_local_y,current_state%column_local_x))
2030 w_advection_published_value%real_1d_array(k-1))+0.5*&
2031 (current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
2032 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*&
2033 q_advection_published_value%real_2d_array(k, n)
2035 if (
allocated(
q_diff))
then
2036 q_diff(k,n)=
q_diff(k,n)+qpr(k)*0.5*(w_viscosity_published_value%real_1d_array(k)+&
2037 w_viscosity_published_value%real_1d_array(k-1))+&
2038 0.5*(current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
2039 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*&
2040 q_diffusion_published_value%real_2d_array(k,n)
2044 w_buoyancy_published_value%real_1d_array(k-1))
2048 if (
allocated(w_advection_published_value%real_1d_array))
deallocate(w_advection_published_value%real_1d_array)
2049 if (
allocated(q_advection_published_value%real_2d_array))
deallocate(q_advection_published_value%real_2d_array)
2050 if (
allocated(w_viscosity_published_value%real_1d_array))
deallocate(w_viscosity_published_value%real_1d_array)
2051 if (
allocated(q_diffusion_published_value%real_2d_array))
deallocate(q_diffusion_published_value%real_2d_array)
2052 if (
allocated(w_buoyancy_published_value%real_1d_array))
deallocate(w_buoyancy_published_value%real_1d_array)
2067 type(model_state_type),
target,
intent(inout) :: current_state
2070 real(kind=default_precision),
dimension(current_state%local_grid%size(Z_INDEX)) :: thpr
2071 type(component_field_value_type) :: w_advection_published_value, th_advection_published_value, w_viscosity_published_value, &
2072 th_diffusion_published_value, w_buoyancy_published_value
2074 do k=1, current_state%local_grid%size(z_index)
2075 thpr(k)=current_state%th%data(k,current_state%column_local_y,current_state%column_local_x)
2076 if (
allocated(current_state%global_grid%configuration%vertical%olthbar))
then
2077 thpr(k)=thpr(k)-current_state%global_grid%configuration%vertical%olthbar(k)
2081 w_advection_published_value=get_component_field_value(current_state,
"w_advection")
2082 th_advection_published_value=get_component_field_value(current_state,
"th_advection")
2085 w_viscosity_published_value=get_component_field_value(current_state,
"w_viscosity")
2086 th_diffusion_published_value=get_component_field_value(current_state,
"th_diffusion")
2089 w_buoyancy_published_value=get_component_field_value(current_state,
"w_buoyancy")
2091 do k=2, current_state%local_grid%size(z_index)-1
2093 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*&
2094 current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)*0.5*(thpr(k)+thpr(k+1))
2096 (current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
2097 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*&
2098 current_state%sth%data(k,current_state%column_local_y,current_state%column_local_x)+0.5*&
2099 thpr(k)*(current_state%sw%data(k,current_state%column_local_y,current_state%column_local_x)+&
2100 current_state%sw%data(k-1,current_state%column_local_y,current_state%column_local_x))
2103 w_advection_published_value%real_1d_array(k-1))+0.5*&
2104 (current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
2105 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*&
2106 th_advection_published_value%real_1d_array(k)
2109 th_diff(k)=
th_diff(k)+thpr(k)*0.5*(w_viscosity_published_value%real_1d_array(k)+&
2110 w_viscosity_published_value%real_1d_array(k-1))+&
2111 0.5*(current_state%w%data(k,current_state%column_local_y,current_state%column_local_x)+&
2112 current_state%w%data(k-1,current_state%column_local_y,current_state%column_local_x))*&
2113 th_diffusion_published_value%real_1d_array(k)
2117 w_buoyancy_published_value%real_1d_array(k-1))
2120 if (
allocated(w_advection_published_value%real_1d_array))
deallocate(w_advection_published_value%real_1d_array)
2121 if (
allocated(th_advection_published_value%real_1d_array))
deallocate(th_advection_published_value%real_1d_array)
2122 if (
allocated(w_viscosity_published_value%real_1d_array))
deallocate(w_viscosity_published_value%real_1d_array)
2123 if (
allocated(th_diffusion_published_value%real_1d_array))
deallocate(th_diffusion_published_value%real_1d_array)
2124 if (
allocated(w_buoyancy_published_value%real_1d_array))
deallocate(w_buoyancy_published_value%real_1d_array)
2131 character(len=*),
intent(in) :: name
2140 character(len=*),
intent(in) :: name
2149 character(len=*),
intent(in) :: name
2158 character(len=*),
intent(in) :: name
2167 character(len=*),
intent(in) :: name
2176 character(len=*),
intent(in) :: name
2185 character(len=*),
intent(in) :: name
2194 character(len=*),
intent(in) :: name
2203 character(len=*),
intent(in) :: name
2213 type(model_state_type),
target,
intent(inout) :: current_state
2214 character(len=*),
intent(in) :: name
2215 type(component_field_value_type),
intent(out) :: field_value
2217 if (name .eq.
"heat_flux_transport_local" .and.
allocated(
th_flux_values))
then
2219 else if (name .eq.
"heat_flux_gradient_local" .and.
allocated(
th_gradient))
then
2221 else if (name .eq.
"heat_flux_dissipation_local" .and.
allocated(
th_diff))
then
2223 else if (name .eq.
"heat_flux_buoyancy_local" .and.
allocated(
th_buoyancy))
then
2225 else if (name .eq.
"heat_flux_tendency_local" .and.
allocated(
th_tendency))
then
2227 else if (name .eq.
"q_flux_transport_local" .and.
allocated(
q_flux_values))
then
2229 else if (name .eq.
"q_flux_gradient_local" .and.
allocated(
q_gradient))
then
2231 else if (name .eq.
"q_flux_dissipation_local" .and.
allocated(
q_diff))
then
2233 else if (name .eq.
"q_flux_buoyancy_local" .and.
allocated(
q_buoyancy))
then
2235 else if (name .eq.
"q_flux_tendency_local" .and.
allocated(
q_tendency))
then
2237 else if (name .eq.
"uw_advection_local" .and.
allocated(
uw_advection))
then
2239 else if (name .eq.
"vw_advection_local" .and.
allocated(
vw_advection))
then
2241 else if (name .eq.
"uw_viscosity_local" .and.
allocated(
uw_viscosity))
then
2243 else if (name .eq.
"vw_viscosity_local" .and.
allocated(
vw_viscosity))
then
2245 else if (name .eq.
"uw_buoyancy_local" .and.
allocated(
uw_buoyancy))
then
2247 else if (name .eq.
"vw_buoyancy_local" .and.
allocated(
vw_buoyancy))
then
2249 else if (name .eq.
"uw_tendency_local" .and.
allocated(
uw_tendency))
then
2251 else if (name .eq.
"vw_tendency_local" .and.
allocated(
vw_tendency))
then
2253 else if (name .eq.
"uw_w_local" .and.
allocated(
uw_w))
then
2255 else if (name .eq.
"vw_w_local" .and.
allocated(
vw_w))
then
2257 else if (name .eq.
"resolved_pressure_transport_local" .and.
allocated(
wp))
then
2259 else if (name .eq.
"tke_tendency_local" .and.
allocated(
tend))
then
2261 else if (name .eq.
"resolved_shear_production_local" .and.
allocated(
sres))
then
2263 else if (name .eq.
"resolved_turbulent_transport_local" .and.
allocated(
wke))
then
2265 else if (name .eq.
"resolved_buoyant_production_local" .and.
allocated(
buoy))
then
2267 else if (name .eq.
"tu_su_local" .and.
allocated(
tu_su))
then
2269 else if (name .eq.
"uu_advection_local" .and.
allocated(
uu_advection))
then
2271 else if (name .eq.
"uu_viscosity_local" .and.
allocated(
uu_viscosity))
then
2273 else if (name .eq.
"wu_u_local" .and.
allocated(
wu_u))
then
2275 else if (name .eq.
"tv_sv_local" .and.
allocated(
tv_sv))
then
2277 else if (name .eq.
"vv_advection_local" .and.
allocated(
vv_advection))
then
2279 else if (name .eq.
"vv_viscosity_local" .and.
allocated(
vv_viscosity))
then
2281 else if (name .eq.
"wv_v_local" .and.
allocated(
wv_v))
then
2283 else if (name .eq.
"tw_sw_local" .and.
allocated(
tw_sw))
then
2285 else if (name .eq.
"ww_advection_local" .and.
allocated(
ww_advection))
then
2287 else if (name .eq.
"ww_viscosity_local" .and.
allocated(
ww_viscosity))
then
2289 else if (name .eq.
"ww_buoyancy_local" .and.
allocated(
ww_buoyancy))
then
2291 else if (name .eq.
"u_thetal_local" .and.
allocated(
u_thetal))
then
2293 else if (name .eq.
"us_thetal_local" .and.
allocated(
us_thetal))
then
2295 else if (name .eq.
"u_thetal_advection_local" .and.
allocated(
u_thetal_advection))
then
2299 else if (name .eq.
"wu_thetal_local" .and.
allocated(
wu_thetal))
then
2301 else if (name .eq.
"v_thetal_local" .and.
allocated(
v_thetal))
then
2303 else if (name .eq.
"vs_thetal_local" .and.
allocated(
vs_thetal))
then
2305 else if (name .eq.
"v_thetal_advection_local" .and.
allocated(
v_thetal_advection))
then
2309 else if (name .eq.
"wv_thetal_local" .and.
allocated(
wv_thetal))
then
2311 else if (name .eq.
"w_thetal_local" .and.
allocated(
w_thetal))
then
2313 else if (name .eq.
"ws_thetal_local" .and.
allocated(
ws_thetal))
then
2315 else if (name .eq.
"w_thetal_advection_local" .and.
allocated(
w_thetal_advection))
then
2319 else if (name .eq.
"w_thetal_buoyancy_local" .and.
allocated(
w_thetal_buoyancy))
then
2321 else if (name .eq.
"ww_thetal_local" .and.
allocated(
ww_thetal))
then
2323 else if (name .eq.
"thetal_thetal_local" .and.
allocated(
thetal_thetal))
then
2325 else if (name .eq.
"sthetal_thetal_local" .and.
allocated(
sthetal_thetal))
then
2331 else if (name .eq.
"wthetal_thetal_local" .and.
allocated(
wthetal_thetal))
then
2333 else if (name .eq.
"u_mse_local" .and.
allocated(
u_mse))
then
2335 else if (name .eq.
"us_mse_local" .and.
allocated(
us_mse))
then
2337 else if (name .eq.
"u_mse_advection_local" .and.
allocated(
u_mse_advection))
then
2341 else if (name .eq.
"wu_mse_local" .and.
allocated(
wu_mse))
then
2343 else if (name .eq.
"v_mse_local" .and.
allocated(
v_mse))
then
2345 else if (name .eq.
"vs_mse_local" .and.
allocated(
vs_mse))
then
2347 else if (name .eq.
"v_mse_advection_local" .and.
allocated(
v_mse_advection))
then
2351 else if (name .eq.
"wv_mse_local" .and.
allocated(
wv_mse))
then
2353 else if (name .eq.
"w_mse_local" .and.
allocated(
w_mse))
then
2355 else if (name .eq.
"ws_mse_local" .and.
allocated(
ws_mse))
then
2357 else if (name .eq.
"w_mse_advection_local" .and.
allocated(
w_mse_advection))
then
2361 else if (name .eq.
"w_mse_buoyancy_local" .and.
allocated(
w_mse_buoyancy))
then
2363 else if (name .eq.
"ww_mse_local" .and.
allocated(
ww_mse))
then
2365 else if (name .eq.
"mse_mse_local" .and.
allocated(
mse_mse))
then
2367 else if (name .eq.
"smse_mse_local" .and.
allocated(
smse_mse))
then
2369 else if (name .eq.
"mse_mse_advection_local" .and.
allocated(
mse_mse_advection))
then
2371 else if (name .eq.
"mse_mse_diffusion_local" .and.
allocated(
mse_mse_diffusion))
then
2373 else if (name .eq.
"wmse_mse_local" .and.
allocated(
wmse_mse))
then
2375 else if (name .eq.
"us_qt_local" .and.
allocated(
us_qt))
then
2377 else if (name .eq.
"u_qt_advection_local" .and.
allocated(
u_qt_advection))
then
2381 else if (name .eq.
"wu_qt_local" .and.
allocated(
wu_qt))
then
2383 else if (name .eq.
"vs_qt_local" .and.
allocated(
vs_qt))
then
2385 else if (name .eq.
"v_qt_advection_local" .and.
allocated(
v_qt_advection))
then
2389 else if (name .eq.
"wv_qt_local" .and.
allocated(
wv_qt))
then
2391 else if (name .eq.
"w_qt_local" .and.
allocated(
w_qt))
then
2393 else if (name .eq.
"ws_qt_local" .and.
allocated(
ws_qt))
then
2395 else if (name .eq.
"w_qt_advection_local" .and.
allocated(
w_qt_advection))
then
2399 else if (name .eq.
"w_qt_buoyancy_local" .and.
allocated(
w_qt_buoyancy))
then
2401 else if (name .eq.
"ww_qt_local" .and.
allocated(
ww_qt))
then
2403 else if (name .eq.
"qt_qt_local" .and.
allocated(
qt_qt))
then
2405 else if (name .eq.
"sqt_qt_local" .and.
allocated(
sqt_qt))
then
2407 else if (name .eq.
"qt_qt_advection_local" .and.
allocated(
qt_qt_advection))
then
2409 else if (name .eq.
"qt_qt_diffusion_local" .and.
allocated(
qt_qt_diffusion))
then
2411 else if (name .eq.
"wqt_qt_local" .and.
allocated(
wqt_qt))
then
2413 else if (name .eq.
"mflux_local")
then
2414 field_value%scalar_real=
mflux
2423 type(component_field_value_type),
intent(inout) :: field_value
2424 real(kind=default_precision),
dimension(:),
optional :: real_1d_field
2425 real(kind=default_precision),
dimension(:,:),
optional :: real_2d_field
2427 if (
present(real_1d_field))
then
2428 allocate(field_value%real_1d_array(
size(real_1d_field)), source=real_1d_field)
2429 else if (
present(real_2d_field))
then
2430 allocate(field_value%real_2d_array(
size(real_2d_field, 1),
size(real_2d_field, 2)), source=real_2d_field)
2439 type(hashmap_type),
intent(inout) :: collection
2440 character(len=*),
intent(in) :: field_name
2441 logical,
intent(in) :: enabled_state
2443 call c_put_logical(collection, field_name, enabled_state)
2451 type(hashmap_type),
intent(inout) :: collection
2452 character(len=*),
intent(in) :: field_name