source: palm/trunk/SOURCE/init_slope.f90 @ 2716

Last change on this file since 2716 was 2716, checked in by kanani, 6 years ago

Correction of "Former revisions" section

  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1!> @file init_slope.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-2017 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! -----------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: init_slope.f90 2716 2017-12-29 16:35:59Z kanani $
27! Corrected "Former revisions" section
28!
29! 2696 2017-12-14 17:12:51Z kanani
30! Change in file header (GPL part)
31!
32! 2101 2017-01-05 16:42:31Z suehring
33!
34! 2000 2016-08-20 18:09:15Z knoop
35! Forced header and separation lines into 80 columns
36!
37! 1682 2015-10-07 23:56:08Z knoop
38! Code annotations made doxygen readable
39!
40! 1353 2014-04-08 15:21:23Z heinze
41! REAL constants provided with KIND-attribute
42!
43! 1322 2014-03-20 16:38:49Z raasch
44! REAL constants defined as wp_kind
45!
46! 1320 2014-03-20 08:40:49Z raasch
47! ONLY-attribute added to USE-statements,
48! kind-parameters added to all INTEGER and REAL declaration statements,
49! kinds are defined in new module kinds,
50! revision history before 2012 removed,
51! comment fields (!:) to be used for variable explanations added to
52! all variable declaration statements
53!
54! 1036 2012-10-22 13:43:42Z raasch
55! code put under GPL (PALM 3.9)
56!
57! Revision 1.1  2000/04/27 07:06:24  raasch
58! Initial revision
59!
60!
61! Description:
62! ------------
63!> Initialization of the temperature field and other variables used in case
64!> of a sloping surface.
65!> @note when a sloping surface is used, only one constant temperature
66!>       gradient is allowed!
67!------------------------------------------------------------------------------!
68 SUBROUTINE init_slope
69 
70
71    USE arrays_3d,                                                             &
72        ONLY:  pt, pt_init, pt_slope_ref, zu
73       
74    USE constants,                                                             &
75        ONLY:  pi
76                   
77    USE control_parameters,                                                    &
78        ONLY:  alpha_surface, initializing_actions, pt_slope_offset,           &
79               pt_surface, pt_vertical_gradient, sin_alpha_surface
80       
81    USE grid_variables,                                                        &
82        ONLY:  dx
83       
84    USE indices,                                                               &
85        ONLY:  ngp_2dh, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
86       
87    USE kinds
88
89    USE pegrid
90
91
92    IMPLICIT NONE
93
94    INTEGER(iwp) ::  i        !<
95    INTEGER(iwp) ::  j        !<
96    INTEGER(iwp) ::  k        !<
97   
98    REAL(wp)     ::  alpha    !<
99    REAL(wp)     ::  height   !<
100    REAL(wp)     ::  pt_value !<
101    REAL(wp)     ::  radius   !<
102   
103    REAL(wp), DIMENSION(:), ALLOCATABLE ::  pt_init_local !<
104
105!
106!-- Calculate reference temperature field needed for computing buoyancy
107    ALLOCATE( pt_slope_ref(nzb:nzt+1,nxlg:nxrg) )
108
109    DO  i = nxlg, nxrg
110       DO  k = nzb, nzt+1
111
112!
113!--       Compute height of grid-point relative to lower left corner of
114!--       the total domain.
115!--       First compute the distance between the actual grid point and the
116!--       lower left corner as well as the angle between the line connecting
117!--       these points and the bottom of the model.
118          IF ( k /= nzb )  THEN
119             radius = SQRT( ( i * dx )**2 + zu(k)**2 )
120             height = zu(k)
121          ELSE
122             radius = SQRT( ( i * dx )**2 )
123             height = 0.0_wp
124          ENDIF
125          IF ( radius /= 0.0_wp )  THEN
126             alpha = ASIN( height / radius )
127          ELSE
128             alpha = 0.0_wp
129          ENDIF
130!
131!--       Compute temperatures in the rotated coordinate system
132          alpha    = alpha + alpha_surface / 180.0_wp * pi
133          pt_value = pt_surface + radius * SIN( alpha ) * &
134                                  pt_vertical_gradient(1) / 100.0_wp
135          pt_slope_ref(k,i) = pt_value
136       ENDDO               
137    ENDDO
138
139!
140!-- Temperature difference between left and right boundary of the total domain,
141!-- used for the cyclic boundary in x-direction
142    pt_slope_offset = (nx+1) * dx * sin_alpha_surface * &
143                      pt_vertical_gradient(1) / 100.0_wp
144
145
146!
147!-- Following action must only be executed for initial runs
148    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
149!
150!--    Set initial temperature equal to the reference temperature field
151       DO  j = nysg, nyng
152          pt(:,j,:) = pt_slope_ref
153       ENDDO
154
155!
156!--    Recompute the mean initial temperature profile (mean along x-direction of
157!--    the rotated coordinate system)
158       ALLOCATE( pt_init_local(nzb:nzt+1) )
159       pt_init_local = 0.0_wp
160       DO  i = nxl, nxr
161          DO  j =  nys, nyn
162             DO  k = nzb, nzt+1
163                pt_init_local(k) = pt_init_local(k) + pt(k,j,i)
164             ENDDO
165          ENDDO
166       ENDDO
167
168#if defined( __parallel )
169       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
170       CALL MPI_ALLREDUCE( pt_init_local, pt_init, nzt+2-nzb, MPI_REAL, &
171                            MPI_SUM, comm2d, ierr )
172#else
173       pt_init = pt_init_local
174#endif
175
176       pt_init = pt_init / ngp_2dh(0)
177       DEALLOCATE( pt_init_local )
178
179    ENDIF
180
181 END SUBROUTINE init_slope
Note: See TracBrowser for help on using the repository browser.