Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 2312)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 2320)
@@ -20,9 +20,12 @@
 ! Current revisions:
 ! -----------------
-!
-!
+! 
+! 
 ! Former revisions:
 ! -----------------
 ! $Id$
+! Modularize large-scale forcing and nudging
+!
+! 2312 2017-07-14 20:26:51Z hoffmann
 ! PA0349 and PA0420 removed.
 !
@@ -498,4 +501,8 @@
         ONLY: lsm_check_data_output, lsm_check_data_output_pr,                 &
               lsm_check_parameters
+
+    USE lsf_nudging_mod,                                                       &
+        ONLY:  lsf_nudging_check_parameters, lsf_nudging_check_data_output_pr, &
+               qsws_surf, shf_surf
 
     USE kinds
@@ -1227,4 +1234,8 @@
 !-- When radiation model is used, peform addtional checks
     IF ( radiation )  CALL radiation_check_parameters
+!
+!-- When large-scale forcing or nudging is used, peform addtional checks
+    IF ( large_scale_forcing  .OR.  nudging )  CALL lsf_nudging_check_parameters
+
 
 
@@ -2848,100 +2859,4 @@
              ENDIF
 
-          CASE ( 'td_lsa_lpt' )
-             IF (  .NOT.  large_scale_forcing )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
-                                 'lemented for large_scale_forcing = .FALSE.'
-                CALL message( 'check_parameters', 'PA0393', 1, 2, 0, 6, 0 )
-             ELSE
-                dopr_index(i) = 81
-                dopr_unit(i)  = 'K/s'
-                hom(:,2,81,:) = SPREAD( zu, 2, statistic_regions+1 )
-             ENDIF
-
-          CASE ( 'td_lsa_q' )
-             IF (  .NOT.  large_scale_forcing )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
-                                 'lemented for large_scale_forcing = .FALSE.'
-                CALL message( 'check_parameters', 'PA0393', 1, 2, 0, 6, 0 )
-             ELSE
-                dopr_index(i) = 82
-                dopr_unit(i)  = 'kg/kgs'
-                hom(:,2,82,:) = SPREAD( zu, 2, statistic_regions+1 )
-             ENDIF
-
-          CASE ( 'td_sub_lpt' )
-             IF (  .NOT.  large_scale_forcing )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
-                                 'lemented for large_scale_forcing = .FALSE.'
-                CALL message( 'check_parameters', 'PA0393', 1, 2, 0, 6, 0 )
-             ELSE
-                dopr_index(i) = 83
-                dopr_unit(i)  = 'K/s'
-                hom(:,2,83,:) = SPREAD( zu, 2, statistic_regions+1 )
-             ENDIF
-
-          CASE ( 'td_sub_q' )
-             IF (  .NOT.  large_scale_forcing )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
-                                 'lemented for large_scale_forcing = .FALSE.'
-                CALL message( 'check_parameters', 'PA0393', 1, 2, 0, 6, 0 )
-             ELSE
-                dopr_index(i) = 84
-                dopr_unit(i)  = 'kg/kgs'
-                hom(:,2,84,:) = SPREAD( zu, 2, statistic_regions+1 )
-             ENDIF
-
-          CASE ( 'td_nud_lpt' )
-             IF (  .NOT.  nudging )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
-                                 'lemented for nudging = .FALSE.'
-                CALL message( 'check_parameters', 'PA0394', 1, 2, 0, 6, 0 )
-             ELSE
-                dopr_index(i) = 85
-                dopr_unit(i)  = 'K/s'
-                hom(:,2,85,:) = SPREAD( zu, 2, statistic_regions+1 )
-             ENDIF
-
-          CASE ( 'td_nud_q' )
-             IF (  .NOT.  nudging )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
-                                 'lemented for nudging = .FALSE.'
-                CALL message( 'check_parameters', 'PA0394', 1, 2, 0, 6, 0 )
-             ELSE
-                dopr_index(i) = 86
-                dopr_unit(i)  = 'kg/kgs'
-                hom(:,2,86,:) = SPREAD( zu, 2, statistic_regions+1 )
-             ENDIF
-
-          CASE ( 'td_nud_u' )
-             IF (  .NOT.  nudging )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
-                                 'lemented for nudging = .FALSE.'
-                CALL message( 'check_parameters', 'PA0394', 1, 2, 0, 6, 0 )
-             ELSE
-                dopr_index(i) = 87
-                dopr_unit(i)  = 'm/s2'
-                hom(:,2,87,:) = SPREAD( zu, 2, statistic_regions+1 )
-             ENDIF
-
-          CASE ( 'td_nud_v' )
-             IF (  .NOT.  nudging )  THEN
-                message_string = 'data_output_pr = ' //                        &
-                                 TRIM( data_output_pr(i) ) // ' is not imp' // &
-                                 'lemented for nudging = .FALSE.'
-                CALL message( 'check_parameters', 'PA0394', 1, 2, 0, 6, 0 )
-             ELSE
-                dopr_index(i) = 88
-                dopr_unit(i)  = 'm/s2'
-                hom(:,2,88,:) = SPREAD( zu, 2, statistic_regions+1 )
-             ENDIF
-
           CASE ( 's*2' )
              IF (  .NOT.  passive_scalar )  THEN
