Index: palm/trunk/SCRIPTS/.mrun.config.csc_sisu
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.csc_sisu	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.csc_sisu	(revision 1241)
@@ -77,4 +77,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.cuhk
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.cuhk	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.cuhk	(revision 1241)
@@ -97,4 +97,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.default
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.default	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.default	(revision 1241)
@@ -98,4 +98,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.forwind
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.forwind	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.forwind	(revision 1241)
@@ -112,4 +112,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT     _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT     _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f:rec  $base_data/$fname/RESTART   _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART   _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.hayaka
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.hayaka	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.hayaka	(revision 1241)
@@ -69,4 +69,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.hlrnIII
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.hlrnIII	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.hlrnIII	(revision 1241)
@@ -30,17 +30,15 @@
 # appropriately, if you are using a different compiler / MPI-Version.
 #
-%tmp_user_catalog    /gfs1/work/<replace by your HLRN-III username>         lccrayb parallel
-%tmp_data_catalog    /gfs1/work/<replace by your HLRN-III username>         lccrayb parallel
-%compiler_name       ftn                         lccrayb parallel
-%compiler_name_ser   ftn                         lccrayb parallel
+%tmp_user_catalog    /gfs1/work/<replace by your username on hlrnIII>     lccrayb parallel
+%tmp_data_catalog    /gfs1/work/<replace by your username on hlrnIII>     lccrayb parallel
+%compiler_name       crayftn                                              lccrayb parallel
+%compiler_name_ser   crayftn                                              lccrayb parallel
 %cpp_options         -e:Z:-DMPI_REAL=MPI_DOUBLE_PRECISION:-DMPI_2REAL=MPI_2DOUBLE_PRECISION:-D__netcdf:-D__netcdf4:-D__fftw   lccrayb parallel
-%mopts               -j:4                        lccrayb parallel
-%fopts               -em:-s:real64:-O3:-hnoomp:-hfp3:-hdynamic          lccrayb parallel
-%lopts               -em:-s:real64:-O3:-hnoomp:-hfp3:-hdynamic:-dynamic lccrayb parallel
-%remote_username     <replace by your HLRN-III username>                    lccrayb parallel
-%memory              1500                        lccrayb parallel
-%login_init_cmd      source:$MODULESHOME/init/ksh lccrayb parallel
-%modules             fftw:cray-netcdf            lccrayb parallel
-#%create_executable_for_batch  true               lccrayb parallel
+%mopts               -j:4                                                 lccrayb parallel
+%fopts               -em:-s:real64:-O3:-hnoomp:-hfp3                      lccrayb parallel
+%lopts               -em:-s:real64:-O3:-hnoomp:-hfp3                      lccrayb parallel
+%remote_username     niksiraa                                             lccrayb parallel
+%memory              1500                                                 lccrayb parallel
+%modules             fftw:netcdf                                          lccrayb parallel
 #             
 %write_binary        true                             restart
@@ -74,4 +72,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.ibmh
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.ibmh	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.ibmh	(revision 1241)
@@ -61,4 +61,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.imuk
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.imuk	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.imuk	(revision 1241)
@@ -84,4 +84,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.imuk_gpu
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.imuk_gpu	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.imuk_gpu	(revision 1241)
@@ -84,4 +84,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.imuk_hlrn
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.imuk_hlrn	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.imuk_hlrn	(revision 1241)
@@ -148,4 +148,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.imuk_ice2_netcdf4
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.imuk_ice2_netcdf4	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.imuk_ice2_netcdf4	(revision 1241)
@@ -93,4 +93,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.kiaps
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.kiaps	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.kiaps	(revision 1241)
@@ -70,4 +70,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.lcxe6
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.lcxe6	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.lcxe6	(revision 1241)
@@ -80,4 +80,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.riam
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.riam	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.riam	(revision 1241)
@@ -79,4 +79,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.tatara
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.tatara	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.tatara	(revision 1241)
@@ -68,4 +68,6 @@
 PARIN                    in:job        d3f      $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f  $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f      $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf     $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/.mrun.config.yonsei2011
===================================================================
--- palm/trunk/SCRIPTS/.mrun.config.yonsei2011	(revision 1240)
+++ palm/trunk/SCRIPTS/.mrun.config.yonsei2011	(revision 1241)
@@ -81,4 +81,6 @@
 PARIN                    in:job        d3f   $base_data/$fname/INPUT    _p3df
 TOPOGRAPHY_DATA          in:locopt     d3#:d3f   $base_data/$fname/INPUT    _topo
+NUDGING_DATA             in:locopt     d3#:d3f  $base_data/$fname/INPUT    _nudge
+LSF_DATA                 in:locopt     d3#:d3f  $base_data/$fname/INPUT    _lsf
 BININ                    in:loc:flpe   d3f:rec   $base_data/$fname/RESTART  _d3d
 PARTICLE_RESTART_DATA_IN in:loc:flpe   prtf  $base_data/$fname/RESTART  _rprt
Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 1240)
+++ palm/trunk/SCRIPTS/mrun	(revision 1241)
@@ -22,5 +22,6 @@
 # Current revisions:
 # ------------------
-# 
+# Enable use of nudging input and input of large scale forcing from 
+# external files
 #
 # Former revisions:
@@ -2352,5 +2353,5 @@
     tmp_check=${working_directory}/tmp_check
 
