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-2019 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: init_pt_anomaly.f90 3655 2019-01-07 16:51:22Z Giersch $ |
---|
27 | ! Added topography flags |
---|
28 | ! |
---|
29 | ! 3035 2018-05-24 09:35:20Z schwenkel |
---|
30 | ! Add option to initialize warm air bubble close to surface |
---|
31 | ! |
---|
32 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
33 | ! Corrected "Former revisions" section |
---|
34 | ! |
---|
35 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
36 | ! Change in file header (GPL part) |
---|
37 | ! |
---|
38 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
39 | ! |
---|
40 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
41 | ! Forced header and separation lines into 80 columns |
---|
42 | ! |
---|
43 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
44 | ! Code annotations made doxygen readable |
---|
45 | ! |
---|
46 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
47 | ! REAL constants provided with KIND-attribute |
---|
48 | ! |
---|
49 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
50 | ! REAL constants defined as wp_kind |
---|
51 | ! |
---|
52 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
53 | ! ONLY-attribute added to USE-statements, |
---|
54 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
55 | ! kinds are defined in new module kinds, |
---|
56 | ! revision history before 2012 removed, |
---|
57 | ! comment fields (!:) to be used for variable explanations added to |
---|
58 | ! all variable declaration statements |
---|
59 | ! |
---|
60 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
61 | ! code put under GPL (PALM 3.9) |
---|
62 | ! |
---|
63 | ! 861 2012-03-26 14:18:34Z suehring |
---|
64 | ! Modification of the amplitude to obtain a visible temperature perturbation. |
---|
65 | ! |
---|
66 | ! Revision 1.1 1997/08/29 08:58:56 raasch |
---|
67 | ! Initial revision |
---|
68 | ! |
---|
69 | ! |
---|
70 | ! Description: |
---|
71 | ! ------------ |
---|
72 | !> Impose a temperature perturbation for an advection test. |
---|
73 | !------------------------------------------------------------------------------! |
---|
74 | SUBROUTINE init_pt_anomaly |
---|
75 | |
---|
76 | |
---|
77 | USE arrays_3d, & |
---|
78 | ONLY: pt, zu |
---|
79 | |
---|
80 | USE control_parameters |
---|
81 | |
---|
82 | USE grid_variables, & |
---|
83 | ONLY: dx, dy |
---|
84 | |
---|
85 | USE indices, & |
---|
86 | ONLY: nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_0 |
---|
87 | |
---|
88 | USE kinds |
---|
89 | |
---|
90 | IMPLICIT NONE |
---|
91 | |
---|
92 | INTEGER(iwp) :: i !< grid index along x |
---|
93 | INTEGER(iwp) :: ic !< center index along x |
---|
94 | INTEGER(iwp) :: j !< grid index along y |
---|
95 | INTEGER(iwp) :: jc !< center index along y |
---|
96 | INTEGER(iwp) :: k !< grid index along z |
---|
97 | INTEGER(iwp) :: kc !< center index along z |
---|
98 | |
---|
99 | REAL(wp) :: amount !< amount of temperature perturbation |
---|
100 | REAL(wp) :: bubble_center_y !< center of bubble in y |
---|
101 | REAL(wp) :: bubble_center_z = 170.0 !< center of bubble in z |
---|
102 | REAL(wp) :: bubble_sigma_y = 300.0 !< width of bubble in y |
---|
103 | REAL(wp) :: bubble_sigma_z = 150.0 !< width of bubble in z |
---|
104 | REAL(wp) :: flag !< flag to mask topography grid points |
---|
105 | REAL(wp) :: initial_temperature_difference = 0.4 !< temperature perturbation for bubble in K |
---|
106 | REAL(wp) :: radius !< radius of pt anomaly |
---|
107 | REAL(wp) :: rc !< radius of pt anomaly |
---|
108 | REAL(wp) :: x !< x dimension of pt anomaly |
---|
109 | REAL(wp) :: y !< y dimension of pt anomaly |
---|
110 | REAL(wp) :: z !< z dimension of pt anomaly |
---|
111 | |
---|
112 | |
---|
113 | ! |
---|
114 | !-- Defaults: radius rc, strength z, |
---|
115 | !-- position of center: ic, jc, kc |
---|
116 | rc = 10.0_wp * dx |
---|
117 | ic = ( nx+1 ) / 2 |
---|
118 | jc = ic |
---|
119 | kc = nzt / 2 |
---|
120 | |
---|
121 | IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 ) THEN |
---|
122 | ! |
---|
123 | !-- Compute the perturbation. |
---|
124 | DO i = nxl, nxr |
---|
125 | DO j = nys, nyn |
---|
126 | DO k = nzb+1, nzt |
---|
127 | ! |
---|
128 | !-- Predetermine flag to mask topography |
---|
129 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) ) |
---|
130 | |
---|
131 | x = ( i - ic ) * dx |
---|
132 | y = ( j - jc ) * dy |
---|
133 | z = ABS( zu(k) - zu(kc) ) |
---|
134 | radius = SQRT( x**2 + y**2 + z**2 ) |
---|
135 | IF ( radius <= rc ) THEN |
---|
136 | amount = 5.0_wp * EXP( -( radius * 0.001_wp / 2.0_wp )**2 ) |
---|
137 | ELSE |
---|
138 | amount = 0.0_wp |
---|
139 | ENDIF |
---|
140 | |
---|
141 | pt(k,j,i) = pt(k,j,i) + amount * flag |
---|
142 | |
---|
143 | ENDDO |
---|
144 | ENDDO |
---|
145 | ENDDO |
---|
146 | |
---|
147 | ! |
---|
148 | !-- Initialize warm air bubble close to surface and homogenous elegonated |
---|
149 | !-- along x-Axis |
---|
150 | ELSEIF ( INDEX( initializing_actions, 'initialize_bubble' ) /= 0 ) THEN |
---|
151 | ! |
---|
152 | !-- Calculate y-center of model domain |
---|
153 | bubble_center_y = ( ny + 1.0 ) * dy / 2.0 |
---|
154 | |
---|
155 | ! |
---|
156 | !-- Compute perturbation for potential temperaure |
---|
157 | DO i = nxl, nxr |
---|
158 | DO j = nys, nyn |
---|
159 | DO k = nzb+1, nzt |
---|
160 | ! |
---|
161 | !-- Predetermine flag to mask topography |
---|
162 | flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) ) |
---|
163 | |
---|
164 | pt(k,j,i) = pt(k,j,i) + & |
---|
165 | EXP( -0.5 * ( (j* dy - bubble_center_y) / & |
---|
166 | bubble_sigma_y )**2) * & |
---|
167 | EXP( -0.5 * ( (zu(k) - bubble_center_z) / & |
---|
168 | bubble_sigma_z)**2) * & |
---|
169 | initial_temperature_difference * flag |
---|
170 | ENDDO |
---|
171 | ENDDO |
---|
172 | ENDDO |
---|
173 | ENDIF |
---|
174 | |
---|
175 | ! |
---|
176 | !-- Exchange of boundary values for temperature |
---|
177 | CALL exchange_horiz( pt, nbgp ) |
---|
178 | |
---|
179 | |
---|
180 | END SUBROUTINE init_pt_anomaly |
---|