Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 3597)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 3637)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! Implementation of the PALM module interface
+! 
+! 3597 2018-12-04 08:40:18Z maronga
 ! Added checks for theta_2m
 ! 
@@ -748,19 +751,11 @@
     USE basic_constants_and_equations_mod
 
-    USE biometeorology_mod,                                                    &
-        ONLY:  bio_check_data_output, bio_check_parameters
-
     USE bulk_cloud_model_mod,                                                  &
-        ONLY:  bulk_cloud_model, bcm_check_parameters, bcm_check_data_output,  &
-               bcm_check_data_output_pr
-
-    USE chem_emissions_mod,                                                    &
-        ONLY:  chem_emissions_check_parameters
+        ONLY:  bulk_cloud_model
 
     USE chem_modules
 
     USE chemistry_model_mod,                                                   &
-        ONLY:  chem_boundary_conds, chem_check_data_output,                    &
-               chem_check_data_output_pr, chem_check_parameters, chem_species
+        ONLY:  chem_boundary_conds
 
     USE control_parameters
@@ -770,25 +765,16 @@
     USE grid_variables
 
-    USE gust_mod,                                                              &
-        ONLY: gust_check_data_output, gust_check_data_output_pr,               &
-              gust_check_parameters, gust_module_enabled
-
     USE kinds
 
     USE indices
-
-    USE land_surface_model_mod,                                                &
-        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
 
     USE model_1d_mod,                                                          &
         ONLY:  damp_level_1d, damp_level_ind_1d
 
-    USE nesting_offl_mod,                                                      &
-        ONLY:  nesting_offl_check_parameters
-        
+    USE module_interface,                                                      &
+        ONLY:  module_interface_check_parameters,                              &
+               module_interface_check_data_output_pr,                          &
+               module_interface_check_data_output
+
     USE netcdf_data_input_mod,                                                 &
         ONLY:  init_model, input_pids_static, netcdf_data_input_check_dynamic, &
@@ -800,14 +786,7 @@
                waterflux_output_unit, momentumflux_output_unit
 
-    USE ocean_mod,                                                             &
-        ONLY:  ocean_check_data_output, ocean_check_data_output_pr,            &
-               ocean_check_parameters
-
     USE particle_attributes
 
     USE pegrid
-
-    USE plant_canopy_model_mod,                                                &
-        ONLY:  pcm_check_data_output, pcm_check_parameters
 
     USE pmc_interface,                                                         &
@@ -816,37 +795,17 @@
     USE profil_parameter
 
-    USE radiation_model_mod,                                                   &
-        ONLY:  radiation, radiation_check_data_output,                         &
-               radiation_check_data_output_pr, radiation_check_parameters
-                            
-    USE salsa_mod,                                                             &
-        ONLY:  salsa_check_data_output, salsa_check_parameters        
-
-    USE spectra_mod,                                                           &
-        ONLY:  calculate_spectra, spectra_check_parameters
-
     USE statistics
 
     USE subsidence_mod
 
-    USE surface_output_mod,                                                    &
-        ONLY:  surface_output_check_parameters
-
-    USE synthetic_turbulence_generator_mod,                                    &
-        ONLY:  stg_check_parameters
-
     USE transpose_indices
 
     USE turbulence_closure_mod,                                                &
-        ONLY:  tcm_check_data_output, tcm_check_parameters
-
-    USE urban_surface_mod,                                                     &
-        ONLY:  usm_check_data_output, usm_check_parameters
-
-    USE wind_turbine_model_mod,                                                &
-        ONLY:  wtm_check_parameters
+        ONLY:  tcm_check_parameters,                                           &
+               tcm_check_data_output
 
     USE vertical_nesting_mod,                                                  &
-        ONLY:  vnested, vnest_check_parameters
+        ONLY:  vnested,                                                        &
+               vnest_check_parameters
 
 
@@ -1525,30 +1484,9 @@
 
 !
-!-- Check the module settings:
-!-- tcm_check_parameters must be called at first
+!-- tcm_check_parameters must be called before all other module calls
     CALL tcm_check_parameters
 
-    IF ( biometeorology )       CALL bio_check_parameters
-    IF ( bulk_cloud_model )     CALL bcm_check_parameters
-    IF ( air_chemistry )        CALL chem_check_parameters
-!   IF ( air_chemistry )        CALL chem_emissions_check_parameters   ! forkel preliminary
-    IF ( gust_module_enabled )  CALL gust_check_parameters
-    IF ( large_scale_forcing  .OR.  nudging )                                  &
-                                CALL lsf_nudging_check_parameters
-    IF ( land_surface )         CALL lsm_check_parameters
-    IF ( nesting_offline )      CALL nesting_offl_check_parameters    
-    IF ( ocean_mode )           CALL ocean_check_parameters
-    IF ( plant_canopy )         CALL pcm_check_parameters
-    IF ( radiation )            CALL radiation_check_parameters
-    IF ( calculate_spectra )    CALL spectra_check_parameters
-                                CALL stg_check_parameters
-    IF ( urban_surface )        CALL usm_check_parameters
-    IF ( wind_turbine )         CALL wtm_check_parameters
-!
-!-- Checks for surface data output
-    IF ( surface_data_output )  CALL surface_output_check_parameters
-!    
-!-- When SALSA is used, perform additional checks 
-    IF ( salsa )  CALL salsa_check_parameters     
+!-- Check the module settings
+    CALL module_interface_check_parameters
 
 !
