1 | !> @file user_init_grid.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 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. |
---|
8 | ! |
---|
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. |
---|
12 | ! |
---|
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/>. |
---|
15 | ! |
---|
16 | ! Copyright 1997-2021 Leibniz Universitaet Hannover |
---|
17 | !--------------------------------------------------------------------------------------------------! |
---|
18 | ! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: user_init_grid.f90 4828 2021-01-05 11:21:41Z moh.hefny $ |
---|
27 | ! file re-formatted to follow the PALM coding standard |
---|
28 | ! |
---|
29 | ! |
---|
30 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
31 | ! Corrected "Former revisions" section |
---|
32 | ! |
---|
33 | ! 3768 2019-02-27 14:35:58Z raasch |
---|
34 | ! variables commented + statement added to avoid compiler warnings about unused variables |
---|
35 | ! |
---|
36 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
37 | ! dz was replaced by dz(1) |
---|
38 | ! |
---|
39 | ! 217 2008-12-09 18:00:48Z letzel |
---|
40 | ! +topography_grid_convention |
---|
41 | ! Former file user_interface.f90 split into one file per subroutine |
---|
42 | ! |
---|
43 | ! Description: |
---|
44 | ! ------------ |
---|
45 | !> Execution of user-defined grid initializing actions |
---|
46 | !--------------------------------------------------------------------------------------------------! |
---|
47 | SUBROUTINE user_init_grid( topo_3d ) |
---|
48 | |
---|
49 | |
---|
50 | USE control_parameters |
---|
51 | |
---|
52 | USE indices |
---|
53 | |
---|
54 | USE kinds |
---|
55 | |
---|
56 | USE user |
---|
57 | |
---|
58 | IMPLICIT NONE |
---|
59 | |
---|
60 | ! INTEGER(iwp) :: k_topo !< topography top index |
---|
61 | INTEGER(iwp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: topo_3d !< 3D topography field |
---|
62 | |
---|
63 | ! REAL(wp) :: h_topo !< user-defined topography height |
---|
64 | |
---|
65 | ! |
---|
66 | !-- Next line is to avoid compiler warning about unused variables. Please remove. |
---|
67 | IF ( topo_3d(nzb,nysg,nxlg) == 0 ) CONTINUE |
---|
68 | |
---|
69 | |
---|
70 | ! |
---|
71 | !-- Here the user-defined grid initializing actions follow: |
---|
72 | |
---|
73 | ! |
---|
74 | !-- Set the index array nzb_local for non-flat topography. |
---|
75 | !-- Here consistency checks concerning domain size and periodicity are necessary |
---|
76 | SELECT CASE ( TRIM( topography ) ) |
---|
77 | |
---|
78 | CASE ( 'flat', 'single_building', 'single_street_canyon', 'tunnel' ) |
---|
79 | ! |
---|
80 | !-- Not allowed here since these are the standard cases used in init_grid. |
---|
81 | |
---|
82 | CASE ( 'user_defined_topography_1' ) |
---|
83 | ! |
---|
84 | !-- Here the user can define their own topography. |
---|
85 | !-- After definition, please remove the following three lines! |
---|
86 | message_string = 'topography "' // topography // '" not available yet' |
---|
87 | CALL message( 'user_init_grid', 'UI0005', 1, 2, 0, 6, 0 ) |
---|
88 | ! |
---|
89 | !-- The user is allowed to set surface-mounted as well as non-surface mounted topography |
---|
90 | !-- (e.g. overhanging structures). For both, use 3D array topo_3d and set bit 0. The |
---|
91 | !-- convention is: bit is zero inside topography, bit is 1 for atmospheric grid point. |
---|
92 | !-- The following example shows how to prescribe sine-like topography along x-direction with |
---|
93 | !-- amplitude of 10 * dz(1) and wavelength 10 * dy. |
---|
94 | ! DO i = nxlg, nxrg |
---|
95 | ! h_topo = 10.0_wp * dz(1) * ( SIN( 3.14_wp * 0.5_wp) * i * dx / ( 5.0_wp * dy ) )**2 |
---|
96 | ! |
---|
97 | ! k_topo = MINLOC( ABS( zw - h_topo ), 1 ) - 1 |
---|
98 | ! |
---|
99 | ! topo_3d(k_topo+1:nzt+1,:,i) = IBSET( topo_3d(k_topo+1:nzt+1,:,i), 0 ) |
---|
100 | ! ENDDO |
---|
101 | ! |
---|
102 | ! CALL exchange_horiz_int( topo_3d, nys, nyn, nxl, nxr, nzt, nbgp ) |
---|
103 | |
---|
104 | CASE DEFAULT |
---|
105 | ! |
---|
106 | !-- The DEFAULT case is reached if the parameter topography contains a wrong character string |
---|
107 | !-- that is neither recognized in init_grid nor here in user_init_grid. |
---|
108 | message_string = 'unknown topography "' // topography // '"' |
---|
109 | CALL message( 'user_init_grid', 'UI0006', 1, 2, 0, 6, 0 ) |
---|
110 | |
---|
111 | END SELECT |
---|
112 | |
---|
113 | END SUBROUTINE user_init_grid |
---|
114 | |
---|