source: palm/trunk/SOURCE/advec_s_pw.f90 @ 3637

Last change on this file since 3637 was 3636, checked in by raasch, 5 years ago

nopointer option removed

  • Property svn:keywords set to Id
File size: 8.7 KB
Line 
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-2018 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: advec_s_pw.f90 3636 2018-12-19 13:48:34Z knoop $
27! nopointer option removed
28!
29! 3547 2018-11-21 13:21:24Z suehring
30! variables documented
31!
32! 3538 2018-11-20 10:55:41Z suehring
33! Remove unnecessary double-masking of topography
34!
35! 3302 2018-10-03 02:39:40Z raasch
36! Stokes drift velocity added
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! Revision 1.1  1997/08/29 08:54:20  raasch
84! Initial revision
85!
86!
87! Description:
88! ------------
89!> Advection term for scalar variables using the Piacsek and Williams scheme
90!> (form C3). Contrary to PW itself, for reasons of accuracy their scheme is
91!> slightly modified as follows: the values of those scalars that are used for
92!> the computation of the flux divergence are reduced by the value of the
93!> relevant scalar at the location where the difference is computed (sk(k,j,i)).
94!> NOTE: at the first grid point above the surface computation still takes place!
95!------------------------------------------------------------------------------!
96 MODULE advec_s_pw_mod
97 
98
99    PRIVATE
100    PUBLIC advec_s_pw
101
102    INTERFACE advec_s_pw
103       MODULE PROCEDURE advec_s_pw
104       MODULE PROCEDURE advec_s_pw_ij
105    END INTERFACE
106 
107 CONTAINS
108
109
110!------------------------------------------------------------------------------!
111! Description:
112! ------------
113!> Call for all grid points
114!------------------------------------------------------------------------------!
115    SUBROUTINE advec_s_pw( sk )
116
117       USE arrays_3d,                                                          &
118           ONLY:  dd2zu, tend, u, u_stokes_zu, v, v_stokes_zu, 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, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, 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)     ::  gu  !< local additional advective velocity
139       REAL(wp)     ::  gv  !< local additional advective velocity
140
141       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
142 
143
144       DO  i = nxl, nxr
145          DO  j = nys, nyn
146             DO  k = nzb+1, nzt
147
148!
149!--             Galilean transformation + Stokes drift velocity (ocean only)
150                gu = u_gtrans - u_stokes_zu(k)
151                gv = v_gtrans - v_stokes_zu(k)
152
153                tend(k,j,i) = tend(k,j,i) +                                    &
154                                     ( -0.5_wp * ( ( u(k,j,i+1) - gu       ) * &
155                                                   ( sk(k,j,i+1) - sk(k,j,i) ) &
156                                                 - ( u(k,j,i)   - gu       ) * &
157                                                   ( sk(k,j,i-1) - sk(k,j,i) ) &
158                                                 ) * ddx                       &
159                                       -0.5_wp * ( ( v(k,j+1,i) - gv       ) * &
160                                                   ( sk(k,j+1,i) - sk(k,j,i) ) &
161                                                 - ( v(k,j,i)   - gv       ) * &
162                                                   ( sk(k,j-1,i) - sk(k,j,i) ) &
163                                                 ) * ddy                       &
164                                       -         (   w(k,j,i)                * &
165                                                   ( sk(k+1,j,i) - sk(k,j,i) ) &
166                                                 -   w(k-1,j,i)              * &
167                                                   ( sk(k-1,j,i) - sk(k,j,i) ) &
168                                                 ) * dd2zu(k)                  &
169                                      )
170             ENDDO
171          ENDDO
172       ENDDO
173
174    END SUBROUTINE advec_s_pw
175
176
177!------------------------------------------------------------------------------!
178! Description:
179! ------------
180!> Call for grid point i,j
181!------------------------------------------------------------------------------!
182    SUBROUTINE advec_s_pw_ij( i, j, sk )
183
184       USE arrays_3d,                                                          &
185           ONLY:  dd2zu, tend, u, u_stokes_zu, v, v_stokes_zu, w
186
187       USE control_parameters,                                                 &
188           ONLY:  u_gtrans, v_gtrans
189
190       USE grid_variables,                                                     &
191           ONLY:  ddx, ddy
192
193       USE indices,                                                            &
194           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzt
195
196       USE kinds
197
198
199       IMPLICIT NONE
200
201       INTEGER(iwp) ::  i !< grid index along x-direction
202       INTEGER(iwp) ::  j !< grid index along y-direction
203       INTEGER(iwp) ::  k !< grid index along z-direction
204
205       REAL(wp)     ::  gu  !< local additional advective velocity
206       REAL(wp)     ::  gv  !< local additional advective velocity
207
208       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
209
210
211       DO  k = nzb+1, nzt
212
213!
214!--       Galilean transformation + Stokes drift velocity (ocean only)
215          gu = u_gtrans - u_stokes_zu(k)
216          gv = v_gtrans - v_stokes_zu(k)
217
218          tend(k,j,i) = tend(k,j,i) +                                          &
219                                    ( -0.5_wp * ( ( u(k,j,i+1) - gu        ) * &
220                                                  ( sk(k,j,i+1) - sk(k,j,i) )  &
221                                                - ( u(k,j,i)   - gu        ) * &
222                                                  ( sk(k,j,i-1) - sk(k,j,i) )  &
223                                                ) * ddx                        &
224                                      -0.5_wp * ( ( v(k,j+1,i) - gv       ) *  &
225                                                  ( sk(k,j+1,i) - sk(k,j,i) )  &
226                                                - ( v(k,j,i)   - gv       ) *  &
227                                                  ( sk(k,j-1,i) - sk(k,j,i) )  &
228                                                ) * ddy                        &
229                                      -         (   w(k,j,i)                *  &
230                                                  ( sk(k+1,j,i) - sk(k,j,i) )  &
231                                                -   w(k-1,j,i)              *  &
232                                                  ( sk(k-1,j,i) - sk(k,j,i) )  &
233                                                ) * dd2zu(k)                   &
234                                    )
235       ENDDO
236
237    END SUBROUTINE advec_s_pw_ij
238
239 END MODULE advec_s_pw_mod
Note: See TracBrowser for help on using the repository browser.