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

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

ghost point exchange modularized, bugfix for wrong 2d-exchange

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