[1873] | 1 | !> @file advec_s_pw.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[2000] | 5 | ! PALM is free software: you can redistribute it and/or modify it under the |
---|
| 6 | ! terms of the GNU General Public License as published by the Free Software |
---|
| 7 | ! Foundation, either version 3 of the License, or (at your option) any later |
---|
| 8 | ! version. |
---|
[1036] | 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 | ! |
---|
[3655] | 17 | ! Copyright 1997-2019 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1354] | 22 | ! |
---|
[2233] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: advec_s_pw.f90 4182 2019-08-22 15:20:23Z oliver.maas $ |
---|
[4182] | 27 | ! Corrected "Former revisions" section |
---|
| 28 | ! |
---|
| 29 | ! 3927 2019-04-23 13:24:29Z raasch |
---|
[3927] | 30 | ! pointer attribute removed from scalar 3d-array for performance reasons |
---|
| 31 | ! |
---|
| 32 | ! 3665 2019-01-10 08:28:24Z raasch |
---|
[3665] | 33 | ! unused variables removed |
---|
| 34 | ! |
---|
| 35 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
[3636] | 36 | ! nopointer option removed |
---|
[1321] | 37 | ! |
---|
[4182] | 38 | ! Revision 1.1 1997/08/29 08:54:20 raasch |
---|
| 39 | ! Initial revision |
---|
| 40 | ! |
---|
| 41 | ! |
---|
[1] | 42 | ! Description: |
---|
| 43 | ! ------------ |
---|
[1682] | 44 | !> Advection term for scalar variables using the Piacsek and Williams scheme |
---|
| 45 | !> (form C3). Contrary to PW itself, for reasons of accuracy their scheme is |
---|
| 46 | !> slightly modified as follows: the values of those scalars that are used for |
---|
| 47 | !> the computation of the flux divergence are reduced by the value of the |
---|
| 48 | !> relevant scalar at the location where the difference is computed (sk(k,j,i)). |
---|
| 49 | !> NOTE: at the first grid point above the surface computation still takes place! |
---|
[1] | 50 | !------------------------------------------------------------------------------! |
---|
[1682] | 51 | MODULE advec_s_pw_mod |
---|
| 52 | |
---|
[1] | 53 | |
---|
| 54 | PRIVATE |
---|
| 55 | PUBLIC advec_s_pw |
---|
| 56 | |
---|
| 57 | INTERFACE advec_s_pw |
---|
| 58 | MODULE PROCEDURE advec_s_pw |
---|
| 59 | MODULE PROCEDURE advec_s_pw_ij |
---|
| 60 | END INTERFACE |
---|
| 61 | |
---|
| 62 | CONTAINS |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | !------------------------------------------------------------------------------! |
---|
[1682] | 66 | ! Description: |
---|
| 67 | ! ------------ |
---|
| 68 | !> Call for all grid points |
---|
[1] | 69 | !------------------------------------------------------------------------------! |
---|
| 70 | SUBROUTINE advec_s_pw( sk ) |
---|
| 71 | |
---|
[1320] | 72 | USE arrays_3d, & |
---|
[3302] | 73 | ONLY: dd2zu, tend, u, u_stokes_zu, v, v_stokes_zu, w |
---|
[1] | 74 | |
---|
[1320] | 75 | USE control_parameters, & |
---|
| 76 | ONLY: u_gtrans, v_gtrans |
---|
| 77 | |
---|
| 78 | USE grid_variables, & |
---|
| 79 | ONLY: ddx, ddy |
---|
| 80 | |
---|
| 81 | USE indices, & |
---|
[3927] | 82 | ONLY: nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
[1320] | 83 | |
---|
| 84 | USE kinds |
---|
| 85 | |
---|
| 86 | |
---|
[1] | 87 | IMPLICIT NONE |
---|
| 88 | |
---|
[3547] | 89 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
| 90 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
| 91 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
[1] | 92 | |
---|
[3302] | 93 | REAL(wp) :: gu !< local additional advective velocity |
---|
| 94 | REAL(wp) :: gv !< local additional advective velocity |
---|
| 95 | |
---|
[3927] | 96 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk |
---|
[1] | 97 | |
---|
| 98 | |
---|
| 99 | DO i = nxl, nxr |
---|
| 100 | DO j = nys, nyn |
---|
[2232] | 101 | DO k = nzb+1, nzt |
---|
[3302] | 102 | |
---|
| 103 | ! |
---|
| 104 | !-- Galilean transformation + Stokes drift velocity (ocean only) |
---|
| 105 | gu = u_gtrans - u_stokes_zu(k) |
---|
| 106 | gv = v_gtrans - v_stokes_zu(k) |
---|
| 107 | |
---|
| 108 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 109 | ( -0.5_wp * ( ( u(k,j,i+1) - gu ) * & |
---|
| 110 | ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
| 111 | - ( u(k,j,i) - gu ) * & |
---|
| 112 | ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 113 | ) * ddx & |
---|
| 114 | -0.5_wp * ( ( v(k,j+1,i) - gv ) * & |
---|
| 115 | ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 116 | - ( v(k,j,i) - gv ) * & |
---|
| 117 | ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 118 | ) * ddy & |
---|
| 119 | - ( w(k,j,i) * & |
---|
| 120 | ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 121 | - w(k-1,j,i) * & |
---|
| 122 | ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
| 123 | ) * dd2zu(k) & |
---|
[3538] | 124 | ) |
---|
[1] | 125 | ENDDO |
---|
| 126 | ENDDO |
---|
| 127 | ENDDO |
---|
| 128 | |
---|
| 129 | END SUBROUTINE advec_s_pw |
---|
| 130 | |
---|
| 131 | |
---|
| 132 | !------------------------------------------------------------------------------! |
---|
[1682] | 133 | ! Description: |
---|
| 134 | ! ------------ |
---|
| 135 | !> Call for grid point i,j |
---|
[1] | 136 | !------------------------------------------------------------------------------! |
---|
| 137 | SUBROUTINE advec_s_pw_ij( i, j, sk ) |
---|
| 138 | |
---|
[1320] | 139 | USE arrays_3d, & |
---|
[3302] | 140 | ONLY: dd2zu, tend, u, u_stokes_zu, v, v_stokes_zu, w |
---|
[1] | 141 | |
---|
[1320] | 142 | USE control_parameters, & |
---|
| 143 | ONLY: u_gtrans, v_gtrans |
---|
| 144 | |
---|
| 145 | USE grid_variables, & |
---|
| 146 | ONLY: ddx, ddy |
---|
| 147 | |
---|
| 148 | USE indices, & |
---|
[3927] | 149 | ONLY: nxlg, nxrg, nyng, nysg, nzb, nzt |
---|
[1320] | 150 | |
---|
| 151 | USE kinds |
---|
| 152 | |
---|
| 153 | |
---|
[1] | 154 | IMPLICIT NONE |
---|
| 155 | |
---|
[3547] | 156 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
| 157 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
| 158 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
[1] | 159 | |
---|
[3302] | 160 | REAL(wp) :: gu !< local additional advective velocity |
---|
| 161 | REAL(wp) :: gv !< local additional advective velocity |
---|
| 162 | |
---|
[3927] | 163 | REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: sk |
---|
[1] | 164 | |
---|
| 165 | |
---|
[2232] | 166 | DO k = nzb+1, nzt |
---|
[3302] | 167 | |
---|
| 168 | ! |
---|
| 169 | !-- Galilean transformation + Stokes drift velocity (ocean only) |
---|
| 170 | gu = u_gtrans - u_stokes_zu(k) |
---|
| 171 | gv = v_gtrans - v_stokes_zu(k) |
---|
| 172 | |
---|
| 173 | tend(k,j,i) = tend(k,j,i) + & |
---|
| 174 | ( -0.5_wp * ( ( u(k,j,i+1) - gu ) * & |
---|
| 175 | ( sk(k,j,i+1) - sk(k,j,i) ) & |
---|
| 176 | - ( u(k,j,i) - gu ) * & |
---|
| 177 | ( sk(k,j,i-1) - sk(k,j,i) ) & |
---|
| 178 | ) * ddx & |
---|
| 179 | -0.5_wp * ( ( v(k,j+1,i) - gv ) * & |
---|
| 180 | ( sk(k,j+1,i) - sk(k,j,i) ) & |
---|
| 181 | - ( v(k,j,i) - gv ) * & |
---|
| 182 | ( sk(k,j-1,i) - sk(k,j,i) ) & |
---|
| 183 | ) * ddy & |
---|
| 184 | - ( w(k,j,i) * & |
---|
| 185 | ( sk(k+1,j,i) - sk(k,j,i) ) & |
---|
| 186 | - w(k-1,j,i) * & |
---|
| 187 | ( sk(k-1,j,i) - sk(k,j,i) ) & |
---|
| 188 | ) * dd2zu(k) & |
---|
[3538] | 189 | ) |
---|
[1] | 190 | ENDDO |
---|
| 191 | |
---|
| 192 | END SUBROUTINE advec_s_pw_ij |
---|
| 193 | |
---|
| 194 | END MODULE advec_s_pw_mod |
---|