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

Last change on this file since 4648 was 4648, checked in by raasch, 4 years ago

files re-formatted to follow the PALM coding standard

  • Property svn:keywords set to Id
File size: 6.0 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 terms of the GNU General
6! Public License as published by the Free Software Foundation, either version 3 of the License, or
7! (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11! Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with PALM. If not, see
14! <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2020 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------------------------!
18!
19! Current revisions:
20! -----------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: init_rankine.f90 4648 2020-08-25 07:52:08Z raasch $
26! file re-formatted to follow the PALM coding standard
27!
28! 4457 2020-03-11 14:20:43Z raasch
29! use statement for exchange horiz added
30!
31! 4360 2020-01-07 11:25:50Z suehring
32! Corrected "Former revisions" section
33!
34! 3655 2019-01-07 16:51:22Z knoop
35! Modularization of all bulk cloud physics code components
36!
37! Revision 1.1  1997/08/11 06:18:43  raasch
38! Initial revision
39!
40!
41! Description:
42! ------------
43!> Initialize a (nondivergent) Rankine eddy with a vertical axis in order to test the advection
44!> terms and the pressure solver.
45!--------------------------------------------------------------------------------------------------!
46 SUBROUTINE init_rankine
47
48
49    USE arrays_3d,                                                                                 &
50        ONLY:  pt, pt_init, u, u_init, v, v_init
51
52    USE control_parameters,                                                                        &
53        ONLY:  initializing_actions, n_sor, nsor, nsor_ini
54
55    USE basic_constants_and_equations_mod,                                                         &
56        ONLY:  pi
57
58    USE exchange_horiz_mod,                                                                        &
59        ONLY:  exchange_horiz
60
61    USE grid_variables,                                                                            &
62        ONLY:  dx, dy
63
64    USE indices,                                                                                   &
65        ONLY:  nbgp, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
66
67    USE kinds
68
69    IMPLICIT NONE
70
71    INTEGER(iwp) ::  i   !<
72    INTEGER(iwp) ::  ic  !<
73    INTEGER(iwp) ::  j   !<
74    INTEGER(iwp) ::  jc  !<
75    INTEGER(iwp) ::  k   !<
76    INTEGER(iwp) ::  kc1 !<
77    INTEGER(iwp) ::  kc2 !<
78
79    REAL(wp)     ::  alpha  !<
80    REAL(wp)     ::  betrag !<
81    REAL(wp)     ::  radius !<
82    REAL(wp)     ::  rc     !<
83    REAL(wp)     ::  uw     !<
84    REAL(wp)     ::  vw     !<
85    REAL(wp)     ::  x      !<
86    REAL(wp)     ::  y      !<
87
88!
89!-- Default: eddy radius rc, eddy strength z,
90!--          position of eddy centre: ic, jc, kc1, kc2
91    rc  =  4.0_wp * dx
92    ic  =  ( nx+1 ) / 2
93    jc  =  ic
94    kc1 = nzb
95    kc2 = nzt+1
96
97!
98!-- Reset initial profiles to constant profiles
99    IF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 )  THEN
100       DO  i = nxlg, nxrg
101          DO  j = nysg, nyng
102             pt(:,j,i) = pt_init
103             u(:,j,i)  = u_init
104             v(:,j,i)  = v_init
105          ENDDO
106       ENDDO
107    ENDIF
108
109!
110!-- Compute the u-component.
111    DO  i = nxl, nxr
112       DO  j = nys, nyn
113          x = ( i - ic - 0.5_wp ) * dx
114          y = ( j - jc          ) * dy
115          radius = SQRT( x**2 + y**2 )
116          IF ( radius <= 2.0_wp * rc )  THEN
117             betrag = radius / ( 2.0_wp * rc ) * 0.08_wp
118          ELSEIF ( radius > 2.0_wp * rc  .AND.  radius < 8.0_wp * rc )  THEN
119             betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp )
120          ELSE
121             betrag = 0.0_wp
122          ENDIF
123
124          IF ( x == 0.0_wp )  THEN
125             IF ( y > 0.0_wp )  THEN
126                alpha = pi / 2.0_wp
127             ELSEIF ( y < 0.0_wp )  THEN
128                alpha = 3.0_wp * pi / 2.0_wp
129             ENDIF
130          ELSE
131             IF ( x < 0.0_wp )  THEN
132                alpha = ATAN( y / x ) + pi
133             ELSE
134                IF ( y < 0.0_wp )  THEN
135                   alpha = ATAN( y / x ) + 2.0_wp * pi
136                ELSE
137                   alpha = ATAN( y / x )
138                ENDIF
139             ENDIF
140          ENDIF
141
142          uw = -SIN( alpha ) * betrag
143
144          DO  k = kc1, kc2
145             u(k,j,i) = u(k,j,i) + uw
146          ENDDO
147       ENDDO
148    ENDDO
149
150!
151!-- Compute the v-component.
152    DO  i = nxl, nxr
153       DO  j = nys, nyn
154          x = ( i - ic          ) * dx
155          y = ( j - jc - 0.5_wp ) * dy
156          radius = SQRT( x**2 + y**2 )
157          IF ( radius <= 2.0_wp * rc )  THEN
158             betrag = radius / ( 2.0_wp * rc ) * 0.08_wp
159          ELSEIF ( radius > 2.0_wp * rc  .AND.  radius < 8.0_wp * rc )  THEN
160             betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp )
161          ELSE
162             betrag = 0.0_wp
163          ENDIF
164
165          IF ( x == 0.0_wp )  THEN
166             IF ( y > 0.0_wp )  THEN
167                alpha = pi / 2.0_wp
168             ELSEIF ( y < 0.0_wp )  THEN
169                alpha = 3.0_wp * pi / 2.0_wp
170             ENDIF
171          ELSE
172             IF ( x < 0.0_wp )  THEN
173                alpha = ATAN( y / x ) + pi
174             ELSE
175                IF ( y < 0.0_wp )  THEN
176                   alpha = ATAN( y / x ) + 2.0_wp * pi
177                ELSE
178                   alpha = ATAN( y / x )
179                ENDIF
180             ENDIF
181          ENDIF
182
183          vw = COS( alpha ) * betrag
184
185          DO  k = kc1, kc2
186             v(k,j,i) = v(k,j,i) + vw
187          ENDDO
188       ENDDO
189    ENDDO
190
191!
192!-- Exchange of boundary values for the velocities.
193    CALL exchange_horiz( u, nbgp)
194    CALL exchange_horiz( v, nbgp )
195!
196!-- Make velocity field nondivergent.
197    n_sor = nsor_ini
198    CALL pres
199    n_sor = nsor
200
201 END SUBROUTINE init_rankine
Note: See TracBrowser for help on using the repository browser.