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