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

Last change on this file since 3830 was 3665, checked in by raasch, 6 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
RevLine 
[1873]1!> @file advec_s_up.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_up.f90 3665 2019-01-10 08:28:24Z raasch $
[3665]27! unused variables removed
28!
29! 3655 2019-01-07 16:51:22Z knoop
[3636]30! nopointer option removed
31!
32! 3547 2018-11-21 13:21:24Z suehring
[3547]33! variables documented
34!
35! 3538 2018-11-20 10:55:41Z suehring
[3538]36! Remove unnecessary double-masking of topography
37!
38! 2718 2018-01-02 08:49:38Z maronga
[2716]39! Corrected "Former revisions" section
40!
41! 2696 2017-12-14 17:12:51Z kanani
42! Change in file header (GPL part)
[1321]43!
[2716]44! 2233 2017-05-30 18:08:54Z suehring
45!
[2233]46! 2232 2017-05-30 17:47:52Z suehring
47! topography representation via flags
48!
[2001]49! 2000 2016-08-20 18:09:15Z knoop
50! Forced header and separation lines into 80 columns
51!
[1874]52! 1873 2016-04-18 14:50:06Z maronga
53! Module renamed (removed _mod)
54!
55!
[1851]56! 1850 2016-04-08 13:29:27Z maronga
57! Module renamed
58!
59!
[1683]60! 1682 2015-10-07 23:56:08Z knoop
61! Code annotations made doxygen readable
62!
[1375]63! 1374 2014-04-25 12:55:07Z raasch
64! missing variables added to ONLY list
65!
[1354]66! 1353 2014-04-08 15:21:23Z heinze
67! REAL constants provided with KIND-attribute
68!
[1321]69! 1320 2014-03-20 08:40:49Z raasch
[1320]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
[1]76!
[1037]77! 1036 2012-10-22 13:43:42Z raasch
78! code put under GPL (PALM 3.9)
79!
[1011]80! 1010 2012-09-20 07:59:54Z raasch
81! cpp switch __nopointer added for pointer free version
82!
[982]83! 981 2012-08-09 14:57:44Z maronga
84! Typo removed
85!
[1]86! Revision 1.1  1997/08/29 08:54:33  raasch
87! Initial revision
88!
89!
90! Description:
91! ------------
[1682]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!
[1]95!------------------------------------------------------------------------------!
[1682]96 MODULE advec_s_up_mod
97 
[1]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!------------------------------------------------------------------------------!
[1682]111! Description:
112! ------------
113!> Call for all grid points
[1]114!------------------------------------------------------------------------------!
115    SUBROUTINE advec_s_up( sk )
116
[1320]117       USE arrays_3d,                                                          &
118           ONLY:  ddzu, tend, u, v, w
[1]119
[1320]120       USE control_parameters,                                                 &
121           ONLY:  u_gtrans, v_gtrans
122
123       USE grid_variables,                                                     &
124           ONLY:  ddx, ddy
125
126       USE indices,                                                            &
[3665]127           ONLY:  nxl, nxr, nyn, nys, nzb, nzt
[1320]128
129       USE kinds
130
131
[1]132       IMPLICIT NONE
133
[3547]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
[1]137
[3547]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
[3636]141
[3547]142       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk !< treated scalar
[1]143
144
145       DO  i = nxl, nxr
146          DO  j = nys, nyn
[2232]147             DO  k = nzb+1, nzt
[1]148!
149!--             x-direction
[1353]150                ukomp = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
151                IF ( ukomp > 0.0_wp )  THEN
[1320]152                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
[3538]153                                         ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
[1]154                ELSE
[1320]155                   tend(k,j,i) = tend(k,j,i) - ukomp *                         &
[3538]156                                         ( sk(k,j,i+1) - sk(k,j,i) ) * ddx
[1]157                ENDIF
158!
159!--             y-direction
[1353]160                vkomp = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
161                IF ( vkomp > 0.0_wp )  THEN
[1320]162                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
[3538]163                                         ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
[1]164                ELSE
[1320]165                   tend(k,j,i) = tend(k,j,i) - vkomp *                         &
[3538]166                                         ( sk(k,j+1,i) - sk(k,j,i) ) * ddy
[1]167                ENDIF
168!
169!--             z-direction
[1353]170                wkomp = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
171                IF ( wkomp > 0.0_wp )  THEN
[1320]172                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
[3538]173                                         ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
[1]174                ELSE
[1320]175                   tend(k,j,i) = tend(k,j,i) - wkomp *                         &
[3538]176                                         ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1)
[1]177                ENDIF
178
179             ENDDO
180          ENDDO
181       ENDDO
182
183    END SUBROUTINE advec_s_up
184
185
186!------------------------------------------------------------------------------!
[1682]187! Description:
188! ------------
189!> Call for grid point i,j
[1]190!------------------------------------------------------------------------------!
191    SUBROUTINE advec_s_up_ij( i, j, sk )
192
[1320]193       USE arrays_3d,                                                          &
194           ONLY:  ddzu, tend, u, v, w
[1]195
[1320]196       USE control_parameters,                                                 &
197           ONLY:  u_gtrans, v_gtrans
198
199       USE grid_variables,                                                     &
200           ONLY:  ddx, ddy
201
202       USE indices,                                                            &
[3665]203           ONLY:  nzb, nzt
[1320]204
205       USE kinds
206
207
[1]208       IMPLICIT NONE
209
[3547]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
[1]213
[3547]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
[1320]217       
[3547]218       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk !< treated scalar
[1]219
220
[2232]221       DO  k = nzb+1, nzt
[1]222!
223!--       x-direction
[1353]224          ukomp = 0.5_wp * ( u(k,j,i) + u(k,j,i+1) ) - u_gtrans
225          IF ( ukomp > 0.0_wp )  THEN
[1320]226             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
[3538]227                                         ( sk(k,j,i) - sk(k,j,i-1) ) * ddx
[1]228          ELSE
[1320]229             tend(k,j,i) = tend(k,j,i) - ukomp *                               &
[3538]230                                         ( sk(k,j,i+1) - sk(k,j,i) ) * ddx
[1]231          ENDIF
232!
233!--       y-direction
[1353]234          vkomp = 0.5_wp * ( v(k,j,i) + v(k,j+1,i) ) - v_gtrans
235          IF ( vkomp > 0.0_wp )  THEN
[1320]236             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
[3538]237                                         ( sk(k,j,i) - sk(k,j-1,i) ) * ddy
[1]238          ELSE
[1320]239             tend(k,j,i) = tend(k,j,i) - vkomp *                               &
[3538]240                                         ( sk(k,j+1,i) - sk(k,j,i) ) * ddy
[1]241          ENDIF
242!
243!--       z-direction
[1353]244          wkomp = 0.5_wp * ( w(k,j,i) + w(k-1,j,i) )
245          IF ( wkomp > 0.0_wp )  THEN
[1320]246             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
[3538]247                                         ( sk(k,j,i) - sk(k-1,j,i) ) * ddzu(k)
[1]248          ELSE
[1320]249             tend(k,j,i) = tend(k,j,i) - wkomp *                               &
[3538]250                                         ( sk(k+1,j,i)-sk(k,j,i) ) * ddzu(k+1)
[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.