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

Last change on this file since 4343 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
RevLine 
[1682]1!> @file init_pt_anomaly.f90
[2000]2!------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1036]4!
[2000]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.
[1036]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!
[3655]17! Copyright 1997-2019 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1036]19!
[484]20! Current revisions:
[1]21! -----------------
[1354]22!
[2001]23!
[1321]24! Former revisions:
25! -----------------
26! $Id: init_pt_anomaly.f90 4329 2019-12-10 15:46:36Z oliver.maas $
[4329]27! Renamed wall_flags_0 to wall_flags_static_0
28!
29! 4182 2019-08-22 15:20:23Z scharf
[4182]30! Corrected "Former revisions" section
31!
32! 3655 2019-01-07 16:51:22Z knoop
[3379]33! Added topography flags
[1321]34!
[4182]35! Revision 1.1  1997/08/29 08:58:56  raasch
36! Initial revision
37!
38!
[1]39! Description:
40! ------------
[1682]41!> Impose a temperature perturbation for an advection test.
[1]42!------------------------------------------------------------------------------!
[1682]43 SUBROUTINE init_pt_anomaly
[1]44
[3379]45
[1320]46    USE arrays_3d,                                                             &
47        ONLY:  pt, zu
[1]48
[3379]49    USE control_parameters
50
[1320]51    USE grid_variables,                                                        &
52        ONLY:  dx, dy
53
54    USE indices,                                                               &
[4329]55        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_static_0
[3379]56
[1320]57    USE kinds
58
[1]59    IMPLICIT NONE
60
[3035]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
[3379]67
[3035]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
[3379]73    REAL(wp)     ::  flag                                 !< flag to mask topography grid points
[3035]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
[3379]80
81
[1]82!
83!-- Defaults: radius rc, strength z,
[3035]84!--           position of center: ic, jc, kc
[1353]85    rc =  10.0_wp * dx
[1]86    ic =  ( nx+1 ) / 2
87    jc =  ic
[1353]88    kc =  nzt / 2
[3379]89
[3035]90    IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 )  THEN
[1]91!
[3035]92!--    Compute the perturbation.
93       DO  i = nxl, nxr
94          DO  j = nys, nyn
95             DO  k = nzb+1, nzt
[3379]96!
97!--             Predetermine flag to mask topography
[4329]98                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
[3379]99
[3035]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
[1]109
[3379]110                pt(k,j,i) = pt(k,j,i) + amount * flag
[1]111
[3035]112             ENDDO
[1]113          ENDDO
114       ENDDO
[3379]115
[3035]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
[3379]123
[3035]124!
125!--    Compute perturbation for potential temperaure
126       DO  i = nxl, nxr
127          DO  j = nys, nyn
[3379]128             DO  k = nzb+1, nzt
129!
130!--             Predetermine flag to mask topography
[4329]131                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_static_0(k,j,i), 0 ) )
[3379]132
[3035]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) *   &
[3379]138                               initial_temperature_difference * flag
[3035]139             ENDDO
140          ENDDO
141       ENDDO
142    ENDIF
[1]143
144!
145!-- Exchange of boundary values for temperature
[667]146    CALL exchange_horiz( pt, nbgp )
[1]147
148
149 END SUBROUTINE init_pt_anomaly
Note: See TracBrowser for help on using the repository browser.