[1682] | 1 | !> @file disturb_heatflux.f90 |
---|
[1036] | 2 | !--------------------------------------------------------------------------------! |
---|
| 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
| 5 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 6 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 7 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 8 | ! |
---|
| 9 | ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
| 10 | ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
| 11 | ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
| 12 | ! |
---|
| 13 | ! You should have received a copy of the GNU General Public License along with |
---|
| 14 | ! PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
| 15 | ! |
---|
[1310] | 16 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1320] | 17 | !------------------------------------------------------------------------------! |
---|
[1036] | 18 | ! |
---|
[484] | 19 | ! Current revisions: |
---|
[1322] | 20 | ! ------------------ |
---|
[1354] | 21 | ! |
---|
[1683] | 22 | ! |
---|
[1321] | 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: disturb_heatflux.f90 1683 2015-10-07 23:57:51Z raasch $ |
---|
| 26 | ! |
---|
[1683] | 27 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 28 | ! Code annotations made doxygen readable |
---|
| 29 | ! |
---|
[1354] | 30 | ! 1353 2014-04-08 15:21:23Z heinze |
---|
| 31 | ! REAL constants provided with KIND-attribute |
---|
| 32 | ! |
---|
[1323] | 33 | ! 1322 2014-03-20 16:38:49Z raasch |
---|
| 34 | ! REAL constants defined as wp-kind |
---|
| 35 | ! |
---|
[1321] | 36 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 37 | ! ONLY-attribute added to USE-statements, |
---|
| 38 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 39 | ! kinds are defined in new module kinds, |
---|
| 40 | ! revision history before 2012 removed, |
---|
| 41 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 42 | ! all variable declaration statements |
---|
[1] | 43 | ! |
---|
[1037] | 44 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 45 | ! code put under GPL (PALM 3.9) |
---|
| 46 | ! |
---|
[1] | 47 | ! Revision 1.1 1998/03/25 20:03:47 raasch |
---|
| 48 | ! Initial revision |
---|
| 49 | ! |
---|
| 50 | ! |
---|
| 51 | ! Description: |
---|
| 52 | ! ------------ |
---|
[1682] | 53 | !> Generate random, normally distributed heatflux values and store them as the |
---|
| 54 | !> near-surface heatflux. |
---|
| 55 | !> On parallel computers, too, this random generator is called at all grid points |
---|
| 56 | !> of the total array in order to guarantee the same random distribution of the |
---|
| 57 | !> total array regardless of the number of processors used during the model run. |
---|
[1] | 58 | !------------------------------------------------------------------------------! |
---|
[1682] | 59 | SUBROUTINE disturb_heatflux |
---|
| 60 | |
---|
[1] | 61 | |
---|
[1320] | 62 | USE arrays_3d, & |
---|
| 63 | ONLY: shf |
---|
| 64 | |
---|
| 65 | USE control_parameters, & |
---|
| 66 | ONLY: iran, surface_heatflux, wall_heatflux |
---|
| 67 | |
---|
| 68 | USE cpulog, & |
---|
| 69 | ONLY: cpu_log, log_point |
---|
| 70 | |
---|
| 71 | USE kinds |
---|
| 72 | |
---|
| 73 | USE indices, & |
---|
| 74 | ONLY: nx, nxl, nxr, ny, nyn, nys, nzb_s_inner |
---|
[1] | 75 | |
---|
| 76 | IMPLICIT NONE |
---|
| 77 | |
---|
[1682] | 78 | INTEGER(iwp) :: j !< |
---|
| 79 | INTEGER(iwp) :: i !< |
---|
[1320] | 80 | |
---|
[1682] | 81 | REAL(wp) :: random_gauss !< |
---|
| 82 | REAL(wp) :: randomnumber !< |
---|
[1] | 83 | |
---|
| 84 | |
---|
| 85 | CALL cpu_log( log_point(23), 'disturb_heatflux', 'start' ) |
---|
| 86 | |
---|
| 87 | ! |
---|
| 88 | !-- Generate random disturbances and store them |
---|
| 89 | DO i = 0, nx |
---|
| 90 | DO j = 0, ny |
---|
[1322] | 91 | randomnumber = random_gauss( iran, 5.0_wp ) |
---|
[1320] | 92 | IF ( nxl <= i .AND. nxr >= i .AND. nys <= j .AND. nyn >= j ) & |
---|
[1] | 93 | THEN |
---|
| 94 | IF ( nzb_s_inner(j,i) == 0 ) THEN |
---|
| 95 | shf(j,i) = randomnumber * surface_heatflux |
---|
[555] | 96 | ELSE |
---|
[1] | 97 | ! |
---|
| 98 | !-- Over topography surface_heatflux is replaced by wall_heatflux(0) |
---|
| 99 | shf(j,i) = randomnumber * wall_heatflux(0) |
---|
| 100 | ENDIF |
---|
| 101 | ENDIF |
---|
| 102 | ENDDO |
---|
| 103 | ENDDO |
---|
| 104 | |
---|
| 105 | ! |
---|
| 106 | !-- Exchange lateral boundary conditions for the heatflux array |
---|
| 107 | CALL exchange_horiz_2d( shf ) |
---|
| 108 | |
---|
| 109 | CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' ) |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | END SUBROUTINE disturb_heatflux |
---|