source: palm/trunk/SOURCE/advec_s_pw_mod.f90 @ 1850

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

added _mod string to several filenames to meet the naming convection for modules

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