[1682] | 1 | !> @file init_pt_anomaly.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 | ! |
---|
[4360] | 17 | ! Copyright 1997-2020 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_pt_anomaly.f90 4360 2020-01-07 11:25:50Z Giersch $ |
---|
[4346] | 27 | ! Introduction of wall_flags_total_0, which currently sets bits based on static |
---|
| 28 | ! topography information used in wall_flags_static_0 |
---|
| 29 | ! |
---|
| 30 | ! 4329 2019-12-10 15:46:36Z motisi |
---|
[4329] | 31 | ! Renamed wall_flags_0 to wall_flags_static_0 |
---|
| 32 | ! |
---|
| 33 | ! 4182 2019-08-22 15:20:23Z scharf |
---|
[4182] | 34 | ! Corrected "Former revisions" section |
---|
| 35 | ! |
---|
| 36 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
[3379] | 37 | ! Added topography flags |
---|
[1321] | 38 | ! |
---|
[4182] | 39 | ! Revision 1.1 1997/08/29 08:58:56 raasch |
---|
| 40 | ! Initial revision |
---|
| 41 | ! |
---|
| 42 | ! |
---|
[1] | 43 | ! Description: |
---|
| 44 | ! ------------ |
---|
[1682] | 45 | !> Impose a temperature perturbation for an advection test. |
---|
[1] | 46 | !------------------------------------------------------------------------------! |
---|
[1682] | 47 | SUBROUTINE init_pt_anomaly |
---|
[1] | 48 | |
---|
[3379] | 49 | |
---|
[1320] | 50 | USE arrays_3d, & |
---|
| 51 | ONLY: pt, zu |
---|
[1] | 52 | |
---|
[3379] | 53 | USE control_parameters |
---|
| 54 | |
---|
[1320] | 55 | USE grid_variables, & |
---|
| 56 | ONLY: dx, dy |
---|
| 57 | |
---|
| 58 | USE indices, & |
---|
[4346] | 59 | ONLY: nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_total_0 |
---|
[3379] | 60 | |
---|
[1320] | 61 | USE kinds |
---|
| 62 | |
---|
[1] | 63 | IMPLICIT NONE |
---|
| 64 | |
---|
[3035] | 65 | INTEGER(iwp) :: i !< grid index along x |
---|
| 66 | INTEGER(iwp) :: ic !< center index along x |
---|
| 67 | INTEGER(iwp) :: j !< grid index along y |
---|
| 68 | INTEGER(iwp) :: jc !< center index along y |
---|
| 69 | INTEGER(iwp) :: k !< grid index along z |
---|
| 70 | INTEGER(iwp) :: kc !< center index along z |
---|
[3379] | 71 | |
---|
[3035] | 72 | REAL(wp) :: amount !< amount of temperature perturbation |
---|
| 73 | REAL(wp) :: bubble_center_y !< center of bubble in y |
---|
| 74 | REAL(wp) :: bubble_center_z = 170.0 !< center of bubble in z |
---|
| 75 | REAL(wp) :: bubble_sigma_y = 300.0 !< width of bubble in y |
---|
| 76 | REAL(wp) :: bubble_sigma_z = 150.0 !< width of bubble in z |
---|
[3379] | 77 | REAL(wp) :: flag !< flag to mask topography grid points |
---|
[3035] | 78 | REAL(wp) :: initial_temperature_difference = 0.4 !< temperature perturbation for bubble in K |
---|
| 79 | REAL(wp) :: radius !< radius of pt anomaly |
---|
| 80 | REAL(wp) :: rc !< radius of pt anomaly |
---|
| 81 | REAL(wp) :: x !< x dimension of pt anomaly |
---|
| 82 | REAL(wp) :: y !< y dimension of pt anomaly |
---|
| 83 | REAL(wp) :: z !< z dimension of pt anomaly |
---|
[3379] | 84 | |
---|
| 85 | |
---|
[1] | 86 | ! |
---|
| 87 | !-- Defaults: radius rc, strength z, |
---|
[3035] | 88 | !-- position of center: ic, jc, kc |
---|
[1353] | 89 | rc = 10.0_wp * dx |
---|
[1] | 90 | ic = ( nx+1 ) / 2 |
---|
| 91 | jc = ic |
---|
[1353] | 92 | kc = nzt / 2 |
---|
[3379] | 93 | |
---|
[3035] | 94 | IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 ) THEN |
---|
[1] | 95 | ! |
---|
[3035] | 96 | !-- Compute the perturbation. |
---|
| 97 | DO i = nxl, nxr |
---|
| 98 | DO j = nys, nyn |
---|
| 99 | DO k = nzb+1, nzt |
---|
[3379] | 100 | ! |
---|
| 101 | !-- Predetermine flag to mask topography |
---|
[4346] | 102 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
[3379] | 103 | |
---|
[3035] | 104 | x = ( i - ic ) * dx |
---|
| 105 | y = ( j - jc ) * dy |
---|
| 106 | z = ABS( zu(k) - zu(kc) ) |
---|
| 107 | radius = SQRT( x**2 + y**2 + z**2 ) |
---|
| 108 | IF ( radius <= rc ) THEN |
---|
| 109 | amount = 5.0_wp * EXP( -( radius * 0.001_wp / 2.0_wp )**2 ) |
---|
| 110 | ELSE |
---|
| 111 | amount = 0.0_wp |
---|
| 112 | ENDIF |
---|
[1] | 113 | |
---|
[3379] | 114 | pt(k,j,i) = pt(k,j,i) + amount * flag |
---|
[1] | 115 | |
---|
[3035] | 116 | ENDDO |
---|
[1] | 117 | ENDDO |
---|
| 118 | ENDDO |
---|
[3379] | 119 | |
---|
[3035] | 120 | ! |
---|
| 121 | !-- Initialize warm air bubble close to surface and homogenous elegonated |
---|
| 122 | !-- along x-Axis |
---|
| 123 | ELSEIF ( INDEX( initializing_actions, 'initialize_bubble' ) /= 0 ) THEN |
---|
| 124 | ! |
---|
| 125 | !-- Calculate y-center of model domain |
---|
| 126 | bubble_center_y = ( ny + 1.0 ) * dy / 2.0 |
---|
[3379] | 127 | |
---|
[3035] | 128 | ! |
---|
| 129 | !-- Compute perturbation for potential temperaure |
---|
| 130 | DO i = nxl, nxr |
---|
| 131 | DO j = nys, nyn |
---|
[3379] | 132 | DO k = nzb+1, nzt |
---|
| 133 | ! |
---|
| 134 | !-- Predetermine flag to mask topography |
---|
[4346] | 135 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
[3379] | 136 | |
---|
[3035] | 137 | pt(k,j,i) = pt(k,j,i) + & |
---|
| 138 | EXP( -0.5 * ( (j* dy - bubble_center_y) / & |
---|
| 139 | bubble_sigma_y )**2) * & |
---|
| 140 | EXP( -0.5 * ( (zu(k) - bubble_center_z) / & |
---|
| 141 | bubble_sigma_z)**2) * & |
---|
[3379] | 142 | initial_temperature_difference * flag |
---|
[3035] | 143 | ENDDO |
---|
| 144 | ENDDO |
---|
| 145 | ENDDO |
---|
| 146 | ENDIF |
---|
[1] | 147 | |
---|
| 148 | ! |
---|
| 149 | !-- Exchange of boundary values for temperature |
---|
[667] | 150 | CALL exchange_horiz( pt, nbgp ) |
---|
[1] | 151 | |
---|
| 152 | |
---|
| 153 | END SUBROUTINE init_pt_anomaly |
---|