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

Last change on this file since 1952 was 1874, checked in by maronga, 8 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 6.5 KB
Line 
1!> @file advec_s_pw.f90
2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2016 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------!
18!
19! Current revisions:
20! -----------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: advec_s_pw.f90 1874 2016-04-18 14:51:10Z suehring $
26!
27! 1873 2016-04-18 14:50:06Z maronga
28! Module renamed (removed _mod)
29!
30!
31! 1850 2016-04-08 13:29:27Z maronga
32! Module renamed
33!
34!
35! 1682 2015-10-07 23:56:08Z knoop
36! Code annotations made doxygen readable
37!
38! 1374 2014-04-25 12:55:07Z raasch
39! missing variables added to ONLY list
40!
41! 1353 2014-04-08 15:21:23Z heinze
42! REAL constants provided with KIND-attribute
43!
44! 1320 2014-03-20 08:40:49Z raasch
45! ONLY-attribute added to USE-statements,
46! kind-parameters added to all INTEGER and REAL declaration statements,
47! kinds are defined in new module kinds,
48! revision history before 2012 removed,
49! comment fields (!:) to be used for variable explanations added to
50! all variable declaration statements
51!
52! 1036 2012-10-22 13:43:42Z raasch
53! code put under GPL (PALM 3.9)
54!
55! 1010 2012-09-20 07:59:54Z raasch
56! cpp switch __nopointer added for pointer free version
57!
58! Revision 1.1  1997/08/29 08:54:20  raasch
59! Initial revision
60!
61!
62! Description:
63! ------------
64!> Advection term for scalar variables using the Piacsek and Williams scheme
65!> (form C3). Contrary to PW itself, for reasons of accuracy their scheme is
66!> slightly modified as follows: the values of those scalars that are used for
67!> the computation of the flux divergence are reduced by the value of the
68!> relevant scalar at the location where the difference is computed (sk(k,j,i)).
69!> NOTE: at the first grid point above the surface computation still takes place!
70!------------------------------------------------------------------------------!
71 MODULE advec_s_pw_mod
72 
73
74    PRIVATE
75    PUBLIC advec_s_pw
76
77    INTERFACE advec_s_pw
78       MODULE PROCEDURE advec_s_pw
79       MODULE PROCEDURE advec_s_pw_ij
80    END INTERFACE
81 
82 CONTAINS
83
84
85!------------------------------------------------------------------------------!
86! Description:
87! ------------
88!> Call for all grid points
89!------------------------------------------------------------------------------!
90    SUBROUTINE advec_s_pw( sk )
91
92       USE arrays_3d,                                                          &
93           ONLY:  dd2zu, tend, u, v, w
94
95       USE control_parameters,                                                 &
96           ONLY:  u_gtrans, v_gtrans
97
98       USE grid_variables,                                                     &
99           ONLY:  ddx, ddy
100
101       USE indices,                                                            &
102           ONLY:  nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzb_s_inner,&
103                  nzt
104
105       USE kinds
106
107
108       IMPLICIT NONE
109
110       INTEGER(iwp) ::  i !<
111       INTEGER(iwp) ::  j !<
112       INTEGER(iwp) ::  k !<
113
114#if defined( __nopointer )
115       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !<
116#else
117       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
118#endif
119 
120
121       DO  i = nxl, nxr
122          DO  j = nys, nyn
123             DO  k = nzb_s_inner(j,i)+1, nzt
124                tend(k,j,i) = tend(k,j,i)                                      &
125              -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
126                        - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
127                        ) * ddx                                                   &
128              -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
129                        - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
130                        ) * ddy                                                   &
131              -         (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
132                        -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
133                        ) * dd2zu(k)
134             ENDDO
135          ENDDO
136       ENDDO
137
138    END SUBROUTINE advec_s_pw
139
140
141!------------------------------------------------------------------------------!
142! Description:
143! ------------
144!> Call for grid point i,j
145!------------------------------------------------------------------------------!
146    SUBROUTINE advec_s_pw_ij( i, j, sk )
147
148       USE arrays_3d,                                                          &
149           ONLY:  dd2zu, tend, u, v, w
150
151       USE control_parameters,                                                 &
152           ONLY:  u_gtrans, v_gtrans
153
154       USE grid_variables,                                                     &
155           ONLY:  ddx, ddy
156
157       USE indices,                                                            &
158           ONLY:  nxlg, nxrg, nyng, nysg, nzb, nzb_s_inner, nzt
159
160       USE kinds
161
162
163       IMPLICIT NONE
164
165       INTEGER(iwp) ::  i !<
166       INTEGER(iwp) ::  j !<
167       INTEGER(iwp) ::  k !<
168
169#if defined( __nopointer )
170       REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk !<
171#else
172       REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
173#endif
174
175
176       DO  k = nzb_s_inner(j,i)+1, nzt
177          tend(k,j,i) = tend(k,j,i)                                            &
178              -0.5_wp * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
179                        - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
180                        ) * ddx                                                   &
181              -0.5_wp * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
182                        - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
183                        ) * ddy                                                   &
184              -         (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
185                        -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
186                        ) * dd2zu(k)
187       ENDDO
188
189    END SUBROUTINE advec_s_pw_ij
190
191 END MODULE advec_s_pw_mod
Note: See TracBrowser for help on using the repository browser.