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 |
---|
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. |
---|
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 | ! |
---|
17 | ! Copyright 1997-2020 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: advec_u_pw.f90 4360 2020-01-07 11:25:50Z suehring $ |
---|
27 | ! Corrected "Former revisions" section |
---|
28 | ! |
---|
29 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
30 | ! variables documented |
---|
31 | ! |
---|
32 | ! Revision 1.1 1997/08/11 06:09:21 raasch |
---|
33 | ! Initial revision |
---|
34 | ! |
---|
35 | ! |
---|
36 | ! Description: |
---|
37 | ! ------------ |
---|
38 | !> Advection term for u velocity-component using Piacsek and Williams. |
---|
39 | !> Vertical advection at the first grid point above the surface is done with |
---|
40 | !> normal centred differences, because otherwise no information from the surface |
---|
41 | !> would be communicated upwards due to w=0 at K=nzb. |
---|
42 | !------------------------------------------------------------------------------! |
---|
43 | MODULE advec_u_pw_mod |
---|
44 | |
---|
45 | |
---|
46 | PRIVATE |
---|
47 | PUBLIC advec_u_pw |
---|
48 | |
---|
49 | INTERFACE advec_u_pw |
---|
50 | MODULE PROCEDURE advec_u_pw |
---|
51 | MODULE PROCEDURE advec_u_pw_ij |
---|
52 | END INTERFACE advec_u_pw |
---|
53 | |
---|
54 | CONTAINS |
---|
55 | |
---|
56 | |
---|
57 | !------------------------------------------------------------------------------! |
---|
58 | ! Description: |
---|
59 | ! ------------ |
---|
60 | !> Call for all grid points |
---|
61 | !------------------------------------------------------------------------------! |
---|
62 | SUBROUTINE advec_u_pw |
---|
63 | |
---|
64 | USE arrays_3d, & |
---|
65 | ONLY: ddzw, tend, u, v, w |
---|
66 | |
---|
67 | USE control_parameters, & |
---|
68 | ONLY: u_gtrans, v_gtrans |
---|
69 | |
---|
70 | USE grid_variables, & |
---|
71 | ONLY: ddx, ddy |
---|
72 | |
---|
73 | USE indices, & |
---|
74 | ONLY: nxlu, nxr, nyn, nys, nzb, nzt |
---|
75 | |
---|
76 | USE kinds |
---|
77 | |
---|
78 | |
---|
79 | IMPLICIT NONE |
---|
80 | |
---|
81 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
82 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
83 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
84 | |
---|
85 | REAL(wp) :: gu !< Galilei-transformation velocity along x |
---|
86 | REAL(wp) :: gv !< Galilei-transformation velocity along y |
---|
87 | |
---|
88 | gu = 2.0_wp * u_gtrans |
---|
89 | gv = 2.0_wp * v_gtrans |
---|
90 | DO i = nxlu, nxr |
---|
91 | DO j = nys, nyn |
---|
92 | DO k = nzb+1, nzt |
---|
93 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
94 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
95 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
96 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
97 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
98 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
99 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
100 | * ddzw(k) & |
---|
101 | ) |
---|
102 | ENDDO |
---|
103 | ENDDO |
---|
104 | ENDDO |
---|
105 | |
---|
106 | END SUBROUTINE advec_u_pw |
---|
107 | |
---|
108 | |
---|
109 | !------------------------------------------------------------------------------! |
---|
110 | ! Description: |
---|
111 | ! ------------ |
---|
112 | !> Call for grid point i,j |
---|
113 | !------------------------------------------------------------------------------! |
---|
114 | SUBROUTINE advec_u_pw_ij( i, j ) |
---|
115 | |
---|
116 | USE arrays_3d, & |
---|
117 | ONLY: ddzw, tend, u, v, w |
---|
118 | |
---|
119 | USE control_parameters, & |
---|
120 | ONLY: u_gtrans, v_gtrans |
---|
121 | |
---|
122 | USE grid_variables, & |
---|
123 | ONLY: ddx, ddy |
---|
124 | |
---|
125 | USE indices, & |
---|
126 | ONLY: nzb, nzt |
---|
127 | |
---|
128 | USE kinds |
---|
129 | |
---|
130 | |
---|
131 | IMPLICIT NONE |
---|
132 | |
---|
133 | INTEGER(iwp) :: i !< grid index along x-direction |
---|
134 | INTEGER(iwp) :: j !< grid index along y-direction |
---|
135 | INTEGER(iwp) :: k !< grid index along z-direction |
---|
136 | |
---|
137 | REAL(wp) :: gu !< Galilei-transformation velocity along x |
---|
138 | REAL(wp) :: gv !< Galilei-transformation velocity along y |
---|
139 | |
---|
140 | gu = 2.0_wp * u_gtrans |
---|
141 | gv = 2.0_wp * v_gtrans |
---|
142 | DO k = nzb+1, nzt |
---|
143 | tend(k,j,i) = tend(k,j,i) - 0.25_wp * ( & |
---|
144 | ( u(k,j,i+1) * ( u(k,j,i+1) + u(k,j,i) - gu ) & |
---|
145 | - u(k,j,i-1) * ( u(k,j,i) + u(k,j,i-1) - gu ) ) * ddx & |
---|
146 | + ( u(k,j+1,i) * ( v(k,j+1,i) + v(k,j+1,i-1) - gv ) & |
---|
147 | - u(k,j-1,i) * ( v(k,j,i) + v(k,j,i-1) - gv ) ) * ddy & |
---|
148 | + ( u(k+1,j,i) * ( w(k,j,i) + w(k,j,i-1) ) & |
---|
149 | - u(k-1,j,i) * ( w(k-1,j,i) + w(k-1,j,i-1) ) ) & |
---|
150 | * ddzw(k) & |
---|
151 | ) |
---|
152 | ENDDO |
---|
153 | |
---|
154 | END SUBROUTINE advec_u_pw_ij |
---|
155 | |
---|
156 | END MODULE advec_u_pw_mod |
---|