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