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