@@ -2962,4 +2877,7 @@
              CALL lsm_check_data_output_pr( data_output_pr(i), i, unit,        &
                                             dopr_unit(i) )
+
+             CALL lsf_nudging_check_data_output_pr( data_output_pr(i), i,      &
+                                                    unit, dopr_unit(i) )
 
              IF ( unit == 'illegal' )  THEN
@@ -3885,45 +3803,4 @@
 
 !
-!-- Check nudging and large scale forcing from external file
-    IF ( nudging  .AND.  (  .NOT.  large_scale_forcing ) )  THEN
-       message_string = 'Nudging requires large_scale_forcing = .T.. &'//      &
-                        'Surface fluxes and geostrophic wind should be &'//    &
-                        'prescribed in file LSF_DATA'
-       CALL message( 'check_parameters', 'PA0374', 1, 2, 0, 6, 0 )
-    ENDIF
-
-    IF ( large_scale_forcing  .AND.  ( bc_lr /= 'cyclic'  .OR.                 &
-                                    bc_ns /= 'cyclic' ) )  THEN
-       message_string = 'Non-cyclic lateral boundaries do not allow for &' //  &
-                        'the usage of large scale forcing from external file.'
-       CALL message( 'check_parameters', 'PA0375', 1, 2, 0, 6, 0 )
-    ENDIF
-
-    IF ( large_scale_forcing  .AND.  (  .NOT.  humidity ) )  THEN
-       message_string = 'The usage of large scale forcing from external &'//   &
-                        'file LSF_DATA requires humidity = .T..'
-       CALL message( 'check_parameters', 'PA0376', 1, 2, 0, 6, 0 )
-    ENDIF
-
-    IF ( large_scale_forcing  .AND.  passive_scalar )  THEN
-       message_string = 'The usage of large scale forcing from external &'//   &
-                        'file LSF_DATA is not implemented for passive scalars'
-       CALL message( 'check_parameters', 'PA0440', 1, 2, 0, 6, 0 )
-    ENDIF
-
-    IF ( large_scale_forcing  .AND.  topography /= 'flat'                      &
-                              .AND.  .NOT.  lsf_exception )  THEN
-       message_string = 'The usage of large scale forcing from external &'//   &
-                        'file LSF_DATA is not implemented for non-flat topography'
-       CALL message( 'check_parameters', 'PA0377', 1, 2, 0, 6, 0 )
-    ENDIF
-
-    IF ( large_scale_forcing  .AND.  ocean )  THEN
-       message_string = 'The usage of large scale forcing from external &'//   &
-                        'file LSF_DATA is not implemented for ocean runs'
-       CALL message( 'check_parameters', 'PA0378', 1, 2, 0, 6, 0 )
-    ENDIF
-
-!
 !-- Prevent empty time records in volume, cross-section and masked data in case
 !-- of non-parallel netcdf-output in restart runs
