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

Last change on this file since 1 was 1, checked in by raasch, 15 years ago

Initial repository layout and content

File size: 4.8 KB
Line 
1 MODULE advec_s_pw_mod
2
3!------------------------------------------------------------------------------!
4! Actual revisions:
5! -----------------
6!
7!
8! Former revisions:
9! -----------------
10! $Log: advec_s_pw.f90,v $
11! Revision 1.12  2006/02/23 09:42:55  raasch
12! nzb_2d replaced by nzb_s_inner
13!
14! Revision 1.11  2004/01/30 10:10:03  raasch
15! Scalar lower k index nzb replaced by 2d-array nzb_2d
16!
17! Revision 1.10  2003/03/12 16:15:32  raasch
18! Full code replaced in the call for all gridpoints instead of calling the
19! _ij version (required by NEC, because otherwise no vectorization)
20!
21! Revision 1.9  2002/06/11 12:22:14  raasch
22! Former subroutine changed to a module which allows to be called for all grid
23! points of a single vertical column with index i,j or for all grid points by
24! using function overloading.
25! Array sk now declared as a pointer.
26!
27! Revision 1.8  2001/03/29 17:30:14  raasch
28! Translation of remaining German identifiers (variables, subroutines, etc.)
29!
30! Revision 1.7  2001/01/22 04:41:39  raasch
31! Module test_variables removed
32!
33! Revision 1.6  2000/01/20 09:13:33  letzel
34! All comments translated into English
35!
36! Revision 1.5  1998/07/06 12:03:09  raasch
37! + USE test_variables
38!
39! Revision 1.4  1998/04/21 15:51:53  raasch
40! Galilei-Transformation eingebaut
41!
42! Revision 1.3  1998/02/10 14:57:53  raasch
43! Es wird jetzt grundsaetzlich die Form C3 verwendet
44!
45! Revision 1.2  1997/09/09 08:27:10  raasch
46! Kehrwerte der Gitterweiten implementiert
47!
48! Revision 1.1  1997/08/29 08:54:20  raasch
49! Initial revision
50!
51!
52! Description:
53! ------------
54! Advection term for scalar variables using the Piacsek and Williams scheme
55! (form C3). Contrary to PW itself, for reasons of accuracy their scheme is
56! slightly modified as follows: the values of those scalars that are used for
57! the computation of the flux divergence are reduced by the value of the
58! relevant scalar at the location where the difference is computed (sk(k,j,i)).
59! NOTE: at the first grid point above the surface computation still takes place!
60!------------------------------------------------------------------------------!
61
62    PRIVATE
63    PUBLIC advec_s_pw
64
65    INTERFACE advec_s_pw
66       MODULE PROCEDURE advec_s_pw
67       MODULE PROCEDURE advec_s_pw_ij
68    END INTERFACE
69 
70 CONTAINS
71
72
73!------------------------------------------------------------------------------!
74! Call for all grid points
75!------------------------------------------------------------------------------!
76    SUBROUTINE advec_s_pw( sk )
77
78       USE arrays_3d
79       USE control_parameters
80       USE grid_variables
81       USE indices
82
83       IMPLICIT NONE
84
85       INTEGER ::  i, j, k
86
87       REAL, DIMENSION(:,:,:), POINTER ::  sk
88 
89
90       DO  i = nxl, nxr
91          DO  j = nys, nyn
92             DO  k = nzb_s_inner(j,i)+1, nzt-1
93                tend(k,j,i) = tend(k,j,i)                                      &
94              -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
95                     - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
96                     ) * ddx                                                   &
97              -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
98                     - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
99                     ) * ddy                                                   &
100              -      (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
101                     -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
102                     ) * dd2zu(k)
103             ENDDO
104          ENDDO
105       ENDDO
106
107    END SUBROUTINE advec_s_pw
108
109
110!------------------------------------------------------------------------------!
111! Call for grid point i,j
112!------------------------------------------------------------------------------!
113    SUBROUTINE advec_s_pw_ij( i, j, sk )
114
115       USE arrays_3d
116       USE control_parameters
117       USE grid_variables
118       USE indices
119
120       IMPLICIT NONE
121
122       INTEGER ::  i, j, k
123
124       REAL, DIMENSION(:,:,:), POINTER ::  sk
125
126
127       DO  k = nzb_s_inner(j,i)+1, nzt-1
128          tend(k,j,i) = tend(k,j,i)                                            &
129              -0.5 * ( ( u(k,j,i+1) - u_gtrans ) * ( sk(k,j,i+1) - sk(k,j,i) ) &
130                     - ( u(k,j,i)   - u_gtrans ) * ( sk(k,j,i-1) - sk(k,j,i) ) &
131                     ) * ddx                                                   &
132              -0.5 * ( ( v(k,j+1,i) - v_gtrans ) * ( sk(k,j+1,i) - sk(k,j,i) ) &
133                     - ( v(k,j,i)   - v_gtrans ) * ( sk(k,j-1,i) - sk(k,j,i) ) &
134                     ) * ddy                                                   &
135              -      (   w(k,j,i)                * ( sk(k+1,j,i) - sk(k,j,i) ) &
136                     -   w(k-1,j,i)              * ( sk(k-1,j,i) - sk(k,j,i) ) &
137                     ) * dd2zu(k)
138       ENDDO
139
140    END SUBROUTINE advec_s_pw_ij
141
142 END MODULE advec_s_pw_mod
Note: See TracBrowser for help on using the repository browser.