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