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-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ----------------- |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: user_init_grid.f90 2718 2018-01-02 08:49:38Z schwenkel $ |
---|
27 | ! Corrected "Former revisions" section |
---|
28 | ! |
---|
29 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
30 | ! Change in file header (GPL part) |
---|
31 | ! Extended argument list (MS) |
---|
32 | ! |
---|
33 | ! 2233 2017-05-30 18:08:54Z suehring |
---|
34 | ! |
---|
35 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
36 | ! +Generic tunnel added |
---|
37 | ! +Example of setting user-defined topography |
---|
38 | ! |
---|
39 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
40 | ! Forced header and separation lines into 80 columns |
---|
41 | ! |
---|
42 | ! 1968 2016-07-18 12:01:49Z suehring |
---|
43 | ! Change dimensions for nzb_local, which do not longer need to be set on |
---|
44 | ! multigrid ghost points. |
---|
45 | ! |
---|
46 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
47 | ! Code annotations made doxygen readable |
---|
48 | ! |
---|
49 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
50 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
51 | ! kinds are defined in new module kinds, |
---|
52 | ! old module precision_kind is removed, |
---|
53 | ! revision history before 2012 removed, |
---|
54 | ! comment fields (!:) to be used for variable explanations added to |
---|
55 | ! all variable declaration statements |
---|
56 | ! |
---|
57 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
58 | ! code put under GPL (PALM 3.9) |
---|
59 | ! |
---|
60 | ! 217 2008-12-09 18:00:48Z letzel |
---|
61 | ! +topography_grid_convention |
---|
62 | ! Former file user_interface.f90 split into one file per subroutine |
---|
63 | ! |
---|
64 | ! Description: |
---|
65 | ! ------------ |
---|
66 | !> Execution of user-defined grid initializing actions |
---|
67 | !------------------------------------------------------------------------------! |
---|
68 | SUBROUTINE user_init_grid( topo_3d ) |
---|
69 | |
---|
70 | |
---|
71 | USE control_parameters |
---|
72 | |
---|
73 | USE indices |
---|
74 | |
---|
75 | USE kinds |
---|
76 | |
---|
77 | USE user |
---|
78 | |
---|
79 | IMPLICIT NONE |
---|
80 | |
---|
81 | INTEGER(iwp) :: k_topo !< topography top index |
---|
82 | INTEGER(iwp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: topo_3d !< 3D topography field |
---|
83 | |
---|
84 | REAL(wp) :: h_topo !< user-defined topography height |
---|
85 | |
---|
86 | ! |
---|
87 | !-- Here the user-defined grid initializing actions follow: |
---|
88 | |
---|
89 | ! |
---|
90 | !-- Set the index array nzb_local for non-flat topography. |
---|
91 | !-- Here consistency checks concerning domain size and periodicity are necessary |
---|
92 | SELECT CASE ( TRIM( topography ) ) |
---|
93 | |
---|
94 | CASE ( 'flat', 'single_building', 'single_street_canyon', 'tunnel' ) |
---|
95 | ! |
---|
96 | !-- Not allowed here since these are the standard cases used in init_grid. |
---|
97 | |
---|
98 | CASE ( 'user_defined_topography_1' ) |
---|
99 | ! |
---|
100 | !-- Here the user can define his own topography. |
---|
101 | !-- After definition, please remove the following three lines! |
---|
102 | message_string = 'topography "' // topography // '" not available yet' |
---|
103 | CALL message( 'user_init_grid', 'UI0005', 1, 2, 0, 6, 0 ) |
---|
104 | ! |
---|
105 | !-- The user is allowed to set surface-mounted as well as non-surface |
---|
106 | !-- mounted topography (e.g. overhanging structures). For both, use |
---|
107 | !-- 3D array topo_3d and set bit 0. The convention is: bit is zero inside |
---|
108 | !-- topography, bit is 1 for atmospheric grid point. |
---|
109 | !-- The following example shows how to prescribe sine-like topography |
---|
110 | !-- along x-direction with amplitude of 10 * dz and wavelength 10 * dy. |
---|
111 | ! DO i = nxlg, nxrg |
---|
112 | ! h_topo = 10.0_wp * dz * (SIN(3.14_wp*0.5_wp)*i*dx / ( 5.0_wp * dy ) )**2 |
---|
113 | ! |
---|
114 | ! k_topo = MINLOC( ABS( zw - h_topo ), 1 ) - 1 |
---|
115 | ! |
---|
116 | ! topo_3d(k_topo+1:nzt+1,:,i) = & |
---|
117 | ! IBSET( topo_3d(k_topo+1:nzt+1,:,i), 0 ) |
---|
118 | ! ENDDO |
---|
119 | ! |
---|
120 | ! CALL exchange_horiz_int( topo_3d, nys, nyn, nxl, nxr, nzt, nbgp ) |
---|
121 | |
---|
122 | CASE DEFAULT |
---|
123 | ! |
---|
124 | !-- The DEFAULT case is reached if the parameter topography contains a |
---|
125 | !-- wrong character string that is neither recognized in init_grid nor |
---|
126 | !-- here in user_init_grid. |
---|
127 | message_string = 'unknown topography "' // topography // '"' |
---|
128 | CALL message( 'user_init_grid', 'UI0006', 1, 2, 0, 6, 0 ) |
---|
129 | |
---|
130 | END SELECT |
---|
131 | |
---|
132 | |
---|
133 | |
---|
134 | |
---|
135 | END SUBROUTINE user_init_grid |
---|
136 | |
---|