Index: palm/trunk/SOURCE/check_parameters.f90
===================================================================
--- palm/trunk/SOURCE/check_parameters.f90	(revision 4171)
+++ palm/trunk/SOURCE/check_parameters.f90	(revision 4172)
@@ -25,4 +25,8 @@
 ! -----------------
 ! $Id$
+! added conversion from recycle_absolute_quantities to raq for recycling of 
+! absolute quantities and added error message PA184 for not implemented quantities
+! 
+! 4142 2019-08-05 12:38:31Z suehring
 ! Consider spinup in number of output timesteps for averaged 2D output (merge
 ! from branch resler).
@@ -866,4 +870,5 @@
     INTEGER(iwp) ::  k                               !< loop index
     INTEGER(iwp) ::  kk                              !< loop index
+    INTEGER(iwp) ::  r                               !< loop index
     INTEGER(iwp) ::  mid                             !< masked output running index
     INTEGER(iwp) ::  netcdf_data_format_save         !< initial value of netcdf_data_format
@@ -3647,4 +3652,23 @@
           CALL message( 'check_parameters', 'PA0421', 1, 2, 0, 6, 0 )
        ENDIF
+
+!
+!--    Convert recycle_absolute_quantities (list of strings that define the quantities for 
+!--    absolute recycling) to raq (list of logicals with length 7 corresponding to u,v,w,pt,e,q,s). 
+!--    Output error message for not implemented quantities.
+       DO r = LBOUND( recycle_absolute_quantities, 1 ), UBOUND( recycle_absolute_quantities, 1 )
+          SELECT CASE ( TRIM( recycle_absolute_quantities(r) ) )
+             CASE ( 'theta' )
+                raq(4) = .TRUE.
+             CASE ( 'q' )
+                raq(6) = .TRUE.
+             CASE ( '' )
+                CONTINUE
+             CASE DEFAULT
+                message_string = 'absolute recycling not implemented for variable ' // &
+                TRIM( recycle_absolute_quantities(r) )
+                CALL message( 'inflow_turbulence', 'PA184', 1, 2, 0, 6, 0 )
+          END SELECT
+       ENDDO
     ENDIF
 
Index: palm/trunk/SOURCE/inflow_turbulence.f90
===================================================================
--- palm/trunk/SOURCE/inflow_turbulence.f90	(revision 4171)
+++ palm/trunk/SOURCE/inflow_turbulence.f90	(revision 4172)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added optional recycling of absolute values for pt and q
+! 
+! 3655 2019-01-07 16:51:22Z knoop
 ! Corrected "Former revisions" section
 ! 
@@ -87,5 +90,5 @@
         
     USE control_parameters,                                                    &
-        ONLY:  humidity, passive_scalar, recycling_plane, recycling_yshift
+        ONLY:  humidity, passive_scalar, recycling_plane, recycling_yshift, raq
         
     USE cpulog,                                                                &
@@ -101,5 +104,5 @@
 
     IMPLICIT NONE
-
+    
     INTEGER(iwp) ::  i        !< loop index
     INTEGER(iwp) ::  j        !< loop index
@@ -119,7 +122,7 @@
     REAL(wp), DIMENSION(nzb:nzt+1,nysg:nyng,7,nbgp) ::                         &
        local_inflow_dist  !< auxiliary variable for inflow_dist, used for yshift
-
+    
     CALL cpu_log( log_point(40), 'inflow_turbulence', 'start' )
-
+    
 !
 !-- Carry out spanwise averaging in the recycling plane
@@ -187,4 +190,6 @@
 !
 !-- Calculate the disturbances at the recycling plane
+!-- for recycling of absolute quantities, the disturbance is defined as the absolute value
+!-- (and not as the deviation from the mean profile)
     i = recycling_plane
 
@@ -198,8 +203,17 @@
                 inflow_dist(k,j,2,l) = v(k,j,i)   - avpr(k,2,l)
                 inflow_dist(k,j,3,l) = w(k,j,i)   - avpr(k,3,l)
-                inflow_dist(k,j,4,l) = pt(k,j,i)  - avpr(k,4,l)
+                IF ( raq(4) )  THEN
+                   inflow_dist(k,j,4,l) = pt(k,j,i)
+                ELSE
+                   inflow_dist(k,j,4,l) = pt(k,j,i) - avpr(k,4,l)
+                ENDIF
                 inflow_dist(k,j,5,l) = e(k,j,i)   - avpr(k,5,l)
-                IF ( humidity )                                                &
-                   inflow_dist(k,j,6,l) = q(k,j,i) - avpr(k,6,l)
+                IF ( humidity ) THEN
+                   IF ( raq(6) ) THEN
+                      inflow_dist(k,j,6,l) = q(k,j,i)
+                   ELSE
+                      inflow_dist(k,j,6,l) = q(k,j,i) - avpr(k,6,l)
+                   ENDIF
+                ENDIF
                 IF ( passive_scalar )                                          &
                    inflow_dist(k,j,7,l) = s(k,j,i) - avpr(k,7,l)
@@ -214,12 +228,20 @@
        DO  j = nysg, nyng
           DO  k = nzb, nzt+1
-
              inflow_dist(k,j,1,l) = u(k,j,i+1) - avpr(k,1,l)
              inflow_dist(k,j,2,l) = v(k,j,i)   - avpr(k,2,l)
              inflow_dist(k,j,3,l) = w(k,j,i)   - avpr(k,3,l)
