Changeset 3701 for palm/trunk


Ignore:
Timestamp:
Jan 26, 2019 6:57:21 PM (5 years ago)
Author:
knoop
Message:

Added module switch for user_module.
User module is enabled as soon as the user_parameters namelist is found.

Location:
palm/trunk/SOURCE
Files:
3 edited

Legend:

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

    r3700 r3701  
    270270
    271271   USE user,                                                                   &
    272        ONLY:  user_parin,                                                      &
     272       ONLY:  user_module_enabled,                                             &
     273              user_parin,                                                      &
    273274              user_check_parameters,                                           &
    274275              user_check_data_output_ts,                                       &
     
    479480   IF ( urban_surface )        CALL usm_check_parameters
    480481   IF ( wind_turbine )         CALL wtm_check_parameters
    481                                CALL user_check_parameters
     482   IF ( user_module_enabled )  CALL user_check_parameters
    482483
    483484
     
    503504   ENDIF
    504505
    505    CALL user_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit )
     506   IF ( user_module_enabled )  THEN
     507      CALL user_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit )
     508   ENDIF
    506509
    507510
     
    551554   ENDIF
    552555
    553    IF ( unit == 'illegal' )  THEN
     556   IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
    554557      unit = '' ! ToDo: Seems like a hack. Find a general soultion!
    555558      CALL user_check_data_output_pr( variable, var_count, unit, dopr_unit )
     
    618621   ENDIF
    619622
    620    IF ( unit == 'illegal' )  THEN
     623   IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
    621624      unit = ''
    622625      CALL user_check_data_output( variable, unit )
     
    652655   ENDIF
    653656
    654    IF ( unit == 'illegal' )  THEN
     657   IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
    655658      unit = ''
    656659      CALL user_check_data_output( variable, unit )
     
    732735   IF ( wind_turbine        )  CALL wtm_init
    733736   IF ( radiation           )  CALL radiation_init
    734                                CALL user_init
     737   IF ( user_module_enabled )  CALL user_init
    735738
    736739
     
    763766   IF ( calculate_spectra   )  CALL spectra_header( io )
    764767   IF ( syn_turb_gen        )  CALL stg_header( io )
    765 
    766    CALL user_header( io ) ! ToDo: make user module switch
     768   IF ( user_module_enabled )  CALL user_header( io )
    767769
    768770
     
    782784
    783785   IF ( gust_module_enabled )  CALL gust_actions( location )
    784 
    785    CALL user_actions( location ) ! ToDo: make user module switch
     786   IF ( user_module_enabled )  CALL user_actions( location )
    786787
    787788
     
    803804
    804805   IF ( gust_module_enabled )  CALL gust_actions( i, j, location )
    805 
    806    CALL user_actions( i, j, location ) ! ToDo: make user module switch
     806   IF ( user_module_enabled )  CALL user_actions( i, j, location )
    807807
    808808
     
    853853   IF ( salsa               )  CALL salsa_3d_data_averaging( mode, variable )
    854854   IF ( urban_surface       )  CALL usm_3d_data_averaging( mode, variable )
    855 
    856    CALL user_3d_data_averaging( mode, variable ) ! ToDo: make user module switch
     855   IF ( user_module_enabled )  CALL user_3d_data_averaging( mode, variable )
    857856
    858857
     
    930929   ENDIF
    931930
    932    IF ( .NOT. found )  THEN  ! ToDo: make user module switch
     931   IF ( .NOT. found  .AND.  user_module_enabled )  THEN
    933932      CALL user_data_output_2d(                                                &
    934933              av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do       &
     
    1000999   ENDIF
    10011000
    1002    IF ( .NOT. found )  THEN  ! ToDo: make user module switch
     1001   IF ( .NOT. found  .AND.  user_module_enabled )  THEN
    10031002      CALL user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
    10041003      resorted = .TRUE.
     
    10241023   IF ( gust_module_enabled )  CALL gust_statistics( mode, sr, tn, dots_max )
    10251024   IF ( air_chemistry       )  CALL chem_statistics( mode, sr, tn )
    1026 
    1027    CALL user_statistics( mode, sr, tn ) ! ToDo: make user module switch
     1025   IF ( user_module_enabled )  CALL user_statistics( mode, sr, tn )
    10281026
    10291027
     
    10491047   IF ( .NOT. found )  CALL stg_rrd_global ( found ) ! ToDo: change interface to pass variable
    10501048   IF ( .NOT. found )  CALL wtm_rrd_global( found ) ! ToDo: change interface to pass variable
    1051 
    10521049   IF ( .NOT. found )  CALL user_rrd_global( found ) ! ToDo: change interface to pass variable
    10531050
     
    10711068   IF ( syn_turb_gen )         CALL stg_wrd_global
    10721069   IF ( wind_turbine )         CALL wtm_wrd_global
    1073 
    1074    CALL user_wrd_global ! ToDo: make user module switch
     1070   IF ( user_module_enabled )  CALL user_wrd_global
    10751071
    10761072
     
    12181214   IF ( salsa )                CALL salsa_wrd_local
    12191215   IF ( urban_surface )        CALL usm_wrd_local
    1220 
    1221    CALL user_wrd_local ! ToDo: make user module switch
     1216   IF ( user_module_enabled )  CALL user_wrd_local
    12221217
    12231218
     
    12331228
    12341229
    1235    CALL user_last_actions ! ToDo: make user module switch
     1230   IF ( user_module_enabled )  CALL user_last_actions
    12361231
    12371232
  • palm/trunk/SOURCE/netcdf_interface_mod.f90

    r3700 r3701  
    673673        ONLY: lsm_define_netcdf_grid, nzb_soil, nzt_soil, nzs, zs
    674674
    675     USE user,                                                                  &
    676         ONLY:  user_define_netcdf_grid
    677 
    678675    USE ocean_mod,                                                             &
    679676        ONLY:  ocean_define_netcdf_grid
     
    707704    USE urban_surface_mod,                                                     &
    708705        ONLY:  usm_define_netcdf_grid
     706
     707    USE user,                                                                  &
     708        ONLY:  user_module_enabled, user_define_netcdf_grid
    709709
    710710
     
    11601160!
    11611161!--                Now check for user-defined quantities
    1162                    IF ( .NOT. found )  THEN
     1162                   IF ( .NOT. found  .AND.  user_module_enabled )  THEN
    11631163                      CALL user_define_netcdf_grid( domask(mid,av,i), found,   &
    11641164                                                    grid_x, grid_y, grid_z )
     
    19221922!                   
    19231923!--                Check for user-defined quantities
    1924                    IF ( .NOT. found )  THEN
     1924                   IF ( .NOT. found  .AND.  user_module_enabled )  THEN
    19251925                      CALL user_define_netcdf_grid( do3d(av,i), found, grid_x, &
    19261926                                                    grid_y, grid_z )
     
    29002900!
    29012901!--                      Check for user-defined quantities
    2902                          IF ( .NOT. found )  THEN
     2902                         IF ( .NOT. found  .AND.  user_module_enabled )  THEN
    29032903                            CALL user_define_netcdf_grid( do2d(av,i), found,   &
    29042904                                                          grid_x, grid_y,      &
     
    37923792!
    37933793!--                   Check for user-defined quantities
    3794                       IF ( .NOT. found )  THEN
     3794                      IF ( .NOT. found  .AND.  user_module_enabled )  THEN
    37953795                         CALL user_define_netcdf_grid( do2d(av,i), found,      &
    37963796                                                       grid_x, grid_y, grid_z )
     
    46494649!
    46504650!--                   Check for user-defined quantities
    4651                       IF ( .NOT. found )  THEN
     4651                      IF ( .NOT. found  .AND.  user_module_enabled )  THEN
    46524652                         CALL user_define_netcdf_grid( do2d(av,i), found,      &
    46534653                                                       grid_x, grid_y, grid_z )
     
    59655965!--                Check for user-defined quantities (found, grid_x and grid_y
    59665966!--                are dummies)
    5967                    CALL user_define_netcdf_grid( data_output_sp(i), found,     &
    5968                                                  grid_x, grid_y, grid_z )
     5967                   IF ( user_module_enabled )  THEN
     5968                      CALL user_define_netcdf_grid( data_output_sp(i), found,  &
     5969                                                    grid_x, grid_y, grid_z )
     5970                   ENDIF
    59695971
    59705972             END SELECT
  • palm/trunk/SOURCE/user_module.f90

    r3700 r3701  
    9494    INTEGER(iwp) ::  user_idummy     !<
    9595   
    96     LOGICAL ::  user_defined_namelist_found = .FALSE.   !<
     96    LOGICAL ::  user_module_enabled = .FALSE.   !<
    9797   
    9898    REAL(wp) ::  user_rdummy   !<
     
    108108    SAVE
    109109
    110 !    PRIVATE
     110    PRIVATE
    111111
    112112!
     
    118118       user_check_data_output_pr, &
    119119       user_check_data_output, &
     120       user_define_netcdf_grid, &
    120121       user_init, &
    121122       user_header, &
     
    128129       user_rrd_local, &
    129130       user_wrd_global, &
    130        user_wrd_local
     131       user_wrd_local, &
     132       user_last_actions
    131133
    132134!
    133135!- Public parameters, constants and initial values
    134 !   PUBLIC &
    135 !      user_module_enabled
     136   PUBLIC &
     137      user_module_enabled
    136138
    137139    INTERFACE user_parin
     
    154156       MODULE PROCEDURE user_check_data_output
    155157    END INTERFACE user_check_data_output
     158
     159    INTERFACE user_define_netcdf_grid
     160       MODULE PROCEDURE user_define_netcdf_grid
     161    END INTERFACE user_define_netcdf_grid
     162   
    156163
    157164    INTERFACE user_init
     
    200207    END INTERFACE user_wrd_local
    201208
     209    INTERFACE user_last_actions
     210       MODULE PROCEDURE user_last_actions
     211    END INTERFACE user_last_actions
     212
    202213
    203214 CONTAINS
     
    218229
    219230
    220     NAMELIST /userpar/  data_output_pr_user, data_output_user, region,         &
    221                         data_output_masks_user
    222                         
    223                         
    224     NAMELIST /user_parameters/  data_output_pr_user, data_output_user, region, &
    225                         data_output_masks_user
     231    NAMELIST /user_parameters/  &
     232       user_module_enabled, &
     233       data_output_pr_user, &
     234       data_output_user, &
     235      region, &
     236       data_output_masks_user
    226237
    227238!
     
    244255    BACKSPACE ( 11 )
    245256
    246 !
     257!-- Set default module switch to true
     258    user_module_enabled = .TRUE.
     259
    247260!-- Read user-defined namelist
    248261    READ ( 11, user_parameters, ERR = 10 )
    249262
    250     user_defined_namelist_found = .TRUE.
    251 
    252     GOTO 14
     263    GOTO 12
    253264
    25426510  BACKSPACE( 11 )
     
    256267    CALL parin_fail_message( 'user_parameters', line )
    257268
    258 12  REWIND ( 11 )
    259 
    260     line = ' '
    261     DO WHILE ( INDEX( line, '&userpar' ) == 0 )
    262        READ ( 11, '(A)', END=14 )  line
    263     ENDDO
    264     BACKSPACE ( 11 )
    265 
    266 !
    267 !-- Read user-defined namelist
    268     READ ( 11, userpar, ERR = 13, END = 14 )
    269 
    270     message_string = 'namelist userpar is deprecated and will be ' //          &
    271                      'removed in near future. &Please use namelist ' //        &
    272                      'user_parameters instead'
    273     CALL message( 'user_parin', 'PA0487', 0, 1, 0, 6, 0 )
    274 
    275     user_defined_namelist_found = .TRUE.
    276 
    277     GOTO 14
    278 
    279 13  BACKSPACE( 11 )
    280     READ( 11 , '(A)') line
    281     CALL parin_fail_message( 'userpar', line )
    282 
    283 14  CONTINUE
     26912  CONTINUE
    284270
    285271!
    286272!-- Determine the number of user-defined profiles and append them to the
    287273!-- standard data output (data_output_pr)
    288     IF ( user_defined_namelist_found )  THEN
     274    IF ( user_module_enabled )  THEN
    289275       IF ( data_output_pr_user(1) /= ' ' )  THEN
    290276          i = 1
     
    301287       ENDIF
    302288    ENDIF
    303  
    304     RETURN
     289
    305290
    306291 END SUBROUTINE user_parin
     
    526511!-- If no user-defined variables are read from the namelist-file, no
    527512!-- information will be printed.
    528     IF ( .NOT. user_defined_namelist_found )  THEN
     513    IF ( .NOT. user_module_enabled )  THEN
    529514       WRITE ( io, 100 )
    530515       RETURN
Note: See TracChangeset for help on using the changeset viewer.