1 | !> @file init_pt_anomaly.f90 |
---|
2 | !--------------------------------------------------------------------------------! |
---|
3 | ! This file is part of PALM. |
---|
4 | ! |
---|
5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
7 | ! either version 3 of the License, or (at your option) any later version. |
---|
8 | ! |
---|
9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
12 | ! |
---|
13 | ! You should have received a copy of the GNU General Public License along with |
---|
14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! Current revisions: |
---|
20 | ! ----------------- |
---|
21 | ! |
---|
22 | ! |
---|
23 | ! Former revisions: |
---|
24 | ! ----------------- |
---|
25 | ! $Id: init_pt_anomaly.f90 1683 2015-10-07 23:57:51Z hoffmann $ |
---|
26 | ! |
---|
27 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
28 | ! Code annotations made doxygen readable |
---|
29 | ! |
---|
30 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
31 | ! REAL constants provided with KIND-attribute |
---|
32 | ! |
---|
33 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
34 | ! REAL constants defined as wp_kind |
---|
35 | ! |
---|
36 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
37 | ! ONLY-attribute added to USE-statements, |
---|
38 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
39 | ! kinds are defined in new module kinds, |
---|
40 | ! revision history before 2012 removed, |
---|
41 | ! comment fields (!:) to be used for variable explanations added to |
---|
42 | ! all variable declaration statements |
---|
43 | ! |
---|
44 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
45 | ! code put under GPL (PALM 3.9) |
---|
46 | ! |
---|
47 | ! 861 2012-03-26 14:18:34Z suehring |
---|
48 | ! Modification of the amplitude to obtain a visible temperature perturbation. |
---|
49 | ! |
---|
50 | ! Revision 1.1 1997/08/29 08:58:56 raasch |
---|
51 | ! Initial revision |
---|
52 | ! |
---|
53 | ! |
---|
54 | ! Description: |
---|
55 | ! ------------ |
---|
56 | !> Impose a temperature perturbation for an advection test. |
---|
57 | !------------------------------------------------------------------------------! |
---|
58 | SUBROUTINE init_pt_anomaly |
---|
59 | |
---|
60 | |
---|
61 | USE arrays_3d, & |
---|
62 | ONLY: pt, zu |
---|
63 | |
---|
64 | USE grid_variables, & |
---|
65 | ONLY: dx, dy |
---|
66 | |
---|
67 | USE indices, & |
---|
68 | ONLY: nbgp, nx, nxl, nxr, nyn, nys, nzb, nzt |
---|
69 | |
---|
70 | USE kinds |
---|
71 | |
---|
72 | IMPLICIT NONE |
---|
73 | |
---|
74 | INTEGER(iwp) :: i !< |
---|
75 | INTEGER(iwp) :: ic !< |
---|
76 | INTEGER(iwp) :: j !< |
---|
77 | INTEGER(iwp) :: jc !< |
---|
78 | INTEGER(iwp) :: k !< |
---|
79 | INTEGER(iwp) :: kc !< |
---|
80 | |
---|
81 | REAL(wp) :: betrag !< |
---|
82 | REAL(wp) :: radius !< |
---|
83 | REAL(wp) :: rc !< |
---|
84 | REAL(wp) :: x !< |
---|
85 | REAL(wp) :: y !< |
---|
86 | REAL(wp) :: z !< |
---|
87 | |
---|
88 | ! |
---|
89 | !-- Defaults: radius rc, strength z, |
---|
90 | !-- position of centre: ic, jc, kc |
---|
91 | rc = 10.0_wp * dx |
---|
92 | ic = ( nx+1 ) / 2 |
---|
93 | jc = ic |
---|
94 | kc = nzt / 2 |
---|
95 | |
---|
96 | ! |
---|
97 | !-- Compute the perturbation. |
---|
98 | DO i = nxl, nxr |
---|
99 | DO j = nys, nyn |
---|
100 | DO k = nzb+1, nzt |
---|
101 | x = ( i - ic ) * dx |
---|
102 | y = ( j - jc ) * dy |
---|
103 | z = ABS( zu(k) - zu(kc) ) |
---|
104 | radius = SQRT( x**2 + y**2 + z**2 ) |
---|
105 | IF ( radius <= rc ) THEN |
---|
106 | betrag = 5.0_wp * EXP( -( radius * 0.001_wp / 2.0_wp )**2 ) |
---|
107 | ELSE |
---|
108 | betrag = 0.0_wp |
---|
109 | ENDIF |
---|
110 | |
---|
111 | pt(k,j,i) = pt(k,j,i) + betrag |
---|
112 | |
---|
113 | ENDDO |
---|
114 | ENDDO |
---|
115 | ENDDO |
---|
116 | |
---|
117 | ! |
---|
118 | !-- Exchange of boundary values for temperature |
---|
119 | CALL exchange_horiz( pt, nbgp ) |
---|
120 | |
---|
121 | |
---|
122 | END SUBROUTINE init_pt_anomaly |
---|