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