Index: palm/trunk/SOURCE/module_interface.f90
===================================================================
--- palm/trunk/SOURCE/module_interface.f90	(revision 4039)
+++ palm/trunk/SOURCE/module_interface.f90	(revision 4047)
@@ -25,20 +25,23 @@
 ! -----------------
 ! $Id$
+! Introduction of the dynamics module
+!
+! 4039 2019-06-18 10:32:41Z suehring
 ! Introduce diagnostic output
-! 
+!
 ! 4028 2019-06-13 12:21:37Z schwenkel
 ! Further modularization of particle code components
-! 
+!
 ! 4017 2019-06-06 12:16:46Z schwenkel
-! local_pf need INTENT(INOUT) attribute rather than INTENT(OUT). This is 
+! local_pf need INTENT(INOUT) attribute rather than INTENT(OUT). This is
 ! because INTENT(OUT) sets the array to not-defined. Especially for outputs that
-! are not defined everywhere, e.g. land-surface outputs, this will be 
-! problematic as NaN will be output.   
-! 
+! are not defined everywhere, e.g. land-surface outputs, this will be
+! problematic as NaN will be output.
+!
 ! 3987 2019-05-22 09:52:13Z kanani
 ! Introduce switchable DEBUG file output via debug_message routine
-! 
+!
 ! 3956 2019-05-07 12:32:52Z monakurppa
-! - Added calls for salsa_non_advective_processes and 
+! - Added calls for salsa_non_advective_processes and
 !   salsa_exchange_horiz_bounds
 ! - Moved the call for salsa_data_output_2d/3d before that of
@@ -46,21 +49,21 @@
 !   salsa output variable and encounters a segmentation fault for "Ntot" due
 !   to the shortoutput name
-! 
+!
 ! 3931 2019-04-24 16:34:28Z schwenkel
 ! Changed non_transport_physics to non_advective_processes
-! 
+!
 ! 3930 2019-04-24 14:57:18Z forkel
 ! Correct/complete module_interface introduction for chemistry model
 !
 ! 3887 2019 -04-12 08:47:41Z schwenkel
-! Changes related to global restructuring of location messages and introduction 
+! Changes related to global restructuring of location messages and introduction
 ! of additional debug messages
-!  
+!
 ! 3880 2019 -04-08 21:43:02Z knoop
 ! Add a call for salsa_prognostic_equations
-! 
+!
 ! 3840 2019-03-29 10:35:52Z knoop
 ! bugfix: intent of dummy arguments changed to inout
-! 
+!
 ! 3770 2019-02-28 11:22:32Z moh.hefny
 ! removed unused variables in module_interface_check_data_output_ts
@@ -68,56 +71,56 @@
 ! 3767 08:18:02Z raasch
 ! unused variable file_index removed from subroutine parameter list
-! 
+!
 ! 3766 2019-02-26 16:23:41Z raasch
 ! first argument removed from module_interface_rrd_*, statement added to avoid
 ! compiler warning about unused variable, file reformatted with respect to coding
 ! standards
-! 
+!
 ! 3762 2019-02-25 16:54:16Z suehring
 ! only pass required arguments to surface_data_output_rrd_local
-! 
+!
 ! 3747 2019-02-16 15:15:23Z gronemeier
 ! Call user_init_arrays
-! 
+!
 ! 3745 2019-02-15 18:57:56Z suehring
 ! Add indoor model
-! 
+!
 ! 3744 2019-02-15 18:38:58Z suehring
 ! Removed bio_check_parameters as the method is empty.
-! 
+!
 ! 3735 2019-02-12 09:52:40Z dom_dwd_user
-! Accepting variable j from check_parameters and passing it to 
+! Accepting variable j from check_parameters and passing it to
 ! bio_check_data_output
 ! Add required restart data for surface output module
-! 
+!
 ! 3731 2019-02-11 13:06:27Z suehring
 ! Add check_parameters routine for virtual measurements
-! 
+!
 ! 3711 2019-01-31 13:44:26Z knoop
 ! Introduced module_interface_init_checks for post-init checks
-! 
+!
 ! 3705 2019-01-29 19:56:39Z suehring
 ! Add last_actions for virtual measurements
