Ignore:
Timestamp:
May 30, 2017 5:47:52 PM (4 years ago)
Author:
suehring
Message:

Adjustments according new topography and surface-modelling concept implemented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/disturb_heatflux.f90

    r2101 r2232  
    2020! Current revisions:
    2121! ------------------
    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.
    2325!
    2426! Former revisions:
     
    6062!> Generate random, normally distributed heatflux values and store them as the
    6163!> near-surface heatflux.
    62 !> On parallel computers, too, this random generator is called at all grid points
    63 !> of the total array in order to guarantee the same random distribution of the
    64 !> total array regardless of the number of processors used during the model run.
    6564!------------------------------------------------------------------------------!
    66  SUBROUTINE disturb_heatflux
     65 SUBROUTINE disturb_heatflux( surf )
    6766 
    6867
    6968    USE arrays_3d,                                                             &
    70         ONLY:  shf, heatflux_input_conversion
     69        ONLY:  heatflux_input_conversion
    7170       
    7271    USE control_parameters,                                                    &
    73         ONLY:  iran, surface_heatflux, wall_heatflux
     72        ONLY:  iran, surface_heatflux, random_generator, wall_heatflux
    7473       
    7574    USE cpulog,                                                                &
     
    7978   
    8079    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
    8288
    8389    IMPLICIT NONE
    8490
    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
    8795   
    8896    REAL(wp) ::  random_gauss  !<
    8997    REAL(wp) ::  randomnumber  !<
     98
     99    TYPE(surf_type) ::  surf   !< surface-type variable
    90100
    91101
     
    93103
    94104!
    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           THEN
    101              IF ( nzb_s_inner(j,i) == 0 )  THEN
    102                 shf(j,i) = randomnumber * surface_heatflux                     &
    103                            * heatflux_input_conversion(nzb)
    104              ELSE
     105!-- Generate random disturbances and store them. Note, if
     106!-- random_generator /= 'random-parallel' it is not guaranteed to obtain 
     107!-- the same random distribution if the number of processors is changed.
     108    IF ( random_generator /= 'random-parallel' )  THEN
     109
     110       DO  m = 1, surf%ns
     111
     112          k = surf%k(m)
     113
     114          randomnumber = random_gauss( iran, 5.0_wp )     
    105115!
    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!--       k-1 is topography top index. If this is 0, set surface heatflux. Over
     117!--       topography surface_heatflux is replaced by wall_heatflux(0).
     118          IF ( k-1 == 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(k-1)
    110124          ENDIF
    111125       ENDDO
    112     ENDDO
     126    ELSE
    113127
     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 )   
    114136!
    115 !-- Exchange lateral boundary conditions for the heatflux array
    116     CALL exchange_horiz_2d( shf )
     137!--       k-1 is topography top index. If this is 0, set surface heatflux. Over
     138!--       topography surface_heatflux is replaced by wall_heatflux(0).
     139          IF ( k-1 == 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(k-1)
     145          ENDIF
     146
     147          CALL random_seed_parallel( get=seq_random_array(:, j, i) )
     148
     149       ENDDO
     150
     151    ENDIF
    117152
    118153    CALL cpu_log( log_point(23), 'disturb_heatflux', 'stop' )
Note: See TracChangeset for help on using the changeset viewer.