Changeset 2232 for palm/trunk/SOURCE/disturb_heatflux.f90
 Timestamp:
 May 30, 2017 5:47:52 PM (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

palm/trunk/SOURCE/disturb_heatflux.f90
r2101 r2232 20 20 ! Current revisions: 21 21 !  22 ! 22 ! Adjustment according new surface data type. 23 ! Implemented parallel random number generator to obtain always the same 24 ! random number distribution regardless of the processor distribution. 23 25 ! 24 26 ! Former revisions: … … 60 62 !> Generate random, normally distributed heatflux values and store them as the 61 63 !> nearsurface heatflux. 62 !> On parallel computers, too, this random generator is called at all grid points63 !> of the total array in order to guarantee the same random distribution of the64 !> total array regardless of the number of processors used during the model run.65 64 !! 66 SUBROUTINE disturb_heatflux 65 SUBROUTINE disturb_heatflux( surf ) 67 66 68 67 69 68 USE arrays_3d, & 70 ONLY: shf,heatflux_input_conversion69 ONLY: heatflux_input_conversion 71 70 72 71 USE control_parameters, & 73 ONLY: iran, surface_heatflux, wall_heatflux72 ONLY: iran, surface_heatflux, random_generator, wall_heatflux 74 73 75 74 USE cpulog, & … … 79 78 80 79 USE indices, & 81 ONLY: nx, nxl, nxr, ny, nyn, nys, nzb, nzb_s_inner 80 ONLY: nzb 81 82 USE random_generator_parallel, & 83 ONLY: random_number_parallel, random_seed_parallel, random_dummy, & 84 id_random_array, seq_random_array 85 86 USE surface_mod, & 87 ONLY: surf_type 82 88 83 89 IMPLICIT NONE 84 90 85 INTEGER(iwp) :: j !< 86 INTEGER(iwp) :: i !< 91 INTEGER(iwp) :: i !< grid index, x direction 92 INTEGER(iwp) :: j !< grid index, y direction 93 INTEGER(iwp) :: k !< grid index, z direction 94 INTEGER(iwp) :: m !< loop variables over surface elements 87 95 88 96 REAL(wp) :: random_gauss !< 89 97 REAL(wp) :: randomnumber !< 98 99 TYPE(surf_type) :: surf !< surfacetype variable 90 100 91 101 … … 93 103 94 104 ! 95 ! Generate random disturbances and store them 96 DO i = 0, nx 97 DO j = 0, ny 98 randomnumber = random_gauss( iran, 5.0_wp )99 IF ( nxl <= i .AND. nxr >= i .AND. nys <= j .AND. nyn >= j ) & 100 THEN101 IF ( nzb_s_inner(j,i) == 0 ) THEN 102 shf(j,i) = randomnumber * surface_heatflux &103 * heatflux_input_conversion(nzb) 104 ELSE105 ! Generate random disturbances and store them. Note, if 106 ! random_generator /= 'randomparallel' it is not guaranteed to obtain 107 ! the same random distribution if the number of processors is changed. 108 IF ( random_generator /= 'randomparallel' ) THEN 109 110 DO m = 1, surf%ns 111 112 k = surf%k(m) 113 114 randomnumber = random_gauss( iran, 5.0_wp ) 105 115 ! 106 ! Over topography surface_heatflux is replaced by wall_heatflux(0) 107 shf(j,i) = randomnumber * wall_heatflux(0) & 108 * heatflux_input_conversion(nzb_s_inner(j,i)) 109 ENDIF 116 ! k1 is topography top index. If this is 0, set surface heatflux. Over 117 ! topography surface_heatflux is replaced by wall_heatflux(0). 118 IF ( k1 == 0 ) THEN 119 surf%shf(m) = randomnumber * surface_heatflux & 120 * heatflux_input_conversion(nzb) 121 ELSE 122 surf%shf(m) = randomnumber * wall_heatflux(0) & 123 * heatflux_input_conversion(k1) 110 124 ENDIF 111 125 ENDDO 112 E NDDO126 ELSE 113 127 128 DO m = 1, surf%ns 129 130 i = surf%i(m) 131 j = surf%j(m) 132 k = surf%k(m) 133 134 CALL random_seed_parallel( put=seq_random_array(:, j, i) ) 135 CALL random_number_parallel( random_dummy ) 114 136 ! 115 ! Exchange lateral boundary conditions for the heatflux array 116 CALL exchange_horiz_2d( shf ) 137 ! k1 is topography top index. If this is 0, set surface heatflux. Over 138 ! topography surface_heatflux is replaced by wall_heatflux(0). 139 IF ( k1 == 0 ) THEN 140 surf%shf(m) = ( random_dummy  0.5_wp ) * surface_heatflux & 141 * heatflux_input_conversion(nzb) 142 ELSE 143 surf%shf(m) = ( random_dummy  0.5_wp ) * wall_heatflux(0) & 144 * heatflux_input_conversion(k1) 145 ENDIF 146 147 CALL random_seed_parallel( get=seq_random_array(:, j, i) ) 148 149 ENDDO 150 151 ENDIF 117 152 118 153 CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' )
Note: See TracChangeset
for help on using the changeset viewer.