-             inflow_dist(k,j,4,l) = pt(k,j,i)  - avpr(k,4,l)
+             IF ( raq(4) )  THEN
+                inflow_dist(k,j,4,l) = pt(k,j,i)
+             ELSE
+                inflow_dist(k,j,4,l) = pt(k,j,i) - avpr(k,4,l) 
+             ENDIF
              inflow_dist(k,j,5,l) = e(k,j,i)   - avpr(k,5,l)
-             IF ( humidity )                                                   &
-                inflow_dist(k,j,6,l) = q(k,j,i) - avpr(k,6,l)
+             IF ( humidity )  THEN
+                IF ( raq(6) ) THEN
+                   inflow_dist(k,j,6,l) = q(k,j,i)
+                ELSE
+                   inflow_dist(k,j,6,l) = q(k,j,i) - avpr(k,6,l)
+                ENDIF
+             ENDIF
              IF ( passive_scalar )                                             &
                 inflow_dist(k,j,7,l) = s(k,j,i) - avpr(k,7,l)
@@ -291,17 +313,25 @@
              w(k,j,-nbgp:-1)  =                                             &
                         inflow_dist(k,j,3,1:nbgp) * inflow_damping_factor(k)
-             pt(k,j,-nbgp:-1) = mean_inflow_profiles(k,4) +                 &
-                        inflow_dist(k,j,4,1:nbgp) * inflow_damping_factor(k)
-             e(k,j,-nbgp:-1)  = mean_inflow_profiles(k,5) +                 &
+             IF ( raq(4) )  THEN
+                pt(k,j,-nbgp:-1) = inflow_dist(k,j,4,1:nbgp)
+             ELSE
+                pt(k,j,-nbgp:-1) = mean_inflow_profiles(k,4) +               &
+                inflow_dist(k,j,4,1:nbgp) * inflow_damping_factor(k)
+             ENDIF
+             e(k,j,-nbgp:-1)  = mean_inflow_profiles(k,5) +                  &
                         inflow_dist(k,j,5,1:nbgp) * inflow_damping_factor(k)
              e(k,j,-nbgp:-1)  = MAX( e(k,j,-nbgp:-1), 0.0_wp )
 
-             IF ( humidity )                                                &
-                q(k,j,-nbgp:-1)  = mean_inflow_profiles(k,6) +              &
+             IF ( humidity )  THEN
+                IF ( raq(6) )  THEN
+                   q(k,j,-nbgp:-1)  = inflow_dist(k,j,6,1:nbgp)
+                ELSE 
+                   q(k,j,-nbgp:-1)  = mean_inflow_profiles(k,6) +           & 
                         inflow_dist(k,j,6,1:nbgp) * inflow_damping_factor(k)
+                ENDIF
+             ENDIF
              IF ( passive_scalar )                                          &
                 s(k,j,-nbgp:-1)  = mean_inflow_profiles(k,7) +              &
                         inflow_dist(k,j,7,1:nbgp) * inflow_damping_factor(k)
-
           ENDDO
        ENDDO
Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 4171)
+++ palm/trunk/SOURCE/modules.f90	(revision 4172)
@@ -25,4 +25,7 @@
 ! -----------------
 ! $Id$
+! added recycle_absolute_quantities and raq
+! 
+! 4168 2019-08-16 13:50:17Z suehring
 ! +topo_top_ind
 ! 
@@ -1197,5 +1200,7 @@
     CHARACTER (LEN=varnamelength), DIMENSION(0:1,500) ::  do2d = ' '  !< label array for 2d output quantities
     CHARACTER (LEN=varnamelength), DIMENSION(0:1,500) ::  do3d = ' '  !< label array for 3d output quantities
-
+     
+    CHARACTER (LEN=varnamelength), DIMENSION(7) :: recycle_absolute_quantities = ' '    !< namelist parameter
+    
     INTEGER(iwp), PARAMETER ::  fl_max = 500     !< maximum number of virtual-flight measurements
     INTEGER(iwp), PARAMETER ::  var_fl_max = 20  !< maximum number of different sampling variables in virtual flight measurements
@@ -1313,5 +1318,5 @@
 
     INTEGER(iwp), DIMENSION(max_masks,mask_xyz_dimension) ::  mask_k_over_surface = -1  !< namelist parameter, k index of height over surface
-
+    
     LOGICAL ::  agent_time_unlimited = .FALSE.                   !< namelist parameter
     LOGICAL ::  air_chemistry = .FALSE.                          !< chemistry model switch
@@ -1431,6 +1436,8 @@
     LOGICAL ::  data_output_yz(0:1) = .FALSE.                !< output of yz cross-section data?
 
-    LOGICAL, DIMENSION(max_masks) ::  mask_surface = .FALSE.      !< flag for surface-following masked output
-
+    LOGICAL, DIMENSION(max_masks) ::  mask_surface = .FALSE.   !< flag for surface-following masked output
+    
+    LOGICAL, DIMENSION(7) ::  raq = .FALSE.                    !< recycle absolute quantities (u,v,w,theta,e,q,s) in inflow_turbulence
+    
     REAL(wp) ::  advected_distance_x = 0.0_wp                  !< advected distance of model domain along x 
                                                                !< (galilei transformation) 
