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

Last change on this file since 1276 was 1037, checked in by raasch, 12 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 4.9 KB
RevLine 
[1]1 MODULE advec_s_pw_mod
2
[1036]3!--------------------------------------------------------------------------------!
4! This file is part of PALM.
5!
6! PALM is free software: you can redistribute it and/or modify it under the terms
7! of the GNU General Public License as published by the Free Software Foundation,
8! either version 3 of the License, or (at your option) any later 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-2012  Leibniz University Hannover
18!--------------------------------------------------------------------------------!
19!
[484]20! Current revisions:
[1]21! -----------------
22!
[1011]23!
[1]24! Former revisions:
25! -----------------
[3]26! $Id: advec_s_pw.f90 1037 2012-10-22 14:10:22Z heinze $
[39]27!
[1037]28! 1036 2012-10-22 13:43:42Z raasch
29! code put under GPL (PALM 3.9)
30!
[1011]31! 1010 2012-09-20 07:59:54Z raasch
32! cpp switch __nopointer added for pointer free version
33!
[39]34! 19 2007-02-23 04:53:48Z raasch
35! Calculation extended for gridpoint nzt
36!
[3]37! RCS Log replace by Id keyword, revision history cleaned up
38!
[1]39! Revision 1.12  2006/02/23 09:42:55  raasch
40! nzb_2d replaced by nzb_s_inner
41!
42! Revision 1.1  1997/08/29 08:54:20  raasch
43! Initial revision
44!
45!
46! Description:
47! ------------
48! Advection term for scalar variables using the Piacsek and Williams scheme
49! (form C3). Contrary to PW itself, for reasons of accuracy their scheme is
50! slightly modified as follows: the values of those scalars that are used for
51! the computation of the flux divergence are reduced by the value of the
52! relevant scalar at the location where the difference is computed (sk(k,j,i)).
53! NOTE: at the first grid point above the surface computation still takes place!
54!------------------------------------------------------------------------------!
55
56    PRIVATE
57    PUBLIC advec_s_pw
58
59    INTERFACE advec_s_pw
60       MODULE PROCEDURE advec_s_pw
61       MODULE PROCEDURE advec_s_pw_ij
62    END INTERFACE
63 
64 CONTAINS
65
66
67!------------------------------------------------------------------------------!
68! Call for all grid points
69!------------------------------------------------------------------------------!
70    SUBROUTINE advec_s_pw( sk )
71
72       USE arrays_3d
73       USE control_parameters
74       USE grid_variables
75       USE indices
76
77       IMPLICIT NONE
78
79       INTEGER ::  i, j, k
80
[1010]81#if defined( __nopointer )
82       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
83#else
[1]84       REAL, DIMENSION(:,:,:), POINTER ::  sk
[1010]85#endif
[1]86 
87
88       DO  i = nxl, nxr
89          DO  j = nys, nyn
[19]90             DO  k = nzb_s_inner(j,i)+1, nzt
[1]91                tend(k,j,i) = tend(k,j,i)                                      &
92              -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
93                     - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
94                     ) * ddx                                                   &
95              -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
96                     - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
97                     ) * ddy                                                   &
98              -      (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
99                     -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
100                     ) * dd2zu(k)
101             ENDDO
102          ENDDO
103       ENDDO
104
105    END SUBROUTINE advec_s_pw
106
107
108!------------------------------------------------------------------------------!
109! Call for grid point i,j
110!------------------------------------------------------------------------------!
111    SUBROUTINE advec_s_pw_ij( i, j, sk )
112
113       USE arrays_3d
114       USE control_parameters
115       USE grid_variables
116       USE indices
117
118       IMPLICIT NONE
119
120       INTEGER ::  i, j, k
121
[1010]122#if defined( __nopointer )
123       REAL, DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) ::  sk
124#else
[1]125       REAL, DIMENSION(:,:,:), POINTER ::  sk
[1010]126#endif
[1]127
128
[19]129       DO  k = nzb_s_inner(j,i)+1, nzt
[1]130          tend(k,j,i) = tend(k,j,i)                                            &
131              -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
132                     - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
133                     ) * ddx                                                   &
134              -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
135                     - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
136                     ) * ddy                                                   &
137              -      (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
138                     -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
139                     ) * dd2zu(k)
140       ENDDO
141
142    END SUBROUTINE advec_s_pw_ij
143
144 END MODULE advec_s_pw_mod
Note: See TracBrowser for help on using the repository browser.