-       # GET TOPOGRAPHY PARAMETER FILE SUFFIX (USUALLY "_P3DF"). THIS FILE MIGHT IS
+       # GET TOPOGRAPHY PARAMETER FILE SUFFIX (USUALLY "_TOPO"). THIS FILE IS
        # NOT NECESSARILY REQUIRED
     line=""
@@ -2372,7 +2373,47 @@
     fi
 
+       # GET NUDGING PARAMETER FILE SUFFIX (USUALLY "_NUDGE"). THIS FILE IS
+       # NOT NECESSARILY REQUIRED
+    line=""
+    found=false
+    grep  "NUDGING_DATA" $config_file  >  $tmp_check
+    while read line1
+    do
+       line="$line1"
+       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
+       then
+          nudge_suffix=`echo $line | tr -s " " | cut -d" " -s -f5`
+          found=true
+       fi
+    done < $tmp_check
+
+    if [[ $found = false ]]
+    then
+       printf "\n  +++ no NUDGING list entry found in the configuration file."
+    fi
+
+       # GET LARGE SCALE FORCING PARAMETER FILE SUFFIX (USUALLY "_LSF"). THIS FILE IS
+       # NOT NECESSARILY REQUIRED
+    line=""
+    found=false
+    grep  "LSF_DATA" $config_file  >  $tmp_check
+    while read line1
+    do
+       line="$line1"
+       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
+       then
+          lsf_suffix=`echo $line | tr -s " " | cut -d" " -s -f5`
+          found=true
+       fi
+    done < $tmp_check
+
+    if [[ $found = false ]]
+    then
+       printf "\n  +++ no LSF list entry found in the configuration file."
+    fi
+
     rm -rf ${working_directory}/tmp_check
 
-       # CHECK IF THE A P3DF FILE MUST BE CHECKED
+       # CHECK IF THE P3DF FILE MUST BE CHECKED
     for  item  in  $input_list
     do
@@ -2520,4 +2561,16 @@
           # WHICH REQUIRE SUFFICIENT MEMORY
        ulimit -s unlimited          
+    fi
+
+    if [[ -f ${pathname}/${fname}${nudge_suffix} && $skip_check == false ]]
+    then
+       printf "\n  *** adding nudging data"
+       cp ${pathname}/${fname}${nudge_suffix} ./NUDGING_DATA       
+    fi
+
+    if [[ -f ${pathname}/${fname}${lsf_suffix} && $skip_check == false ]]
+    then
+       printf "\n  *** adding large scale forcing data"
+       cp ${pathname}/${fname}${lsf_suffix} ./LSF_DATA        
     fi
 
Index: palm/trunk/SOURCE/Makefile
===================================================================
--- palm/trunk/SOURCE/Makefile	(revision 1240)
+++ palm/trunk/SOURCE/Makefile	(revision 1241)
@@ -20,5 +20,5 @@
 # Current revisions:
 # ------------------
-# 
+# +nudging, ls_forcing
 #
 # Former revisions:
@@ -158,6 +158,7 @@
 	lpm_set_attributes.f90 lpm_sort_arrays.f90 \
 	lpm_write_exchange_statistics.f90 lpm_write_restart_file.f90 \
-	message.f90 microphysics.f90 modules.f90 netcdf.f90 package_parin.f90 \
-	palm.f90 parin.f90 plant_canopy_model.f90 poisfft.f90 \
+        ls_forcing.f90 \
+	message.f90 microphysics.f90 modules.f90 netcdf.f90 nudging.f90 \
+        package_parin.f90 palm.f90 parin.f90 plant_canopy_model.f90 poisfft.f90 \
 	poismg.f90 prandtl_fluxes.f90 pres.f90 print_1d.f90 \
 	production_e.f90 prognostic_equations.f90 random_function.f90 \
@@ -265,5 +266,5 @@
 inflow_turbulence.o: modules.o
 init_1d_model.o: modules.o
-init_3d_model.o: modules.o random_function.o advec_ws.o
+init_3d_model.o: modules.o random_function.o advec_ws.o ls_forcing.o
 init_advec.o: modules.o
 init_cloud_physics.o: modules.o
@@ -303,10 +304,12 @@
 lpm_write_exchange_statistics.o: modules.o
 lpm_write_restart_file.o: modules.o
+ls_forcing.o: modules.o
 message.o: modules.o
 microphysics.o: modules.o
 modules.o: modules.f90
 netcdf.o: modules.o
+nudging.o: modules.o
 package_parin.o: modules.o
-palm.o: modules.o
+palm.o: modules.o ls_forcing.o nudging.o
 parin.o: modules.o
 plant_canopy_model.o: modules.o
@@ -322,5 +325,5 @@
 	diffusion_e.o diffusion_s.o diffusion_u.o diffusion_v.o diffusion_w.o \
 	eqn_state_seawater.o impact_of_latent_heat.o microphysics.o \
-        plant_canopy_model.o production_e.o subsidence.o user_actions.o
+        nudging.o plant_canopy_model.o production_e.o subsidence.o user_actions.o
 random_gauss.o: random_function.o
 read_3d_binary.o: modules.o random_function.o
@@ -336,5 +339,5 @@
 temperton_fft.o: modules.o
 time_integration.o: modules.o advec_ws.o buoyancy.o interaction_droplets_ptq.o \
