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