Changeset 3747 for palm/trunk


Ignore:
Timestamp:
Feb 16, 2019 3:15:23 PM (5 years ago)
Author:
gronemeier
Message:

bugfix: set user-defined statistic regions within new routine user_init_arrays and initialize rmask before this routine is called. This ensures that the correct number of grid points is calculated for each statistic region within init_3d_model.
(init_3d_model, module_interface, user_module)
bugfix: update former revisions section (modules, parin)

Location:
palm/trunk/SOURCE
Files:
5 edited

Legend:

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

    r3711 r3747  
    2525! -----------------
    2626! $Id$
     27! Move initialization of rmask before initializing user_init_arrays
     28!
     29! 3711 2019-01-31 13:44:26Z knoop
    2730! Introduced module_interface_init_checks for post-init checks in modules
    2831!
     
    761764       ALLOCATE( pt_2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    762765    ENDIF
    763 
     766!
     767!-- Pre-set masks for regional statistics. Default is the total model domain.
     768!-- Ghost points are excluded because counting values at the ghost boundaries
     769!-- would bias the statistics
     770    rmask = 1.0_wp
     771    rmask(:,nxlg:nxl-1,:) = 0.0_wp;  rmask(:,nxr+1:nxrg,:) = 0.0_wp
     772    rmask(nysg:nys-1,:,:) = 0.0_wp;  rmask(nyn+1:nyng,:,:) = 0.0_wp
    764773!
    765774!-- Following array is required for perturbation pressure within the iterative
     
    20212030
    20222031!
    2023 !-- Before initializing further modules, compute total sum of active mask
    2024 !-- grid points and the mean surface level height for each statistic region.
     2032!-- Compute total sum of grid points and the mean surface level height for each
     2033!-- statistic region. These are mainly used for horizontal averaging of
     2034!-- turbulence statistics.
    20252035!-- ngp_2dh: number of grid points of a horizontal cross section through the
    2026 !--          total domain
    2027 !-- ngp_3d:  number of grid points of the total domain
     2036!--          respective statistic region
     2037!-- ngp_3d:  number of grid points of the respective statistic region
    20282038    ngp_2dh_outer_l   = 0
    20292039    ngp_2dh_outer     = 0
     
    20392049    mean_surface_level_height   = 0.0_wp
    20402050    mean_surface_level_height_l = 0.0_wp
    2041 !
    2042 !-- Pre-set masks for regional statistics. Default is the total model domain.
    2043 !-- Ghost points are excluded because counting values at the ghost boundaries
    2044 !-- would bias the statistics
    2045     rmask = 1.0_wp
    2046     rmask(:,nxlg:nxl-1,:) = 0.0_wp;  rmask(:,nxr+1:nxrg,:) = 0.0_wp
    2047     rmask(nysg:nys-1,:,:) = 0.0_wp;  rmask(nyn+1:nyng,:,:) = 0.0_wp
    20482051!
    20492052!-- To do: New concept for these non-topography grid points!
     
    21032106       ENDDO
    21042107    ENDDO
    2105 !
    2106 !-- Initialize arrays encompassing number of grid-points in inner and outer
    2107 !-- domains, statistic regions, etc. Mainly used for horizontal averaging
    2108 !-- of turbulence statistics. Please note, user_init must be called before
    2109 !-- doing this.   
     2108
    21102109    sr = statistic_regions + 1
    21112110#if defined( __parallel )
  • palm/trunk/SOURCE/module_interface.f90

    r3745 r3747  
    2525! -----------------
    2626! $Id$
     27! Call user_init_arrays
     28!
     29! 3745 2019-02-15 18:57:56Z suehring
    2730! Add indoor model
    2831!
     
    306309              user_check_data_output,                                          &
    307310              user_init,                                                       &
     311              user_init_arrays,                                                &
    308312              user_header,                                                     &
    309313              user_actions,                                                    &
     
    749753   IF ( surface_output      )  CALL surface_data_output_init_arrays
    750754   IF ( wind_turbine        )  CALL wtm_init_arrays
     755   IF ( user_module_enabled )  CALL user_init_arrays
    751756
    752757
  • palm/trunk/SOURCE/modules.f90

    r3746 r3747  
    2020! Current revisions:
    2121! ------------------
    22 ! Initialized parameter region
     22!
    2323!
    2424! Former revisions:
    2525! -----------------
    2626! $Id$
     27! Initialized parameter region
     28!
     29! 3746 2019-02-16 12:41:27Z gronemeier
    2730! Removed most_method
    2831!
  • palm/trunk/SOURCE/parin.f90

    r3746 r3747  
    2020! Current revisions:
    2121! -----------------
    22 ! removed setting of parameter region
     22!
    2323!
    2424! Former revisions:
    2525! -----------------
    2626! $Id$
     27! removed setting of parameter region
     28!
     29! 3746 2019-02-16 12:41:27Z gronemeier
    2730! Removed most_method
    2831!
  • palm/trunk/SOURCE/user_module.f90

    r3703 r3747  
    2525! -----------------
    2626! $Id$
     27! Add routine user_init_arrays
     28!
     29! 3703 2019-01-29 16:43:53Z knoop
    2730! An example for a user defined global variable has been added (Giersch)
    2831!
     
    120123       user_define_netcdf_grid, &
    121124       user_init, &
     125       user_init_arrays, &
    122126       user_header, &
    123127       user_actions, &
     
    160164       MODULE PROCEDURE user_define_netcdf_grid
    161165    END INTERFACE user_define_netcdf_grid
    162    
    163166
    164167    INTERFACE user_init
    165168       MODULE PROCEDURE user_init
    166169    END INTERFACE user_init
     170
     171    INTERFACE user_init_arrays
     172       MODULE PROCEDURE user_init_arrays
     173    END INTERFACE user_init_arrays
    167174
    168175    INTERFACE user_header
     
    433440! Description:
    434441! ------------
     442!> Initialize user-defined arrays
     443!------------------------------------------------------------------------------!
     444 SUBROUTINE user_init_arrays
     445
     446
     447    INTEGER(iwp) :: i       !< loop index
     448    INTEGER(iwp) :: j       !< loop index
     449    INTEGER(iwp) :: region  !< index for loop over statistic regions
     450
     451!
     452!-- Allocate user-defined arrays and set flags for statistic regions.
     453!-- Sample for user-defined output
     454!    ALLOCATE( u2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
     455!    ALLOCATE( ustvst(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
     456
     457!
     458!-- Example for defining a statistic region:
     459!     IF ( statistic_regions >= 1 )  THEN
     460!        region = 1
     461!
     462!        rmask(:,:,region) = 0.0_wp
     463!        DO  i = nxl, nxr
     464!           IF ( i >= INT( 0.25 * nx ) .AND. i <= INT( 0.75 * nx ) )  THEN
     465!              DO  j = nys, nyn
     466!                 IF ( i >= INT( 0.25 * ny ) .AND. i <= INT( 0.75 * ny ) )  THEN
     467!                    rmask(j,i,region) = 1.0_wp
     468!                 ENDIF
     469!              ENDDO
     470!           ENDIF
     471!        ENDDO
     472!
     473!     ENDIF
     474
     475 END SUBROUTINE user_init_arrays
     476
     477
     478!------------------------------------------------------------------------------!
     479! Description:
     480! ------------
    435481!> Execution of user-defined initializing actions
    436482!------------------------------------------------------------------------------!
     
    442488!-- Here the user-defined initializing actions follow:
    443489!-- Sample for user-defined output
    444 !    ALLOCATE( u2(nzb:nzt+1,nysg:nyng,nxlg:nxrg) )
    445 !    ALLOCATE( ustvst(nzb:nzt+1,nysg:nyng,nxlg:nxrg) );  ustvst = 0.0_wp
     490!    ustvst = 0.0_wp
    446491
    447492
Note: See TracChangeset for help on using the changeset viewer.