Index: palm/trunk/SOURCE/modules.f90
===================================================================
--- palm/trunk/SOURCE/modules.f90	(revision 2201)
+++ palm/trunk/SOURCE/modules.f90	(revision 2232)
@@ -20,5 +20,24 @@
 ! Current revisions:
 ! ------------------
-! 
+! Renamed wall_flags_0 and wall_flags_00 into advc_flags_1 and advc_flags_2, 
+! respectively. Moreover, introduced further flag array wall_flags_0. 
+!
+! Adjustments for new topography concept:
+!   -fwxm, fwxp, fwym, fwyp, fxm, fxp, fym, fyp, rif_wall, wall_e_x, wall_e_y, 
+!   -wall_v, wall_u, wall_w_x, wall_w_y, wall_qflux, wall_sflux, wall_nrflux, 
+!   -wall_qrflux
+!
+! Adjustments for new surface concept:
+!   +land_surface
+!   -z0, z0h, z0q, us, ts, qs, qsws, nrs, nrsws, qrs, qrsws, ssws, ss, saswsb 
+!   -nzb_diff_u, nzb_diff_v, nzt_diff
+!   -uswst, vswst, tswst, sswst, saswst, qswst, qrswst, nrswst, qswst_remote
+!
+! Generic tunnel setup:
+!   +tunnel_height, tunnel_length, tunnel_width_x, tunnel_width_y, 
+!   +tunnel_wall_depth
+!
+! Topography input via netcdf
+!   +lod
 ! 
 ! Former revisions:
@@ -534,8 +553,4 @@
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  f3_mg                 !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  mean_inflow_profiles  !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  nrs                   !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  nrsws                 !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  nrswst                !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ol                    !< Obukhov length 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  precipitation_amount  !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  precipitation_rate    !< 
@@ -543,17 +558,4 @@
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  pt_slope_ref          !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  qnudge                !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  qs                    !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  qsws                  !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  qswst                 !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  qswst_remote          !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  qrs                   !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  qrsws                 !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  qrswst                !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  saswsb                !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  saswst                !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  shf                   !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ss                    !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ssws                  !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  sswst                 !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  tnudge                !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  td_lsa_lpt            !< 
@@ -563,20 +565,10 @@
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  total_2d_a            !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  total_2d_o            !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ts                    !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  tswst                 !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  ug_vert               !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  unudge                !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  us                    !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  usws                  !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  uswst                 !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  vnudge                !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  vg_vert               !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  vsws                  !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  vswst                 !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  wnudge                !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  wsubs_vert            !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  z0                    !< roughness length for momentum
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  z0h                   !< roughness length for heat
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  z0q                   !< roughness length for moisture
     
     REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  d          !< 
@@ -744,5 +736,4 @@
 #endif
 
-    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  rif_wall !< 
     REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  tri      !< 
 
@@ -1014,4 +1005,5 @@
     INTEGER(iwp) ::  io_blocks = 1                     !< 
     INTEGER(iwp) ::  iran = -1234567                   !< 
+    INTEGER(iwp) ::  lod = 1                           !< level of detail, topography input parameter 
     INTEGER(iwp) ::  masks = 0                         !< 
     INTEGER(iwp) ::  maximum_grid_level                !< 
@@ -1130,4 +1122,5 @@
     LOGICAL ::  large_scale_forcing = .FALSE.                !< 
     LOGICAL ::  large_scale_subsidence = .FALSE.             !< 
+    LOGICAL ::  land_surface = .FALSE.                       !< flag parameter indicating wheather the lsm is used
     LOGICAL ::  lsf_exception = .FALSE.                      !< temporary flag for use of lsf with buildings on flat terrain
     LOGICAL ::  lsf_surf = .TRUE.                            !< 
@@ -1183,5 +1176,4 @@
     LOGICAL ::  ws_scheme_sca = .FALSE.                      !< 
     LOGICAL ::  ws_scheme_mom = .FALSE.                      !< 
