[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 | ! |
---|
[3655] | 17 | ! Copyright 1997-2019 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 4182 2019-08-22 15:20:23Z Giersch $ |
---|
[4182] | 27 | ! Corrected "Former revisions" section |
---|
| 28 | ! |
---|
| 29 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
[3274] | 30 | ! Modularization of all bulk cloud physics code components |
---|
[1321] | 31 | ! |
---|
[4182] | 32 | ! Revision 1.1 1997/08/11 06:18:43 raasch |
---|
| 33 | ! Initial revision |
---|
| 34 | ! |
---|
| 35 | ! |
---|
[1] | 36 | ! Description: |
---|
| 37 | ! ------------ |
---|
[1682] | 38 | !> Initialize a (nondivergent) Rankine eddy with a vertical axis in order to test |
---|
| 39 | !> the advection terms and the pressure solver. |
---|
[1] | 40 | !------------------------------------------------------------------------------! |
---|
[1682] | 41 | SUBROUTINE init_rankine |
---|
| 42 | |
---|
[1] | 43 | |
---|
[1320] | 44 | USE arrays_3d, & |
---|
| 45 | ONLY: pt, pt_init, u, u_init, v, v_init |
---|
[1] | 46 | |
---|
[1320] | 47 | USE control_parameters, & |
---|
| 48 | ONLY: initializing_actions, n_sor, nsor, nsor_ini |
---|
| 49 | |
---|
[3274] | 50 | USE basic_constants_and_equations_mod, & |
---|
[1320] | 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 | |
---|
[1] | 61 | IMPLICIT NONE |
---|
| 62 | |
---|
[1682] | 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 !< |
---|
[1320] | 70 | |
---|
[1682] | 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 !< |
---|
[1] | 79 | |
---|
| 80 | ! |
---|
| 81 | !-- Default: eddy radius rc, eddy strength z, |
---|
| 82 | !-- position of eddy centre: ic, jc, kc1, kc2 |
---|
[1353] | 83 | rc = 4.0_wp * dx |
---|
[1] | 84 | ic = ( nx+1 ) / 2 |
---|
| 85 | jc = ic |
---|
| 86 | kc1 = nzb |
---|
| 87 | kc2 = nzt+1 |
---|
| 88 | |
---|
| 89 | ! |
---|
[107] | 90 | !-- Reset initial profiles to constant profiles |
---|
| 91 | IF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 ) THEN |
---|
[667] | 92 | DO i = nxlg, nxrg |
---|
| 93 | DO j = nysg, nyng |
---|
[107] | 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 | ! |
---|
[1] | 102 | !-- Compute the u-component. |
---|
| 103 | DO i = nxl, nxr |
---|
| 104 | DO j = nys, nyn |
---|
[1353] | 105 | x = ( i - ic - 0.5_wp ) * dx |
---|
| 106 | y = ( j - jc ) * dy |
---|
[1] | 107 | radius = SQRT( x**2 + y**2 ) |
---|
[1353] | 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 ) |
---|
[1] | 112 | ELSE |
---|
[1353] | 113 | betrag = 0.0_wp |
---|
[1] | 114 | ENDIF |
---|
| 115 | |
---|
[1353] | 116 | IF ( x == 0.0_wp ) THEN |
---|
| 117 | IF ( y > 0.0_wp ) THEN |
---|
[1322] | 118 | alpha = pi / 2.0_wp |
---|
[1353] | 119 | ELSEIF ( y < 0.0_wp ) THEN |
---|
| 120 | alpha = 3.0_wp * pi / 2.0_wp |
---|
[1] | 121 | ENDIF |
---|
| 122 | ELSE |
---|
[1353] | 123 | IF ( x < 0.0_wp ) THEN |
---|
[1] | 124 | alpha = ATAN( y / x ) + pi |
---|
| 125 | ELSE |
---|
[1353] | 126 | IF ( y < 0.0_wp ) THEN |
---|
[1322] | 127 | alpha = ATAN( y / x ) + 2.0_wp * pi |
---|
[1] | 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 |
---|
[1353] | 146 | x = ( i - ic ) * dx |
---|
| 147 | y = ( j - jc - 0.5_wp ) * dy |
---|
[1] | 148 | radius = SQRT( x**2 + y**2 ) |
---|
[1353] | 149 | IF ( radius <= 2.0_wp * rc ) THEN |
---|
[1322] | 150 | betrag = radius / ( 2.0_wp * rc ) * 0.08_wp |
---|
[1353] | 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 ) |
---|
[1] | 153 | ELSE |
---|
[1353] | 154 | betrag = 0.0_wp |
---|
[1] | 155 | ENDIF |
---|
| 156 | |
---|
[1353] | 157 | IF ( x == 0.0_wp ) THEN |
---|
| 158 | IF ( y > 0.0_wp ) THEN |
---|
[1322] | 159 | alpha = pi / 2.0_wp |
---|
[1353] | 160 | ELSEIF ( y < 0.0_wp ) THEN |
---|
| 161 | alpha = 3.0_wp * pi / 2.0_wp |
---|
[1] | 162 | ENDIF |
---|
| 163 | ELSE |
---|
[1353] | 164 | IF ( x < 0.0_wp ) THEN |
---|
[1] | 165 | alpha = ATAN( y / x ) + pi |
---|
| 166 | ELSE |
---|
[1353] | 167 | IF ( y < 0.0_wp ) THEN |
---|
[1322] | 168 | alpha = ATAN( y / x ) + 2.0_wp * pi |
---|
[1] | 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. |
---|
[667] | 185 | CALL exchange_horiz( u, nbgp) |
---|
| 186 | CALL exchange_horiz( v, nbgp ) |
---|
[1] | 187 | ! |
---|
| 188 | !-- Make velocity field nondivergent. |
---|
| 189 | n_sor = nsor_ini |
---|
| 190 | CALL pres |
---|
| 191 | n_sor = nsor |
---|
| 192 | |
---|
| 193 | END SUBROUTINE init_rankine |
---|