1 | !> @file init_rankine.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-2017 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: init_rankine.f90 2696 2017-12-14 17:12:51Z kanani $ |
---|
27 | ! |
---|
28 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
29 | ! Forced header and separation lines into 80 columns |
---|
30 | ! |
---|
31 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
32 | ! Code annotations made doxygen readable |
---|
33 | ! |
---|
34 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
35 | ! REAL constants provided with KIND-attribute |
---|
36 | ! |
---|
37 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
38 | ! REAL constants defined as wp_kind |
---|
39 | ! |
---|
40 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
41 | ! ONLY-attribute added to USE-statements, |
---|
42 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
43 | ! kinds are defined in new module kinds, |
---|
44 | ! revision history before 2012 removed, |
---|
45 | ! comment fields (!:) to be used for variable explanations added to |
---|
46 | ! all variable declaration statements |
---|
47 | ! |
---|
48 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
49 | ! code put under GPL (PALM 3.9) |
---|
50 | ! |
---|
51 | ! Revision 1.1 1997/08/11 06:18:43 raasch |
---|
52 | ! Initial revision |
---|
53 | ! |
---|
54 | ! |
---|
55 | ! Description: |
---|
56 | ! ------------ |
---|
57 | !> Initialize a (nondivergent) Rankine eddy with a vertical axis in order to test |
---|
58 | !> the advection terms and the pressure solver. |
---|
59 | !------------------------------------------------------------------------------! |
---|
60 | SUBROUTINE init_rankine |
---|
61 | |
---|
62 | |
---|
63 | USE arrays_3d, & |
---|
64 | ONLY: pt, pt_init, u, u_init, v, v_init |
---|
65 | |
---|
66 | USE control_parameters, & |
---|
67 | ONLY: initializing_actions, n_sor, nsor, nsor_ini |
---|
68 | |
---|
69 | USE constants, & |
---|
70 | ONLY: pi |
---|
71 | |
---|
72 | USE grid_variables, & |
---|
73 | ONLY: dx, dy |
---|
74 | |
---|
75 | USE indices, & |
---|
76 | ONLY: nbgp, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
77 | |
---|
78 | USE kinds |
---|
79 | |
---|
80 | IMPLICIT NONE |
---|
81 | |
---|
82 | INTEGER(iwp) :: i !< |
---|
83 | INTEGER(iwp) :: ic !< |
---|
84 | INTEGER(iwp) :: j !< |
---|
85 | INTEGER(iwp) :: jc !< |
---|
86 | INTEGER(iwp) :: k !< |
---|
87 | INTEGER(iwp) :: kc1 !< |
---|
88 | INTEGER(iwp) :: kc2 !< |
---|
89 | |
---|
90 | REAL(wp) :: alpha !< |
---|
91 | REAL(wp) :: betrag !< |
---|
92 | REAL(wp) :: radius !< |
---|
93 | REAL(wp) :: rc !< |
---|
94 | REAL(wp) :: uw !< |
---|
95 | REAL(wp) :: vw !< |
---|
96 | REAL(wp) :: x !< |
---|
97 | REAL(wp) :: y !< |
---|
98 | |
---|
99 | ! |
---|
100 | !-- Default: eddy radius rc, eddy strength z, |
---|
101 | !-- position of eddy centre: ic, jc, kc1, kc2 |
---|
102 | rc = 4.0_wp * dx |
---|
103 | ic = ( nx+1 ) / 2 |
---|
104 | jc = ic |
---|
105 | kc1 = nzb |
---|
106 | kc2 = nzt+1 |
---|
107 | |
---|
108 | ! |
---|
109 | !-- Reset initial profiles to constant profiles |
---|
110 | IF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 ) THEN |
---|
111 | DO i = nxlg, nxrg |
---|
112 | DO j = nysg, nyng |
---|
113 | pt(:,j,i) = pt_init |
---|
114 | u(:,j,i) = u_init |
---|
115 | v(:,j,i) = v_init |
---|
116 | ENDDO |
---|
117 | ENDDO |
---|
118 | ENDIF |
---|
119 | |
---|
120 | ! |
---|
121 | !-- Compute the u-component. |
---|
122 | DO i = nxl, nxr |
---|
123 | DO j = nys, nyn |
---|
124 | x = ( i - ic - 0.5_wp ) * dx |
---|
125 | y = ( j - jc ) * dy |
---|
126 | radius = SQRT( x**2 + y**2 ) |
---|
127 | IF ( radius <= 2.0_wp * rc ) THEN |
---|
128 | betrag = radius / ( 2.0_wp * rc ) * 0.08_wp |
---|
129 | ELSEIF ( radius > 2.0_wp * rc .AND. radius < 8.0_wp * rc ) THEN |
---|
130 | betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp ) |
---|
131 | ELSE |
---|
132 | betrag = 0.0_wp |
---|
133 | ENDIF |
---|
134 | |
---|
135 | IF ( x == 0.0_wp ) THEN |
---|
136 | IF ( y > 0.0_wp ) THEN |
---|
137 | alpha = pi / 2.0_wp |
---|
138 | ELSEIF ( y < 0.0_wp ) THEN |
---|
139 | alpha = 3.0_wp * pi / 2.0_wp |
---|
140 | ENDIF |
---|
141 | ELSE |
---|
142 | IF ( x < 0.0_wp ) THEN |
---|
143 | alpha = ATAN( y / x ) + pi |
---|
144 | ELSE |
---|
145 | IF ( y < 0.0_wp ) THEN |
---|
146 | alpha = ATAN( y / x ) + 2.0_wp * pi |
---|
147 | ELSE |
---|
148 | alpha = ATAN( y / x ) |
---|
149 | ENDIF |
---|
150 | ENDIF |
---|
151 | ENDIF |
---|
152 | |
---|
153 | uw = -SIN( alpha ) * betrag |
---|
154 | |
---|
155 | DO k = kc1, kc2 |
---|
156 | u(k,j,i) = u(k,j,i) + uw |
---|
157 | ENDDO |
---|
158 | ENDDO |
---|
159 | ENDDO |
---|
160 | |
---|
161 | ! |
---|
162 | !-- Compute the v-component. |
---|
163 | DO i = nxl, nxr |
---|
164 | DO j = nys, nyn |
---|
165 | x = ( i - ic ) * dx |
---|
166 | y = ( j - jc - 0.5_wp ) * dy |
---|
167 | radius = SQRT( x**2 + y**2 ) |
---|
168 | IF ( radius <= 2.0_wp * rc ) THEN |
---|
169 | betrag = radius / ( 2.0_wp * rc ) * 0.08_wp |
---|
170 | ELSEIF ( radius > 2.0_wp * rc .AND. radius < 8.0_wp * rc ) THEN |
---|
171 | betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp ) |
---|
172 | ELSE |
---|
173 | betrag = 0.0_wp |
---|
174 | ENDIF |
---|
175 | |
---|
176 | IF ( x == 0.0_wp ) THEN |
---|
177 | IF ( y > 0.0_wp ) THEN |
---|
178 | alpha = pi / 2.0_wp |
---|
179 | ELSEIF ( y < 0.0_wp ) THEN |
---|
180 | alpha = 3.0_wp * pi / 2.0_wp |
---|
181 | ENDIF |
---|
182 | ELSE |
---|
183 | IF ( x < 0.0_wp ) THEN |
---|
184 | alpha = ATAN( y / x ) + pi |
---|
185 | ELSE |
---|
186 | IF ( y < 0.0_wp ) THEN |
---|
187 | alpha = ATAN( y / x ) + 2.0_wp * pi |
---|
188 | ELSE |
---|
189 | alpha = ATAN( y / x ) |
---|
190 | ENDIF |
---|
191 | ENDIF |
---|
192 | ENDIF |
---|
193 | |
---|
194 | vw = COS( alpha ) * betrag |
---|
195 | |
---|
196 | DO k = kc1, kc2 |
---|
197 | v(k,j,i) = v(k,j,i) + vw |
---|
198 | ENDDO |
---|
199 | ENDDO |
---|
200 | ENDDO |
---|
201 | |
---|
202 | ! |
---|
203 | !-- Exchange of boundary values for the velocities. |
---|
204 | CALL exchange_horiz( u, nbgp) |
---|
205 | CALL exchange_horiz( v, nbgp ) |
---|
206 | ! |
---|
207 | !-- Make velocity field nondivergent. |
---|
208 | n_sor = nsor_ini |
---|
209 | CALL pres |
---|
210 | n_sor = nsor |
---|
211 | |
---|
212 | END SUBROUTINE init_rankine |
---|