Classic swap and smooth based upon the old or no smoothing.
79 type(model_state_type),
intent(inout) :: current_state
80 logical,
intent(in) :: old_smoother
82 integer :: y_index, x_index, k, n
83 real(kind=DEFAULT_PRECISION) :: c1, c2, existing_value
85 if (old_smoother)
then 86 c1 = 1.0_default_precision - current_state%tsmth
87 c2 = 2.0_default_precision * current_state%tsmth - 1.0_default_precision
89 c1 = 1.0_default_precision
90 c2 = -1.0_default_precision
93 x_index=current_state%column_local_x
94 y_index=current_state%column_local_y
96 do k=1,current_state%global_grid%size(z_index)
98 existing_value = current_state%u%data(k,y_index,x_index) + current_state%zu%data(k,y_index,x_index)
99 current_state%u%data(k,y_index,x_index)=existing_value * c1 + current_state%u%data(k,y_index,x_index) * c2
100 current_state%zu%data(k,y_index,x_index)=existing_value - current_state%u%data(k,y_index,x_index)
103 existing_value = current_state%v%data(k,y_index,x_index) + current_state%zv%data(k,y_index,x_index)
104 current_state%v%data(k,y_index,x_index)=existing_value * c1 + current_state%v%data(k,y_index,x_index) * c2
105 current_state%zv%data(k,y_index,x_index)=existing_value - current_state%v%data(k,y_index,x_index)
108 existing_value = current_state%w%data(k,y_index,x_index) + current_state%zw%data(k,y_index,x_index)
109 current_state%w%data(k,y_index,x_index)=existing_value * c1 + current_state%w%data(k,y_index,x_index) * c2
110 current_state%zw%data(k,y_index,x_index)=existing_value - current_state%w%data(k,y_index,x_index)
112 if (current_state%th%active)
then 113 existing_value = current_state%th%data(k,y_index,x_index) + current_state%zth%data(k,y_index,x_index)
114 current_state%th%data(k,y_index,x_index)=existing_value * c1 + current_state%th%data(k,y_index,x_index) * c2
115 current_state%zth%data(k,y_index,x_index)=existing_value - current_state%th%data(k,y_index,x_index)
117 do n=1,current_state%number_q_fields
118 if (current_state%q(n)%active)
then 119 existing_value = current_state%q(n)%data(k,y_index,x_index) + current_state%zq(n)%data(k,y_index,x_index)
120 current_state%q(n)%data(k,y_index,x_index)=existing_value * c1 + current_state%q(n)%data(k,y_index,x_index) * c2
121 current_state%zq(n)%data(k,y_index,x_index)=existing_value - current_state%q(n)%data(k,y_index,x_index)