1 | !> @file advec_u_pw.f90 |
---|
2 | !--------------------------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General |
---|
6 | ! Public License as published by the Free Software Foundation, either version 3 of the License, or |
---|
7 | ! (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
---|
10 | ! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
11 | ! Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with PALM. If not, see |
---|
14 | ! <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2021 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: advec_u_pw.f90 4828 2021-01-05 11:21:41Z suehring $ |
---|
26 | ! file re-formatted to follow the PALM coding standard |
---|
27 | ! |
---|
28 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
29 | ! Corrected "Former revisions" section |
---|
30 | ! |
---|
31 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
32 | ! variables documented |
---|
33 | ! |
---|
34 | ! Revision 1.1 1997/08/11 06:09:21 raasch |
---|
35 | ! Initial revision |
---|
36 | ! |
---|
37 | ! |
---|
38 | ! Description: |
---|
39 | ! ------------ |
---|
40 | !> Advection term for u velocity-component using Piacsek and Williams. |
---|
41 | !> Vertical advection at the first grid point above the surface is done with normal centred |
---|
42 | !> differences, because otherwise no information from the surface would be communicated upwards due |
---|
43 | !> to w=0 at K=nzb. |
---|
44 | !--------------------------------------------------------------------------------------------------! |
---|
45 | MODULE advec_u_pw_mod |
---|
46 | |
---|
47 | |
---|
48 | PRIVATE |
---|
49 | PUBLIC advec_u_pw |
---|
50 | |
---|
51 | INTERFACE advec_u_pw |
---|
52 | MODULE PROCEDURE advec_u_pw |
---|
53 | MODULE PROCEDURE advec_u_pw_ij |
---|
54 | END INTERFACE advec_u_pw |
---|
55 | |
---|
56 | CONTAINS |
---|
57 | |
---|
58 | |
---|
59 | !--------------------------------------------------------------------------------------------------! |
---|
60 | ! Description: |
---|
61 | ! ------------ |
---|
62 | !> Call for all grid points |
---|
63 | !--------------------------------------------------------------------------------------------------! |
---|
64 | SUBROUTINE advec_u_pw |
---|
65 | |
---|
66 | USE arrays_3d, & |
---|
67 | ONLY: ddzw, tend, u, v, w |
---|
68 | |
---|
69 | USE control_parameters, & |
---|
70 | ONLY: u_gtrans, v_gtrans |
---|
71 | |
---|
72 | USE grid_variables, & |
---|
73 | ONLY: ddx, ddy |
---|
74 | |
---|
75 | USE indices, & |
---|
76 | ONLY: nxlu, nxr, nyn, nys, nzb, nzt |
---|
77 | |
---|
78 | USE kinds |
---|
79 | |
---|
80 | |
---|
81 | IMPLICIT NONE |
---|
82 | |
---|
83 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
84 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
85 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
86 | |
---|
87 | REAL(wp) :: gu !< Galilei-transformation velocity along x |
---|
88 | REAL(wp) :: gv !< Galilei-transformation velocity along y |
---|
89 | |
---|
90 | gu = 2.0_wp * u_gtrans |
---|
91 | gv = 2.0_wp * v_gtrans |
---|
92 | DO i = nxlu, nxr |
---|
93 | DO j = nys, nyn |
---|
94 | DO k = nzb+1, nzt |
---|
95 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
96 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
97 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
98 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
99 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
100 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
101 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) * ddzw(k) & |
---|
102 | ) |
---|
103 | ENDDO |
---|
104 | ENDDO |
---|
105 | ENDDO |
---|
106 | |
---|
107 | END SUBROUTINE advec_u_pw |
---|
108 | |
---|
109 | |
---|
110 | !--------------------------------------------------------------------------------------------------! |
---|
111 | ! Description: |
---|
112 | ! ------------ |
---|
113 | !> Call for grid point i,j |
---|
114 | !--------------------------------------------------------------------------------------------------! |
---|
115 | SUBROUTINE advec_u_pw_ij( i, j ) |
---|
116 | |
---|
117 | USE arrays_3d, & |
---|
118 | ONLY: ddzw, tend, u, v, w |
---|
119 | |
---|
120 | USE control_parameters, & |
---|
121 | ONLY: u_gtrans, v_gtrans |
---|
122 | |
---|
123 | USE grid_variables, & |
---|
124 | ONLY: ddx, ddy |
---|
125 | |
---|
126 | USE indices, & |
---|
127 | ONLY: nzb, nzt |
---|
128 | |
---|
129 | USE kinds |
---|
130 | |
---|
131 | |
---|
132 | IMPLICIT NONE |
---|
133 | |
---|
134 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
135 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
136 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
137 | |
---|
138 | REAL(wp) :: gu !< Galilei-transformation velocity along x |
---|
139 | REAL(wp) :: gv !< Galilei-transformation velocity along y |
---|
140 | |
---|
141 | gu = 2.0_wp * u_gtrans |
---|
142 | gv = 2.0_wp * v_gtrans |
---|
143 | DO k = nzb+1, nzt |
---|
144 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
145 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
146 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
147 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
148 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
149 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
150 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) * ddzw(k) & |
---|
151 | ) |
---|
152 | ENDDO |
---|
153 | |
---|
154 | END SUBROUTINE advec_u_pw_ij |
---|
155 | |
---|
156 | END MODULE advec_u_pw_mod |
---|