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