Ignore:
Timestamp:
Apr 7, 2016 12:01:39 PM (8 years ago)
Author:
maronga
Message:

further modularization of radiation model and plant canopy model

File:
1 edited

Legend:

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

    r1825 r1826  
    1919! Current revisions:
    2020! -----------------
    21 !
    22 !
     21! Moved checks for radiation model to the respective module.
     22! Moved checks for plant canopy model to the respective module.
     23! Bugfix for check of too large roughness_length
     24!
    2325! Former revisions:
    2426! -----------------
     
    349351    USE land_surface_model_mod,                                                &
    350352        ONLY: land_surface, lsm_check_data_output, lsm_check_data_output_pr,   &
    351               lsm_check_parameters, nzs, zs
     353              lsm_check_parameters
     354
    352355    USE kinds
    353356    USE model_1d
     
    355358        ONLY:  dopr_unit, do2d_unit, do3d_unit, netcdf_data_format,            &
    356359               netcdf_data_format_string
     360
    357361    USE particle_attributes
    358362    USE pegrid
    359     USE plant_canopy_model_mod
     363    USE plant_canopy_model_mod,                                                &
     364        ONLY:  pcm_check_parameters, plant_canopy
     365       
    360366    USE pmc_interface,                                                         &
    361367        ONLY:  cpl_id, nested_run
     368
    362369    USE profil_parameter
    363     USE radiation_model_mod
     370    USE radiation_model_mod,                                                   &
     371        ONLY: radiation, radiation_check_data_output,                          &
     372              radiation_check_data_output_pr, radiation_check_parameters
    364373    USE statistics
    365374    USE subsidence_mod
     
    10221031    ENDIF
    10231032
    1024     IF ( plant_canopy )  THEN
     1033!
     1034!-- When plant canopy model is used, peform addtional checks
     1035    IF ( plant_canopy )  CALL pcm_check_parameters
    10251036   
    1026        IF ( canopy_drag_coeff == 0.0_wp )  THEN
    1027           message_string = 'plant_canopy = .TRUE. requires a non-zero drag '// &
    1028                            'coefficient & given value is canopy_drag_coeff = 0.0'
    1029           CALL message( 'check_parameters', 'PA0041', 1, 2, 0, 6, 0 )
    1030        ENDIF
    1031    
    1032        IF ( ( alpha_lad /= 9999999.9_wp  .AND.  beta_lad == 9999999.9_wp )  .OR.&
    1033               beta_lad /= 9999999.9_wp   .AND.  alpha_lad == 9999999.9_wp )  THEN
    1034           message_string = 'using the beta function for the construction ' //  &
    1035                            'of the leaf area density profile requires '    //  &
    1036                            'both alpha_lad and beta_lad to be /= 9999999.9'
    1037           CALL message( 'check_parameters', 'PA0118', 1, 2, 0, 6, 0 )
    1038        ENDIF
    1039    
    1040        IF ( calc_beta_lad_profile  .AND.  lai_beta == 0.0_wp )  THEN
    1041           message_string = 'using the beta function for the construction ' //  &
    1042                            'of the leaf area density profile requires '    //  &
    1043                            'a non-zero lai_beta, but given value is '      //  &
    1044                            'lai_beta = 0.0'
    1045           CALL message( 'check_parameters', 'PA0119', 1, 2, 0, 6, 0 )
    1046        ENDIF
    1047 
    1048        IF ( calc_beta_lad_profile  .AND.  lad_surface /= 0.0_wp )  THEN
    1049           message_string = 'simultaneous setting of alpha_lad /= 9999999.9' // &
    1050                            'and lad_surface /= 0.0 is not possible, '       // &
    1051                            'use either vertical gradients or the beta '     // &
    1052                            'function for the construction of the leaf area '// &
    1053                            'density profile'
    1054           CALL message( 'check_parameters', 'PA0120', 1, 2, 0, 6, 0 )
    1055        ENDIF
    1056 
    1057        IF ( cloud_physics  .AND.  microphysics_seifert )  THEN
    1058           message_string = 'plant_canopy = .TRUE. requires cloud_scheme /=' // &
    1059                            ' seifert_beheng'
    1060           CALL message( 'check_parameters', 'PA0360', 1, 2, 0, 6, 0 )
    1061        ENDIF
    1062 
    1063     ENDIF
    1064 
    10651037!
    10661038!-- When land surface model is used, peform addtional checks
    10671039    IF ( land_surface )  CALL lsm_check_parameters
    10681040
    1069 
    1070     IF ( radiation )  THEN
    1071        IF ( radiation_scheme /= 'constant'   .AND.                             &
    1072             radiation_scheme /= 'clear-sky'  .AND.                             &
    1073             radiation_scheme /= 'rrtmg' )  THEN
    1074           message_string = 'unknown radiation_scheme = '//                     &
    1075                            TRIM( radiation_scheme )
    1076           CALL message( 'check_parameters', 'PA0405', 1, 2, 0, 6, 0 )
    1077        ELSEIF ( radiation_scheme == 'rrtmg' )  THEN
    1078 #if ! defined ( __rrtmg )
    1079           message_string = 'radiation_scheme = "rrtmg" requires ' //           &
    1080                            'compilation of PALM with pre-processor ' //        &
    1081                            'directive -D__rrtmg'
    1082           CALL message( 'check_parameters', 'PA0407', 1, 2, 0, 6, 0 )
    1083 #endif
    1084 #if defined ( __rrtmg ) && ! defined( __netcdf )
    1085           message_string = 'radiation_scheme = "rrtmg" requires ' //           &
    1086                            'the use of NetCDF (preprocessor directive ' //     &
    1087                            '-D__netcdf'
    1088           CALL message( 'check_parameters', 'PA0412', 1, 2, 0, 6, 0 )
    1089 #endif
    1090 
    1091        ENDIF
    1092        IF ( albedo_type == 0  .AND.  albedo == 9999999.9_wp  .AND.             &
    1093             radiation_scheme == 'clear-sky')  THEN
    1094           message_string = 'radiation_scheme = "clear-sky" in combination' //  &
    1095                            'with albedo_type = 0 requires setting of albedo'// &
    1096                            ' /= 9999999.9'
    1097           CALL message( 'check_parameters', 'PA0410', 1, 2, 0, 6, 0 )
    1098        ENDIF
    1099        IF ( albedo_type == 0  .AND.  radiation_scheme == 'rrtmg'  .AND.        &
    1100           (    albedo_lw_dif == 9999999.9_wp .OR. albedo_lw_dir == 9999999.9_wp&
    1101           .OR. albedo_sw_dif == 9999999.9_wp .OR. albedo_sw_dir == 9999999.9_wp&
    1102           ) ) THEN
    1103           message_string = 'radiation_scheme = "rrtmg" in combination' //      &
    1104                            'with albedo_type = 0 requires setting of ' //      &
    1105                            'albedo_lw_dif /= 9999999.9' //                     &
    1106                            'albedo_lw_dir /= 9999999.9' //                     &
    1107                            'albedo_sw_dif /= 9999999.9 and' //                 &
    1108                            'albedo_sw_dir /= 9999999.9'
    1109           CALL message( 'check_parameters', 'PA0411', 1, 2, 0, 6, 0 )
    1110        ENDIF
    1111        IF ( topography /= 'flat' )  THEN
    1112           message_string = 'radiation scheme cannot be used ' //               &
    1113                            'in combination with  topography /= "flat"'
    1114           CALL message( 'check_parameters', 'PA0414', 1, 2, 0, 6, 0 )
    1115        ENDIF
    1116     ENDIF
     1041!
     1042!-- When radiation model is used, peform addtional checks
     1043    IF ( radiation )  CALL radiation_check_parameters
    11171044
    11181045    IF ( .NOT. ( loop_optimization == 'cache'  .OR.                            &
     
    29802907             ENDIF
    29812908
    2982           CASE ( 'rad_net' )
    2983              IF ( (  .NOT.  radiation )  .OR.  radiation_scheme == 'constant' )&
    2984              THEN
    2985                 message_string = 'data_output_pr = ' //                        &
    2986                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    2987                                  'lable for radiation = .FALSE. or ' //        &
    2988                                  'radiation_scheme = "constant"'
    2989                 CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 )
    2990              ELSE
    2991                 dopr_index(i) = 101
    2992                 dopr_unit(i)  = 'W/m2'
    2993                 hom(:,2,101,:)  = SPREAD( zw, 2, statistic_regions+1 )
    2994              ENDIF
    2995 
    2996           CASE ( 'rad_lw_in' )
    2997              IF ( (  .NOT.  radiation)  .OR.  radiation_scheme == 'constant' ) &
    2998              THEN
    2999                 message_string = 'data_output_pr = ' //                        &
    3000                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    3001                                  'lable for radiation = .FALSE. or ' //        &
    3002                                  'radiation_scheme = "constant"'
    3003                 CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 )
    3004              ELSE
    3005                 dopr_index(i) = 102
    3006                 dopr_unit(i)  = 'W/m2'
    3007                 hom(:,2,102,:)  = SPREAD( zw, 2, statistic_regions+1 )
    3008              ENDIF
    3009 
    3010           CASE ( 'rad_lw_out' )
    3011              IF ( (  .NOT. radiation )  .OR.  radiation_scheme == 'constant' ) &
    3012              THEN
    3013                 message_string = 'data_output_pr = ' //                        &
    3014                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    3015                                  'lable for radiation = .FALSE. or ' //        &
    3016                                  'radiation_scheme = "constant"'
    3017                 CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 )
    3018              ELSE
    3019                 dopr_index(i) = 103
    3020                 dopr_unit(i)  = 'W/m2'
    3021                 hom(:,2,103,:)  = SPREAD( zw, 2, statistic_regions+1 )
    3022              ENDIF
    3023 
    3024           CASE ( 'rad_sw_in' )
    3025              IF ( (  .NOT. radiation )  .OR.  radiation_scheme == 'constant' ) &
    3026              THEN
    3027                 message_string = 'data_output_pr = ' //                        &
    3028                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    3029                                  'lable for radiation = .FALSE. or ' //        &
    3030                                  'radiation_scheme = "constant"'
    3031                 CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 )
    3032              ELSE
    3033                 dopr_index(i) = 104
    3034                 dopr_unit(i)  = 'W/m2'
    3035                 hom(:,2,104,:)  = SPREAD( zw, 2, statistic_regions+1 )
    3036              ENDIF
    3037 
    3038           CASE ( 'rad_sw_out')
    3039              IF ( (  .NOT.  radiation )  .OR.  radiation_scheme == 'constant' ) &
    3040              THEN
    3041                 message_string = 'data_output_pr = ' //                        &
    3042                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    3043                                  'lable for radiation = .FALSE. or ' //        &
    3044                                  'radiation_scheme = "constant"'
    3045                 CALL message( 'check_parameters', 'PA0408', 1, 2, 0, 6, 0 )
    3046              ELSE
    3047                 dopr_index(i) = 105
    3048                 dopr_unit(i)  = 'W/m2'
    3049                 hom(:,2,105,:)  = SPREAD( zw, 2, statistic_regions+1 )
    3050              ENDIF
    3051 
    3052           CASE ( 'rad_lw_cs_hr' )
    3053              IF ( (  .NOT.  radiation )  .OR.  radiation_scheme /= 'rrtmg' )   &
    3054              THEN
    3055                 message_string = 'data_output_pr = ' //                        &
    3056                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    3057                                  'lable for radiation = .FALSE. or ' //        &
    3058                                  'radiation_scheme /= "rrtmg"'
    3059                 CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 )
    3060              ELSE
    3061                 dopr_index(i) = 106
    3062                 dopr_unit(i)  = 'K/h'
    3063                 hom(:,2,106,:)  = SPREAD( zu, 2, statistic_regions+1 )
    3064              ENDIF
    3065 
    3066           CASE ( 'rad_lw_hr' )
    3067              IF ( (  .NOT.  radiation )  .OR.  radiation_scheme /= 'rrtmg' )   &
    3068              THEN
    3069                 message_string = 'data_output_pr = ' //                        &
    3070                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    3071                                  'lable for radiation = .FALSE. or ' //        &
    3072                                  'radiation_scheme /= "rrtmg"'
    3073                 CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 )
    3074              ELSE
    3075                 dopr_index(i) = 107
    3076                 dopr_unit(i)  = 'K/h'
    3077                 hom(:,2,107,:)  = SPREAD( zu, 2, statistic_regions+1 )
    3078              ENDIF
    3079 
    3080           CASE ( 'rad_sw_cs_hr' )
    3081              IF ( (  .NOT.  radiation )  .OR.  radiation_scheme /= 'rrtmg' )   &
    3082              THEN
    3083                 message_string = 'data_output_pr = ' //                        &
    3084                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    3085                                  'lable for radiation = .FALSE. or ' //        &
    3086                                  'radiation_scheme /= "rrtmg"'
    3087                 CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 )
    3088              ELSE
    3089                 dopr_index(i) = 108
    3090                 dopr_unit(i)  = 'K/h'
    3091                 hom(:,2,108,:)  = SPREAD( zu, 2, statistic_regions+1 )
    3092              ENDIF
    3093 
    3094           CASE ( 'rad_sw_hr' )
    3095              IF ( (  .NOT.  radiation )  .OR.  radiation_scheme /= 'rrtmg' )   &
    3096              THEN
    3097                 message_string = 'data_output_pr = ' //                        &
    3098                                  TRIM( data_output_pr(i) ) // ' is not ava' // &
    3099                                  'lable for radiation = .FALSE. or ' //        &
    3100                                  'radiation_scheme /= "rrtmg"'
    3101                 CALL message( 'check_parameters', 'PA0413', 1, 2, 0, 6, 0 )
    3102              ELSE
    3103                 dopr_index(i) = 109
    3104                 dopr_unit(i)  = 'K/h'
    3105                 hom(:,2,109,:)  = SPREAD( zu, 2, statistic_regions+1 )
    3106              ENDIF
     2909 
    31072910
    31082911          CASE DEFAULT
    31092912
    3110              CALL lsm_check_data_output_pr( data_output_pr(i), i, unit, dopr_unit(i) )
    3111 
     2913             CALL lsm_check_data_output_pr( data_output_pr(i), i, unit,        &
     2914                                            dopr_unit(i) )
     2915
     2916             IF ( unit == 'illegal' )  THEN
     2917                CALL radiation_check_data_output_pr( data_output_pr(i), i,     &
     2918                                                     unit, dopr_unit(i) )
     2919             ENDIF
     2920             
    31122921             IF ( unit == 'illegal' )  THEN
    31132922                CALL user_check_data_output_pr( data_output_pr(i), i, unit )
     
    32883097             unit = 'kg/kg'
    32893098
    3290           CASE ( 'rad_lw_in', 'rad_lw_out', 'rad_lw_cs_hr', 'rad_lw_hr',       &
    3291                  'rad_sw_in', 'rad_sw_out', 'rad_sw_cs_hr', 'rad_sw_hr' )
    3292              IF (  .NOT.  radiation  .OR.  radiation_scheme /= 'rrtmg' )  THEN
    3293                 message_string = '"output of "' // TRIM( var ) // '" requi' // &
    3294                                  'res radiation = .TRUE. and ' //              &
    3295                                  'radiation_scheme = "rrtmg"'
    3296                 CALL message( 'check_parameters', 'PA0406', 1, 2, 0, 6, 0 )
    3297              ENDIF
    3298              unit = 'W/m2'
    3299 
    33003099          CASE ( 'rho' )
    33013100             IF (  .NOT.  ocean )  THEN
     
    33303129             CONTINUE
    33313130
    3332           CASE ( 'lai*', 'lwp*', 'ol*', 'pra*', 'prr*', 'qsws*', 'rad_net*',   &
    3333                  'rrtm_aldif*', 'rrtm_aldir*', 'rrtm_asdif*', 'rrtm_asdir*',   &
    3334                  'shf*', 't*', 'u*', 'z0*', 'z0h*', 'z0q*' )
     3131          CASE ( 'lai*', 'lwp*', 'ol*', 'pra*', 'prr*', 'qsws*', 'shf*', 't*', &
     3132                 'u*', 'z0*', 'z0h*', 'z0q*' )
    33353133             IF ( k == 0  .OR.  data_output(i)(ilen-2:ilen) /= '_xy' )  THEN
    33363134                message_string = 'illegal value for data_output: "' //         &
     
    33393137                CALL message( 'check_parameters', 'PA0111', 1, 2, 0, 6, 0 )
    33403138             ENDIF
    3341              IF (  .NOT.  radiation  .OR.  radiation_scheme /= "rrtmg" )  THEN
    3342                 IF ( TRIM( var ) == 'rrtm_aldif*'  .OR.                        &
    3343                      TRIM( var ) == 'rrtm_aldir*'  .OR.                        &
    3344                      TRIM( var ) == 'rrtm_asdif*'  .OR.                        &
    3345                      TRIM( var ) == 'rrtm_asdir*'      )                       &
    3346                 THEN
    3347                    message_string = 'output of "' // TRIM( var ) // '" require'&
    3348                                     // 's radiation = .TRUE. and radiation_sch'&
    3349                                     // 'eme = "rrtmg"'
    3350                    CALL message( 'check_parameters', 'PA0409', 1, 2, 0, 6, 0 )
    3351                 ENDIF
    3352              ENDIF
    3353              IF ( TRIM( var ) == 'lai*'  .AND.  .NOT.  land_surface )  THEN
    3354                 message_string = 'output of "' // TRIM( var ) // '" requi' //  &
    3355                                  'res land_surface = .TRUE.'
    3356                 CALL message( 'check_parameters', 'PA0404', 1, 2, 0, 6, 0 )
    3357              ENDIF
     3139
    33583140             IF ( TRIM( var ) == 'lwp*'  .AND.  .NOT. cloud_physics )  THEN
    33593141                message_string = 'output of "' // TRIM( var ) // '" requi' //  &
     
    33843166             ENDIF
    33853167
    3386              IF ( TRIM( var ) == 'lai*'   )  unit = 'none'
    33873168             IF ( TRIM( var ) == 'lwp*'   )  unit = 'kg/m2'
    33883169             IF ( TRIM( var ) == 'ol*'   )   unit = 'm'
     
    33903171             IF ( TRIM( var ) == 'prr*'   )  unit = 'mm/s'
    33913172             IF ( TRIM( var ) == 'qsws*'  )  unit = 'kgm/kgs'
    3392              IF ( TRIM( var ) == 'rad_net*'      ) unit = 'W/m2'   
    3393              IF ( TRIM( var ) == 'rrtm_aldif*'   ) unit = ''   
    3394              IF ( TRIM( var ) == 'rrtm_aldir*'   ) unit = ''
    3395              IF ( TRIM( var ) == 'rrtm_asdif*'   ) unit = ''
    3396              IF ( TRIM( var ) == 'rrtm_asdir*'   ) unit = ''
    33973173             IF ( TRIM( var ) == 'shf*'   )  unit = 'K*m/s'
    33983174             IF ( TRIM( var ) == 't*'     )  unit = 'K'
     
    34043180
    34053181             CALL lsm_check_data_output ( var, unit, i, ilen, k )
    3406              
     3182 
     3183             IF ( unit == 'illegal' )  THEN
     3184                CALL radiation_check_data_output( var, unit, i, ilen, k )
     3185             ENDIF
     3186
    34073187             IF ( unit == 'illegal' )  THEN
    34083188                CALL user_check_data_output( var, unit )
     
    40733853    ENDIF
    40743854
     3855    CALL location_message( 'finished', .TRUE. )
     3856
    40753857!
    40763858!-- Prevent empty time records in volume, cross-section and masked data in case of
     
    41003882    IF ( ( constant_flux_layer .OR.  &
    41013883           INDEX( initializing_actions, 'set_1d-model_profiles' ) /= 0 ) &
    4102          .AND. roughness_length <= 0.5 * dz )  THEN
     3884         .AND. roughness_length > 0.5 * dz )  THEN
    41033885       message_string = 'roughness_length must be smaller than dz/2'
    41043886       CALL message( 'check_parameters', 'PA0424', 1, 2, 0, 6, 0 )
Note: See TracChangeset for help on using the changeset viewer.