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

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

last commit documented / copyright update

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