-	production_e.o prognostic_equations.o user_actions.o
+	ls_forcing.o production_e.o prognostic_equations.o user_actions.o
 timestep.o: modules.o
 timestep_scheme_steering.o: modules.o
Index: palm/trunk/SOURCE/boundary_conds.f90
===================================================================
--- palm/trunk/SOURCE/boundary_conds.f90	(revision 1240)
+++ palm/trunk/SOURCE/boundary_conds.f90	(revision 1241)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! Adjust ug and vg at each timestep in case of large_scale_forcing
 !  
 ! Former revisions:
@@ -147,4 +147,8 @@
         u_p(nzt+1,:,:) = u_init(nzt+1)
         v_p(nzt+1,:,:) = v_init(nzt+1)
+        IF ( large_scale_forcing) THEN
+           u_p(nzt+1,:,:) = ug(nzt+1)
+           v_p(nzt+1,:,:) = vg(nzt+1)
+        END IF
        !$acc end kernels
     ELSE
Index: palm/trunk/SOURCE/buoyancy.f90
===================================================================
--- palm/trunk/SOURCE/buoyancy.f90	(revision 1240)
+++ palm/trunk/SOURCE/buoyancy.f90	(revision 1241)
@@ -20,4 +20,6 @@
 ! Currrent revisions:
 ! ------------------
+! Generalize calc_mean_profile for wider use: use additional steering 
+! character loc
 !
 !
@@ -344,5 +346,5 @@
 
 
-    SUBROUTINE calc_mean_profile( var, pr )
+    SUBROUTINE calc_mean_profile( var, pr, loc )
 
 !------------------------------------------------------------------------------!
@@ -363,4 +365,5 @@
 
        INTEGER ::  i, j, k, omp_get_thread_num, pr, tn
+       CHARACTER (LEN=*) ::  loc
 #if defined( __nopointer )
        REAL, DIMENSION(:,:,:) ::  var
@@ -414,5 +417,22 @@
        ENDIF
 
-       ref_state(:)  = hom(:,1,pr,0)   ! this is used in the buoyancy term
+       SELECT CASE ( loc )
+
+          CASE ( 'time_int' )
+
+             ref_state(:)  = hom(:,1,pr,0)   ! this is used in the buoyancy term
+
+
+          CASE ( 'nudging' )
+             !nothing to be done
+
+
+          CASE DEFAULT
+             message_string = 'unknown location "' // loc // '"'
+             CALL message( 'calc_mean_profile', 'PA0379', 1, 2, 0, 6, 0 )
+
+       END SELECT
+
+
 
     END SUBROUTINE calc_mean_profile
Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 1240)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 1241)
@@ -20,5 +20,8 @@
 ! Current revisions:
 ! -----------------
-!
+! output for profiles of ug and vg added
+! set surface_heatflux and surface_waterflux also in dependence on 
+! large_scale_forcing
+! checks for nudging and large scale forcing from external file
 !
 ! Former revisions:
@@ -311,4 +314,5 @@
     USE statistics
     USE subsidence_mod
+    USE statistics
     USE transpose_indices
 
@@ -1606,5 +1610,14 @@
     ENDIF
 
-    IF ( surface_heatflux == 9999999.9 )  constant_heatflux     = .FALSE.
+    IF ( surface_heatflux == 9999999.9  .AND.  .NOT. large_scale_forcing )  THEN
+        constant_heatflux     = .FALSE.
+    ELSE
+        constant_heatflux     = .TRUE.
+        IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. &
+               large_scale_forcing ) THEN
+           surface_heatflux      = shf_surf(1)
+        ENDIF
+    ENDIF
+
     IF ( top_heatflux     == 9999999.9 )  constant_top_heatflux = .FALSE.
 
@@ -1726,5 +1739,14 @@
        ENDIF
 
-       IF ( surface_waterflux == 9999999.9 )  constant_waterflux = .FALSE.
+       IF ( surface_waterflux == 9999999.9  .AND.  &
+                             .NOT. large_scale_forcing )  THEN
+           constant_waterflux     = .FALSE.
+       ELSE
+           constant_waterflux     = .TRUE.
+           IF ( TRIM( initializing_actions ) /= 'read_restart_data' .AND. &
+               large_scale_forcing ) THEN 
+              surface_waterflux      = qsws_surf(1)
+           ENDIF
+       ENDIF
 
 !
@@ -2666,4 +2688,14 @@
              ENDIF
 
+          CASE ( 'ug' )
+             dopr_index(i) = 78
+             dopr_unit(i)  = 'm/s'
+             hom(:,2,78,:) = SPREAD( zu, 2, statistic_regions+1 )
+
+          CASE ( 'vg' )
+             dopr_index(i) = 79
+             dopr_unit(i)  = 'm/s'
+             hom(:,2,79,:) = SPREAD( zu, 2, statistic_regions+1 )
+
           CASE DEFAULT
 
@@ -3597,4 +3629,37 @@
 
 !
+!-- 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. topography /= 'flat' )  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
+!
 !-- Check &userpar parameters
     CALL user_check_parameters
Index: palm/trunk/SOURCE/flow_statistics.f90
===================================================================
--- palm/trunk/SOURCE/flow_statistics.f90	(revision 1240)
+++ palm/trunk/SOURCE/flow_statistics.f90	(revision 1241)
@@ -21,5 +21,5 @@
 ! Current revisions:
 ! -----------------
