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