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

Last change on this file since 4798 was 4648, checked in by raasch, 4 years ago

files re-formatted to follow the PALM coding standard

  • Property svn:keywords set to Id
File size: 5.1 KB
RevLine 
[1682]1!> @file init_slope.f90
[4648]2!--------------------------------------------------------------------------------------------------!
[2696]3! This file is part of the PALM model system.
[1036]4!
[4648]5! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
6! Public License as published by the Free Software Foundation, either version 3 of the License, or
7! (at your option) any later version.
[1036]8!
[4648]9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11! Public License for more details.
[1036]12!
[4648]13! You should have received a copy of the GNU General Public License along with PALM. If not, see
14! <http://www.gnu.org/licenses/>.
[1036]15!
[4360]16! Copyright 1997-2020 Leibniz Universitaet Hannover
[4648]17!--------------------------------------------------------------------------------------------------!
[1036]18!
[484]19! Current revisions:
[1]20! -----------------
[4648]21!
22!
[1321]23! Former revisions:
24! -----------------
25! $Id: init_slope.f90 4648 2020-08-25 07:52:08Z schwenkel $
[4648]26! file re-formatted to follow the PALM coding standard
27!
28! 4360 2020-01-07 11:25:50Z suehring
[4182]29! Corrected "Former revisions" section
[4648]30!
[4182]31! 3655 2019-01-07 16:51:22Z knoop
[3274]32! Modularization of all bulk cloud physics code components
[1321]33!
[4182]34! Revision 1.1  2000/04/27 07:06:24  raasch
35! Initial revision
36!
37!
[1]38! Description:
39! ------------
[4648]40!> Initialization of the temperature field and other variables used in case of a sloping surface.
[1682]41!> @note when a sloping surface is used, only one constant temperature
42!>       gradient is allowed!
[4648]43!--------------------------------------------------------------------------------------------------!
[1682]44 SUBROUTINE init_slope
[1]45
[4648]46
47    USE arrays_3d,                                                                                 &
[1320]48        ONLY:  pt, pt_init, pt_slope_ref, zu
[4648]49
50    USE basic_constants_and_equations_mod,                                                         &
[1320]51        ONLY:  pi
[4648]52
53    USE control_parameters,                                                                        &
54        ONLY:  alpha_surface, initializing_actions, pt_slope_offset, pt_surface,                   &
55               pt_vertical_gradient, sin_alpha_surface
56
57    USE grid_variables,                                                                            &
[1320]58        ONLY:  dx
[4648]59
60    USE indices,                                                                                   &
[1320]61        ONLY:  ngp_2dh, nx, nxl, nxlg, nxr, nxrg, nyn, nyng, nys, nysg, nzb, nzt
[4648]62
[1320]63    USE kinds
64
[1]65    USE pegrid
66
[1320]67
[1]68    IMPLICIT NONE
69
[1682]70    INTEGER(iwp) ::  i        !<
71    INTEGER(iwp) ::  j        !<
72    INTEGER(iwp) ::  k        !<
[4648]73
[1682]74    REAL(wp)     ::  alpha    !<
75    REAL(wp)     ::  height   !<
76    REAL(wp)     ::  pt_value !<
77    REAL(wp)     ::  radius   !<
[4648]78
[1682]79    REAL(wp), DIMENSION(:), ALLOCATABLE ::  pt_init_local !<
[1]80
81!
82!-- Calculate reference temperature field needed for computing buoyancy
[667]83    ALLOCATE( pt_slope_ref(nzb:nzt+1,nxlg:nxrg) )
[1]84
[667]85    DO  i = nxlg, nxrg
[1]86       DO  k = nzb, nzt+1
87
88!
[4648]89!--       Compute height of grid-point relative to lower left corner of the total domain.
90!--       First compute the distance between the actual grid point and the lower left corner as well
91!--       as the angle between the line connecting these points and the bottom of the model.
[1]92          IF ( k /= nzb )  THEN
93             radius = SQRT( ( i * dx )**2 + zu(k)**2 )
94             height = zu(k)
95          ELSE
96             radius = SQRT( ( i * dx )**2 )
[1353]97             height = 0.0_wp
[1]98          ENDIF
[1353]99          IF ( radius /= 0.0_wp )  THEN
[1]100             alpha = ASIN( height / radius )
101          ELSE
[1353]102             alpha = 0.0_wp
[1]103          ENDIF
104!
105!--       Compute temperatures in the rotated coordinate system
[1322]106          alpha    = alpha + alpha_surface / 180.0_wp * pi
[4648]107          pt_value = pt_surface + radius * SIN( alpha ) * pt_vertical_gradient(1) / 100.0_wp
[1]108          pt_slope_ref(k,i) = pt_value
[4648]109       ENDDO
[1]110    ENDDO
111
112!
[4648]113!-- Temperature difference between left and right boundary of the total domain, used for the cyclic
114!-- boundary in x-direction
115    pt_slope_offset = (nx+1) * dx * sin_alpha_surface * pt_vertical_gradient(1) / 100.0_wp
[1]116
117
118!
119!-- Following action must only be executed for initial runs
120    IF ( TRIM( initializing_actions ) /= 'read_restart_data' )  THEN
121!
122!--    Set initial temperature equal to the reference temperature field
[667]123       DO  j = nysg, nyng
[1]124          pt(:,j,:) = pt_slope_ref
125       ENDDO
126
127!
[4648]128!--    Recompute the mean initial temperature profile (mean along x-direction of the rotated
129!--    coordinate system)
[1]130       ALLOCATE( pt_init_local(nzb:nzt+1) )
[1353]131       pt_init_local = 0.0_wp
[1]132       DO  i = nxl, nxr
133          DO  j =  nys, nyn
134             DO  k = nzb, nzt+1
135                pt_init_local(k) = pt_init_local(k) + pt(k,j,i)
136             ENDDO
137          ENDDO
[622]138       ENDDO
[1]139
140#if defined( __parallel )
[622]141       IF ( collective_wait )  CALL MPI_BARRIER( comm2d, ierr )
[4648]142       CALL MPI_ALLREDUCE( pt_init_local, pt_init, nzt+2-nzb, MPI_REAL, MPI_SUM, comm2d, ierr )
[1]143#else
[622]144       pt_init = pt_init_local
[1]145#endif
146
[622]147       pt_init = pt_init / ngp_2dh(0)
148       DEALLOCATE( pt_init_local )
[1]149
[622]150    ENDIF
[1]151
152 END SUBROUTINE init_slope
Note: See TracBrowser for help on using the repository browser.