source: palm/trunk/SOURCE/advec_u_pw.f90 @ 2232

Last change on this file since 2232 was 2232, checked in by suehring, 7 years ago

Adjustments according new topography and surface-modelling concept implemented

  • Property svn:keywords set to Id
File size: 6.3 KB
RevLine 
[1873]1!> @file advec_u_pw.f90
[2000]2!------------------------------------------------------------------------------!
[1036]3! This file is part of PALM.
4!
[2000]5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
[1036]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!
[2101]17! Copyright 1997-2017 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1036]19!
[484]20! Current revisions:
[1]21! -----------------
[2232]22! topography representation via flags
[1354]23!
[1321]24! Former revisions:
25! -----------------
26! $Id: advec_u_pw.f90 2232 2017-05-30 17:47:52Z suehring $
27!
[2001]28! 2000 2016-08-20 18:09:15Z knoop
29! Forced header and separation lines into 80 columns
30!
[1874]31! 1873 2016-04-18 14:50:06Z maronga
32! Module renamed (removed _mod)
33!
34!
[1851]35! 1850 2016-04-08 13:29:27Z maronga
36! Module renamed
37!
38!
[1683]39! 1682 2015-10-07 23:56:08Z knoop
40! Code annotations made doxygen readable
41!
[1354]42! 1353 2014-04-08 15:21:23Z heinze
43! REAL constants provided with KIND-attribute
44!
[1321]45! 1320 2014-03-20 08:40:49Z raasch
[1320]46! ONLY-attribute added to USE-statements,
47! kind-parameters added to all INTEGER and REAL declaration statements,
48! kinds are defined in new module kinds,
49! revision history before 2012 removed,
50! comment fields (!:) to be used for variable explanations added to
51! all variable declaration statements
[1]52!
[1037]53! 1036 2012-10-22 13:43:42Z raasch
54! code put under GPL (PALM 3.9)
55!
[1]56! Revision 1.1  1997/08/11 06:09:21  raasch
57! Initial revision
58!
59!
60! Description:
61! ------------
[1682]62!> Advection term for u velocity-component using Piacsek and Williams.
63!> Vertical advection at the first grid point above the surface is done with
64!> normal centred differences, because otherwise no information from the surface
65!> would be communicated upwards due to w=0 at K=nzb.
[1]66!------------------------------------------------------------------------------!
[1682]67 MODULE advec_u_pw_mod
68 
[1]69
70    PRIVATE
71    PUBLIC advec_u_pw
72
73    INTERFACE advec_u_pw
74       MODULE PROCEDURE advec_u_pw
75       MODULE PROCEDURE advec_u_pw_ij
76    END INTERFACE advec_u_pw
77 
78 CONTAINS
79
80
81!------------------------------------------------------------------------------!
[1682]82! Description:
83! ------------
84!> Call for all grid points
[1]85!------------------------------------------------------------------------------!
86    SUBROUTINE advec_u_pw
87
[1320]88       USE arrays_3d,                                                          &
89           ONLY:  ddzw, tend, u, v, w
[1]90
[1320]91       USE control_parameters,                                                 &
92           ONLY:  u_gtrans, v_gtrans
93
94       USE grid_variables,                                                     &
95           ONLY:  ddx, ddy
96
97       USE indices,                                                            &
[2232]98           ONLY:  nxlu, nxr, nyn, nys, nzb, nzt, wall_flags_0
[1320]99
100       USE kinds
101
102
[1]103       IMPLICIT NONE
104
[1682]105       INTEGER(iwp) ::  i !<
106       INTEGER(iwp) ::  j !<
107       INTEGER(iwp) ::  k !<
[1320]108       
[1682]109       REAL(wp)    ::  gu !<
110       REAL(wp)    ::  gv !<
[1]111 
[1353]112       gu = 2.0_wp * u_gtrans
113       gv = 2.0_wp * v_gtrans
[106]114       DO  i = nxlu, nxr
[1]115          DO  j = nys, nyn
[2232]116             DO  k = nzb+1, nzt
[1353]117                tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                        &
[1]118                         ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu )         &
119                         - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx &
120                       + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv )     &
121                         - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy &
122                       + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) )              &
123                         - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
124                                                                  * ddzw(k)    &
[2232]125                                                      )                        &
126                                      * MERGE( 1.0_wp, 0.0_wp,                 &
127                                               BTEST( wall_flags_0(k,j,i), 1 ) )
[1]128             ENDDO
129          ENDDO
130       ENDDO
131
132    END SUBROUTINE advec_u_pw
133
134
135!------------------------------------------------------------------------------!
[1682]136! Description:
137! ------------
138!> Call for grid point i,j
[1]139!------------------------------------------------------------------------------!
140    SUBROUTINE advec_u_pw_ij( i, j )
141
[1320]142       USE arrays_3d,                                                          &
143           ONLY:  ddzw, tend, u, v, w
[1]144
[1320]145       USE control_parameters,                                                 &
146           ONLY:  u_gtrans, v_gtrans
147
148       USE grid_variables,                                                     &
149           ONLY:  ddx, ddy
150
151       USE indices,                                                            &
[2232]152           ONLY:  nzb, nzt, wall_flags_0
[1320]153
154       USE kinds
155
156
[1]157       IMPLICIT NONE
158
[1682]159       INTEGER(iwp) ::  i !<
160       INTEGER(iwp) ::  j !<
161       INTEGER(iwp) ::  k !<
[1320]162       
[1682]163       REAL(wp)    ::  gu !<
164       REAL(wp)    ::  gv !<
[1]165
[1353]166       gu = 2.0_wp * u_gtrans
167       gv = 2.0_wp * v_gtrans
[2232]168       DO  k = nzb+1, nzt
[1353]169          tend(k,j,i) = tend(k,j,i) - 0.25_wp * (                              &
[1]170                         ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu )         &
171                         - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx &
172                       + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv )     &
173                         - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy &
174                       + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) )              &
175                         - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) )        &
176                                                                  * ddzw(k)    &
[2232]177                                                )                              &
178                                      * MERGE( 1.0_wp, 0.0_wp,                 &
179                                               BTEST( wall_flags_0(k,j,i), 1 ) )
[1]180       ENDDO
181
182    END SUBROUTINE advec_u_pw_ij
183
184 END MODULE advec_u_pw_mod
Note: See TracBrowser for help on using the repository browser.