MODULE advec_u_up_mod !------------------------------------------------------------------------------! ! Actual revisions: ! ----------------- ! ! ! Former revisions: ! ----------------- ! $Id: advec_u_up.f90 110 2007-10-05 05:13:14Z weinreis $ ! ! 106 2007-08-16 14:30:26Z raasch ! i loop is starting from nxlu (needed for non-cyclic boundary conditions) ! ! 75 2007-03-22 09:54:05Z raasch ! uxrp eliminated ! ! RCS Log replace by Id keyword, revision history cleaned up ! ! Revision 1.12 2006/02/23 09:45:04 raasch ! nzb_2d replaced by nzb_u_inner ! ! Revision 1.1 1997/08/29 08:55:25 raasch ! Initial revision ! ! ! Description: ! ------------ ! Advection term for the u velocity-component using upstream scheme. ! NOTE: vertical advection at k=1 still has wrong grid spacing for w>0! ! The same problem occurs for all topography boundaries! !------------------------------------------------------------------------------! PRIVATE PUBLIC advec_u_up INTERFACE advec_u_up MODULE PROCEDURE advec_u_up MODULE PROCEDURE advec_u_up_ij END INTERFACE advec_u_up CONTAINS !------------------------------------------------------------------------------! ! Call for all grid points !------------------------------------------------------------------------------! SUBROUTINE advec_u_up USE arrays_3d USE control_parameters USE grid_variables USE indices IMPLICIT NONE INTEGER :: i, j, k REAL :: ukomp, vkomp, wkomp DO i = nxlu, nxr DO j = nys, nyn DO k = nzb_u_inner(j,i)+1, nzt ! !-- x-direction ukomp = u(k,j,i) - u_gtrans IF ( ukomp > 0.0 ) THEN tend(k,j,i) = tend(k,j,i) - ukomp * & ( u(k,j,i) - u(k,j,i-1) ) * ddx ELSE tend(k,j,i) = tend(k,j,i) - ukomp * & ( u(k,j,i+1) - u(k,j,i) ) * ddx ENDIF ! !-- y-direction vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + & v(k,j,i-1) + v(k,j+1,i-1) ) - v_gtrans IF ( vkomp > 0.0 ) THEN tend(k,j,i) = tend(k,j,i) - vkomp * & ( u(k,j,i) - u(k,j-1,i) ) * ddy ELSE tend(k,j,i) = tend(k,j,i) - vkomp * & ( u(k,j+1,i) - u(k,j,i) ) * ddy ENDIF ! !-- z-direction wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + & w(k,j,i-1) + w(k-1,j,i-1) ) IF ( wkomp > 0.0 ) THEN tend(k,j,i) = tend(k,j,i) - wkomp * & ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) ELSE tend(k,j,i) = tend(k,j,i) - wkomp * & ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) ENDIF ENDDO ENDDO ENDDO END SUBROUTINE advec_u_up !------------------------------------------------------------------------------! ! Call for grid point i,j !------------------------------------------------------------------------------! SUBROUTINE advec_u_up_ij( i, j ) USE arrays_3d USE control_parameters USE grid_variables USE indices IMPLICIT NONE INTEGER :: i, j, k REAL :: ukomp, vkomp, wkomp DO k = nzb_u_inner(j,i)+1, nzt ! !-- x-direction ukomp = u(k,j,i) - u_gtrans IF ( ukomp > 0.0 ) THEN tend(k,j,i) = tend(k,j,i) - ukomp * & ( u(k,j,i) - u(k,j,i-1) ) * ddx ELSE tend(k,j,i) = tend(k,j,i) - ukomp * & ( u(k,j,i+1) - u(k,j,i) ) * ddx ENDIF ! !-- y-direction vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k,j,i-1) + v(k,j+1,i-1) & ) - v_gtrans IF ( vkomp > 0.0 ) THEN tend(k,j,i) = tend(k,j,i) - vkomp * & ( u(k,j,i) - u(k,j-1,i) ) * ddy ELSE tend(k,j,i) = tend(k,j,i) - vkomp * & ( u(k,j+1,i) - u(k,j,i) ) * ddy ENDIF ! !-- z-direction wkomp = 0.25 * ( w(k,j,i) + w(k-1,j,i) + w(k,j,i-1) + w(k-1,j,i-1) ) IF ( wkomp > 0.0 ) THEN tend(k,j,i) = tend(k,j,i) - wkomp * & ( u(k,j,i) - u(k-1,j,i) ) * ddzu(k) ELSE tend(k,j,i) = tend(k,j,i) - wkomp * & ( u(k+1,j,i) - u(k,j,i) ) * ddzu(k+1) ENDIF ENDDO END SUBROUTINE advec_u_up_ij END MODULE advec_u_up_mod