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

Last change on this file since 4181 was 4180, checked in by scharf, 5 years ago

removed comments in 'Former revisions' section that are older than 01.01.2019

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