[1] | 1 | SUBROUTINE init_rankine |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later 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 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[1321] | 22 | ! |
---|
[1323] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: init_rankine.f90 1323 2014-03-20 17:09:54Z heinze $ |
---|
| 27 | ! |
---|
[1323] | 28 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 29 | ! REAL constants defined as wp_kind |
---|
| 30 | ! |
---|
[1321] | 31 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 32 | ! ONLY-attribute added to USE-statements, |
---|
| 33 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 34 | ! kinds are defined in new module kinds, |
---|
| 35 | ! revision history before 2012 removed, |
---|
| 36 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 37 | ! all variable declaration statements |
---|
[1] | 38 | ! |
---|
[1037] | 39 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 40 | ! code put under GPL (PALM 3.9) |
---|
| 41 | ! |
---|
[1] | 42 | ! Revision 1.1 1997/08/11 06:18:43 raasch |
---|
| 43 | ! Initial revision |
---|
| 44 | ! |
---|
| 45 | ! |
---|
| 46 | ! Description: |
---|
| 47 | ! ------------ |
---|
| 48 | ! Initialize a (nondivergent) Rankine eddy with a vertical axis in order to test |
---|
| 49 | ! the advection terms and the pressure solver. |
---|
| 50 | !------------------------------------------------------------------------------! |
---|
| 51 | |
---|
[1320] | 52 | USE arrays_3d, & |
---|
| 53 | ONLY: pt, pt_init, u, u_init, v, v_init |
---|
[1] | 54 | |
---|
[1320] | 55 | USE control_parameters, & |
---|
| 56 | ONLY: initializing_actions, n_sor, nsor, nsor_ini |
---|
| 57 | |
---|
| 58 | USE constants, & |
---|
| 59 | ONLY: pi |
---|
| 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 | |
---|
[1] | 69 | IMPLICIT NONE |
---|
| 70 | |
---|
[1320] | 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 !: |
---|
[1] | 87 | |
---|
| 88 | ! |
---|
| 89 | !-- Default: eddy radius rc, eddy strength z, |
---|
| 90 | !-- position of eddy centre: ic, jc, kc1, kc2 |
---|
| 91 | rc = 4.0 * dx |
---|
| 92 | ic = ( nx+1 ) / 2 |
---|
| 93 | jc = ic |
---|
| 94 | kc1 = nzb |
---|
| 95 | kc2 = nzt+1 |
---|
| 96 | |
---|
| 97 | ! |
---|
[107] | 98 | !-- Reset initial profiles to constant profiles |
---|
| 99 | IF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 ) THEN |
---|
[667] | 100 | DO i = nxlg, nxrg |
---|
| 101 | DO j = nysg, nyng |
---|
[107] | 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 | ! |
---|
[1] | 110 | !-- Compute the u-component. |
---|
| 111 | DO i = nxl, nxr |
---|
| 112 | DO j = nys, nyn |
---|
| 113 | x = ( i - ic - 0.5 ) * dx |
---|
| 114 | y = ( j - jc ) * dy |
---|
| 115 | radius = SQRT( x**2 + y**2 ) |
---|
| 116 | IF ( radius <= 2.0 * rc ) THEN |
---|
[1322] | 117 | betrag = radius / ( 2.0 * rc ) * 0.08_wp |
---|
[1] | 118 | ELSEIF ( radius > 2.0 * rc .AND. radius < 8.0 * rc ) THEN |
---|
[1322] | 119 | betrag = 0.08 * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp ) |
---|
[1] | 120 | ELSE |
---|
| 121 | betrag = 0.0 |
---|
| 122 | ENDIF |
---|
| 123 | |
---|
| 124 | IF ( x == 0.0 ) THEN |
---|
| 125 | IF ( y > 0.0 ) THEN |
---|
[1322] | 126 | alpha = pi / 2.0_wp |
---|
[1] | 127 | ELSEIF ( y < 0.0 ) THEN |
---|
[1322] | 128 | alpha = 3.0 * pi / 2.0_wp |
---|
[1] | 129 | ENDIF |
---|
| 130 | ELSE |
---|
| 131 | IF ( x < 0.0 ) THEN |
---|
| 132 | alpha = ATAN( y / x ) + pi |
---|
| 133 | ELSE |
---|
| 134 | IF ( y < 0.0 ) THEN |
---|
[1322] | 135 | alpha = ATAN( y / x ) + 2.0_wp * pi |
---|
[1] | 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) * dy |
---|
| 156 | radius = SQRT( x**2 + y**2 ) |
---|
| 157 | IF ( radius <= 2.0 * rc ) THEN |
---|
[1322] | 158 | betrag = radius / ( 2.0_wp * rc ) * 0.08_wp |
---|
[1] | 159 | ELSEIF ( radius > 2.0 * rc .AND. radius < 8.0 * rc ) THEN |
---|
[1322] | 160 | betrag = 0.08 * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp ) |
---|
[1] | 161 | ELSE |
---|
| 162 | betrag = 0.0 |
---|
| 163 | ENDIF |
---|
| 164 | |
---|
| 165 | IF ( x == 0.0 ) THEN |
---|
| 166 | IF ( y > 0.0 ) THEN |
---|
[1322] | 167 | alpha = pi / 2.0_wp |
---|
[1] | 168 | ELSEIF ( y < 0.0 ) THEN |
---|
[1322] | 169 | alpha = 3.0 * pi / 2.0_wp |
---|
[1] | 170 | ENDIF |
---|
| 171 | ELSE |
---|
| 172 | IF ( x < 0.0 ) THEN |
---|
| 173 | alpha = ATAN( y / x ) + pi |
---|
| 174 | ELSE |
---|
| 175 | IF ( y < 0.0 ) THEN |
---|
[1322] | 176 | alpha = ATAN( y / x ) + 2.0_wp * pi |
---|
[1] | 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. |
---|
[667] | 193 | CALL exchange_horiz( u, nbgp) |
---|
| 194 | CALL exchange_horiz( v, nbgp ) |
---|
[1] | 195 | ! |
---|
| 196 | !-- Make velocity field nondivergent. |
---|
| 197 | n_sor = nsor_ini |
---|
| 198 | CALL pres |
---|
| 199 | n_sor = nsor |
---|
| 200 | |
---|
| 201 | END SUBROUTINE init_rankine |
---|