[1682] | 1 | !> @file user_init_grid.f90 |
---|
[4498] | 2 | !--------------------------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[4498] | 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 | ! |
---|
[4498] | 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 | ! |
---|
[4498] | 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 | ! |
---|
[4828] | 16 | ! Copyright 1997-2021 Leibniz Universitaet Hannover |
---|
[4498] | 17 | !--------------------------------------------------------------------------------------------------! |
---|
[1036] | 18 | ! |
---|
[4498] | 19 | ! |
---|
[258] | 20 | ! Current revisions: |
---|
[211] | 21 | ! ----------------- |
---|
[1683] | 22 | ! |
---|
[2233] | 23 | ! |
---|
[1321] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: user_init_grid.f90 4828 2021-01-05 11:21:41Z moh.hefny $ |
---|
[4498] | 27 | ! file re-formatted to follow the PALM coding standard |
---|
| 28 | ! |
---|
| 29 | ! |
---|
| 30 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
[4182] | 31 | ! Corrected "Former revisions" section |
---|
[4498] | 32 | ! |
---|
[4182] | 33 | ! 3768 2019-02-27 14:35:58Z raasch |
---|
[3768] | 34 | ! variables commented + statement added to avoid compiler warnings about unused variables |
---|
[4498] | 35 | ! |
---|
[3768] | 36 | ! 3655 2019-01-07 16:51:22Z knoop |
---|
[3065] | 37 | ! dz was replaced by dz(1) |
---|
[1321] | 38 | ! |
---|
[4182] | 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 | ! |
---|
[211] | 43 | ! Description: |
---|
| 44 | ! ------------ |
---|
[1682] | 45 | !> Execution of user-defined grid initializing actions |
---|
[4498] | 46 | !--------------------------------------------------------------------------------------------------! |
---|
[2232] | 47 | SUBROUTINE user_init_grid( topo_3d ) |
---|
[211] | 48 | |
---|
[4498] | 49 | |
---|
[211] | 50 | USE control_parameters |
---|
[4498] | 51 | |
---|
[211] | 52 | USE indices |
---|
[4498] | 53 | |
---|
[1320] | 54 | USE kinds |
---|
[4498] | 55 | |
---|
[211] | 56 | USE user |
---|
| 57 | |
---|
| 58 | IMPLICIT NONE |
---|
| 59 | |
---|
[4498] | 60 | ! INTEGER(iwp) :: k_topo !< topography top index |
---|
| 61 | INTEGER(iwp), DIMENSION(nzb:nzt+1,nysg:nyng,nxlg:nxrg) :: topo_3d !< 3D topography field |
---|
[211] | 62 | |
---|
[3768] | 63 | ! REAL(wp) :: h_topo !< user-defined topography height |
---|
[2232] | 64 | |
---|
[211] | 65 | ! |
---|
[3768] | 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 | ! |
---|
[211] | 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 | |
---|
[2232] | 78 | CASE ( 'flat', 'single_building', 'single_street_canyon', 'tunnel' ) |
---|
[211] | 79 | ! |
---|
| 80 | !-- Not allowed here since these are the standard cases used in init_grid. |
---|
| 81 | |
---|
| 82 | CASE ( 'user_defined_topography_1' ) |
---|
| 83 | ! |
---|
[4498] | 84 | !-- Here the user can define their own topography. |
---|
[217] | 85 | !-- After definition, please remove the following three lines! |
---|
[258] | 86 | message_string = 'topography "' // topography // '" not available yet' |
---|
| 87 | CALL message( 'user_init_grid', 'UI0005', 1, 2, 0, 6, 0 ) |
---|
[2232] | 88 | ! |
---|
[4498] | 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. |
---|
[2232] | 94 | ! DO i = nxlg, nxrg |
---|
[4498] | 95 | ! h_topo = 10.0_wp * dz(1) * ( SIN( 3.14_wp * 0.5_wp) * i * dx / ( 5.0_wp * dy ) )**2 |
---|
| 96 | ! |
---|
[2232] | 97 | ! k_topo = MINLOC( ABS( zw - h_topo ), 1 ) - 1 |
---|
[4498] | 98 | ! |
---|
| 99 | ! topo_3d(k_topo+1:nzt+1,:,i) = IBSET( topo_3d(k_topo+1:nzt+1,:,i), 0 ) |
---|
| 100 | ! ENDDO |
---|
| 101 | ! |
---|
[2696] | 102 | ! CALL exchange_horiz_int( topo_3d, nys, nyn, nxl, nxr, nzt, nbgp ) |
---|
[211] | 103 | |
---|
| 104 | CASE DEFAULT |
---|
| 105 | ! |
---|
[4498] | 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. |
---|
[258] | 108 | message_string = 'unknown topography "' // topography // '"' |
---|
| 109 | CALL message( 'user_init_grid', 'UI0006', 1, 2, 0, 6, 0 ) |
---|
[211] | 110 | |
---|
| 111 | END SELECT |
---|
| 112 | |
---|
| 113 | END SUBROUTINE user_init_grid |
---|
| 114 | |
---|