[1682] | 1 | !> @file init_rankine.f90 |
---|
[1036] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1310] | 16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 17 | !--------------------------------------------------------------------------------! |
---|
| 18 | ! |
---|
[484] | 19 | ! Current revisions: |
---|
[1] | 20 | ! ----------------- |
---|
[1682] | 21 | ! Code annotations made doxygen readable |
---|
[1354] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: init_rankine.f90 1682 2015-10-07 23:56:08Z knoop $ |
---|
| 26 | ! |
---|
[1354] | 27 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 28 | ! REAL constants provided with KIND-attribute |
---|
| 29 | ! |
---|
[1323] | 30 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 31 | ! REAL constants defined as wp_kind |
---|
| 32 | ! |
---|
[1321] | 33 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 34 | ! ONLY-attribute added to USE-statements, |
---|
| 35 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 36 | ! kinds are defined in new module kinds, |
---|
| 37 | ! revision history before 2012 removed, |
---|
| 38 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 39 | ! all variable declaration statements |
---|
[1] | 40 | ! |
---|
[1037] | 41 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 42 | ! code put under GPL (PALM 3.9) |
---|
| 43 | ! |
---|
[1] | 44 | ! Revision 1.1 1997/08/11 06:18:43 raasch |
---|
| 45 | ! Initial revision |
---|
| 46 | ! |
---|
| 47 | ! |
---|
| 48 | ! Description: |
---|
| 49 | ! ------------ |
---|
[1682] | 50 | !> Initialize a (nondivergent) Rankine eddy with a vertical axis in order to test |
---|
| 51 | !> the advection terms and the pressure solver. |
---|
[1] | 52 | !------------------------------------------------------------------------------! |
---|
[1682] | 53 | SUBROUTINE init_rankine |
---|
| 54 | |
---|
[1] | 55 | |
---|
[1320] | 56 | USE arrays_3d, & |
---|
| 57 | ONLY: pt, pt_init, u, u_init, v, v_init |
---|
[1] | 58 | |
---|
[1320] | 59 | USE control_parameters, & |
---|
| 60 | ONLY: initializing_actions, n_sor, nsor, nsor_ini |
---|
| 61 | |
---|
| 62 | USE constants, & |
---|
| 63 | ONLY: pi |
---|
| 64 | |
---|
| 65 | USE grid_variables, & |
---|
| 66 | ONLY: dx, dy |
---|
| 67 | |
---|
| 68 | USE indices, & |
---|
| 69 | ONLY: nbgp, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt |
---|
| 70 | |
---|
| 71 | USE kinds |
---|
| 72 | |
---|
[1] | 73 | IMPLICIT NONE |
---|
| 74 | |
---|
[1682] | 75 | INTEGER(iwp) :: i !< |
---|
| 76 | INTEGER(iwp) :: ic !< |
---|
| 77 | INTEGER(iwp) :: j !< |
---|
| 78 | INTEGER(iwp) :: jc !< |
---|
| 79 | INTEGER(iwp) :: k !< |
---|
| 80 | INTEGER(iwp) :: kc1 !< |
---|
| 81 | INTEGER(iwp) :: kc2 !< |
---|
[1320] | 82 | |
---|
[1682] | 83 | REAL(wp) :: alpha !< |
---|
| 84 | REAL(wp) :: betrag !< |
---|
| 85 | REAL(wp) :: radius !< |
---|
| 86 | REAL(wp) :: rc !< |
---|
| 87 | REAL(wp) :: uw !< |
---|
| 88 | REAL(wp) :: vw !< |
---|
| 89 | REAL(wp) :: x !< |
---|
| 90 | REAL(wp) :: y !< |
---|
[1] | 91 | |
---|
| 92 | ! |
---|
| 93 | !-- Default: eddy radius rc, eddy strength z, |
---|
| 94 | !-- position of eddy centre: ic, jc, kc1, kc2 |
---|
[1353] | 95 | rc = 4.0_wp * dx |
---|
[1] | 96 | ic = ( nx+1 ) / 2 |
---|
| 97 | jc = ic |
---|
| 98 | kc1 = nzb |
---|
| 99 | kc2 = nzt+1 |
---|
| 100 | |
---|
| 101 | ! |
---|
[107] | 102 | !-- Reset initial profiles to constant profiles |
---|
| 103 | IF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 ) THEN |
---|
[667] | 104 | DO i = nxlg, nxrg |
---|
| 105 | DO j = nysg, nyng |
---|
[107] | 106 | pt(:,j,i) = pt_init |
---|
| 107 | u(:,j,i) = u_init |
---|
| 108 | v(:,j,i) = v_init |
---|
| 109 | ENDDO |
---|
| 110 | ENDDO |
---|
| 111 | ENDIF |
---|
| 112 | |
---|
| 113 | ! |
---|
[1] | 114 | !-- Compute the u-component. |
---|
| 115 | DO i = nxl, nxr |
---|
| 116 | DO j = nys, nyn |
---|
[1353] | 117 | x = ( i - ic - 0.5_wp ) * dx |
---|
| 118 | y = ( j - jc ) * dy |
---|
[1] | 119 | radius = SQRT( x**2 + y**2 ) |
---|
[1353] | 120 | IF ( radius <= 2.0_wp * rc ) THEN |
---|
| 121 | betrag = radius / ( 2.0_wp * rc ) * 0.08_wp |
---|
| 122 | ELSEIF ( radius > 2.0_wp * rc .AND. radius < 8.0_wp * rc ) THEN |
---|
| 123 | betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp ) |
---|
[1] | 124 | ELSE |
---|
[1353] | 125 | betrag = 0.0_wp |
---|
[1] | 126 | ENDIF |
---|
| 127 | |
---|
[1353] | 128 | IF ( x == 0.0_wp ) THEN |
---|
| 129 | IF ( y > 0.0_wp ) THEN |
---|
[1322] | 130 | alpha = pi / 2.0_wp |
---|
[1353] | 131 | ELSEIF ( y < 0.0_wp ) THEN |
---|
| 132 | alpha = 3.0_wp * pi / 2.0_wp |
---|
[1] | 133 | ENDIF |
---|
| 134 | ELSE |
---|
[1353] | 135 | IF ( x < 0.0_wp ) THEN |
---|
[1] | 136 | alpha = ATAN( y / x ) + pi |
---|
| 137 | ELSE |
---|
[1353] | 138 | IF ( y < 0.0_wp ) THEN |
---|
[1322] | 139 | alpha = ATAN( y / x ) + 2.0_wp * pi |
---|
[1] | 140 | ELSE |
---|
| 141 | alpha = ATAN( y / x ) |
---|
| 142 | ENDIF |
---|
| 143 | ENDIF |
---|
| 144 | ENDIF |
---|
| 145 | |
---|
| 146 | uw = -SIN( alpha ) * betrag |
---|
| 147 | |
---|
| 148 | DO k = kc1, kc2 |
---|
| 149 | u(k,j,i) = u(k,j,i) + uw |
---|
| 150 | ENDDO |
---|
| 151 | ENDDO |
---|
| 152 | ENDDO |
---|
| 153 | |
---|
| 154 | ! |
---|
| 155 | !-- Compute the v-component. |
---|
| 156 | DO i = nxl, nxr |
---|
| 157 | DO j = nys, nyn |
---|
[1353] | 158 | x = ( i - ic ) * dx |
---|
| 159 | y = ( j - jc - 0.5_wp ) * dy |
---|
[1] | 160 | radius = SQRT( x**2 + y**2 ) |
---|
[1353] | 161 | IF ( radius <= 2.0_wp * rc ) THEN |
---|
[1322] | 162 | betrag = radius / ( 2.0_wp * rc ) * 0.08_wp |
---|
[1353] | 163 | ELSEIF ( radius > 2.0_wp * rc .AND. radius < 8.0_wp * rc ) THEN |
---|
| 164 | betrag = 0.08_wp * EXP( -( radius - 2.0_wp * rc ) / 2.0_wp ) |
---|
[1] | 165 | ELSE |
---|
[1353] | 166 | betrag = 0.0_wp |
---|
[1] | 167 | ENDIF |
---|
| 168 | |
---|
[1353] | 169 | IF ( x == 0.0_wp ) THEN |
---|
| 170 | IF ( y > 0.0_wp ) THEN |
---|
[1322] | 171 | alpha = pi / 2.0_wp |
---|
[1353] | 172 | ELSEIF ( y < 0.0_wp ) THEN |
---|
| 173 | alpha = 3.0_wp * pi / 2.0_wp |
---|
[1] | 174 | ENDIF |
---|
| 175 | ELSE |
---|
[1353] | 176 | IF ( x < 0.0_wp ) THEN |
---|
[1] | 177 | alpha = ATAN( y / x ) + pi |
---|
| 178 | ELSE |
---|
[1353] | 179 | IF ( y < 0.0_wp ) THEN |
---|
[1322] | 180 | alpha = ATAN( y / x ) + 2.0_wp * pi |
---|
[1] | 181 | ELSE |
---|
| 182 | alpha = ATAN( y / x ) |
---|
| 183 | ENDIF |
---|
| 184 | ENDIF |
---|
| 185 | ENDIF |
---|
| 186 | |
---|
| 187 | vw = COS( alpha ) * betrag |
---|
| 188 | |
---|
| 189 | DO k = kc1, kc2 |
---|
| 190 | v(k,j,i) = v(k,j,i) + vw |
---|
| 191 | ENDDO |
---|
| 192 | ENDDO |
---|
| 193 | ENDDO |
---|
| 194 | |
---|
| 195 | ! |
---|
| 196 | !-- Exchange of boundary values for the velocities. |
---|
[667] | 197 | CALL exchange_horiz( u, nbgp) |
---|
| 198 | CALL exchange_horiz( v, nbgp ) |
---|
[1] | 199 | ! |
---|
| 200 | !-- Make velocity field nondivergent. |
---|
| 201 | n_sor = nsor_ini |
---|
| 202 | CALL pres |
---|
| 203 | n_sor = nsor |
---|
| 204 | |
---|
| 205 | END SUBROUTINE init_rankine |
---|