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