1 | !> @file init_pt_anomaly.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
4 | ! |
---|
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. |
---|
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 | ! |
---|
17 | ! Copyright 1997-2020 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: init_pt_anomaly.f90 4457 2020-03-11 14:20:43Z oliver.maas $ |
---|
27 | ! use statement for exchange horiz added |
---|
28 | ! |
---|
29 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
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 |
---|
34 | ! Renamed wall_flags_0 to wall_flags_static_0 |
---|
35 | ! |
---|
36 | ! 4182 2019-08-22 15:20:23Z scharf |
---|
37 | ! Corrected "Former revisions" section |
---|
38 | ! |
---|
39 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
40 | ! Added topography flags |
---|
41 | ! |
---|
42 | ! Revision 1.1 1997/08/29 08:58:56 raasch |
---|
43 | ! Initial revision |
---|
44 | ! |
---|
45 | ! |
---|
46 | ! Description: |
---|
47 | ! ------------ |
---|
48 | !> Impose a temperature perturbation for an advection test. |
---|
49 | !------------------------------------------------------------------------------! |
---|
50 | SUBROUTINE init_pt_anomaly |
---|
51 | |
---|
52 | |
---|
53 | USE arrays_3d, & |
---|
54 | ONLY: pt, zu |
---|
55 | |
---|
56 | USE control_parameters |
---|
57 | |
---|
58 | USE exchange_horiz_mod, & |
---|
59 | ONLY: exchange_horiz |
---|
60 | |
---|
61 | USE grid_variables, & |
---|
62 | ONLY: dx, dy |
---|
63 | |
---|
64 | USE indices, & |
---|
65 | ONLY: nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_total_0 |
---|
66 | |
---|
67 | USE kinds |
---|
68 | |
---|
69 | IMPLICIT NONE |
---|
70 | |
---|
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 |
---|
77 | |
---|
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 |
---|
83 | REAL(wp) :: flag !< flag to mask topography grid points |
---|
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 |
---|
90 | |
---|
91 | |
---|
92 | ! |
---|
93 | !-- Defaults: radius rc, strength z, |
---|
94 | !-- position of center: ic, jc, kc |
---|
95 | rc = 10.0_wp * dx |
---|
96 | ic = ( nx+1 ) / 2 |
---|
97 | jc = ic |
---|
98 | kc = nzt / 2 |
---|
99 | |
---|
100 | IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 ) THEN |
---|
101 | ! |
---|
102 | !-- Compute the perturbation. |
---|
103 | DO i = nxl, nxr |
---|
104 | DO j = nys, nyn |
---|
105 | DO k = nzb+1, nzt |
---|
106 | ! |
---|
107 | !-- Predetermine flag to mask topography |
---|
108 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
109 | |
---|
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 |
---|
119 | |
---|
120 | pt(k,j,i) = pt(k,j,i) + amount * flag |
---|
121 | |
---|
122 | ENDDO |
---|
123 | ENDDO |
---|
124 | ENDDO |
---|
125 | |
---|
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 |
---|
133 | |
---|
134 | ! |
---|
135 | !-- Compute perturbation for potential temperaure |
---|
136 | DO i = nxl, nxr |
---|
137 | DO j = nys, nyn |
---|
138 | DO k = nzb+1, nzt |
---|
139 | ! |
---|
140 | !-- Predetermine flag to mask topography |
---|
141 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) ) |
---|
142 | |
---|
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) * & |
---|
148 | initial_temperature_difference * flag |
---|
149 | ENDDO |
---|
150 | ENDDO |
---|
151 | ENDDO |
---|
152 | ENDIF |
---|
153 | |
---|
154 | ! |
---|
155 | !-- Exchange of boundary values for temperature |
---|
156 | CALL exchange_horiz( pt, nbgp ) |
---|
157 | |
---|
158 | |
---|
159 | END SUBROUTINE init_pt_anomaly |
---|