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