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