Called for each column per timestep this will calculate the buoyancy terms for the SW field. 
  196     type(model_state_type), 
target, 
intent(inout) :: current_state
 
  199     integer :: current_x_index, current_y_index, target_x_index, target_y_index
 
  201     current_x_index=current_state%column_local_x
 
  202     current_y_index=current_state%column_local_y
 
  203     target_y_index=current_y_index-current_state%local_grid%halo_size(y_index)
 
  204     target_x_index=current_x_index-current_state%local_grid%halo_size(x_index)
 
  207     if (current_state%first_timestep_column) 
then 
  208       if (l_tend_pr_tot_w) 
then 
  209         tend_pr_tot_w(:)=0.0_default_precision
 
  213     if (mod(current_state%timestep, diagnostic_generation_frequency) == 0 .and. .not. current_state%halo_column) 
then 
  214       call save_precomponent_tendencies(current_state, current_x_index, current_y_index, target_x_index, target_y_index)
 
  219     if (.not. current_state%passive_th .and. current_state%th%active) 
then 
  220       do k=2,current_state%local_grid%size(z_index)-1    
 
  221         w_buoyancy(k)=(0.5_default_precision*current_state%global_grid%configuration%vertical%buoy_co(k))*&
 
  222              (current_state%th%data(k, current_state%column_local_y, current_state%column_local_x)&
 
  223              +current_state%th%data(k+1, current_state%column_local_y, current_state%column_local_x))
 
  224         current_state%sw%data(k, current_state%column_local_y, current_state%column_local_x)=&
 
  225              current_state%sw%data(k, current_state%column_local_y, current_state%column_local_x)+w_buoyancy(k)             
 
  228     if (.not. current_state%passive_q .and. current_state%number_q_fields .gt. 0) 
then 
  229       if (current_state%use_anelastic_equations) 
then                                                       
  230         do n=1,current_state%number_q_fields
 
  231           do k=2,current_state%local_grid%size(z_index)-1            
 
  232             current_state%sw%data(k, current_state%column_local_y, current_state%column_local_x)=&
 
  233                  current_state%sw%data(k, current_state%column_local_y, current_state%column_local_x)+&
 
  234                  (0.5_default_precision*current_state%global_grid%configuration%vertical%buoy_co(k))*&
 
  235                  current_state%cq(n)* (current_state%global_grid%configuration%vertical%thref(k)*&
 
  236                  current_state%q(n)%data(k, current_state%column_local_y, current_state%column_local_x)+&
 
  237                  current_state%global_grid%configuration%vertical%thref(k+1)*&
 
  238                  current_state%q(n)%data(k+1, current_state%column_local_y, current_state%column_local_x))
 
  242         do n=1,current_state%number_q_fields
 
  243           do k=2,current_state%local_grid%size(z_index)-1
 
  244              current_state%sw%data(k, current_state%column_local_y, current_state%column_local_x)=&
 
  245                   current_state%sw%data(k, current_state%column_local_y, current_state%column_local_x)+&
 
  246                   g_over_2*current_state%cq(n)*&
 
  247                   (current_state%q(n)%data(k, current_state%column_local_y, current_state%column_local_x)+&
 
  248                   current_state%q(n)%data(k+1, current_state%column_local_y, current_state%column_local_x))
 
  255     if (mod(current_state%timestep, diagnostic_generation_frequency) == 0 .and. .not. current_state%halo_column) 
then 
  256       call compute_component_tendencies(current_state, current_x_index, current_y_index, target_x_index, target_y_index)