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

Last change on this file since 3844 was 3655, checked in by knoop, 6 years ago

Bugfix: made "unit" and "found" intend INOUT in module interface subroutines + automatic copyright update

  • Property svn:keywords set to Id
File size: 6.2 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 3655 2019-01-07 16:51:22Z suehring $
[3379]27! Added topography flags
28!
29! 3035 2018-05-24 09:35:20Z schwenkel
[3035]30! Add option to initialize warm air bubble close to surface
31!
32! 2718 2018-01-02 08:49:38Z maronga
[2716]33! Corrected "Former revisions" section
34!
35! 2696 2017-12-14 17:12:51Z kanani
36! Change in file header (GPL part)
[1321]37!
[2716]38! 2101 2017-01-05 16:42:31Z suehring
39!
[2001]40! 2000 2016-08-20 18:09:15Z knoop
41! Forced header and separation lines into 80 columns
42!
[1683]43! 1682 2015-10-07 23:56:08Z knoop
44! Code annotations made doxygen readable
45!
[1354]46! 1353 2014-04-08 15:21:23Z heinze
47! REAL constants provided with KIND-attribute
48!
[1323]49! 1322 2014-03-20 16:38:49Z raasch
50! REAL constants defined as wp_kind
51!
[1321]52! 1320 2014-03-20 08:40:49Z raasch
[1320]53! ONLY-attribute added to USE-statements,
54! kind-parameters added to all INTEGER and REAL declaration statements,
55! kinds are defined in new module kinds,
56! revision history before 2012 removed,
57! comment fields (!:) to be used for variable explanations added to
58! all variable declaration statements
[1]59!
[1037]60! 1036 2012-10-22 13:43:42Z raasch
61! code put under GPL (PALM 3.9)
62!
[863]63! 861 2012-03-26 14:18:34Z suehring
64! Modification of the amplitude to obtain a visible temperature perturbation.
65!
[1]66! Revision 1.1  1997/08/29 08:58:56  raasch
67! Initial revision
68!
69!
70! Description:
71! ------------
[1682]72!> Impose a temperature perturbation for an advection test.
[1]73!------------------------------------------------------------------------------!
[1682]74 SUBROUTINE init_pt_anomaly
[1]75
[3379]76
[1320]77    USE arrays_3d,                                                             &
78        ONLY:  pt, zu
[1]79
[3379]80    USE control_parameters
81
[1320]82    USE grid_variables,                                                        &
83        ONLY:  dx, dy
84
85    USE indices,                                                               &
[3379]86        ONLY:  nbgp, nx, nxl, nxr, ny, nyn, nys, nzb, nzt, wall_flags_0
87
[1320]88    USE kinds
89
[1]90    IMPLICIT NONE
91
[3035]92    INTEGER(iwp) ::  i  !< grid index along x
93    INTEGER(iwp) ::  ic !< center index along x
94    INTEGER(iwp) ::  j  !< grid index along y
95    INTEGER(iwp) ::  jc !< center index along y
96    INTEGER(iwp) ::  k  !< grid index along z
97    INTEGER(iwp) ::  kc !< center index along z
[3379]98
[3035]99    REAL(wp)     ::  amount                               !< amount of temperature perturbation
100    REAL(wp)     ::  bubble_center_y                      !< center of bubble in y
101    REAL(wp)     ::  bubble_center_z = 170.0              !< center of bubble in z
102    REAL(wp)     ::  bubble_sigma_y = 300.0               !< width of bubble in y
103    REAL(wp)     ::  bubble_sigma_z = 150.0               !< width of bubble in z
[3379]104    REAL(wp)     ::  flag                                 !< flag to mask topography grid points
[3035]105    REAL(wp)     ::  initial_temperature_difference = 0.4 !< temperature perturbation for bubble in K
106    REAL(wp)     ::  radius                               !< radius of pt anomaly
107    REAL(wp)     ::  rc                                   !< radius of pt anomaly
108    REAL(wp)     ::  x                                    !< x dimension of pt anomaly
109    REAL(wp)     ::  y                                    !< y dimension of pt anomaly
110    REAL(wp)     ::  z                                    !< z dimension of pt anomaly
[3379]111
112
[1]113!
114!-- Defaults: radius rc, strength z,
[3035]115!--           position of center: ic, jc, kc
[1353]116    rc =  10.0_wp * dx
[1]117    ic =  ( nx+1 ) / 2
118    jc =  ic
[1353]119    kc =  nzt / 2
[3379]120
[3035]121    IF ( INDEX( initializing_actions, 'initialize_ptanom' ) /= 0 )  THEN
[1]122!
[3035]123!--    Compute the perturbation.
124       DO  i = nxl, nxr
125          DO  j = nys, nyn
126             DO  k = nzb+1, nzt
[3379]127!
128!--             Predetermine flag to mask topography
129                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
130
[3035]131                x = ( i - ic ) * dx
132                y = ( j - jc ) * dy
133                z = ABS( zu(k) - zu(kc) )
134                radius = SQRT( x**2 + y**2 + z**2 )
135                IF ( radius <= rc )  THEN
136                   amount = 5.0_wp * EXP( -( radius * 0.001_wp / 2.0_wp )**2 )
137                ELSE
138                   amount = 0.0_wp
139                ENDIF
[1]140
[3379]141                pt(k,j,i) = pt(k,j,i) + amount * flag
[1]142
[3035]143             ENDDO
[1]144          ENDDO
145       ENDDO
[3379]146
[3035]147!
148!-- Initialize warm air bubble close to surface and homogenous elegonated
149!-- along x-Axis
150    ELSEIF ( INDEX( initializing_actions, 'initialize_bubble' ) /= 0 )  THEN
151!
152!--    Calculate y-center of model domain
153       bubble_center_y = ( ny + 1.0 ) * dy / 2.0
[3379]154
[3035]155!
156!--    Compute perturbation for potential temperaure
157       DO  i = nxl, nxr
158          DO  j = nys, nyn
[3379]159             DO  k = nzb+1, nzt
160!
161!--             Predetermine flag to mask topography
162                flag = MERGE( 1.0_wp, 0.0_wp, BTEST( wall_flags_0(k,j,i), 0 ) )
163
[3035]164                pt(k,j,i) = pt(k,j,i) +                                        &
165                               EXP( -0.5 * ( (j* dy  - bubble_center_y) /      &
166                                                       bubble_sigma_y )**2) *  &
167                               EXP( -0.5 * ( (zu(k)  - bubble_center_z) /      &
168                                                       bubble_sigma_z)**2) *   &
[3379]169                               initial_temperature_difference * flag
[3035]170             ENDDO
171          ENDDO
172       ENDDO
173    ENDIF
[1]174
175!
176!-- Exchange of boundary values for temperature
[667]177    CALL exchange_horiz( pt, nbgp )
[1]178
179
180 END SUBROUTINE init_pt_anomaly
Note: See TracBrowser for help on using the repository browser.