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