source: palm/trunk/SOURCE/init_pt_anomaly.f90 @ 4366

Last change on this file since 4366 was 4360, checked in by suehring, 5 years ago

Bugfix in output of time-averaged plant-canopy quanities; Output of plant-canopy data only where tall canopy is defined; land-surface model: fix wrong location strings; tests: update urban test case; all source code files: copyright update

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