-!
+! Output of ug and vg
 !
 ! Former revisions:
@@ -563,4 +563,5 @@
           ENDDO
        ENDIF
+
 !
 !--    Horizontally averaged profiles of the vertical fluxes
@@ -886,5 +887,4 @@
 
        ENDIF
-
 
 !
@@ -1156,4 +1156,6 @@
        hom(:,1,76,sr) = sums(:,76)     ! prr (precipitation rate)
                                        ! 77 is initial density profile
+       hom(:,1,78,sr) = ug             ! ug
+       hom(:,1,79,sr) = vg             ! vg
 
        hom(:,1,pr_palm-1,sr) = sums(:,pr_palm-1)
@@ -2774,4 +2776,6 @@
        hom(:,1,76,sr) = sums(:,76)     ! prr (precipitation rate)
                                        ! 77 is initial density profile
+       hom(:,1,78,sr) = ug             ! ug
+       hom(:,1,79,sr) = vg             ! vg
 
        hom(:,1,pr_palm-1,sr) = sums(:,pr_palm-1)
Index: palm/trunk/SOURCE/header.f90
===================================================================
--- palm/trunk/SOURCE/header.f90	(revision 1240)
+++ palm/trunk/SOURCE/header.f90	(revision 1241)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! output for nudging + large scale forcing from external file
 !
 ! Former revisions:
@@ -428,4 +428,12 @@
         WRITE ( io, 154 )
     ENDIF
+    IF ( nudging )  THEN
+        WRITE ( io, 155 )
+        WRITE ( io, 156 )
+    ENDIF
+    IF ( large_scale_forcing )  THEN
+        WRITE ( io, 157 )
+        WRITE ( io, 158 )
+    ENDIF
     WRITE ( io, 99 )
 
@@ -706,9 +714,17 @@
        WRITE ( io, 303 )
        IF ( constant_heatflux )  THEN
-          WRITE ( io, 306 )  surface_heatflux
+          IF ( large_scale_forcing .AND. lsf_surf ) THEN
+             WRITE ( io, 306 )  shf(0,0)
+          ELSE
+             WRITE ( io, 306 )  surface_heatflux
+          ENDIF
           IF ( random_heatflux )  WRITE ( io, 307 )
        ENDIF
        IF ( humidity  .AND.  constant_waterflux )  THEN
-          WRITE ( io, 311 ) surface_waterflux
+          IF ( large_scale_forcing .AND. lsf_surf ) THEN
+             WRITE ( io, 311 ) qsws(0,0)
+          ELSE
+             WRITE ( io, 311 ) surface_waterflux
+          ENDIF
        ENDIF
        IF ( passive_scalar  .AND.  constant_waterflux )  THEN
@@ -1288,6 +1304,10 @@
     ENDDO
 
-    WRITE ( io, 423 )  TRIM( coordinates ), TRIM( ugcomponent ), &
-                       TRIM( gradients ), TRIM( slices )
+    IF ( .NOT. large_scale_forcing ) THEN
+       WRITE ( io, 423 )  TRIM( coordinates ), TRIM( ugcomponent ), &
+                          TRIM( gradients ), TRIM( slices )
+    ELSE
+       WRITE ( io, 429 ) 
+    ENDIF
 
 !-- Profile of the geostrophic wind (component vg)
@@ -1320,6 +1340,8 @@
     ENDDO
 
-    WRITE ( io, 424 )  TRIM( coordinates ), TRIM( vgcomponent ), &
-                       TRIM( gradients ), TRIM( slices )
+    IF ( .NOT. large_scale_forcing ) THEN
+       WRITE ( io, 424 )  TRIM( coordinates ), TRIM( vgcomponent ), &
+                          TRIM( gradients ), TRIM( slices )
+    ENDIF
 
 !
@@ -1357,6 +1379,10 @@
     ENDDO
 
-    WRITE ( io, 420 )  TRIM( coordinates ), TRIM( temperatures ), &
-                       TRIM( gradients ), TRIM( slices )
+    IF ( .NOT. nudging ) THEN
+       WRITE ( io, 420 )  TRIM( coordinates ), TRIM( temperatures ), &
+                          TRIM( gradients ), TRIM( slices )
+    ELSE
+       WRITE ( io, 428 ) 
+    ENDIF
 
 !
@@ -1392,6 +1418,8 @@
 
        IF ( humidity )  THEN
-          WRITE ( io, 421 )  TRIM( coordinates ), TRIM( temperatures ), &
-                             TRIM( gradients ), TRIM( slices )
+          IF ( .NOT. nudging ) THEN
+             WRITE ( io, 421 )  TRIM( coordinates ), TRIM( temperatures ), &
+                                TRIM( gradients ), TRIM( slices )
+          ENDIF
        ELSE
           WRITE ( io, 422 )  TRIM( coordinates ), TRIM( temperatures ), &
@@ -1705,4 +1733,9 @@
                   'prognostic equation for')
 154 FORMAT ('     the potential temperature')
+155 FORMAT (' --> Nudging is used - initial profiles for u, v, pt and q ',& 
+                  'correspond to the')
+156 FORMAT ('     first profiles in NUDGING_DATA')
+157 FORMAT (' --> Large scale forcing from external file (LSF_DATA) is used: ')
+158 FORMAT ('     prescribed surfaces fluxes and geostrophic wind components')
 200 FORMAT (//' Run time and time step information:'/ &
              ' ----------------------------------'/)
