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