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

Last change on this file since 4642 was 4360, checked in by suehring, 5 years ago

Bugfix in output of time-averaged plant-canopy quanities; Output of plant-canopy data only where tall canopy is defined; land-surface model: fix wrong location strings; tests: update urban test case; all source code files: copyright update

  • Property svn:keywords set to Id
File size: 5.0 KB
RevLine 
[1682]1!> @file init_slope.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!
[4360]17! Copyright 1997-2020 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_slope.f90 4360 2020-01-07 11:25:50Z suehring $
[4182]27! Corrected "Former revisions" section
28!
29! 3655 2019-01-07 16:51:22Z knoop
[3274]30! Modularization of all bulk cloud physics code components
[1321]31!
[4182]32! Revision 1.1  2000/04/27 07:06:24  raasch
33! Initial revision
34!
35!
[1]36! Description:
37! ------------
[1682]38!> Initialization of the temperature field and other variables used in case
39!> of a sloping surface.
40!> @note when a sloping surface is used, only one constant temperature
41!>       gradient is allowed!
[3]42!------------------------------------------------------------------------------!
[1682]43 SUBROUTINE init_slope
44 
[1]45
[1320]46    USE arrays_3d,                                                             &
47        ONLY:  pt, pt_init, pt_slope_ref, zu
48       
[3274]49    USE basic_constants_and_equations_mod,                                     &
[1320]50        ONLY:  pi
51                   
52    USE control_parameters,                                                    &
53        ONLY:  alpha_surface, initializing_actions, pt_slope_offset,           &
54               pt_surface, pt_vertical_gradient, sin_alpha_surface
55       
56    USE grid_variables,                                                        &
57        ONLY:  dx
58       
59    USE indices,                                                               &
60        ONLY:  ngp_2dh, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
61       
62    USE kinds
63
[1]64    USE pegrid
65
[1320]66
[1]67    IMPLICIT NONE
68
[1682]69    INTEGER(iwp) ::  i        !<
70    INTEGER(iwp) ::  j        !<
71    INTEGER(iwp) ::  k        !<
[1320]72   
[1682]73    REAL(wp)     ::  alpha    !<
74    REAL(wp)     ::  height   !<
75    REAL(wp)     ::  pt_value !<
76    REAL(wp)     ::  radius   !<
[1320]77   
[1682]78    REAL(wp), DIMENSION(:), ALLOCATABLE ::  pt_init_local !<
[1]79
80!
81!-- Calculate reference temperature field needed for computing buoyancy
[667]82    ALLOCATE( pt_slope_ref(nzb:nzt+1,nxlg:nxrg) )
[1]83
[667]84    DO  i = nxlg, nxrg
[1]85       DO  k = nzb, nzt+1
86
87!
88!--       Compute height of grid-point relative to lower left corner of
89!--       the total domain.
90!--       First compute the distance between the actual grid point and the
91!--       lower left corner as well as the angle between the line connecting
92!--       these points and the bottom of the model.
93          IF ( k /= nzb )  THEN
94             radius = SQRT( ( i * dx )**2 + zu(k)**2 )
95             height = zu(k)
96          ELSE
97             radius = SQRT( ( i * dx )**2 )
[1353]98             height = 0.0_wp
[1]99          ENDIF
[1353]100          IF ( radius /= 0.0_wp )  THEN
[1]101             alpha = ASIN( height / radius )
102          ELSE
[1353]103             alpha = 0.0_wp
[1]104          ENDIF
105!
106!--       Compute temperatures in the rotated coordinate system
[1322]107          alpha    = alpha + alpha_surface / 180.0_wp * pi
[1]108          pt_value = pt_surface + radius * SIN( alpha ) * &
[1322]109                                  pt_vertical_gradient(1) / 100.0_wp
[1]110          pt_slope_ref(k,i) = pt_value
111       ENDDO               
112    ENDDO
113
114!
115!-- Temperature difference between left and right boundary of the total domain,
116!-- used for the cyclic boundary in x-direction
117    pt_slope_offset = (nx+1) * dx * sin_alpha_surface * &
[1322]118                      pt_vertical_gradient(1) / 100.0_wp
[1]119
120
121!
122!-- Following action must only be executed for initial runs
123    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
124!
125!--    Set initial temperature equal to the reference temperature field
[667]126       DO  j = nysg, nyng
[1]127          pt(:,j,:) = pt_slope_ref
128       ENDDO
129
130!
131!--    Recompute the mean initial temperature profile (mean along x-direction of
132!--    the rotated coordinate system)
133       ALLOCATE( pt_init_local(nzb:nzt+1) )
[1353]134       pt_init_local = 0.0_wp
[1]135       DO  i = nxl, nxr
136          DO  j =  nys, nyn
137             DO  k = nzb, nzt+1
138                pt_init_local(k) = pt_init_local(k) + pt(k,j,i)
139             ENDDO
140          ENDDO
[622]141       ENDDO
[1]142
143#if defined( __parallel )
[622]144       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
145       CALL MPI_ALLREDUCE( pt_init_local, pt_init, nzt+2-nzb, MPI_REAL, &
146                            MPI_SUM, comm2d, ierr )
[1]147#else
[622]148       pt_init = pt_init_local
[1]149#endif
150
[622]151       pt_init = pt_init / ngp_2dh(0)
152       DEALLOCATE( pt_init_local )
[1]153
[622]154    ENDIF
[1]155
156 END SUBROUTINE init_slope
Note: See TracBrowser for help on using the repository browser.