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 4182 2019-08-22 15:20:23Z gronemeier $ |
---|
27 | ! Corrected "Former revisions" section |
---|
28 | ! |
---|
29 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
30 | ! Added topography flags |
---|
31 | ! |
---|
32 | ! Revision 1.1 1997/08/29 08:58:56 raasch |
---|
33 | ! Initial revision |
---|
34 | ! |
---|
35 | ! |
---|
36 | ! Description: |
---|
37 | ! ------------ |
---|
38 | !> Impose a temperature perturbation for an advection test. |
---|
39 | !------------------------------------------------------------------------------! |
---|
40 | SUBROUTINE init_pt_anomaly |
---|
41 | |
---|
42 | |
---|
43 | USE arrays_3d, & |
---|
44 | ONLY: pt, zu |
---|
45 | |
---|
46 | USE control_parameters |
---|
47 | |
---|
48 | USE grid_variables, & |
---|
49 | ONLY: dx, dy |
---|
50 | |
---|
51 | USE indices, & |
---|
52 | ONLY: nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_0 |
---|
53 | |
---|
54 | USE kinds |
---|
55 | |
---|
56 | IMPLICIT NONE |
---|
57 | |
---|
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 |
---|
64 | |
---|
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 |
---|
70 | REAL(wp) :: flag !< flag to mask topography grid points |
---|
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 |
---|
77 | |
---|
78 | |
---|
79 | ! |
---|
80 | !-- Defaults: radius rc, strength z, |
---|
81 | !-- position of center: ic, jc, kc |
---|
82 | rc = 10.0_wp * dx |
---|
83 | ic = ( nx+1 ) / 2 |
---|
84 | jc = ic |
---|
85 | kc = nzt / 2 |
---|
86 | |
---|
87 | IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 ) THEN |
---|
88 | ! |
---|
89 | !-- Compute the perturbation. |
---|
90 | DO i = nxl, nxr |
---|
91 | DO j = nys, nyn |
---|
92 | DO k = nzb+1, nzt |
---|
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 | |
---|
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 |
---|
106 | |
---|
107 | pt(k,j,i) = pt(k,j,i) + amount * flag |
---|
108 | |
---|
109 | ENDDO |
---|
110 | ENDDO |
---|
111 | ENDDO |
---|
112 | |
---|
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 |
---|
120 | |
---|
121 | ! |
---|
122 | !-- Compute perturbation for potential temperaure |
---|
123 | DO i = nxl, nxr |
---|
124 | DO j = nys, nyn |
---|
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 | |
---|
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) * & |
---|
135 | initial_temperature_difference * flag |
---|
136 | ENDDO |
---|
137 | ENDDO |
---|
138 | ENDDO |
---|
139 | ENDIF |
---|
140 | |
---|
141 | ! |
---|
142 | !-- Exchange of boundary values for temperature |
---|
143 | CALL exchange_horiz( pt, nbgp ) |
---|
144 | |
---|
145 | |
---|
146 | END SUBROUTINE init_pt_anomaly |
---|