@@ -1957,4 +1990,8 @@
 427 FORMAT (/'    Initial wind profiles (u,v) are interpolated from given'// &
                   ' profiles')
+428 FORMAT (/'    Initial profiles (u, v, pt, q) are taken from file '/ &
+             '    NUDGING_DATA')
+429 FORMAT (/'    Geostrophic wind profiles (ug, vg) are are taken from file '/ &
+             '    LSF_DATA_DATA')
 430 FORMAT (//' Cloud physics quantities / methods:'/ &
               ' ----------------------------------'/)
Index: palm/trunk/SOURCE/init_3d_model.f90
===================================================================
--- palm/trunk/SOURCE/init_3d_model.f90	(revision 1240)
+++ palm/trunk/SOURCE/init_3d_model.f90	(revision 1241)
@@ -23,5 +23,6 @@
 ! Current revisions:
 ! ------------------
-!
+! Overwrite initial profiles in case of nudging
+! Inititialize shf and qsws in case of large_scale_forcing
 !
 ! Former revisions:
@@ -260,4 +261,5 @@
     USE indices
     USE interfaces
+    USE ls_forcing_mod
     USE model_1d
     USE netcdf_control
@@ -780,4 +782,20 @@
        ELSEIF ( INDEX(initializing_actions, 'set_constant_profiles') /= 0 ) &
        THEN
+
+!
+!--       Overwrite initial profiles in case of nudging
+          IF ( nudging ) THEN
+             pt_init = ptnudge(:,1)
+             u_init  = unudge(:,1)
+             v_init  = vnudge(:,1)
+             IF ( humidity  .OR.  passive_scalar )  THEN
+                q_init = qnudge(:,1)
+             ENDIF
+
+             WRITE( message_string, * ) 'Initial profiles of u, v and ', &
+                 'scalars from NUDGING_DATA are used.'
+             CALL message( 'init_3d_model', 'PA0370', 0, 0, 0, 6, 0 )
+          ENDIF
+
 !
 !--       Use constructed initial profiles (velocity constant with height,
@@ -948,4 +966,10 @@
              ELSE
                 shf = surface_heatflux
+!
+!--             Initialize shf with data from external file LSF_DATA
+                IF ( large_scale_forcing .AND. lsf_surf ) THEN
+                   CALL ls_forcing_surf ( simulated_time )
+                ENDIF
+
 !
 !--             Over topography surface_heatflux is replaced by wall_heatflux(0)
Index: palm/trunk/SOURCE/ls_forcing.f90
===================================================================
--- palm/trunk/SOURCE/ls_forcing.f90	(revision 1240)
+++ palm/trunk/SOURCE/ls_forcing.f90	(revision 1241)
@@ -161,4 +161,5 @@
           ENDIF
 
+
           DO  k = nzb, nzt+1
              IF ( highheight < zu(k) ) THEN
Index: palm/trunk/SOURCE/microphysics.f90
===================================================================
--- palm/trunk/SOURCE/microphysics.f90	(revision 1240)
+++ palm/trunk/SOURCE/microphysics.f90	(revision 1241)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! ------------------
-!
+! hyp and rho have to be calculated at each time step if data from external
+! file LSF_DATA are used
 !
 ! Former revisions:
@@ -103,5 +104,7 @@
 
        USE arrays_3d
-       USE control_parameters
+       USE cloud_parameters
+       USE control_parameters
+       USE grid_variables
        USE indices
        USE statistics
@@ -296,9 +299,32 @@
        USE cloud_parameters
        USE control_parameters
+       USE grid_variables
+       USE indices
        USE statistics
 
        IMPLICIT NONE
 
-       INTEGER ::  i, j
+       INTEGER ::  i, j, k 
+       REAL    ::  t_surface
+
+       IF ( large_scale_forcing .AND. lsf_surf ) THEN
+!
+!--       Calculate:
+!--       pt / t : ratio of potential and actual temperature (pt_d_t)
+!--       t / pt : ratio of actual and potential temperature (t_d_pt)
+!--       p_0(z) : vertical profile of the hydrostatic pressure (hyp)
+          t_surface = pt_surface * ( surface_pressure / 1000.0 )**0.286
+          DO  k = nzb, nzt+1
+             hyp(k)    = surface_pressure * 100.0 * &
+                         ( (t_surface - g/cp * zu(k)) / t_surface )**(1.0/0.286)
+             pt_d_t(k) = ( 100000.0 / hyp(k) )**0.286
+             t_d_pt(k) = 1.0 / pt_d_t(k)
+             hyrho(k)  = hyp(k) / ( r_d * t_d_pt(k) * pt_init(k) )       
+          ENDDO
+!
+!--       Compute reference density
+          rho_surface = surface_pressure * 100.0 / ( r_d * t_surface )
+       ENDIF
+
 
        dt_micro = dt_3d * weight_pres(intermediate_timestep_count)
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 1240)
+++ palm/trunk/SOURCE/modules.f90	(revision 1241)
@@ -20,5 +20,12 @@
 ! Current revisions:
 ! ------------------
