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