-
     LOGICAL ::  data_output_xy(0:1) = .FALSE.                !< 
     LOGICAL ::  data_output_xz(0:1) = .FALSE.                !< 
@@ -1322,4 +1314,9 @@
     REAL(wp) ::  top_salinityflux = 9999999.9_wp               !< 
     REAL(wp) ::  top_scalarflux = 9999999.9_wp                 !< 
+    REAL(wp) ::  tunnel_height = 9999999.9_wp                  !< height of tunnel outer wall
+    REAL(wp) ::  tunnel_length = 9999999.9_wp                  !< tunnel length
+    REAL(wp) ::  tunnel_width_x = 9999999.9_wp                 !< tunnel width in x, with respect to outer wall
+    REAL(wp) ::  tunnel_width_y = 9999999.9_wp                 !< tunnel width in y, with respect to outer wall
+    REAL(wp) ::  tunnel_wall_depth = 9999999.9_wp              !< tunnel wall depth
     REAL(wp) ::  ug_surface = 0.0_wp                           !< 
     REAL(wp) ::  u_bulk = 0.0_wp                               !< 
@@ -1366,9 +1363,5 @@
     REAL(wp) ::  wall_heatflux(0:4) = 0.0_wp                       !< 
     REAL(wp) ::  wall_humidityflux(0:4) = 0.0_wp                   !< 
-    REAL(wp) ::  wall_nrflux(0:4) = 0.0_wp                         !< 
-    REAL(wp) ::  wall_qflux(0:4) = 0.0_wp                          !< 
-    REAL(wp) ::  wall_qrflux(0:4) = 0.0_wp                         !< 
     REAL(wp) ::  wall_salinityflux(0:4) = 0.0_wp                   !< 
-    REAL(wp) ::  wall_sflux(0:4) = 0.0_wp                          !< 
     REAL(wp) ::  wall_scalarflux(0:4) = 0.0_wp                     !< 
     REAL(wp) ::  subs_vertical_gradient(10) = 0.0_wp               !< 
@@ -1534,18 +1527,4 @@
     REAL(wp), DIMENSION(:), ALLOCATABLE ::  ddy2_mg  !< 
 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fwxm        !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fwxp        !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fwym        !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fwyp        !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fxm         !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fxp         !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fym         !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fyp         !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  wall_e_x    !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  wall_e_y    !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  wall_u      !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  wall_v      !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  wall_w_x    !< 
-    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  wall_w_y    !< 
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  zu_s_inner  !<  
     REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  zw_w_inner  !< 
@@ -1594,5 +1573,4 @@
     INTEGER(iwp) ::  nzb_max      !< 
     INTEGER(iwp) ::  nzt          !< 
-    INTEGER(iwp) ::  nzt_diff     !< 
 
     INTEGER(idp), DIMENSION(:), ALLOCATABLE ::  ngp_3d        !< 
@@ -1612,6 +1590,4 @@
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nzb_diff_s_inner  !< 
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nzb_diff_s_outer  !< 
-    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nzb_diff_u        !< 
-    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nzb_diff_v        !< 
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nzb_inner         !< 
     INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  nzb_outer         !< 
@@ -1627,7 +1603,4 @@
     INTEGER(iwp), DIMENSION(:,:,:), POINTER ::  flags  !<
 
-    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_0   !< 
-    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_00  !< 
-
     INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE,  TARGET ::  wall_flags_1   !< 
     INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE,  TARGET ::  wall_flags_2   !< 
@@ -1641,6 +1614,7 @@
     INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE,  TARGET ::  wall_flags_10  !< 
 
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  rflags_s_inner  !< 
-    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  rflags_invers   !< 
+    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  advc_flags_1            !< flags used to degrade order of advection scheme
+    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  advc_flags_2            !< flags used to degrade order of advection scheme
+    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_0            !< flags to mask topography
 
     SAVE
