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