@@ -1562,14 +1500,5 @@
        IF ( humidity       )  q_init  = q_surface
        IF ( passive_scalar )  s_init  = s_surface
-!
-!--    TODO
-!--    Russo: Is done in chem_init and would overwrite what is done there
-!--    --> kanani: Revise
-!      IF ( air_chemistry )  THEN
-!        DO lsp = 1, nvar
-!           chem_species(lsp)%conc_pr_init = cs_surface(lsp)      
-!        ENDDO
-!      ENDIF
-!
+
 !--
 !--    If required, compute initial profile of the geostrophic wind
@@ -2960,44 +2889,6 @@
 !
 !--          Check for other modules
-             IF ( unit == 'illegal' .AND.  bulk_cloud_model )  THEN
-                CALL bcm_check_data_output_pr( data_output_pr(i), i, unit,     &
-                                               dopr_unit(i) )
-             ENDIF
-
-             IF ( unit == 'illegal' .AND.  air_chemistry )  THEN
-                CALL chem_check_data_output_pr( data_output_pr(i), i, unit,    &
-                                                dopr_unit(i) )
-             ENDIF
-
-             IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
-                CALL gust_check_data_output_pr( data_output_pr(i), i, unit,    &
-                                                dopr_unit(i) )
-             ENDIF
-
-             IF ( unit == 'illegal' )  THEN
-                CALL lsf_nudging_check_data_output_pr( data_output_pr(i), i,   &
-                                                       unit, dopr_unit(i) )
-             ENDIF
-
-             IF ( unit == 'illegal' )  THEN
-                CALL lsm_check_data_output_pr( data_output_pr(i), i, unit,        &
-                                            dopr_unit(i) )
-             ENDIF
-             IF ( unit == 'illegal' )  THEN
-                CALL ocean_check_data_output_pr( data_output_pr(i), i, unit,   &
-                                                 dopr_unit(i) )
-             ENDIF
-
-             IF ( unit == 'illegal' )  THEN
-                CALL radiation_check_data_output_pr( data_output_pr(i), i,     &
-                                                     unit, dopr_unit(i) )
-             ENDIF
-
-!
-!--          Finally, check for user defined quantities
-             IF ( unit == 'illegal' )  THEN
-                unit = ''
-                CALL user_check_data_output_pr( data_output_pr(i), i, unit )
-             ENDIF
+             CALL module_interface_check_data_output_pr( data_output_pr(i), i, &
+                                                         unit, dopr_unit(i) )
 
 !
@@ -3224,55 +3115,7 @@
 
              CALL tcm_check_data_output( var, unit )
-
 !
 !--          Check for other modules
-             IF ( unit == 'illegal'  .AND.  bulk_cloud_model  )  THEN
-                CALL bcm_check_data_output( var, unit )
-             ENDIF
-
-             IF ( unit == 'illegal'  .AND.  air_chemistry                      &
-                  .AND.  (var(1:3) == 'kc_' .OR. var(1:3) == 'em_') )  THEN
-                CALL chem_check_data_output( var, unit, i, ilen, k )
-             ENDIF
-
-             IF ( unit == 'illegal' )  THEN
-                CALL lsm_check_data_output ( var, unit, i, ilen, k )
-             ENDIF
-
-             IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
-                CALL gust_check_data_output ( var, unit )
-             ENDIF
-
-             IF ( unit == 'illegal'  .AND.  biometeorology )  THEN
-                CALL bio_check_data_output( var, unit, i, ilen, k )
-             ENDIF
-
-             IF ( unit == 'illegal'  .AND.  ocean_mode )  THEN
-                CALL ocean_check_data_output( var, unit )
-             ENDIF
-
-             IF ( unit == 'illegal'  .AND.  plant_canopy                       &
-                                     .AND.  var(1:4) == 'pcm_' )  THEN
-                CALL pcm_check_data_output( var, unit )
-             ENDIF
-
-             IF ( unit == 'illegal' )  THEN
-                CALL radiation_check_data_output( var, unit, i, ilen, k )
-             ENDIF
-
-             IF ( unit == 'illegal' .AND. salsa ) THEN
-                 CALL salsa_check_data_output( var, unit )
-             ENDIF   
-
-             IF ( unit == 'illegal'  .AND.  urban_surface                      &
-                                     .AND.  var(1:4) == 'usm_' )  THEN
-                 CALL usm_check_data_output( var, unit )
-             ENDIF
-!
-!--          Finally, check for user-defined quantities
-             IF ( unit == 'illegal' )  THEN
-                unit = ''
-                CALL user_check_data_output( var, unit )
-             ENDIF
+             CALL module_interface_check_data_output( var, unit, i, ilen, k )
 
              IF ( unit == 'illegal' )  THEN
@@ -3986,7 +3829,4 @@
 
     CALL location_message( 'finished', .TRUE. )
-!
-!-- Check &userpar parameters
-    CALL user_check_parameters
 
  CONTAINS
