source: palm/trunk/SOURCE/init_rankine.f90 @ 4186

Last change on this file since 4186 was 4182, checked in by scharf, 5 years ago
  • corrected "Former revisions" section
  • minor formatting in "Former revisions" section
  • added "Author" section
  • Property svn:keywords set to Id
File size: 5.6 KB
Line 
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 4182 2019-08-22 15:20:23Z suehring $
27! Corrected "Former revisions" section
28!
29! 3655 2019-01-07 16:51:22Z knoop
30! Modularization of all bulk cloud physics code components
31!
32! Revision 1.1  1997/08/11 06:18:43  raasch
33! Initial revision
34!
35!
36! Description:
37! ------------
38!> Initialize a (nondivergent) Rankine eddy with a vertical axis in order to test
39!> the advection terms and the pressure solver.
40!------------------------------------------------------------------------------!
41 SUBROUTINE init_rankine
42 
43
44    USE arrays_3d,                                                             &
45        ONLY:  pt, pt_init, u, u_init, v, v_init
46
47    USE control_parameters,                                                    &
48        ONLY:  initializing_actions, n_sor, nsor, nsor_ini   
49
50    USE basic_constants_and_equations_mod,                                     &
51        ONLY:  pi
52
53    USE grid_variables,                                                        &
54        ONLY:  dx, dy 
55
56    USE indices,                                                               &
57        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt     
58               
59    USE kinds
60
61    IMPLICIT NONE
62
63    INTEGER(iwp) ::  i   !<
64    INTEGER(iwp) ::  ic  !<
65    INTEGER(iwp) ::  j   !<
66    INTEGER(iwp) ::  jc  !<
67    INTEGER(iwp) ::  k   !<
68    INTEGER(iwp) ::  kc1 !<
69    INTEGER(iwp) ::  kc2 !<
70   
71    REAL(wp)     ::  alpha  !<
72    REAL(wp)     ::  betrag !<
73    REAL(wp)     ::  radius !<
74    REAL(wp)     ::  rc     !<
75    REAL(wp)     ::  uw     !<
76    REAL(wp)     ::  vw     !<
77    REAL(wp)     ::  x      !<
78    REAL(wp)     ::  y      !<
79
80!
81!-- Default: eddy radius rc, eddy strength z,
82!--          position of eddy centre: ic, jc, kc1, kc2
83    rc  =  4.0_wp * dx
84    ic  =  ( nx+1 ) / 2
85    jc  =  ic
86    kc1 = nzb
87    kc2 = nzt+1
88
89!
90!-- Reset initial profiles to constant profiles
91    IF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 )  THEN
92       DO  i = nxlg, nxrg
93          DO  j = nysg, nyng
94             pt(:,j,i) = pt_init
95             u(:,j,i)  = u_init
96             v(:,j,i)  = v_init
97          ENDDO
98       ENDDO
99    ENDIF
100
101!
102!-- Compute the u-component.
103    DO  i = nxl, nxr
104       DO  j = nys, nyn
105          x = ( i - ic - 0.5_wp ) * dx
106          y = ( j - jc          ) * dy
107          radius = SQRT( x**2 + y**2 )
108          IF ( radius <= 2.0_wp * rc )  THEN
109             betrag = radius / ( 2.0_wp * rc ) * 0.08_wp
110          ELSEIF ( radius > 2.0_wp * rc  .AND.  radius < 8.0_wp * rc )  THEN
111             betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp )
112          ELSE
113             betrag = 0.0_wp
114          ENDIF
115
116          IF ( x == 0.0_wp )  THEN
117             IF ( y > 0.0_wp )  THEN
118                alpha = pi / 2.0_wp
119             ELSEIF ( y < 0.0_wp )  THEN
120                alpha = 3.0_wp * pi / 2.0_wp
121             ENDIF
122          ELSE
123             IF ( x < 0.0_wp )  THEN
124                alpha = ATAN( y / x ) + pi
125             ELSE
126                IF ( y < 0.0_wp )  THEN
127                   alpha = ATAN( y / x ) + 2.0_wp * pi
128                ELSE
129                   alpha = ATAN( y / x )
130                ENDIF
131             ENDIF
132          ENDIF
133
134          uw = -SIN( alpha ) * betrag
135
136          DO  k = kc1, kc2
137             u(k,j,i) = u(k,j,i) + uw
138          ENDDO
139       ENDDO
140    ENDDO
141
142!
143!-- Compute the v-component.
144    DO  i = nxl, nxr
145       DO  j = nys, nyn
146          x = ( i - ic          ) * dx
147          y = ( j - jc - 0.5_wp ) * dy
148          radius = SQRT( x**2 + y**2 )
149          IF ( radius <= 2.0_wp * rc )  THEN
150             betrag = radius / ( 2.0_wp * rc ) * 0.08_wp
151          ELSEIF ( radius > 2.0_wp * rc  .AND.  radius < 8.0_wp * rc )  THEN
152             betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp )
153          ELSE
154             betrag = 0.0_wp
155          ENDIF
156
157          IF ( x == 0.0_wp )  THEN
158             IF ( y > 0.0_wp )  THEN
159                alpha = pi / 2.0_wp
160             ELSEIF ( y < 0.0_wp )  THEN
161                alpha = 3.0_wp * pi / 2.0_wp
162             ENDIF
163          ELSE
164             IF ( x < 0.0_wp )  THEN
165                alpha = ATAN( y / x ) + pi
166             ELSE
167                IF ( y < 0.0_wp )  THEN
168                   alpha = ATAN( y / x ) + 2.0_wp * pi
169                ELSE
170                   alpha = ATAN( y / x )
171                ENDIF
172             ENDIF
173          ENDIF
174
175          vw = COS( alpha ) * betrag
176
177          DO  k = kc1, kc2
178             v(k,j,i) = v(k,j,i) + vw
179          ENDDO
180       ENDDO
181    ENDDO
182
183!
184!-- Exchange of boundary values for the velocities.
185    CALL exchange_horiz( u, nbgp)
186    CALL exchange_horiz( v, nbgp )
187!
188!-- Make velocity field nondivergent.
189    n_sor = nsor_ini
190    CALL pres
191    n_sor = nsor
192
193 END SUBROUTINE init_rankine
Note: See TracBrowser for help on using the repository browser.