-! 
+!
 ! 3704 2019-01-29 19:51:41Z suehring
 ! Some interface calls moved to module_interface + cleanup
-! 
+!
 ! 3684 2019-01-20 20:20:58Z knoop
 ! Bugfix: made unit intend INOUT
-! 
+!
 ! 3650 2019-01-04 13:01:33Z kanani
 ! Add restart routines for biometeorology
-! 
+!
 ! 3649 2019-01-02 16:52:21Z suehring
 ! Initialize strings, in order to avoid compiler warnings for non-initialized
 ! characters with intent(out) attribute
-! 
+!
 ! 3648 2019-01-02 16:35:46Z suehring
 ! Rename subroutines for surface-data output
-! 
+!
 ! 3641 2018-12-23 22:10:01Z knoop
 ! Initial implementation of the PALM module interface
 !
-! 
+!
 ! Description:
 ! ------------
@@ -136,4 +139,35 @@
 !-- load module-specific control parameters.
 !-- ToDo: move all of them to respective module or a dedicated central module
+
+    USE dynamics_mod, &
+        ONLY:  dynamics_parin, &
+               dynamics_check_parameters, &
+               dynamics_check_data_output_ts, &
+               dynamics_check_data_output_pr, &
+               dynamics_check_data_output, &
+               dynamics_init_masks, &
+               dynamics_define_netcdf_grid, &
+               dynamics_init_arrays, &
+               dynamics_init, &
+               dynamics_init_checks, &
+               dynamics_header, &
+               dynamics_actions, &
+               dynamics_non_advective_processes, &
+               dynamics_exchange_horiz, &
+               dynamics_prognostic_equations, &
+               dynamics_swap_timelevel, &
+               dynamics_3d_data_averaging, &
+               dynamics_data_output_2d, &
+               dynamics_data_output_3d, &
+               dynamics_statistics, &
+               dynamics_rrd_global, &
+               dynamics_rrd_local, &
+               dynamics_wrd_global, &
+               dynamics_wrd_local, &
+               dynamics_last_actions
+
+    USE turbulence_closure_mod, &
+        ONLY:  tcm_swap_timelevel
+
     USE control_parameters,                                                    &
         ONLY:  air_chemistry,                                                  &
@@ -213,6 +247,6 @@
               chem_rrd_local,                                                  &
               chem_wrd_local
-     
-    USE diagnostic_output_quantities_mod,                                      & 
+
+    USE diagnostic_output_quantities_mod,                                      &
         ONLY:  doq_3d_data_averaging,                                          &
                doq_check_data_output,                                          &
@@ -257,10 +291,10 @@
                im_data_output_3d,                                              &
                im_init
-               
+
     USE lagrangian_particle_model_mod,                                         &
         ONLY:  lpm_parin,                                                      &
                lpm_header,                                                     &
                lpm_check_parameters,                                           &
-               lpm_init_arrays,                                                &                              
+               lpm_init_arrays,                                                &
                lpm_init,                                                       &
                lpm_actions,                                                    &
@@ -269,5 +303,5 @@
                lpm_wrd_local,                                                  &
                lpm_wrd_global
-               
+
     USE land_surface_model_mod,                                                &
         ONLY:  lsm_parin,                                                      &
@@ -317,7 +351,7 @@
                ocean_rrd_local,                                                &
                ocean_wrd_local
-               
+
     USE particle_attributes,                                                   &
-        ONLY:  particle_advection               
+        ONLY:  particle_advection
 
     USE plant_canopy_model_mod,                                                &
@@ -394,4 +428,19 @@
                usm_rrd_local,                                                  &
                usm_wrd_local
+
+    USE virtual_measurement_mod,                                               &
+        ONLY:  vm_check_parameters,                                            &
+               vm_init,                                                        &
+               vm_last_actions,                                                &
+               vm_parin
+
+    USE wind_turbine_model_mod,                                                &
+        ONLY:  wtm_parin,                                                      &
+               wtm_check_parameters,                                           &
+               wtm_init_arrays,                                                &
+               wtm_init,                                                       &
+               wtm_actions,                                                    &
+               wtm_rrd_global,                                                 &
+               wtm_wrd_global
 
     USE user,                                                                  &
