source: palm/trunk/SOURCE/init_pt_anomaly.f90

Last change on this file was 4828, checked in by Giersch, 9 months ago

Copyright updated to year 2021, interface pmc_sort removed to accelarate the nesting code

  • Property svn:keywords set to Id
File size: 5.7 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 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.
8!
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.
12!
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/>.
15!
16! Copyright 1997-2021 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------------------------!
18!
19! Current revisions:
20! -----------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: init_pt_anomaly.f90 4828 2021-01-05 11:21:41Z banzhafs $
26! file re-formatted to follow the PALM coding standard
27!
28! 4457 2020-03-11 14:20:43Z raasch
29! use statement for exchange horiz added
30!
31! 4360 2020-01-07 11:25:50Z suehring
32! Introduction of wall_flags_total_0, which currently sets bits based on static topography
33! information used in wall_flags_static_0
34!
35! 4329 2019-12-10 15:46:36Z motisi
36! Renamed wall_flags_0 to wall_flags_static_0
37!
38! 4182 2019-08-22 15:20:23Z scharf
39! Corrected "Former revisions" section
40!
41! 3655 2019-01-07 16:51:22Z knoop
42! Added topography flags
43!
44! Revision 1.1  1997/08/29 08:58:56  raasch
45! Initial revision
46!
47!
48! Description:
49! ------------
50!> Impose a temperature perturbation for an advection test.
51!--------------------------------------------------------------------------------------------------!
52 SUBROUTINE init_pt_anomaly
53
54
55    USE arrays_3d,                                                                                 &
56        ONLY:  pt, zu
57
58    USE control_parameters
59
60    USE exchange_horiz_mod,                                                                        &
61        ONLY:  exchange_horiz
62
63    USE grid_variables,                                                                            &
64        ONLY:  dx, dy
65
66    USE indices,                                                                                   &
67        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_total_0
68
69    USE kinds
70
71    IMPLICIT NONE
72
73    INTEGER(iwp) ::  i  !< grid index along x
74    INTEGER(iwp) ::  ic !< center index along x
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
79
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
85    REAL(wp)     ::  flag                                 !< flag to mask topography grid points
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
92
93
94!
95!-- Defaults: radius rc, strength z,
96!--           position of center: ic, jc, kc
97    rc =  10.0_wp * dx
98    ic =  ( nx+1 ) / 2
99    jc =  ic
100    kc =  nzt / 2
101
102    IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 )  THEN
103!
104!--    Compute the perturbation.
105       DO  i = nxl, nxr
106          DO  j = nys, nyn
107             DO  k = nzb+1, nzt
108!
109!--             Predetermine flag to mask topography
110                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
111
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
121
122                pt(k,j,i) = pt(k,j,i) + amount * flag
123
124             ENDDO
125          ENDDO
126       ENDDO
127
128!
129!-- Initialize warm air bubble close to surface and homogenous elegonated along x-Axis
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
134
135!
136!--    Compute perturbation for potential temperaure
137       DO  i = nxl, nxr
138          DO  j = nys, nyn
139             DO  k = nzb+1, nzt
140!
141!--             Predetermine flag to mask topography
142                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_total_0(k,j,i), 0 ) )
143
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)  *    &
147                               initial_temperature_difference * flag
148             ENDDO
149          ENDDO
150       ENDDO
151    ENDIF
152
153!
154!-- Exchange of boundary values for temperature
155    CALL exchange_horiz( pt, nbgp )
156
157
158 END SUBROUTINE init_pt_anomaly
Note: See TracBrowser for help on using the repository browser.