-!
+! Usage of nudging enabled 
+! +nudging, ntnudge, ptnudge, qnudge, tnudge, unudge, vnudge, wnudge
+! increase pr_palm from 80 to 90 to allow for more standard profiles
+!
+! Enable prescribed time depenend surface fluxes and geostrophic wind read in
+! from external file LSF_DATA
+! +large_scale_forcing, lsf_surf, lsf_vert, nlsf, time_surf, shf_surf, qsws_surf,
+!  pt_surf, q_surf, p_surf, time_vert, ug_vert, vg_vert, wsubs_vert
 !
 ! Former revisions:
@@ -434,7 +441,8 @@
           c_u_m, c_u_m_l, c_v_m, c_v_m_l, c_w_m, c_w_m_l, ddzu, ddzu_pres,     &
           dd2zu, dzu, ddzw, dzw, hyp, inflow_damping_factor, lad, l_grid,      &
-          nc_1d, nr_1d, ptdf_x, ptdf_y, pt_1d, pt_init, q_1d, q_init, qc_1d,   &
-          qr_1d, rdf, rdf_sc, ref_state, sa_init, ug, u_init,                  &
-          u_nzb_p1_for_vfc, vg, v_init, v_nzb_p1_for_vfc, w_subs, zu, zw
+          nc_1d, nr_1d, ptdf_x, ptdf_y, p_surf, pt_surf, pt_1d, pt_init,       &
+          qsws_surf, q_1d, q_init, q_surf, qc_1d, qr_1d, rdf, rdf_sc,          & 
+          ref_state, sa_init, shf_surf, timenudge, time_surf, time_vert, ug,   &
+          u_init, u_nzb_p1_for_vfc, vg, v_init, v_nzb_p1_for_vfc, w_subs, zu, zw
 
     REAL, DIMENSION(:,:), ALLOCATABLE ::                                       &
@@ -443,8 +451,9 @@
           flux_s_e, flux_s_nr, flux_s_pt, flux_s_q, flux_s_qr, flux_s_sa,      &
           flux_s_u, flux_s_v, flux_s_w, f1_mg, f2_mg, f3_mg,                   &
-          mean_inflow_profiles, nrs, nrsws, nrswst, pt_slope_ref, qs, qsws,    &
-          qswst, qswst_remote, qrs, qrsws, qrswst, rif, saswsb, saswst, shf,   &
-          total_2d_a, total_2d_o, ts, tswst, us, usws, uswst, vsws, vswst, z0, &
-          z0h
+          mean_inflow_profiles, nrs, nrsws, nrswst, ptnudge, pt_slope_ref,     &
+          qnudge, qs, qsws, qswst, qswst_remote, qrs, qrsws, qrswst, rif,      &
+          saswsb, saswst, shf, tnudge, total_2d_a, total_2d_o, ts, tswst,      &
+          ug_vert, unudge, us, usws, uswst, vnudge, vg_vert, vsws, vswst,      &
+          wnudge, wsubs_vert, z0, z0h
 
     REAL, DIMENSION(:,:,:), ALLOCATABLE ::                                     &
@@ -478,4 +487,5 @@
     REAL, DIMENSION(:,:,:), ALLOCATABLE :: var_x, var_y, var_z, gamma_x,       &
                                            gamma_y, gamma_z
+
 
     SAVE
@@ -715,5 +725,6 @@
                 maximum_parallel_io_streams = -1, max_pr_user = 0, &
                 mgcycles = 0, mg_cycles = -1, mg_switch_to_pe0_level = 0, mid, &
-                netcdf_data_format = 2, ngsrb = 2, nr_timesteps_this_run = 0, &
+                nlsf = 1000, ntnudge = 100, netcdf_data_format = 2, ngsrb = 2, &
+                nr_timesteps_this_run = 0, &
                 nsor = 20, nsor_ini = 100, n_sor, normalizing_region = 0, &
                 nz_do3d = -9999, pch_index = 0, prt_time_count = 0, &
@@ -772,8 +783,11 @@
                 inflow_l = .FALSE., inflow_n = .FALSE., &
                 inflow_r = .FALSE., inflow_s = .FALSE., &
-                iso2d_output = .FALSE., large_scale_subsidence = .FALSE., &
+                iso2d_output = .FALSE., large_scale_forcing = .FALSE., &
+                large_scale_subsidence = .FALSE., lsf_surf = .TRUE., &
+                lsf_vert = .TRUE., lptnudge = .FALSE., lqnudge = .FALSE., &
+                lunudge = .FALSE., lvnudge = .FALSE., lwnudge = .FALSE., &
                 masking_method = .FALSE., mg_switch_to_pe0 = .FALSE., &
-                netcdf_output = .FALSE., neutral = .FALSE., ocean = .FALSE., &
-                on_device = .FALSE., &
+                netcdf_output = .FALSE., neutral = .FALSE., nudging = .FALSE., &
+                ocean = .FALSE., on_device = .FALSE., &
                 outflow_l = .FALSE., outflow_n = .FALSE., outflow_r = .FALSE., &
                 outflow_s = .FALSE., passive_scalar = .FALSE., &
@@ -1661,5 +1675,5 @@
 
     CHARACTER (LEN=40) ::  region(0:9)
-    INTEGER ::  pr_palm = 80, statistic_regions = 0
+    INTEGER ::  pr_palm = 90, statistic_regions = 0
     INTEGER ::  u_max_ijk(3), v_max_ijk(3), w_max_ijk(3)
     LOGICAL ::  flow_statistics_called = .FALSE.
