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

Last change on this file since 4180 was 4180, checked in by scharf, 5 years ago

removed comments in 'Former revisions' section that are older than 01.01.2019

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