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

Last change on this file since 3129 was 3035, checked in by schwenkel, 6 years ago

Add option to initialize warm air bubble close to surface

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