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