[1] | 1 | MODULE advec_s_pw_mod |
---|
| 2 | |
---|
| 3 | !------------------------------------------------------------------------------! |
---|
[484] | 4 | ! Current revisions: |
---|
[1] | 5 | ! ----------------- |
---|
| 6 | ! |
---|
[1011] | 7 | ! |
---|
[1] | 8 | ! Former revisions: |
---|
| 9 | ! ----------------- |
---|
[3] | 10 | ! $Id: advec_s_pw.f90 1011 2012-09-20 08:15:29Z letzel $ |
---|
[39] | 11 | ! |
---|
[1011] | 12 | ! 1010 2012-09-20 07:59:54Z raasch |
---|
| 13 | ! cpp switch __nopointer added for pointer free version |
---|
| 14 | ! |
---|
[39] | 15 | ! 19 2007-02-23 04:53:48Z raasch |
---|
| 16 | ! Calculation extended for gridpoint nzt |
---|
| 17 | ! |
---|
[3] | 18 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
| 19 | ! |
---|
[1] | 20 | ! Revision 1.12 2006/02/23 09:42:55 raasch |
---|
| 21 | ! nzb_2d replaced by nzb_s_inner |
---|
| 22 | ! |
---|
| 23 | ! Revision 1.1 1997/08/29 08:54:20 raasch |
---|
| 24 | ! Initial revision |
---|
| 25 | ! |
---|
| 26 | ! |
---|
| 27 | ! Description: |
---|
| 28 | ! ------------ |
---|
| 29 | ! Advection term for scalar variables using the Piacsek and Williams scheme |
---|
| 30 | ! (form C3). Contrary to PW itself, for reasons of accuracy their scheme is |
---|
| 31 | ! slightly modified as follows: the values of those scalars that are used for |
---|
| 32 | ! the computation of the flux divergence are reduced by the value of the |
---|
| 33 | ! relevant scalar at the location where the difference is computed (sk(k,j,i)). |
---|
| 34 | ! NOTE: at the first grid point above the surface computation still takes place! |
---|
| 35 | !------------------------------------------------------------------------------! |
---|
| 36 | |
---|
| 37 | PRIVATE |
---|
| 38 | PUBLIC advec_s_pw |
---|
| 39 | |
---|
| 40 | INTERFACE advec_s_pw |
---|
| 41 | MODULE PROCEDURE advec_s_pw |
---|
| 42 | MODULE PROCEDURE advec_s_pw_ij |
---|
| 43 | END INTERFACE |
---|
| 44 | |
---|
| 45 | CONTAINS |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | !------------------------------------------------------------------------------! |
---|
| 49 | ! Call for all grid points |
---|
| 50 | !------------------------------------------------------------------------------! |
---|
| 51 | SUBROUTINE advec_s_pw( sk ) |
---|
| 52 | |
---|
| 53 | USE arrays_3d |
---|
| 54 | USE control_parameters |
---|
| 55 | USE grid_variables |
---|
| 56 | USE indices |
---|
| 57 | |
---|
| 58 | IMPLICIT NONE |
---|
| 59 | |
---|
| 60 | INTEGER :: i, j, k |
---|
| 61 | |
---|
[1010] | 62 | #if defined( __nopointer ) |
---|
| 63 | REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk |
---|
| 64 | #else |
---|
[1] | 65 | REAL, DIMENSION(:,:,:), POINTER :: sk |
---|
[1010] | 66 | #endif |
---|
[1] | 67 | |
---|
| 68 | |
---|
| 69 | DO i = nxl, nxr |
---|
| 70 | DO j = nys, nyn |
---|
[19] | 71 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
[1] | 72 | tend(k,j,i) = tend(k,j,i) & |
---|
| 73 | -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
| 74 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 75 | ) * ddx & |
---|
| 76 | -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 77 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 78 | ) * ddy & |
---|
| 79 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 80 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
| 81 | ) * dd2zu(k) |
---|
| 82 | ENDDO |
---|
| 83 | ENDDO |
---|
| 84 | ENDDO |
---|
| 85 | |
---|
| 86 | END SUBROUTINE advec_s_pw |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | !------------------------------------------------------------------------------! |
---|
| 90 | ! Call for grid point i,j |
---|
| 91 | !------------------------------------------------------------------------------! |
---|
| 92 | SUBROUTINE advec_s_pw_ij( i, j, sk ) |
---|
| 93 | |
---|
| 94 | USE arrays_3d |
---|
| 95 | USE control_parameters |
---|
| 96 | USE grid_variables |
---|
| 97 | USE indices |
---|
| 98 | |
---|
| 99 | IMPLICIT NONE |
---|
| 100 | |
---|
| 101 | INTEGER :: i, j, k |
---|
| 102 | |
---|
[1010] | 103 | #if defined( __nopointer ) |
---|
| 104 | REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk |
---|
| 105 | #else |
---|
[1] | 106 | REAL, DIMENSION(:,:,:), POINTER :: sk |
---|
[1010] | 107 | #endif |
---|
[1] | 108 | |
---|
| 109 | |
---|
[19] | 110 | DO k = nzb_s_inner(j,i)+1, nzt |
---|
[1] | 111 | tend(k,j,i) = tend(k,j,i) & |
---|
| 112 | -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
| 113 | - ( u(k,j,i) - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 114 | ) * ddx & |
---|
| 115 | -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 116 | - ( v(k,j,i) - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 117 | ) * ddy & |
---|
| 118 | - ( w(k,j,i) * ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 119 | - w(k-1,j,i) * ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
| 120 | ) * dd2zu(k) |
---|
| 121 | ENDDO |
---|
| 122 | |
---|
| 123 | END SUBROUTINE advec_s_pw_ij |
---|
| 124 | |
---|
| 125 | END MODULE advec_s_pw_mod |
---|