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