Index: palm/trunk/SOURCE/nudging.f90
===================================================================
--- palm/trunk/SOURCE/nudging.f90	(revision 1240)
+++ palm/trunk/SOURCE/nudging.f90	(revision 1241)
@@ -161,4 +161,5 @@
 !
 !--    Prevent nudging if nudging profiles exhibt too small values
+!--    not used so far
        lptnudge  = ANY( ABS( ptnudge ) > 1e-8 )
        lqnudge   = ANY( ABS( qnudge ) > 1e-8 )
@@ -326,4 +327,8 @@
                 currtnudge = MAX( dt_3d, tnudge(k,t) * dtp + tnudge(k,t+1) * dtm )
 
+                !IF ((myid ==0 .AND. k==2) .AND. (i==1 .AND. j==1)) THEN
+                !  PRINT*, time, dt_3d, intermediate_timestep_count, currtnudge, dtp, dtm
+                !ENDIF
+
                 tend(k,j,i) = tend(k,j,i) - ( hom(k,1,1,0) - &
                                ( unudge(k,t) * dtp + &
Index: palm/trunk/SOURCE/palm.f90
===================================================================
--- palm/trunk/SOURCE/palm.f90	(revision 1240)
+++ palm/trunk/SOURCE/palm.f90	(revision 1241)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! -----------------
-!
+! initialization of nuding and large scale forcing from external file
 !
 ! Former revisions:
@@ -110,5 +110,7 @@
     USE indices
     USE interfaces
+    USE ls_forcing_mod
     USE model_1d
+    USE nudge_mod
     USE particle_attributes
     USE pegrid
@@ -217,7 +219,18 @@
 
 !
+!-- Initialize nudging if required
+    IF ( nudging )  THEN
+       CALL init_nudge
+    ENDIF
+
+!
+!-- Initialize reading of large scale forcing from external file - if required
+    IF ( large_scale_forcing )  THEN
+       CALL init_ls_forcing
+    ENDIF
+
+!
 !-- Check control parameters and deduce further quantities
     CALL check_parameters
-
 
 !
Index: palm/trunk/SOURCE/parin.f90
===================================================================
--- palm/trunk/SOURCE/parin.f90	(revision 1240)
+++ palm/trunk/SOURCE/parin.f90	(revision 1241)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! +nudging
+! +large_scale_forcing
 !
 ! Former revisions:
@@ -239,9 +240,10 @@
              initializing_actions, km_constant, lad_surface, &
              lad_vertical_gradient, lad_vertical_gradient_level, &
+             large_scale_forcing, &
              leaf_surface_concentration, limiter_sedimentation, &
              loop_optimization, masking_method, mg_cycles, &
              mg_switch_to_pe0_level, mixing_length_1d, momentum_advec, &
              nc_const, netcdf_precision, neutral, ngsrb, &
-             nsor, nsor_ini, nx, ny, nz, ocean, omega, omega_sor, &
+             nsor, nsor_ini, nudging, nx, ny, nz, ocean, omega, omega_sor, &
              passive_scalar, pch_index, phi, plant_canopy, prandtl_layer, &
              prandtl_number, precipitation, psolver, pt_damping_factor, &
Index: palm/trunk/SOURCE/prognostic_equations.f90
===================================================================
--- palm/trunk/SOURCE/prognostic_equations.f90	(revision 1240)
+++ palm/trunk/SOURCE/prognostic_equations.f90	(revision 1241)
@@ -20,5 +20,5 @@
 ! Current revisions:
 ! ------------------
-!
+! usage of nudging enabled (so far not implemented for accelerator version)
 !
 ! Former revisions:
@@ -182,4 +182,5 @@
     USE impact_of_latent_heat_mod
     USE microphysics_mod
+    USE nudge_mod
     USE plant_canopy_model_mod
     USE production_e_mod
@@ -285,4 +286,8 @@
              ENDIF
 
+!
+!--          Nudging
+             IF ( nudging )  CALL nudge( i, j, simulated_time, 'u' ) 
+
              CALL user_actions( i, j, 'u-tendency' )
 !
@@ -340,4 +345,8 @@
              ENDIF
 
+!
+!--          Nudging
+             IF ( nudging )  CALL nudge( i, j, simulated_time, 'v' ) 
+
              CALL user_actions( i, j, 'v-tendency' )
 !
@@ -471,4 +480,8 @@
                 CALL subsidence( i, j, tend, pt, pt_init )
              ENDIF
+
+!
+!--          Nudging
+             IF ( nudging )  CALL nudge( i, j, simulated_time, 'pt' ) 
 
              CALL user_actions( i, j, 'pt-tendency' )
@@ -594,4 +607,8 @@
                 CALL subsidence( i, j, tend, q, q_init )
              ENDIF
+
+!
+!--          Nudging
+             IF ( nudging )  CALL nudge( i, j, simulated_time, 'q' ) 
 
              CALL user_actions( i, j, 'q-tendency' )
@@ -847,4 +864,8 @@
     ENDIF
 
+!
+!-- Nudging
+    IF ( nudging )  CALL nudge( simulated_time, 'u' ) 
+
     CALL user_actions( 'u-tendency' )
 
@@ -919,4 +940,8 @@
     ENDIF
 
+!
+!-- Nudging
+    IF ( nudging )  CALL nudge( simulated_time, 'v' ) 
+
     CALL user_actions( 'v-tendency' )
 
@@ -1092,4 +1117,8 @@
           CALL subsidence( tend, pt, pt_init )
        ENDIF
+
+!
+!--    Nudging
+       IF ( nudging )  CALL nudge( simulated_time, 'pt' ) 
 
        CALL user_actions( 'pt-tendency' )
@@ -1278,4 +1307,8 @@
          CALL subsidence( tend, q, q_init )
        ENDIF
+
+!
+!--    Nudging
+       IF ( nudging )  CALL nudge( simulated_time, 'q' ) 
 
        CALL user_actions( 'q-tendency' )
Index: palm/trunk/SOURCE/read_var_list.f90
===================================================================
--- palm/trunk/SOURCE/read_var_list.f90	(revision 1240)
+++ palm/trunk/SOURCE/read_var_list.f90	(revision 1241)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! ------------------
-! 
+! +nudging
+! +large_scale_forcing
 !
 ! Former revisions:
@@ -448,4 +449,6 @@
           CASE ( 'lad_vertical_gradient_level_in' )
              READ ( 13 )  lad_vertical_gradient_level_ind
+          CASE ( 'large_scale_forcing' )
+             READ ( 13 )  large_scale_forcing
            CASE ( 'large_scale_subsidence' )
              READ ( 13 )  large_scale_subsidence
@@ -483,4 +486,6 @@
           CASE ( 'nsor_ini' )
              READ ( 13 )  nsor_ini
+          CASE ( 'nudging' )
+             READ ( 13 )  nudging
           CASE ( 'nx' )
              READ ( 13 )  nx
Index: palm/trunk/SOURCE/time_integration.f90
===================================================================
--- palm/trunk/SOURCE/time_integration.f90	(revision 1240)
+++ palm/trunk/SOURCE/time_integration.f90	(revision 1241)
@@ -20,5 +20,8 @@
 ! Current revisions:
 ! ------------------
-!
+! Call of user_actions in order to determine sgs momentum fluxes
+! Generalize calc_mean_profile for wider use
+! Determine shf and qsws in dependence on data from LSF_DATA
+! Determine ug and vg in dependence on data from LSF_DATA
 !
 ! Former revisions:
@@ -165,4 +168,5 @@
     USE interaction_droplets_ptq_mod
     USE interfaces
+    USE ls_forcing_mod
     USE particle_attributes
     USE pegrid
@@ -223,4 +227,11 @@
 
 !
+!--    Determine ug, vg and w_subs in dependence on data from external file 
+!--    LSF_DATA
+       IF ( large_scale_forcing .AND. lsf_vert ) THEN
+           CALL ls_forcing_vert ( simulated_time )
+       ENDIF
+
+!
 !--    Execute the user-defined actions
        CALL user_actions( 'before_timestep' )
@@ -248,7 +259,7 @@
 !--          buoyancy terms (WARNING: only the respective last call of
 !--          calc_mean_profile defines the reference state!)
-             IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4 )
-             IF ( ocean         )  CALL calc_mean_profile( rho, 64 )
-             IF ( humidity      )  CALL calc_mean_profile( vpt, 44 )
+             IF ( .NOT. neutral )  CALL calc_mean_profile( pt, 4, 'time_int' )
+             IF ( ocean         )  CALL calc_mean_profile( rho, 64, 'time_int' )
+             IF ( humidity      )  CALL calc_mean_profile( vpt, 44, 'time_int' )
           ENDIF
 
@@ -566,4 +577,14 @@
                 CALL cpu_log( log_point(19), 'prandtl_fluxes', 'stop' )
              ENDIF
+
+!
+!--          Determine shf and qsws in dependence on data from external file 
+!--          LSF_DATA
+             IF ( ( large_scale_forcing .AND. lsf_surf ) .AND. &
+                 intermediate_timestep_count == intermediate_timestep_count_max )&
+             THEN
+                CALL ls_forcing_surf ( simulated_time )
+             ENDIF
+
 !
 !--          Compute the diffusion coefficients
Index: palm/trunk/SOURCE/write_var_list.f90
===================================================================
--- palm/trunk/SOURCE/write_var_list.f90	(revision 1240)
+++ palm/trunk/SOURCE/write_var_list.f90	(revision 1241)
@@ -20,5 +20,6 @@
 ! Current revisions:
 ! -----------------
-!
+! +nudging
+! +large_scale_forcing
 !
 ! Former revisions:
@@ -365,4 +366,6 @@
     WRITE ( 14 )  'lad_vertical_gradient_level_in'
     WRITE ( 14 )  lad_vertical_gradient_level_ind
+    WRITE ( 14 )  'large_scale_forcing           '
+    WRITE ( 14 )  large_scale_forcing
     WRITE ( 14 )  'large_scale_subsidence        '
     WRITE ( 14 )  large_scale_subsidence
@@ -399,4 +402,6 @@
     WRITE ( 14 )  'nsor_ini                      '
     WRITE ( 14 )  nsor_ini
+    WRITE ( 14 )  'nudging                       '
+    WRITE ( 14 )  nudging
     WRITE ( 14 )  'nx                            '
     WRITE ( 14 )  nx
