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

Last change on this file since 2000 was 2000, checked in by knoop, 8 years ago

Forced header and separation lines into 80 columns

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