[1] | 1 | MODULE advec_w_up_mod |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 9 | ! |
---|
| 10 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 11 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 12 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 13 | ! |
---|
| 14 | ! You should have received a copy of the GNU General Public License along with |
---|
| 15 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 16 | ! |
---|
| 17 | ! Copyright 1997-2012 Leibniz University Hannover |
---|
| 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
| 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
[3] | 26 | ! $Id: advec_w_up.f90 1037 2012-10-22 14:10:22Z maronga $ |
---|
[1037] | 27 | ! |
---|
| 28 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 29 | ! code put under GPL (PALM 3.9) |
---|
| 30 | ! |
---|
[3] | 31 | ! RCS Log replace by Id keyword, revision history cleaned up |
---|
| 32 | ! |
---|
[1] | 33 | ! Revision 1.11 2006/02/23 09:47:23 raasch |
---|
| 34 | ! *** empty log message *** |
---|
| 35 | ! |
---|
| 36 | ! Revision 1.1 1997/08/29 08:56:33 raasch |
---|
| 37 | ! Initial revision |
---|
| 38 | ! |
---|
| 39 | ! |
---|
| 40 | ! Description: |
---|
| 41 | ! ------------ |
---|
| 42 | ! Advection term for the w velocity-component using upstream scheme. |
---|
| 43 | ! NOTE: vertical advection at k=1 still has wrong grid spacing for w>0 |
---|
| 44 | ! The same problem occurs for all topography boundaries! |
---|
| 45 | !------------------------------------------------------------------------------! |
---|
| 46 | |
---|
| 47 | PRIVATE |
---|
| 48 | PUBLIC advec_w_up |
---|
| 49 | |
---|
| 50 | INTERFACE advec_w_up |
---|
| 51 | MODULE PROCEDURE advec_w_up |
---|
| 52 | MODULE PROCEDURE advec_w_up_ij |
---|
| 53 | END INTERFACE advec_w_up |
---|
| 54 | |
---|
| 55 | CONTAINS |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | !------------------------------------------------------------------------------! |
---|
| 59 | ! Call for all grid points |
---|
| 60 | !------------------------------------------------------------------------------! |
---|
| 61 | SUBROUTINE advec_w_up |
---|
| 62 | |
---|
| 63 | USE arrays_3d |
---|
| 64 | USE control_parameters |
---|
| 65 | USE grid_variables |
---|
| 66 | USE indices |
---|
| 67 | |
---|
| 68 | IMPLICIT NONE |
---|
| 69 | |
---|
| 70 | INTEGER :: i, j, k |
---|
| 71 | REAL :: ukomp, vkomp |
---|
| 72 | |
---|
| 73 | |
---|
| 74 | DO i = nxl, nxr |
---|
| 75 | DO j = nys, nyn |
---|
| 76 | DO k = nzb_w_inner(j,i)+1, nzt-1 |
---|
| 77 | ! |
---|
| 78 | !-- x-direction |
---|
| 79 | ukomp = 0.25 * ( u(k,j,i) + u(k,j,i+1) + & |
---|
| 80 | u(k+1,j,i) + u(k+1,j,i+1) ) - u_gtrans |
---|
| 81 | IF ( ukomp > 0.0 ) THEN |
---|
| 82 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
| 83 | ( w(k,j,i) - w(k,j,i-1) ) * ddx |
---|
| 84 | ELSE |
---|
| 85 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
| 86 | ( w(k,j,i+1) - w(k,j,i) ) * ddx |
---|
| 87 | ENDIF |
---|
| 88 | ! |
---|
| 89 | !-- y-direction |
---|
| 90 | vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + & |
---|
| 91 | v(k+1,j,i) + v(k+1,j+1,i) ) - v_gtrans |
---|
| 92 | IF ( vkomp > 0.0 ) THEN |
---|
| 93 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
| 94 | ( w(k,j,i) - w(k,j-1,i) ) * ddy |
---|
| 95 | ELSE |
---|
| 96 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
| 97 | ( w(k,j+1,i) - w(k,j,i) ) * ddy |
---|
| 98 | ENDIF |
---|
| 99 | ! |
---|
| 100 | !-- z-direction |
---|
| 101 | IF ( w(k,j,i) > 0.0 ) THEN |
---|
| 102 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
| 103 | ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) |
---|
| 104 | ELSE |
---|
| 105 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
| 106 | ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) |
---|
| 107 | ENDIF |
---|
| 108 | |
---|
| 109 | ENDDO |
---|
| 110 | ENDDO |
---|
| 111 | ENDDO |
---|
| 112 | |
---|
| 113 | END SUBROUTINE advec_w_up |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | !------------------------------------------------------------------------------! |
---|
| 117 | ! Call for grid point i,j |
---|
| 118 | !------------------------------------------------------------------------------! |
---|
| 119 | SUBROUTINE advec_w_up_ij( i, j ) |
---|
| 120 | |
---|
| 121 | USE arrays_3d |
---|
| 122 | USE control_parameters |
---|
| 123 | USE grid_variables |
---|
| 124 | USE indices |
---|
| 125 | |
---|
| 126 | IMPLICIT NONE |
---|
| 127 | |
---|
| 128 | INTEGER :: i, j, k |
---|
| 129 | REAL :: ukomp, vkomp |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | DO k = nzb_w_inner(j,i)+1, nzt-1 |
---|
| 133 | ! |
---|
| 134 | !-- x-direction |
---|
| 135 | ukomp = 0.25 * ( u(k,j,i) + u(k,j,i+1) + u(k+1,j,i) + u(k+1,j,i+1) & |
---|
| 136 | ) - u_gtrans |
---|
| 137 | IF ( ukomp > 0.0 ) THEN |
---|
| 138 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
| 139 | ( w(k,j,i) - w(k,j,i-1) ) * ddx |
---|
| 140 | ELSE |
---|
| 141 | tend(k,j,i) = tend(k,j,i) - ukomp * & |
---|
| 142 | ( w(k,j,i+1) - w(k,j,i) ) * ddx |
---|
| 143 | ENDIF |
---|
| 144 | ! |
---|
| 145 | !-- y-direction |
---|
| 146 | vkomp = 0.25 * ( v(k,j,i) + v(k,j+1,i) + v(k+1,j,i) + v(k+1,j+1,i) & |
---|
| 147 | ) - v_gtrans |
---|
| 148 | IF ( vkomp > 0.0 ) THEN |
---|
| 149 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
| 150 | ( w(k,j,i) - w(k,j-1,i) ) * ddy |
---|
| 151 | ELSE |
---|
| 152 | tend(k,j,i) = tend(k,j,i) - vkomp * & |
---|
| 153 | ( w(k,j+1,i) - w(k,j,i) ) * ddy |
---|
| 154 | ENDIF |
---|
| 155 | ! |
---|
| 156 | !-- z-direction |
---|
| 157 | IF ( w(k,j,i) > 0.0 ) THEN |
---|
| 158 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
| 159 | ( w(k,j,i) - w(k-1,j,i) ) * ddzw(k) |
---|
| 160 | ELSE |
---|
| 161 | tend(k,j,i) = tend(k,j,i) - w(k,j,i) * & |
---|
| 162 | ( w(k+1,j,i) - w(k,j,i) ) * ddzw(k+1) |
---|
| 163 | ENDIF |
---|
| 164 | |
---|
| 165 | ENDDO |
---|
| 166 | |
---|
| 167 | END SUBROUTINE advec_w_up_ij |
---|
| 168 | |
---|
| 169 | END MODULE advec_w_up_mod |
---|