@@ -415,19 +464,4 @@
                user_wrd_local,                                                 &
                user_last_actions
-
-    USE virtual_measurement_mod,                                               &
-        ONLY:  vm_check_parameters,                                            &
-               vm_init,                                                        &
-               vm_last_actions,                                                &
-               vm_parin
-
-    USE wind_turbine_model_mod,                                                &
-        ONLY:  wtm_parin,                                                      &
-               wtm_check_parameters,                                           &
-               wtm_init_arrays,                                                &
-               wtm_init,                                                       &
-               wtm_actions,                                                    &
-               wtm_rrd_global,                                                 &
-               wtm_wrd_global
 
     IMPLICIT NONE
@@ -518,9 +552,9 @@
        MODULE PROCEDURE module_interface_non_advective_processes_ij
     END INTERFACE module_interface_non_advective_processes
-    
+
     INTERFACE module_interface_exchange_horiz
        MODULE PROCEDURE module_interface_exchange_horiz
     END INTERFACE module_interface_exchange_horiz
-    
+
     INTERFACE module_interface_prognostic_equations
        MODULE PROCEDURE module_interface_prognostic_equations
@@ -581,4 +615,6 @@
 
     IF ( debug_output )  CALL debug_message( 'reading module-specific parameters', 'start' )
+
+    CALL dynamics_parin
 
     CALL bio_parin
@@ -588,5 +624,5 @@
     CALL gust_parin
     CALL im_parin
-    CALL lpm_parin      
+    CALL lpm_parin
     CALL lsm_parin
     ! ToDo: create parin routine for large_scale_forcing and nudging (should be seperate modules or new module switch)
@@ -600,9 +636,10 @@
     CALL surface_data_output_parin
     CALL stg_parin
-    CALL user_parin ! ToDo: make user code a single Fortran module
     CALL usm_parin
     CALL vm_parin
     CALL wtm_parin
 
+    CALL user_parin
+
     IF ( debug_output )  CALL debug_message( 'reading module-specific parameters', 'end' )
 
@@ -620,4 +657,6 @@
 
     IF ( debug_output )  CALL debug_message( 'checking module-specific parameters', 'start' )
+
+    CALL dynamics_check_parameters
 
     IF ( bulk_cloud_model )     CALL bcm_check_parameters
@@ -625,5 +664,5 @@
     IF ( gust_module_enabled )  CALL gust_check_parameters
     IF ( indoor_model )         CALL im_check_parameters
-    IF ( particle_advection )   CALL lpm_check_parameters        
+    IF ( particle_advection )   CALL lpm_check_parameters
     IF ( land_surface )         CALL lsm_check_parameters
     IF ( large_scale_forcing  .OR.  nudging )  CALL lsf_nudging_check_parameters ! ToDo: create single module switch
@@ -639,4 +678,5 @@
     IF ( virtual_measurement )  CALL vm_check_parameters
     IF ( wind_turbine )         CALL wtm_check_parameters
+
     IF ( user_module_enabled )  CALL user_check_parameters
 
@@ -663,4 +703,6 @@
     IF ( debug_output )  CALL debug_message( 'checking module-specific data output ts', 'start' )
 
+    CALL dynamics_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit )
+
     IF ( radiation )  THEN
        CALL radiation_check_data_output_ts( dots_max, dots_num )
@@ -694,4 +736,6 @@
     IF ( debug_output )  CALL debug_message( 'checking module-specific data output pr', 'start' )
 
+    CALL dynamics_check_data_output_pr( variable, var_count, unit, dopr_unit )
+
     IF ( unit == 'illegal' .AND.  bulk_cloud_model )  THEN
        CALL bcm_check_data_output_pr( variable, var_count, unit, dopr_unit )
@@ -751,4 +795,6 @@
     IF ( debug_output )  CALL debug_message( 'checking module-specific data output 2d/3d', 'start' )
 
+    CALL dynamics_check_data_output( variable, unit )
+
     IF ( unit == 'illegal'  .AND.  biometeorology )  THEN
        CALL bio_check_data_output( variable, unit, i, j, ilen, k )
