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

Last change on this file since 4335 was 4329, checked in by motisi, 4 years ago

Renamed wall_flags_0 to wall_flags_static_0

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