source: palm/trunk/SOURCE/advec_s_up.f90 @ 3701

Last change on this file since 3701 was 3665, checked in by raasch, 5 years ago

dummy statements added to avoid compiler warnings about unused variables, unused variables removed, ssh-call for submitting batch jobs on remote systems modified again to avoid output of login messages on specific systems

  • Property svn:keywords set to Id
File size: 8.5 KB
Line 
1!> @file advec_s_up.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_up.f90 3665 2019-01-10 08:28:24Z knoop $
27! unused variables removed
28!
29! 3655 2019-01-07 16:51:22Z knoop
30! nopointer option removed
31!
32! 3547 2018-11-21 13:21:24Z suehring
33! variables documented
34!
35! 3538 2018-11-20 10:55:41Z suehring
36! Remove unnecessary double-masking of topography
37!
38! 2718 2018-01-02 08:49:38Z maronga
39! Corrected "Former revisions" section
40!
41! 2696 2017-12-14 17:12:51Z kanani
42! Change in file header (GPL part)
43!
44! 2233 2017-05-30 18:08:54Z suehring
45!
46! 2232 2017-05-30 17:47:52Z suehring
47! topography representation via flags
48!
49! 2000 2016-08-20 18:09:15Z knoop
50! Forced header and separation lines into 80 columns
51!
52! 1873 2016-04-18 14:50:06Z maronga
53! Module renamed (removed _mod)
54!
55!
56! 1850 2016-04-08 13:29:27Z maronga
57! Module renamed
58!
59!
60! 1682 2015-10-07 23:56:08Z knoop
61! Code annotations made doxygen readable
62!
63! 1374 2014-04-25 12:55:07Z raasch
64! missing variables added to ONLY list
65!
66! 1353 2014-04-08 15:21:23Z heinze
67! REAL constants provided with KIND-attribute
68!
69! 1320 2014-03-20 08:40:49Z raasch
70! ONLY-attribute added to USE-statements,
71! kind-parameters added to all INTEGER and REAL declaration statements,
72! kinds are defined in new module kinds,
73! revision history before 2012 removed,
74! comment fields (!:) to be used for variable explanations added to
75! all variable declaration statements
76!
77! 1036 2012-10-22 13:43:42Z raasch
78! code put under GPL (PALM 3.9)
79!
80! 1010 2012-09-20 07:59:54Z raasch
81! cpp switch __nopointer added for pointer free version
82!
83! 981 2012-08-09 14:57:44Z maronga
84! Typo removed
85!
86! Revision 1.1  1997/08/29 08:54:33  raasch
87! Initial revision
88!
89!
90! Description:
91! ------------
92!> Advection term for scalar quantities using the Upstream scheme.
93!> NOTE: vertical advection at k=1 still has wrong grid spacing for w>0!
94!>       The same problem occurs for all topography boundaries!
95!------------------------------------------------------------------------------!
96 MODULE advec_s_up_mod
97 
98
99    PRIVATE
100    PUBLIC advec_s_up
101
102    INTERFACE advec_s_up
103       MODULE PROCEDURE advec_s_up
104       MODULE PROCEDURE advec_s_up_ij
105    END INTERFACE advec_s_up
106
107 CONTAINS
108
109
110!------------------------------------------------------------------------------!
111! Description:
112! ------------
113!> Call for all grid points
114!------------------------------------------------------------------------------!
115    SUBROUTINE advec_s_up( sk )
116
117       USE arrays_3d,                                                          &
118           ONLY:  ddzu, tend, u, v, w
119
120       USE control_parameters,                                                 &
121           ONLY:  u_gtrans, v_gtrans
122
123       USE grid_variables,                                                     &
124           ONLY:  ddx, ddy
125
126       USE indices,                                                            &
127           ONLY:  nxl, nxr, nyn, nys, nzb, nzt
128
129       USE kinds
130
131
132       IMPLICIT NONE
133
134       INTEGER(iwp) ::  i !< grid index along x-direction
135       INTEGER(iwp) ::  j !< grid index along y-direction
136       INTEGER(iwp) ::  k !< grid index along z-direction
137
138       REAL(wp) ::  ukomp !< advection velocity along x-direction
139       REAL(wp) ::  vkomp !< advection velocity along y-direction
140       REAL(wp) ::  wkomp !< advection velocity along z-direction
141
142       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk !< treated scalar
143
144
145       DO  i = nxl, nxr
146          DO  j = nys, nyn
147             DO  k = nzb+1, nzt
148!
149!--             x-direction
150                ukomp = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
151                IF ( ukomp > 0.0_wp )  THEN
152                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
153                                         ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
154                ELSE
155                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
156                                         ( sk(k,j,i+1) - sk(k,j,i) ) * ddx
157                ENDIF
158!
159!--             y-direction
160                vkomp = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
161                IF ( vkomp > 0.0_wp )  THEN
162                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
163                                         ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
164                ELSE
165                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
166                                         ( sk(k,j+1,i) - sk(k,j,i) ) * ddy
167                ENDIF
168!
169!--             z-direction
170                wkomp = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
171                IF ( wkomp > 0.0_wp )  THEN
172                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
173                                         ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
174                ELSE
175                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
176                                         ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1)
177                ENDIF
178
179             ENDDO
180          ENDDO
181       ENDDO
182
183    END SUBROUTINE advec_s_up
184
185
186!------------------------------------------------------------------------------!
187! Description:
188! ------------
189!> Call for grid point i,j
190!------------------------------------------------------------------------------!
191    SUBROUTINE advec_s_up_ij( i, j, sk )
192
193       USE arrays_3d,                                                          &
194           ONLY:  ddzu, tend, u, v, w
195
196       USE control_parameters,                                                 &
197           ONLY:  u_gtrans, v_gtrans
198
199       USE grid_variables,                                                     &
200           ONLY:  ddx, ddy
201
202       USE indices,                                                            &
203           ONLY:  nzb, nzt
204
205       USE kinds
206
207
208       IMPLICIT NONE
209
210       INTEGER(iwp) ::  i !< grid index along x-direction
211       INTEGER(iwp) ::  j !< grid index along y-direction
212       INTEGER(iwp) ::  k !< grid index along z-direction
213
214       REAL(wp) ::  ukomp !< advection velocity along x-direction
215       REAL(wp) ::  vkomp !< advection velocity along y-direction
216       REAL(wp) ::  wkomp !< advection velocity along z-direction
217       
218       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk !< treated scalar
219
220
221       DO  k = nzb+1, nzt
222!
223!--       x-direction
224          ukomp = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
225          IF ( ukomp > 0.0_wp )  THEN
226             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
227                                         ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
228          ELSE
229             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
230                                         ( sk(k,j,i+1) - sk(k,j,i) ) * ddx
231          ENDIF
232!
233!--       y-direction
234          vkomp = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
235          IF ( vkomp > 0.0_wp )  THEN
236             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
237                                         ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
238          ELSE
239             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
240                                         ( sk(k,j+1,i) - sk(k,j,i) ) * ddy
241          ENDIF
242!
243!--       z-direction
244          wkomp = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
245          IF ( wkomp > 0.0_wp )  THEN
246             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
247                                         ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
248          ELSE
249             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
250                                         ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1)
251          ENDIF
252
253       ENDDO
254
255    END SUBROUTINE advec_s_up_ij
256
257 END MODULE advec_s_up_mod
Note: See TracBrowser for help on using the repository browser.