1 | !> @file advec_w_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_w_pw.f90 4828 2021-01-05 11:21:41Z moh.hefny $ |
---|
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:10:29 raasch |
---|
35 | ! Initial revision |
---|
36 | ! |
---|
37 | ! |
---|
38 | ! Description: |
---|
39 | ! ------------ |
---|
40 | !> Advection term for w 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_w_pw_mod |
---|
46 | |
---|
47 | |
---|
48 | PRIVATE |
---|
49 | PUBLIC advec_w_pw |
---|
50 | |
---|
51 | INTERFACE advec_w_pw |
---|
52 | MODULE PROCEDURE advec_w_pw |
---|
53 | MODULE PROCEDURE advec_w_pw_ij |
---|
54 | END INTERFACE advec_w_pw |
---|
55 | |
---|
56 | CONTAINS |
---|
57 | |
---|
58 | |
---|
59 | !--------------------------------------------------------------------------------------------------! |
---|
60 | ! Description: |
---|
61 | ! ------------ |
---|
62 | !> Call for all grid points |
---|
63 | !--------------------------------------------------------------------------------------------------! |
---|
64 | SUBROUTINE advec_w_pw |
---|
65 | |
---|
66 | USE arrays_3d, & |
---|
67 | ONLY: ddzu, 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: nxl, 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 | |
---|
91 | gu = 2.0_wp * u_gtrans |
---|
92 | gv = 2.0_wp * v_gtrans |
---|
93 | DO i = nxl, nxr |
---|
94 | DO j = nys, nyn |
---|
95 | DO k = nzb+1, nzt |
---|
96 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
97 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
98 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
99 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
100 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
101 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
102 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) * ddzu(k+1) & |
---|
103 | ) |
---|
104 | ENDDO |
---|
105 | ENDDO |
---|
106 | ENDDO |
---|
107 | |
---|
108 | END SUBROUTINE advec_w_pw |
---|
109 | |
---|
110 | |
---|
111 | !--------------------------------------------------------------------------------------------------! |
---|
112 | ! Description: |
---|
113 | ! ------------ |
---|
114 | !> Call for grid point i,j |
---|
115 | !--------------------------------------------------------------------------------------------------! |
---|
116 | SUBROUTINE advec_w_pw_ij( i, j ) |
---|
117 | |
---|
118 | USE arrays_3d, & |
---|
119 | ONLY: ddzu, tend, u, v, w |
---|
120 | |
---|
121 | USE control_parameters, & |
---|
122 | ONLY: u_gtrans, v_gtrans |
---|
123 | |
---|
124 | USE grid_variables, & |
---|
125 | ONLY: ddx, ddy |
---|
126 | |
---|
127 | USE indices, & |
---|
128 | ONLY: nzb, nzt |
---|
129 | |
---|
130 | USE kinds |
---|
131 | |
---|
132 | |
---|
133 | IMPLICIT NONE |
---|
134 | |
---|
135 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
136 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
137 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
138 | |
---|
139 | REAL(wp) :: gu !< Galilei-transformation velocity along x |
---|
140 | REAL(wp) :: gv !< Galilei-transformation velocity along y |
---|
141 | |
---|
142 | gu = 2.0_wp * u_gtrans |
---|
143 | gv = 2.0_wp * v_gtrans |
---|
144 | DO k = nzb+1, nzt |
---|
145 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
146 | ( w(k,j,i+1) * ( u(k+1,j,i+1) + u(k,j,i+1) - gu ) & |
---|
147 | - w(k,j,i-1) * ( u(k+1,j,i) + u(k,j,i) - gu ) ) * ddx & |
---|
148 | + ( w(k,j+1,i) * ( v(k+1,j+1,i) + v(k,j+1,i) - gv ) & |
---|
149 | - w(k,j-1,i) * ( v(k+1,j,i) + v(k,j,i) - gv ) ) * ddy & |
---|
150 | + ( w(k+1,j,i) * ( w(k+1,j,i) + w(k,j,i) ) & |
---|
151 | - w(k-1,j,i) * ( w(k,j,i) + w(k-1,j,i) ) ) * ddzu(k+1) & |
---|
152 | ) |
---|
153 | ENDDO |
---|
154 | END SUBROUTINE advec_w_pw_ij |
---|
155 | |
---|
156 | END MODULE advec_w_pw_mod |
---|