MODULE advec_s_pw_mod !------------------------------------------------------------------------------! ! Current revisions: ! ----------------- ! ! ! Former revisions: ! ----------------- ! $Id: advec_s_pw.f90 1011 2012-09-20 08:15:29Z suehring $ ! ! 1010 2012-09-20 07:59:54Z raasch ! cpp switch __nopointer added for pointer free version ! ! 19 2007-02-23 04:53:48Z raasch ! Calculation extended for gridpoint nzt ! ! RCS Log replace by Id keyword, revision history cleaned up ! ! Revision 1.12 2006/02/23 09:42:55 raasch ! nzb_2d replaced by nzb_s_inner ! ! Revision 1.1 1997/08/29 08:54:20 raasch ! Initial revision ! ! ! Description: ! ------------ ! Advection term for scalar variables using the Piacsek and Williams scheme ! (form C3). Contrary to PW itself, for reasons of accuracy their scheme is ! slightly modified as follows: the values of those scalars that are used for ! the computation of the flux divergence are reduced by the value of the ! relevant scalar at the location where the difference is computed (sk(k,j,i)). ! NOTE: at the first grid point above the surface computation still takes place! !------------------------------------------------------------------------------! PRIVATE PUBLIC advec_s_pw INTERFACE advec_s_pw MODULE PROCEDURE advec_s_pw MODULE PROCEDURE advec_s_pw_ij END INTERFACE CONTAINS !------------------------------------------------------------------------------! ! Call for all grid points !------------------------------------------------------------------------------! SUBROUTINE advec_s_pw( sk ) USE arrays_3d USE control_parameters USE grid_variables USE indices IMPLICIT NONE INTEGER :: i, j, k #if defined( __nopointer ) REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk #else REAL, DIMENSION(:,:,:), POINTER :: sk #endif DO i = nxl, nxr DO j = nys, nyn DO k = nzb_s_inner(j,i)+1, nzt tend(k,j,i) = tend(k,j,i) & -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & ) * ddx & -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & ) * ddy & - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & ) * dd2zu(k) ENDDO ENDDO ENDDO END SUBROUTINE advec_s_pw !------------------------------------------------------------------------------! ! Call for grid point i,j !------------------------------------------------------------------------------! SUBROUTINE advec_s_pw_ij( i, j, sk ) USE arrays_3d USE control_parameters USE grid_variables USE indices IMPLICIT NONE INTEGER :: i, j, k #if defined( __nopointer ) REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk #else REAL, DIMENSION(:,:,:), POINTER :: sk #endif DO k = nzb_s_inner(j,i)+1, nzt tend(k,j,i) = tend(k,j,i) & -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & ) * ddx & -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & ) * ddy & - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & ) * dd2zu(k) ENDDO END SUBROUTINE advec_s_pw_ij END MODULE advec_s_pw_mod