@@ -763,5 +809,5 @@
        CALL chem_check_data_output( variable, unit, i, ilen, k )
     ENDIF
-    
+
     IF ( unit == 'illegal' )  THEN
        CALL doq_check_data_output( variable, unit )
@@ -796,5 +842,5 @@
        CALL im_check_data_output( variable, unit )
     ENDIF
-   
+
     IF ( unit == 'illegal'  .AND.  urban_surface                      &
         .AND.  variable(1:4) == 'usm_' )  THEN  ! ToDo: remove aditional conditions
@@ -827,4 +873,6 @@
 
     IF ( debug_output )  CALL debug_message( 'initializing module-specific masks', 'start' )
+
+    CALL dynamics_init_masks( variable, unit )
 
     IF ( unit == 'illegal'  .AND.  air_chemistry                               &
@@ -897,8 +945,10 @@
     IF ( debug_output )  CALL debug_message( 'initializing module-specific arrays', 'start' )
 
+    CALL dynamics_init_arrays
+
     IF ( bulk_cloud_model    )  CALL bcm_init_arrays
     IF ( air_chemistry       )  CALL chem_init_arrays
     IF ( gust_module_enabled )  CALL gust_init_arrays
-    IF ( particle_advection  )  CALL lpm_init_arrays        
+    IF ( particle_advection  )  CALL lpm_init_arrays
     IF ( land_surface        )  CALL lsm_init_arrays
     IF ( ocean_mode          )  CALL ocean_init_arrays
@@ -907,4 +957,5 @@
     IF ( surface_output      )  CALL surface_data_output_init_arrays
     IF ( wind_turbine        )  CALL wtm_init_arrays
+
     IF ( user_module_enabled )  CALL user_init_arrays
 
@@ -924,4 +975,6 @@
 
     IF ( debug_output )  CALL debug_message( 'module-specific initialization', 'start' )
+
+    CALL dynamics_init
 
     IF ( biometeorology      )  CALL bio_init
@@ -931,5 +984,5 @@
     IF ( gust_module_enabled )  CALL gust_init
     IF ( indoor_model        )  CALL im_init
-    IF ( particle_advection  )  CALL lpm_init    
+    IF ( particle_advection  )  CALL lpm_init
     IF ( large_scale_forcing )  CALL lsf_init
     IF ( land_surface        )  CALL lsm_init
@@ -942,4 +995,5 @@
     IF ( wind_turbine        )  CALL wtm_init
     IF ( radiation           )  CALL radiation_init
+
     IF ( user_module_enabled )  CALL user_init
 
@@ -960,4 +1014,6 @@
     IF ( debug_output )  CALL debug_message( 'module-specific post-initialization checks', 'start' )
 
+    CALL dynamics_init_checks
+
     IF ( biometeorology      )  CALL bio_init_checks
 
@@ -980,4 +1036,6 @@
 
     IF ( debug_output )  CALL debug_message( 'module-specific header output', 'start' )
+
+    CALL dynamics_header( io )
 
     IF ( biometeorology      )  CALL bio_header ( io )
@@ -986,5 +1044,5 @@
     IF ( virtual_flight      )  CALL flight_header( io )
     IF ( gust_module_enabled )  CALL gust_header( io )
-    IF ( particle_advection  )  CALL lpm_header( io )    
+    IF ( particle_advection  )  CALL lpm_header( io )
     IF ( land_surface        )  CALL lsm_header( io )
     IF ( large_scale_forcing )  CALL lsf_nudging_header( io )
@@ -996,4 +1054,5 @@
     IF ( calculate_spectra   )  CALL spectra_header( io )
     IF ( syn_turb_gen        )  CALL stg_header( io )
+
     IF ( user_module_enabled )  CALL user_header( io )
 
@@ -1014,12 +1073,14 @@
     CHARACTER (LEN=*), INTENT(IN) ::  location !< call location string
 
+    CALL dynamics_actions( location )
 
     IF ( bulk_cloud_model    )  CALL bcm_actions( location )
     IF ( air_chemistry       )  CALL chem_actions( location )
     IF ( gust_module_enabled )  CALL gust_actions( location )
-    IF ( particle_advection  )  CALL lpm_actions( location )    
+    IF ( particle_advection  )  CALL lpm_actions( location )
     IF ( ocean_mode          )  CALL ocean_actions( location )
     IF ( salsa               )  CALL salsa_actions( location )
     IF ( wind_turbine        )  CALL wtm_actions( location )
+
     IF ( user_module_enabled )  CALL user_actions( location )
 
@@ -1040,4 +1101,5 @@
     CHARACTER (LEN=*), INTENT(IN) ::  location  !< call location string
 
+    CALL dynamics_actions( i, j, location )
 
     IF ( bulk_cloud_model    )  CALL bcm_actions( i, j, location )
@@ -1047,4 +1109,5 @@
     IF ( salsa               )  CALL salsa_actions( i, j, location )
     IF ( wind_turbine        )  CALL wtm_actions( i, j, location )
+
     IF ( user_module_enabled )  CALL user_actions( i, j, location )
 
@@ -1058,10 +1121,12 @@
 !> Compute module-specific non_advective_processes (vector-optimized)
 !------------------------------------------------------------------------------!
- SUBROUTINE module_interface_non_advective_processes()
-
-
-    IF ( bulk_cloud_model    )  CALL bcm_non_advective_processes()
-    IF ( air_chemistry       )  CALL chem_non_advective_processes()
-    IF ( salsa               )  CALL salsa_non_advective_processes()
+ SUBROUTINE module_interface_non_advective_processes
+
+
+    CALL dynamics_non_advective_processes
+
+    IF ( bulk_cloud_model    )  CALL bcm_non_advective_processes
+    IF ( air_chemistry       )  CALL chem_non_advective_processes
+    IF ( salsa               )  CALL salsa_non_advective_processes
 
 
@@ -1080,4 +1145,5 @@
     INTEGER(iwp), INTENT(IN) ::  j            !< grid index in y-direction
 
+    CALL dynamics_non_advective_processes( i, j )
 
     IF ( bulk_cloud_model    )  CALL bcm_non_advective_processes( i, j )
@@ -1087,18 +1153,20 @@
 
  END SUBROUTINE module_interface_non_advective_processes_ij
- 
-!------------------------------------------------------------------------------!
-! Description:
-! ------------
-!> Exchange horiz for module-specific quantities 
-!------------------------------------------------------------------------------!
- SUBROUTINE module_interface_exchange_horiz()
+
+!------------------------------------------------------------------------------!
+! Description:
+! ------------
+!> Exchange horiz for module-specific quantities
+!------------------------------------------------------------------------------!
+ SUBROUTINE module_interface_exchange_horiz
 
 
     IF ( debug_output_timestep )  CALL debug_message( 'module-specific exchange_horiz', 'start' )
 
-    IF ( bulk_cloud_model    )  CALL bcm_exchange_horiz()
-    IF ( air_chemistry       )  CALL chem_exchange_horiz_bounds()
-    IF ( salsa               )  CALL salsa_exchange_horiz_bounds()
+    CALL dynamics_exchange_horiz
+
+    IF ( bulk_cloud_model    )  CALL bcm_exchange_horiz
+    IF ( air_chemistry       )  CALL chem_exchange_horiz_bounds
+    IF ( salsa               )  CALL salsa_exchange_horiz_bounds
 
     IF ( debug_output_timestep )  CALL debug_message( 'module-specific exchange_horiz', 'end' )
@@ -1113,12 +1181,14 @@
 !> Compute module-specific prognostic_equations (vector-optimized)
 !------------------------------------------------------------------------------!
- SUBROUTINE module_interface_prognostic_equations()
-
-
-    IF ( bulk_cloud_model    )  CALL bcm_prognostic_equations()
-    IF ( air_chemistry       )  CALL chem_prognostic_equations()
-    IF ( gust_module_enabled )  CALL gust_prognostic_equations()
-    IF ( ocean_mode          )  CALL ocean_prognostic_equations()
-    IF ( salsa               )  CALL salsa_prognostic_equations()
+ SUBROUTINE module_interface_prognostic_equations
+
+
+    CALL dynamics_prognostic_equations
+
+    IF ( bulk_cloud_model    )  CALL bcm_prognostic_equations
+    IF ( air_chemistry       )  CALL chem_prognostic_equations
+    IF ( gust_module_enabled )  CALL gust_prognostic_equations
+    IF ( ocean_mode          )  CALL ocean_prognostic_equations
+    IF ( salsa               )  CALL salsa_prognostic_equations
 
 
@@ -1139,4 +1209,5 @@
     INTEGER(iwp), INTENT(IN) ::  tn           !< task number of openmp task
 
+    CALL dynamics_prognostic_equations( i, j, i_omp_start, tn )
 
     IF ( bulk_cloud_model    )  CALL bcm_prognostic_equations( i, j, i_omp_start, tn )
@@ -1162,4 +1233,7 @@
 
     IF ( debug_output_timestep )  CALL debug_message( 'module-specific swap timelevel', 'start' )
+
+    CALL dynamics_swap_timelevel( swap_mode )
+    CALL tcm_swap_timelevel( swap_mode )
 
     IF ( bulk_cloud_model    )  CALL bcm_swap_timelevel( swap_mode )
@@ -1192,8 +1266,10 @@
     IF ( debug_output_timestep )  CALL debug_message( 'module-specific 3d data averaging', 'start' )
 
+    CALL dynamics_3d_data_averaging( mode, variable )
+
     IF ( biometeorology      )  CALL bio_3d_data_averaging( mode, variable )
     IF ( bulk_cloud_model    )  CALL bcm_3d_data_averaging( mode, variable )
     IF ( air_chemistry       )  CALL chem_3d_data_averaging( mode, variable )
-    CALL doq_3d_data_averaging( mode, variable )
+    CALL doq_3d_data_averaging( mode, variable )  ! ToDo: this seems to be not according to the design
     IF ( gust_module_enabled )  CALL gust_3d_data_averaging( mode, variable )
     IF ( land_surface        )  CALL lsm_3d_data_averaging( mode, variable )
@@ -1202,4 +1278,5 @@
     IF ( salsa               )  CALL salsa_3d_data_averaging( mode, variable )
     IF ( urban_surface       )  CALL usm_3d_data_averaging( mode, variable )
+
     IF ( user_module_enabled )  CALL user_3d_data_averaging( mode, variable )
 
@@ -1234,4 +1311,8 @@
     IF ( debug_output_timestep )  CALL debug_message( 'module-specific 2d data output', 'start' )
 
+    CALL dynamics_data_output_2d(                                                  &
+               av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do, fill_value &
+            )
+
     IF ( .NOT. found  .AND.  biometeorology )  THEN
        CALL bio_data_output_2d(                                                &
@@ -1251,5 +1332,5 @@
             )
     ENDIF
-    
+
     IF ( .NOT. found )  THEN
        CALL doq_output_2d(                                                     &
@@ -1323,4 +1404,7 @@
     IF ( debug_output_timestep )  CALL debug_message( 'module-specific 3d data output', 'start' )
 
+    CALL dynamics_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
+    resorted = .FALSE.
+
     IF ( .NOT. found  .AND.  biometeorology )  THEN
        CALL bio_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
@@ -1337,15 +1421,15 @@
        resorted = .TRUE.
     ENDIF
-    
+
     IF ( .NOT. found )  THEN
        CALL doq_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
        resorted = .TRUE.
     ENDIF
-    
+
     IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
        CALL gust_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
        resorted = .TRUE.
     ENDIF
-   
+
     IF ( .NOT. found  .AND.  indoor_model )  THEN
        CALL im_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
@@ -1400,6 +1484,9 @@
     IF ( debug_output_timestep )  CALL debug_message( 'module-specific statistics', 'start' )
 
+    CALL dynamics_statistics( mode, sr, tn )
+
     IF ( gust_module_enabled )  CALL gust_statistics( mode, sr, tn, dots_max )
     IF ( air_chemistry       )  CALL chem_statistics( mode, sr, tn )
+
     IF ( user_module_enabled )  CALL user_statistics( mode, sr, tn )
 
@@ -1422,4 +1509,6 @@
 
     IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'start' )
+
+    CALL dynamics_rrd_global( found ) ! ToDo: change interface to pass variable
 
     IF ( .NOT. found )  CALL bio_rrd_global( found ) ! ToDo: change interface to pass variable
@@ -1427,9 +1516,10 @@
     IF ( .NOT. found )  CALL flight_rrd_global( found ) ! ToDo: change interface to pass variable
     IF ( .NOT. found )  CALL gust_rrd_global( found ) ! ToDo: change interface to pass variable
-    IF ( .NOT. found )  CALL lpm_rrd_global( found ) ! ToDo: change interface to pass variable        
+    IF ( .NOT. found )  CALL lpm_rrd_global( found ) ! ToDo: change interface to pass variable
     IF ( .NOT. found )  CALL ocean_rrd_global( found ) ! ToDo: change interface to pass variable
     IF ( .NOT. found )  CALL stg_rrd_global ( found ) ! ToDo: change interface to pass variable
     IF ( .NOT. found )  CALL wtm_rrd_global( found ) ! ToDo: change interface to pass variable
     IF ( .NOT. found )  CALL surface_data_output_rrd_global( found )
+
     IF ( .NOT. found )  CALL user_rrd_global( found ) ! ToDo: change interface to pass variable
 
@@ -1449,4 +1539,6 @@
 
     IF ( debug_output )  CALL debug_message( 'module-specific write global restart data', 'start' )
+
+    CALL dynamics_wrd_global
 
     IF ( biometeorology )       CALL bio_wrd_global
@@ -1458,4 +1550,5 @@
     IF ( wind_turbine )         CALL wtm_wrd_global
     IF ( surface_output )       CALL surface_data_output_wrd_global
+
     IF ( user_module_enabled )  CALL user_wrd_global
 
@@ -1504,4 +1597,13 @@
     IF ( debug_output )  CALL debug_message( 'module-specific read local restart data', 'start' )
 
+    CALL dynamics_rrd_local(                                                   &
+           map_index,                                                          &
+           nxlf, nxlc, nxl_on_file,                                            &
+           nxrf, nxrc, nxr_on_file,                                            &
+           nynf, nync, nyn_on_file,                                            &
+           nysf, nysc, nys_on_file,                                            &
+           tmp_2d, tmp_3d, found                                               &
+        ) ! ToDo: change interface to pass variable
+
     IF ( .NOT. found )  CALL bio_rrd_local(                                    &
                                found                                           &
@@ -1525,5 +1627,5 @@
                                tmp_3d, found                                   &
                             ) ! ToDo: change interface to pass variable
-                            
+
 !     IF ( .NOT. found )  CALL doq_rrd_local(                                    &
 !                                map_index,                                      &
@@ -1600,5 +1702,5 @@
 !-- Surface data do not need overlap data, so do not pass these information.
     IF ( .NOT. found )  CALL surface_data_output_rrd_local( found )
-                           
+
     IF ( .NOT. found )  CALL user_rrd_local(                                   &
                                map_index,                                      &
@@ -1626,4 +1728,6 @@
     IF ( debug_output )  CALL debug_message( 'module-specific write local restart data', 'start' )
 
+    CALL dynamics_wrd_local
+
     IF ( biometeorology )       CALL bio_wrd_local
     IF ( bulk_cloud_model )     CALL bcm_wrd_local
@@ -1631,5 +1735,5 @@
     CALL doq_wrd_local
     IF ( gust_module_enabled )  CALL gust_wrd_local
-    IF ( particle_advection )   CALL lpm_wrd_local    
+    IF ( particle_advection )   CALL lpm_wrd_local
     IF ( land_surface )         CALL lsm_wrd_local
     IF ( ocean_mode )           CALL ocean_wrd_local
@@ -1638,4 +1742,5 @@
     IF ( urban_surface )        CALL usm_wrd_local
     IF ( surface_output )       CALL surface_data_output_wrd_local
+
     IF ( user_module_enabled )  CALL user_wrd_local
 
@@ -1656,5 +1761,8 @@
     IF ( debug_output )  CALL debug_message( 'module-specific last actions', 'start' )
 
+    CALL dynamics_last_actions
+
     IF ( virtual_measurement )  CALL vm_last_actions
+
     IF ( user_module_enabled )  CALL user_last_actions
 
