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

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

revised renaming of modules

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