Ignore:
Timestamp:
Mar 20, 2014 8:40:49 AM (10 years ago)
Author:
raasch
Message:

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/modules.f90

    r1319 r1320  
    2020! Current revisions:
    2121! ------------------
    22 !
     22! ONLY-attribute added to USE-statements,
     23! kind-parameters added to all INTEGER and REAL declaration statements,
     24! kinds are defined in new module kinds,
     25! old module precision_kind is removed,
     26! revision history before 2012 removed,
     27! comment fields (!:) to be used for variable explanations added to
     28! all variable declaration statements
    2329!
    2430! Former revisions:
     
    210216! for thread-safe summation in advec_ws.
    211217!
    212 ! 792 2011-12-01 01:23:23Z raasch
    213 ! particle arrays (particles, parrticles_temp) implemented as pointers,
    214 ! +particles_1, particles_2, sort_count
    215 !
    216 ! 790 2011-11-29 03:11:20Z raasch
    217 ! +turbulence_effects_on_collision, wang_collision_kernel
    218 !
    219 ! 785 2011-11-28 09:47:19Z raasch
    220 ! +scalar_rayleigh_damping, rdf_sc
    221 !
    222 ! 778 2011-11-07 14:18:25Z fricke
    223 ! +gathered_size, subdomain_size
    224 !
    225 ! 771 2011-10-27 10:56:21Z heinze
    226 ! +lpt_av
    227 !
    228 ! 767 2011-10-14 06:39:12Z raasch
    229 ! +u_profile, v_profile, uv_heights, use_prescribed_profile_data
    230 !
    231 ! 759 2011-09-15 13:58:31Z raasch
    232 ! +io_blocks, io_group, maximum_parallel_io_streams,
    233 ! synchronous_exchange moved to control_parameters
    234 !
    235 ! 743 2011-08-18 16:10:16Z suehring
    236 ! Dimension of sums_wsus_ws_l, sums_wsvs_ws_l, sums_us2_ws_l, sums_vs2_ws_l,
    237 ! sums_ws2_ws_l, sums_wspts_ws_l, sums_wssas_ws_l,sums_wsqs_ws_l needed for
    238 ! statistical evaluation of turbulent fluxes in WS-scheme decreased.
    239 ! 736 2011-08-17 14:13:26Z suehring
    240 ! Dimension of fluxes needed for WS-scheme increased.
    241 !
    242 ! 722 2011-04-11 06:21:09Z raasch
    243 ! Bugfix: default value for south_border_pe changed to .F.
    244 !
    245 ! 707 2011-03-29 11:39:40Z raasch
    246 ! +bc_lr_dirrad, bc_lr_raddir, bc_ns_dirrad, bc_ns_raddir, left_border_pe,
    247 ! north_border_pe, right_border_pe, south_border_pe
    248 ! p_sub renamed p_loc
    249 !
    250 ! 683 2011-02-09 14:25:15Z raasch
    251 ! +synchronous_exchange
    252 !
    253 ! 673 2011-01-18 16:19:48Z suehring
    254 ! +weight_pres to weight the respective contribution of the Runge-Kutta
    255 ! substeps. +p_sub to buffer the intermediate contributions for Multigrid and
    256 ! SOR.
    257 !
    258 ! 667 2010-12-23 12:06:00Z suehring/gryschka
    259 ! Removed u_nzb_p1_for_vfc and v_nzb_p1_for_vfc
    260 ! For coupling with different resolution in ocean and atmophere:
    261 ! +nx_a, +nx_o, ny_a, +ny_o, ngp_a, ngp_o, +total_2d_o, +total_2d_a,
    262 ! +coupling_topology
    263 ! Buffer arrays for the left sided advective fluxes added in arrays_3d.
    264 ! +flux_s_u, +flux_s_v, +flux_s_w, +diss_s_u, +diss_s_v, +diss_s_w,
    265 ! +flux_s_pt, +diss_s_pt, +flux_s_e, +diss_s_e, +flux_s_q, +diss_s_q,
    266 ! +flux_s_sa, +diss_s_sa
    267 ! 3d arrays for dissipation control added. (only necessary for vector arch.)
    268 ! +var_x, +var_y, +var_z, +gamma_x, +gamma_y, +gamma_z
    269 ! Default of momentum_advec and scalar_advec changed to 'ws-scheme' .
    270 ! +exchange_mg added in control_parameters to steer the data exchange.
    271 ! Parameters +nbgp, +nxlg, +nxrg, +nysg, +nyng added in indices.
    272 ! flag array +boundary_flags added in indices to steer the degradation of order
    273 ! of the advective fluxes when non-cyclic boundaries are used.
    274 ! MPI-datatypes +type_y, +type_y_int and +type_yz for data_exchange added in
    275 ! pegrid.
    276 ! +sums_wsus_ws_l, +sums_wsvs_ws_l, +sums_us2_ws_l, +sums_vs2_ws_l,
    277 ! +sums_ws2_ws_l, +sums_wspts_ws_l, +sums_wssas_ws_l, +sums_wsqs_ws_l
    278 ! and +weight_substep added in statistics to steer the statistical evaluation
    279 ! of turbulent fluxes in the advection routines.
    280 ! LOGICALS +ws_scheme_sca and +ws_scheme_mom added to get a better performance
    281 ! in prognostic_equations.
    282 ! LOGICAL +dissipation_control control added to steer numerical dissipation
    283 ! in ws-scheme.
    284 ! Changed length of string run_description_header
    285 !
    286 ! 622 2010-12-10 08:08:13Z raasch
    287 ! +collective_wait in pegrid
    288 !
    289 ! 600 2010-11-24 16:10:51Z raasch
    290 ! default values of surface_scalarflux and surface_waterflux changed
    291 ! to 9999999.9
    292 !
    293 ! 580 2010-10-05 13:59:11Z heinze
    294 ! Renaming of ws_vertical_gradient to subs_vertical_gradient,
    295 ! ws_vertical_gradient_level to subs_vertical_gradient_level and
    296 ! ws_vertical_gradient_level_ind to subs_vertical_gradient_level_i
    297 !
    298 ! 564 2010-09-30 13:18:59Z helmke
    299 ! nc_precision and netcdf_precision dimension changed to 11, all default
    300 ! values of mask_xyz_loop changed to -1.0, dimension of openfile changed to
    301 ! 200+2*max_masks, max_masks changed to 50
    302 !
    303 ! 553 2010-09-01 14:09:06Z weinreis
    304 ! parameters for masked output are replaced by arrays
    305 !
    306 ! 531 2010-04-21 06:47:21Z heinze
    307 ! character length of dopr_unit enlarged
    308 !
    309 ! 519 2010-03-19 05:30:02Z raasch
    310 ! -replace_char, replace_by
    311 !
    312 ! 493 2010-03-01 08:30:24Z raasch
    313 ! +netcdf_data_format, -netcdf_64bit, -netcdf_64bit_3d, -netcdf_format_mask*,
    314 ! -nc_format_mask, -format_parallel_io
    315 !
    316 ! 485 2010-02-05 10:57:51Z raasch
    317 ! ngp_3d, ngp_3d_inner changed to 64 bit
    318 !
    319 ! 449 2010-02-02 11:23:59Z raasch
    320 ! -var_ts: replaced by dots_max,
    321 ! initial data assignments to some dvrp arrays changed due to error messages
    322 ! from gfortran compiler
    323 ! +large_scale_subsidence, ws_vertical_gradient, ws_vertical_gradient_level,
    324 ! ws_vertical_gradient_level_ind, w_subs
    325 !
    326 ! 388 2009-09-23 09:40:33Z raasch
    327 ! +prho, prho_1
    328 ! +bc_lr_cyc, bc_ns_cyc
    329 ! +output_for_t0
    330 ! translation error of actual -> current revisions fixed
    331 ! +q* in dots_label, dots_unit. increased dots_num respectively
    332 ! typographical error in dots_unit fixed
    333 ! +clip_dvrp_*, cluster_size, color_interval, dvrpsize_interval, dvrp_overlap,
    334 ! dvrp_total_overlap, groundplate_color, local_dvrserver_running, n*_dvrp,
    335 ! interval_*_dvrp_prt, isosurface_color, particle_color, particle_dvrpsize,
    336 ! topography color in dvrp_variables,
    337 ! vertical_particle_advection is a 1d-array,
    338 ! +canyon_height, canyon_width_x, canyon_width_y, canyon_wall_left,
    339 ! canyon_wall_south, conserve_volume_flow_mode, coupling_start_time,
    340 ! dp_external, dp_level_b, dp_level_ind_b, dp_smooth, dp_smooth_factor, dpdxy,
    341 ! run_coupled, time_since_reference_point, u_bulk, v_bulk in control_parameters,
    342 ! default value of grid_matching changed to strict
    343 ! +shf_av, qsws_av
    344 !
    345 ! 217 2008-12-09 18:00:48Z letzel
    346 ! +topography_grid_convention
    347 ! some dvrp-variables changed to single precision, variables for dvrp-mode
    348 ! pathlines added, +target_id, abort_mode, message_string
    349 !
    350 ! 197 2008-09-16 15:29:03Z raasch
    351 ! allow 100 spectra levels instead of 10 for consistency with
    352 ! define_netcdf_header, +canopy_heat_flux, cthf, lai,
    353 ! +leaf_surface_concentration, scalar_exchange_coefficient, sec, sls
    354 ! +hor_index_bounds, hor_index_bounds_previous_run, id_inflow, id_recycling,
    355 ! inflow_damping_*, mean_inflow_profiles, numprocs_previous_run, nx_on_file,
    356 ! ny_on_file, offset_ocean_*, recycling_plane, recycling_width, turbulent_inflow
    357 ! -myid_char_14
    358 !
    359 ! 138 2007-11-28 10:03:58Z letzel
    360 ! +drag_coefficient, pch_index, lad_surface, lad_vertical_gradient,
    361 ! lad_vertical_gradient_level, plant_canopy, lad, lad_s, lad_u, lad_v,
    362 ! lad_w, cdc, lad_vertical_gradient_level_ind, canopy_mode
    363 ! +dt_sort_particles, ngp_2dh_s_inner, time_sort_particles, flags,
    364 ! wall_flags_1..10, wall_humidityflux(0:4), wall_qflux(0:4),
    365 ! wall_salinityflux(0:4), wall_scalarflux(0:4)
    366 !
    367 ! 108 2007-08-24 15:10:38Z letzel
    368 ! +comm_inter, constant_top_momentumflux, coupling_char, coupling_mode,
    369 ! coupling_mode_remote, c_u, c_v, c_w, dt_coupling, e_init, humidity_remote,
    370 ! ngp_xy, nxlu, nysv, port_name, qswst_remote, terminate_coupled,
    371 ! terminate_coupled_remote, time_coupling, top_momentumflux_u|v, type_xy,
    372 ! uswst*, vswst*
    373 !
    374 ! 97 2007-06-21 08:23:15Z raasch
    375 ! +atmos_ocean_sign, ocean, r, + salinity variables
    376 ! defaults of .._vertical_gradient_levels changed from -1.0 to -9999999.9
    377 ! hydro_press renamed hyp, use_pt_reference renamed use_reference
    378 !
    379 ! 89 2007-05-25 12:08:31Z raasch
    380 ! +data_output_pr_user, max_pr_user, size of data_output_pr, dopr_index,
    381 ! dopr_initial_index and dopr_unit enlarged,
    382 ! var_hom and var_sum renamed pr_palm
    383 !
    384 ! 82 2007-04-16 15:40:52Z raasch
    385 ! +return_addres, return_username
    386 ! Cpp-directive lcmuk renamed lc
    387 !
    388 ! 75 2007-03-22 09:54:05Z raasch
    389 ! +arrays precipitation_amount, precipitation_rate, precipitation_rate_av,
    390 ! rif_wall, z0_av, +arrays u_m_l, u_m_r, etc. for radiation boundary conditions,
    391 ! +loop_optimization, netcdf_64bit_3d, zu_s_inner, zw_w_inner, id_var_zusi_*,
    392 ! id_var_zwwi_*, ts_value, u_nzb_p1_for_vfc, v_nzb_p1_for_vfc, pt_reference,
    393 ! use_pt_reference, precipitation_amount_interval, revision
    394 ! +age_m in particle_type, moisture renamed humidity,
    395 ! -data_output_ts, dots_n, uvmean_outflow, uxrp, vynp,
    396 ! arrays dots_label and dots_unit now dimensioned with dots_max,
    397 ! setting of palm version moved to main program
    398 !
    399 ! 37 2007-03-01 08:33:54Z raasch
    400 ! +constant_top_heatflux, top_heatflux, use_top_fluxes, +arrays for top fluxes,
    401 ! +nzt_diff, default of bc_pt_t renamed "initial_gradient"
    402 ! Bugfix: p is not a pointer
    403 !
    404218! RCS Log replace by Id keyword, revision history cleaned up
    405219!
     
    415229! Definition of variables for special advection schemes
    416230!------------------------------------------------------------------------------!
    417 
    418     REAL, DIMENSION(:), ALLOCATABLE   ::  aex, bex, dex, eex
     231    USE kinds
     232
     233    REAL(wp), DIMENSION(:), ALLOCATABLE   ::  aex, bex, dex, eex
    419234
    420235    SAVE
     
    425240
    426241
    427  MODULE precision_kind
    428 
    429 !------------------------------------------------------------------------------!
    430 ! Description:
    431 ! ------------
    432 ! Definition of type parameters (used for the definition of single or double
    433 ! precision variables)
    434 !------------------------------------------------------------------------------!
    435 
    436     INTEGER, PARAMETER ::  dpk = SELECTED_REAL_KIND( 12 ), &
    437                            spk = SELECTED_REAL_KIND( 6 )
    438 
    439     SAVE
    440 
    441  END MODULE precision_kind
    442 
    443 
    444 
    445 
    446242 MODULE arrays_3d
    447243
     
    452248!------------------------------------------------------------------------------!
    453249
    454     USE precision_kind
    455 
    456     REAL, DIMENSION(:), ALLOCATABLE ::                                         &
     250    USE kinds
     251
     252    REAL(wp), DIMENSION(:), ALLOCATABLE ::                                     &
    457253          c_u_m, c_u_m_l, c_v_m, c_v_m_l, c_w_m, c_w_m_l, ddzu, ddzu_pres,     &
    458254          dd2zu, dzu, ddzw, dzw, hyp, inflow_damping_factor, lad, l_grid,      &
     
    462258          u_init, u_nzb_p1_for_vfc, vg, v_init, v_nzb_p1_for_vfc, w_subs, zu, zw
    463259
    464     REAL, DIMENSION(:,:), ALLOCATABLE ::                                       &
     260    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::                                   &
    465261          c_u, c_v, c_w, diss_s_e, diss_s_nr, diss_s_pt, diss_s_q,             &
    466262          diss_s_qr, diss_s_sa, diss_s_u, diss_s_v, diss_s_w, dzu_mg, dzw_mg,  &
     
    473269          wnudge, wsubs_vert, z0, z0h
    474270
    475     REAL, DIMENSION(:,:,:), ALLOCATABLE ::                                     &
     271    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::                                 &
    476272          canopy_heat_flux, cdc, d, de_dx, de_dy, de_dz, diss, diss_l_e,       &
    477273          diss_l_nr, diss_l_pt, diss_l_q, diss_l_qr, diss_l_sa, diss_l_u,      &
     
    483279
    484280#if defined( __nopointer )
    485     REAL, DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                             &
     281    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
    486282          e, e_p, nr, nr_p, p, prho, pt, pt_p, q, q_p, qc, ql, ql_c, ql_v,     &
    487283          ql_vp, qr, qr_p, rho, sa, sa_p, te_m, tnr_m, tpt_m, tq_m, tqr_m,     &
    488284          tsa_m, tu_m, tv_m, tw_m, u, u_p, v, v_p, vpt, w, w_p
    489285#else
    490     REAL, DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                             &
     286    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
    491287          e_1, e_2, e_3, p, prho_1, nr_1, nr_2, nr_3, pt_1, pt_2, pt_3, q_1,   &
    492288          q_2, q_3, qc_1, ql_v, ql_vp, ql_1, ql_2, qr_1, qr_2, qr_3, rho_1,    &
    493289          sa_1, sa_2, sa_3, u_1, u_2, u_3, v_1, v_2, v_3, vpt_1, w_1, w_2, w_3
    494290
    495     REAL, DIMENSION(:,:,:), POINTER ::                                         &
     291    REAL(wp), DIMENSION(:,:,:), POINTER ::                                     &
    496292          e, e_p, nr, nr_p, prho, pt, pt_p, q, q_p, qc, ql, ql_c, qr, qr_p,    &
    497293          rho, sa, sa_p, te_m, tnr_m, tpt_m, tq_m, tqr_m, tsa_m, tu_m, tv_m,   &
     
    499295#endif
    500296
    501     REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  rif_wall, tri
    502 
    503     REAL, DIMENSION(:,:,:), ALLOCATABLE :: var_x, var_y, var_z, gamma_x,       &
     297    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  rif_wall, tri
     298
     299    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE :: var_x, var_y, var_z, gamma_x,   &
    504300                                           gamma_y, gamma_z
    505301
     
    519315! Definition of variables needed for time-averaging of 2d/3d data
    520316!------------------------------------------------------------------------------!
    521 
    522     REAL, DIMENSION(:,:), ALLOCATABLE ::  lwp_av, precipitation_rate_av,       &
     317    USE kinds
     318
     319    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  lwp_av, precipitation_rate_av,   &
    523320                                          qsws_av, shf_av,ts_av, us_av, z0_av, &
    524321                                          z0h_av
    525322
    526     REAL, DIMENSION(:,:,:), ALLOCATABLE, TARGET :: &
     323    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                        &
    527324          e_av, lpt_av, nr_av, p_av, pc_av, pr_av, prr_av, pt_av, q_av, qc_av, &
    528325          ql_av, ql_c_av, ql_v_av, ql_vp_av, qr_av, qv_av, rho_av, s_av, sa_av,&
     
    540337! Definition of variables and constants for cloud physics
    541338!------------------------------------------------------------------------------!
     339    USE kinds
    542340
    543341    LOGICAL ::  curvature_solution_effects = .FALSE., &
     
    546344               
    547345
    548     REAL ::  a_1 = 8.69E-4,     & ! coef. in turb. parametrization (cm-2 s3)
    549              a_2 = -7.38E-5,    & ! coef. in turb. parametrization (cm-2 s3)
    550              a_3 = -1.40E-2,    & ! coef. in turb. parametrization
    551              a_term = 9.65,     & ! coef. for terminal velocity (m s-1)
    552              a_vent = 0.78,     & ! coef. for ventilation effect
    553              b_1 = 11.45E-6,    & ! coef. in turb. parametrization (m)
    554              b_2 = 9.68E-6,     & ! coef. in turb. parametrization (m)
    555              b_3 = 0.62,        & ! coef. in turb. parametrization
    556              b_term = 9.8,      & ! coef. for terminal velocity (m s-1)
    557              b_vent = 0.308,    & ! coef. for ventilation effect
    558              beta_cc = 3.09E-4, & ! coef. in turb. parametrization (cm-2 s3)
    559              bfactor,           &
    560              c_1 = 4.82E-6,     & ! coef. in turb. parametrization (m)
    561              c_2 = 4.8E-6,      & ! coef. in turb. parametrization (m)
    562              c_3 = 0.76,        & ! coef. in turb. parametrization
    563              c_const = 0.93,    & ! const. in Taylor-microscale Reynolds number
    564              c_evap = 0.7,      & ! constant in evaporation
    565              c_sedimentation = 2.0, & ! Courant number of sedimentation process
    566              c_term = 600.0,    & ! coef. for terminal velocity (m-1)
    567              cof(6) = (/ 76.18009172947146,      & ! coefficients in the
    568                          -86.50532032941677,     & ! numerical
    569                          24.01409824083091,      & ! calculation of the
    570                          -1.231739572450155,     & ! gamma function
    571                          0.1208650973866179E-2,  &
    572                          -0.5395239384953E-5 /), &
    573              cp = 1005.0,       & ! heat capacity of dry air (J kg-1 K-1)
    574              diff_coeff_l = 0.23E-4, & ! diffusivity of water vapor (m2 s-1)
    575              effective_coll_efficiency, &
    576              eps_ros = 1.0E-4,  & ! accuracy of Rosenbrock method
    577              eps_sb = 1.0E-20,  & ! threshold in two-moments scheme
    578              k_cc = 9.44E09,    & ! const. cloud-cloud kernel (m3 kg-2 s-1)
    579              k_cr0 = 4.33,      & ! const. cloud-rain kernel (m3 kg-1 s-1)
    580              k_rr = 7.12,       & ! const. rain-rain kernel (m3 kg-1 s-1)
    581              k_br = 1000.,      & ! const. in breakup parametrization (m-1)
    582              k_st = 1.2E8,      & ! const. in drizzle parametrization (m-1 s-1)
    583              kappa_rr = 60.7,   & ! const. in collision kernel (kg-1/3)
    584              kin_vis_air = 1.4086E-5, & ! kin. viscosity of air (m2 s-1)
    585              l_v = 2.5E+06,     & ! latent heat of vaporization (J kg-1)
    586              l_d_cp, l_d_r, l_d_rv, & ! l_v / cp, l_v / r_d, l_v / r_v
    587              mass_of_solute = 1.0E-17, & ! soluted NaCl (kg)
    588              molecular_weight_of_solute = 0.05844, & ! mol. m. NaCl (kg mol-1)
    589              molecular_weight_of_water = 0.01801528, & ! mol. m. H2O (kg mol-1)
    590              nc_const = 70.0E6, & ! cloud droplet concentration
    591              prec_time_const = 0.001, & !coef. in Kessler scheme
    592              pirho_l, dpirho_l, & ! pi * rho_l / 6.0; 6.0 / ( pi * rho_l )
    593              rho_l = 1.0E3,     & ! density of water (kg m-3)
    594              ql_crit = 0.0005,  & ! coef. in Kessler scheme
    595              r_d = 287.0,       & ! sp. gas const. dry air (J kg-1 K-1)
    596              r_v = 461.51,      & ! sp. gas const. water vapor (J kg-1 K-1)
    597              schmidt = 0.71,    & ! Schmidt number
    598              schmidt_p_1d3,     & ! schmidt**( 1.0 / 3.0 )
    599              sigma_gc = 1.3,    & ! log-normal geometric standard deviation
    600              stp = 2.5066282746310005, & ! parameter in gamma function
    601              thermal_conductivity_l = 2.43E-2, & ! therm. cond. air (J m-1 s-1 K-1)
    602              vanthoff = 2.0,    & ! van't Hoff factor for NaCl
    603              x0 = 2.6E-10,      & ! separating drop mass (kg)
    604              xrmin = 2.6E-10,   & ! minimum rain drop size (kg)
    605              xrmax = 5.0E-6,    & ! maximum rain drop site (kg)
    606              dt_precipitation = 100.0, & ! timestep precipitation (s)
    607              w_precipitation = 9.65      ! maximum terminal velocity (m s-1)
    608 
    609     REAL, DIMENSION(:), ALLOCATABLE     ::  hyrho, pt_d_t, t_d_pt 
    610 
    611     REAL, DIMENSION(:,:), ALLOCATABLE   ::  precipitation_amount, &
    612                                             precipitation_rate
     346    REAL(wp) ::  a_1 = 8.69E-4,     & !: coef. in turb. parametrization (cm-2 s3)
     347                 a_2 = -7.38E-5,    & !: coef. in turb. parametrization (cm-2 s3)
     348                 a_3 = -1.40E-2,    & !: coef. in turb. parametrization
     349                 a_term = 9.65,     & !: coef. for terminal velocity (m s-1)
     350                 a_vent = 0.78,     & !: coef. for ventilation effect
     351                 b_1 = 11.45E-6,    & !: coef. in turb. parametrization (m)
     352                 b_2 = 9.68E-6,     & !: coef. in turb. parametrization (m)
     353                 b_3 = 0.62,        & !: coef. in turb. parametrization
     354                 b_term = 9.8,      & !: coef. for terminal velocity (m s-1)
     355                 b_vent = 0.308,    & !: coef. for ventilation effect
     356                 beta_cc = 3.09E-4, & !: coef. in turb. parametrization (cm-2 s3)
     357                 bfactor,           &
     358                 c_1 = 4.82E-6,     & !: coef. in turb. parametrization (m)
     359                 c_2 = 4.8E-6,      & !: coef. in turb. parametrization (m)
     360                 c_3 = 0.76,        & !: coef. in turb. parametrization
     361                 c_const = 0.93,    & !: const. in Taylor-microscale Reynolds number
     362                 c_evap = 0.7,      & !: constant in evaporation
     363                 c_sedimentation = 2.0, & !: Courant number of sedimentation process
     364                 c_term = 600.0,    & !: coef. for terminal velocity (m-1)
     365                 cof(6) = (/ 76.18009172947146,      & !: coefficients in the
     366                             -86.50532032941677,     & !: numerical
     367                             24.01409824083091,      & !: calculation of the
     368                             -1.231739572450155,     & !: gamma function
     369                             0.1208650973866179E-2,  &
     370                             -0.5395239384953E-5 /), &
     371                cp = 1005.0,       & !: heat capacity of dry air (J kg-1 K-1)
     372                diff_coeff_l = 0.23E-4, & !: diffusivity of water vapor (m2 s-1)
     373                effective_coll_efficiency, & !:
     374                eps_ros = 1.0E-4,  & !: accuracy of Rosenbrock method
     375                eps_sb = 1.0E-20,  & !: threshold in two-moments scheme
     376                k_cc = 9.44E09,    & !: const. cloud-cloud kernel (m3 kg-2 s-1)
     377                k_cr0 = 4.33,      & !: const. cloud-rain kernel (m3 kg-1 s-1)
     378                k_rr = 7.12,       & !: const. rain-rain kernel (m3 kg-1 s-1)
     379                k_br = 1000.,      & !: const. in breakup parametrization (m-1)
     380                k_st = 1.2E8,      & !: const. in drizzle parametrization (m-1 s-1)
     381                kappa_rr = 60.7,   & !: const. in collision kernel (kg-1/3)
     382                kin_vis_air = 1.4086E-5, & !: kin. viscosity of air (m2 s-1)
     383                l_v = 2.5E+06,     & !: latent heat of vaporization (J kg-1)
     384                l_d_cp, l_d_r, l_d_rv, & !: l_v / cp, l_v / r_d, l_v / r_v
     385                mass_of_solute = 1.0E-17, & !: soluted NaCl (kg)
     386                molecular_weight_of_solute = 0.05844, & !: mol. m. NaCl (kg mol-1)
     387                molecular_weight_of_water = 0.01801528, & !: mol. m. H2O (kg mol-1)
     388                nc_const = 70.0E6, & !: cloud droplet concentration
     389                prec_time_const = 0.001, & !: coef. in Kessler scheme
     390                pirho_l, dpirho_l, & !: pi * rho_l / 6.0; 6.0 / ( pi * rho_l )
     391                rho_l = 1.0E3,     & !: density of water (kg m-3)
     392                ql_crit = 0.0005,  & !: coef. in Kessler scheme
     393                r_d = 287.0,       & !: sp. gas const. dry air (J kg-1 K-1)
     394                r_v = 461.51,      & !: sp. gas const. water vapor (J kg-1 K-1)
     395                schmidt = 0.71,    & !: Schmidt number
     396                schmidt_p_1d3,     & !: schmidt**( 1.0 / 3.0 )
     397                sigma_gc = 1.3,    & !: log-normal geometric standard deviation
     398                stp = 2.5066282746310005, & !: parameter in gamma function
     399                thermal_conductivity_l = 2.43E-2, & !: therm. cond. air (J m-1 s-1 K-1)
     400                vanthoff = 2.0,    & !: van't Hoff factor for NaCl
     401                x0 = 2.6E-10,      & !: separating drop mass (kg)
     402                xrmin = 2.6E-10,   & !: minimum rain drop size (kg)
     403                xrmax = 5.0E-6,    & !: maximum rain drop site (kg)
     404                dt_precipitation = 100.0, & !: timestep precipitation (s)
     405                w_precipitation = 9.65      !: maximum terminal velocity (m s-1)
     406
     407    REAL(wp), DIMENSION(:), ALLOCATABLE     ::  hyrho, pt_d_t, t_d_pt 
     408
     409    REAL(wp), DIMENSION(:,:), ALLOCATABLE   ::  precipitation_amount, &
     410                                                precipitation_rate
    613411!
    614412!-- 3D array of precipitation rate
    615     REAL, DIMENSION(:,:,:), ALLOCATABLE ::  prr
     413    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  prr
    616414
    617415    SAVE
     
    629427! Definition of general constants
    630428!------------------------------------------------------------------------------!
    631 
    632     REAL    ::  pi = 3.141592654
    633     REAL    ::  adv_mom_1, adv_mom_3, adv_mom_5, adv_sca_1, adv_sca_3, adv_sca_5
     429    USE kinds
     430
     431    REAL(wp)  ::  pi = 3.141592654_wp
     432    REAL(wp)  ::  adv_mom_1, adv_mom_3, adv_mom_5, adv_sca_1, adv_sca_3, adv_sca_5
    634433   
    635434
     
    648447! Definition of parameters for program control
    649448!------------------------------------------------------------------------------!
     449    USE kinds
    650450
    651451    TYPE plot_precision
    652452       CHARACTER (LEN=8) ::  variable
    653        INTEGER           ::  precision
     453       INTEGER(iwp)      ::  precision
    654454    END TYPE plot_precision
    655455
     
    722522    CHARACTER (LEN=10), DIMENSION(0:1,100) ::  do2d = ' ', do3d = ' '
    723523
    724     INTEGER ::  abort_mode = 1, average_count_pr = 0, average_count_sp = 0, &
    725                 average_count_3d = 0, current_timestep_number = 0, &
    726                 coupling_topology = 0, &
    727                 dist_range = 0, disturbance_level_ind_b, &
    728                 disturbance_level_ind_t, doav_n = 0, dopr_n = 0, &
    729                 dopr_time_count = 0, dopts_time_count = 0, &
    730                 dosp_time_count = 0, dots_time_count = 0, &
    731                 do2d_xy_n = 0, do2d_xz_n = 0, do2d_yz_n = 0, do3d_avs_n = 0, &
    732                 dp_level_ind_b = 0, dvrp_filecount = 0, &
    733                 dz_stretch_level_index, gamma_mg, gathered_size, &
    734                 grid_level, ibc_e_b, ibc_p_b, ibc_p_t, &
    735                 ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, &
    736                 ibc_sa_t, ibc_uv_b, ibc_uv_t, icloud_scheme, &
    737                 inflow_disturbance_begin = -1, inflow_disturbance_end = -1, &
    738                 intermediate_timestep_count, intermediate_timestep_count_max, &
    739                 io_group = 0, io_blocks = 1, iran = -1234567, &
    740                 masks = 0, maximum_grid_level, &
    741                 maximum_parallel_io_streams = -1, max_pr_user = 0, &
    742                 mgcycles = 0, mg_cycles = -1, mg_switch_to_pe0_level = 0, mid, &
    743                 nlsf = 1000, ntnudge = 100, netcdf_data_format = 2, ngsrb = 2, &
    744                 nr_timesteps_this_run = 0, &
    745                 nsor = 20, nsor_ini = 100, n_sor, normalizing_region = 0, &
    746                 nz_do3d = -9999, pch_index = 0, prt_time_count = 0, &
    747                 recycling_plane, runnr = 0, &
    748                 skip_do_avs = 0, subdomain_size, terminate_coupled = 0, &
    749                 terminate_coupled_remote = 0, timestep_count = 0
    750 
    751     INTEGER ::  dist_nxl(0:1), dist_nxr(0:1), dist_nyn(0:1), dist_nys(0:1), &
    752                 do2d_no(0:1) = 0, do2d_xy_time_count(0:1), &
    753                 do2d_xz_time_count(0:1), do2d_yz_time_count(0:1), &
    754                 do3d_no(0:1) = 0, do3d_time_count(0:1), &
    755                 domask_no(max_masks,0:1) = 0, domask_time_count(max_masks,0:1),&
    756                 lad_vertical_gradient_level_ind(10) = -9999, &
    757                 mask_size(max_masks,3) = -1, mask_size_l(max_masks,3) = -1, &
    758                 mask_start_l(max_masks,3) = -1, &
    759                 pt_vertical_gradient_level_ind(10) = -9999, &
    760                 q_vertical_gradient_level_ind(10) = -9999, &
    761                 sa_vertical_gradient_level_ind(10) = -9999, &
    762                 section(100,3), section_xy(100) = -9999, &
    763                 section_xz(100) = -9999, section_yz(100) = -9999, &
    764                 ug_vertical_gradient_level_ind(10) = -9999, &
    765                 vg_vertical_gradient_level_ind(10) = -9999, &
    766                 subs_vertical_gradient_level_i(10) = -9999
     524    INTEGER(iwp) ::  abort_mode = 1, average_count_pr = 0, average_count_sp = 0, &
     525                     average_count_3d = 0, current_timestep_number = 0, &
     526                     coupling_topology = 0, &
     527                     dist_range = 0, disturbance_level_ind_b, &
     528                     disturbance_level_ind_t, doav_n = 0, dopr_n = 0, &
     529                     dopr_time_count = 0, dopts_time_count = 0, &
     530                     dosp_time_count = 0, dots_time_count = 0, &
     531                     do2d_xy_n = 0, do2d_xz_n = 0, do2d_yz_n = 0, do3d_avs_n = 0, &
     532                     dp_level_ind_b = 0, dvrp_filecount = 0, &
     533                     dz_stretch_level_index, gamma_mg, gathered_size, &
     534                     grid_level, ibc_e_b, ibc_p_b, ibc_p_t, &
     535                     ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, &
     536                     ibc_sa_t, ibc_uv_b, ibc_uv_t, icloud_scheme, &
     537                     inflow_disturbance_begin = -1, inflow_disturbance_end = -1, &
     538                     intermediate_timestep_count, intermediate_timestep_count_max, &
     539                     io_group = 0, io_blocks = 1, iran = -1234567, &
     540                     masks = 0, maximum_grid_level, &
     541                     maximum_parallel_io_streams = -1, max_pr_user = 0, &
     542                     mgcycles = 0, mg_cycles = -1, mg_switch_to_pe0_level = 0, mid, &
     543                     nlsf = 1000, ntnudge = 100, netcdf_data_format = 2, ngsrb = 2, &
     544                     nr_timesteps_this_run = 0, &
     545                     nsor = 20, nsor_ini = 100, n_sor, normalizing_region = 0, &
     546                     nz_do3d = -9999, pch_index = 0, prt_time_count = 0, &
     547                     recycling_plane, runnr = 0, &
     548                     skip_do_avs = 0, subdomain_size, terminate_coupled = 0, &
     549                     terminate_coupled_remote = 0, timestep_count = 0
     550
     551    INTEGER(iwp) ::  dist_nxl(0:1), dist_nxr(0:1), dist_nyn(0:1), dist_nys(0:1), &
     552                     do2d_no(0:1) = 0, do2d_xy_time_count(0:1), &
     553                     do2d_xz_time_count(0:1), do2d_yz_time_count(0:1), &
     554                     do3d_no(0:1) = 0, do3d_time_count(0:1), &
     555                     domask_no(max_masks,0:1) = 0, domask_time_count(max_masks,0:1),&
     556                     lad_vertical_gradient_level_ind(10) = -9999, &
     557                     mask_size(max_masks,3) = -1, mask_size_l(max_masks,3) = -1, &
     558                     mask_start_l(max_masks,3) = -1, &
     559                     pt_vertical_gradient_level_ind(10) = -9999, &
     560                     q_vertical_gradient_level_ind(10) = -9999, &
     561                     sa_vertical_gradient_level_ind(10) = -9999, &
     562                     section(100,3), section_xy(100) = -9999, &
     563                     section_xz(100) = -9999, section_yz(100) = -9999, &
     564                     ug_vertical_gradient_level_ind(10) = -9999, &
     565                     vg_vertical_gradient_level_ind(10) = -9999, &
     566                     subs_vertical_gradient_level_i(10) = -9999
    767567
    768568#if defined ( __check )
    769     INTEGER :: check_restart = 0
     569    INTEGER(iwp) :: check_restart = 0
    770570#endif
    771571
    772     INTEGER, DIMENSION(0:1) :: ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, ntdim_3d
    773 
    774     INTEGER, DIMENSION(:), ALLOCATABLE ::  grid_level_count
    775 
    776     INTEGER, DIMENSION(:,:), ALLOCATABLE   ::  mask_i, mask_j, mask_k
    777     INTEGER, DIMENSION(:,:), ALLOCATABLE   ::  &
    778                 mask_i_global, mask_j_global, mask_k_global
     572    INTEGER(iwp), DIMENSION(0:1) :: ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, ntdim_3d
     573
     574    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  grid_level_count
     575
     576    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  mask_i, mask_j, mask_k
     577    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  &
     578                    mask_i_global, mask_j_global, mask_k_global
    779579
    780580    LOGICAL ::  avs_output = .FALSE., &
     
    829629                data_output_yz(0:1) = .FALSE.
    830630
    831     REAL ::  advected_distance_x = 0.0, advected_distance_y = 0.0, &
    832              alpha_surface = 0.0, atmos_ocean_sign = 1.0, &
    833              averaging_interval = 0.0, averaging_interval_pr = 9999999.9, &
    834              averaging_interval_sp = 9999999.9, bc_pt_t_val, bc_q_t_val, &
    835              bottom_salinityflux = 0.0, &
    836              building_height = 50.0, building_length_x = 50.0, &
    837              building_length_y = 50.0, building_wall_left = 9999999.9, &
    838              building_wall_south = 9999999.9, canyon_height = 50.0, &
    839              canyon_width_x = 9999999.9, canyon_width_y = 9999999.9, &
    840              canyon_wall_left = 9999999.9, canyon_wall_south = 9999999.9, &
    841              cthf = 0.0, cfl_factor = -1.0, cos_alpha_surface, &
    842              coupling_start_time = 0.0, disturbance_amplitude = 0.25, &
    843              disturbance_energy_limit = 0.01, &
    844              disturbance_level_b = -9999999.9, &
    845              disturbance_level_t = -9999999.9, &
    846              dp_level_b = 0.0, drag_coefficient = 0.0, &
    847              dt = -1.0, dt_averaging_input = 0.0, &
    848              dt_averaging_input_pr = 9999999.9, dt_coupling = 9999999.9, &
    849              dt_data_output = 9999999.9, &
    850              dt_data_output_av = 9999999.9, dt_disturb = 9999999.9, &
    851              dt_dopr = 9999999.9, dt_dopr_listing = 9999999.9, &
    852              dt_dopts = 9999999.9, dt_dosp = 9999999.9, dt_dots = 9999999.9, &
    853              dt_do2d_xy = 9999999.9, dt_do2d_xz = 9999999.9, &
    854              dt_do2d_yz = 9999999.9, dt_do3d = 9999999.9, dt_dvrp = 9999999.9, &
    855              dt_max = 20.0, dt_micro = -1.0, dt_restart = 9999999.9, &
    856              dt_run_control = 60.0, dt_3d = -1.0, dz = -1.0, &
    857              dz_max = 9999999.9, dz_stretch_factor = 1.08, &
    858              dz_stretch_level = 100000.0, e_init = 0.0, e_min = 0.0, &
    859              end_time = 0.0, &
    860              f = 0.0, fs = 0.0, g = 9.81, inflow_damping_height = 9999999.9, &
    861              inflow_damping_width = 9999999.9, kappa = 0.4, km_constant = -1.0,&
    862              lad_surface = 0.0, leaf_surface_concentration = 0.0, &
    863              mask_scale_x = 1.0, mask_scale_y = 1.0, mask_scale_z = 1.0, &
    864              maximum_cpu_time_allowed = 0.0,  &
    865              molecular_viscosity = 1.461E-5, &
    866              old_dt = 1.0E-10, omega = 7.29212E-5, omega_sor = 1.8, &
    867              particle_maximum_age = 9999999.9, &
    868              phi = 55.0, prandtl_number = 1.0, &
    869              precipitation_amount_interval = 9999999.9, prho_reference, &
    870              pt_damping_factor = 0.0, pt_damping_width = 0.0, &
    871              pt_reference = 9999999.9, pt_slope_offset = 0.0, &
    872              pt_surface = 300.0, pt_surface_initial_change = 0.0, &
    873              q_surface = 0.0, q_surface_initial_change = 0.0, &
    874              rayleigh_damping_factor = -1.0, rayleigh_damping_height = -1.0, &
    875              recycling_width = 9999999.9, residual_limit = 1.0E-4, &
    876              restart_time = 9999999.9, rho_reference, rho_surface, &
    877              rif_max = 1.0, rif_min = -5.0, roughness_length = 0.1, &
    878              sa_surface = 35.0, scalar_exchange_coefficient = 0.0, &
    879              simulated_time = 0.0, simulated_time_at_begin, sin_alpha_surface, &
    880              skip_time_data_output = 0.0, skip_time_data_output_av = 9999999.9,&
    881              skip_time_dopr = 9999999.9, skip_time_dosp = 9999999.9, &
    882              skip_time_do2d_xy = 9999999.9, skip_time_do2d_xz = 9999999.9, &
    883              skip_time_do2d_yz = 9999999.9, skip_time_do3d = 9999999.9, &
    884              surface_heatflux = 9999999.9, surface_pressure = 1013.25, &
    885              surface_scalarflux = 9999999.9, surface_waterflux = 9999999.9, &
    886              s_surface = 0.0, s_surface_initial_change = 0.0, &
    887              termination_time_needed = -1.0, time_coupling = 0.0, &
    888              time_disturb = 0.0, time_dopr = 0.0, time_dopr_av = 0.0, &
    889              time_dopr_listing = 0.0, time_dopts = 0.0, time_dosp = 0.0, &
    890              time_dosp_av = 0.0, time_dots = 0.0, time_do2d_xy = 0.0, &
    891              time_do2d_xz = 0.0, time_do2d_yz = 0.0, time_do3d = 0.0, &
    892              time_do_av = 0.0, time_do_sla = 0.0, time_dvrp = 0.0, &
    893              time_restart = 9999999.9, time_run_control = 0.0,&
    894              time_since_reference_point, top_heatflux = 9999999.9, &
    895              top_momentumflux_u = 9999999.9, &
    896              top_momentumflux_v = 9999999.9, top_salinityflux = 9999999.9, &
    897              ug_surface = 0.0, u_bulk = 0.0, u_gtrans = 0.0, &
    898              vg_surface = 0.0, vpt_reference = 9999999.9, &
    899              v_bulk = 0.0, v_gtrans = 0.0, wall_adjustment_factor = 1.8, &
    900              z_max_do2d = -1.0, z0h_factor = 1.0
    901 
    902     REAL ::  do2d_xy_last_time(0:1) = -1.0, do2d_xz_last_time(0:1) = -1.0, &
    903              do2d_yz_last_time(0:1) = -1.0, dpdxy(1:2) = 0.0, &
    904              dt_domask(max_masks) = 9999999.9, lad_vertical_gradient(10) = 0.0,&
    905              lad_vertical_gradient_level(10) = -9999999.9, &
    906              mask_scale(3), &
    907              pt_vertical_gradient(10) = 0.0, &
    908              pt_vertical_gradient_level(10) = -9999999.9, &
    909              q_vertical_gradient(10) = 0.0, &
    910              q_vertical_gradient_level(10) = -1.0, &
    911              s_vertical_gradient(10) = 0.0, &
    912              s_vertical_gradient_level(10) = -1.0, &
    913              sa_vertical_gradient(10) = 0.0, &
    914              sa_vertical_gradient_level(10) = -9999999.9, &
    915              skip_time_domask(max_masks) = 9999999.9, threshold(20) = 0.0, &
    916              time_domask(max_masks) = 0.0, &
    917              tsc(10) = (/ 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 /), &
    918              u_profile(100) = 9999999.9, uv_heights(100) = 9999999.9, &
    919              v_profile(100) = 9999999.9, &
    920              ug_vertical_gradient(10) = 0.0, &
    921              ug_vertical_gradient_level(10) = -9999999.9, &
    922              vg_vertical_gradient(10) = 0.0, &
    923              vg_vertical_gradient_level(10) = -9999999.9, &
    924              volume_flow(1:2) = 0.0, volume_flow_area(1:2) = 0.0, &
    925              volume_flow_initial(1:2) = 0.0, wall_heatflux(0:4) = 0.0, &
    926              wall_humidityflux(0:4) = 0.0, wall_nrflux(0:4) = 0.0, &
    927              wall_qflux(0:4) = 0.0, wall_qrflux(0:4) = 0.0, &
    928              wall_salinityflux(0:4) = 0.0, wall_scalarflux(0:4) = 0.0, &
    929              subs_vertical_gradient(10) = 0.0, &
    930              subs_vertical_gradient_level(10) = -9999999.9
    931 
    932     REAL, DIMENSION(:), ALLOCATABLE ::  dp_smooth_factor
    933 
    934     REAL, DIMENSION(max_masks,mask_xyz_dimension) :: &
    935         mask_x = -1.0, mask_y = -1.0, mask_z = -1.0
    936     REAL, DIMENSION(max_masks,3) ::                  &
    937         mask_x_loop = -1.0, mask_y_loop = -1.0, mask_z_loop = -1.0
     631    REAL(wp) ::  advected_distance_x = 0.0, advected_distance_y = 0.0, &
     632                 alpha_surface = 0.0, atmos_ocean_sign = 1.0, &
     633                 averaging_interval = 0.0, averaging_interval_pr = 9999999.9, &
     634                 averaging_interval_sp = 9999999.9, bc_pt_t_val, bc_q_t_val, &
     635                 bottom_salinityflux = 0.0, &
     636                 building_height = 50.0, building_length_x = 50.0, &
     637                 building_length_y = 50.0, building_wall_left = 9999999.9, &
     638                 building_wall_south = 9999999.9, canyon_height = 50.0, &
     639                 canyon_width_x = 9999999.9, canyon_width_y = 9999999.9, &
     640                 canyon_wall_left = 9999999.9, canyon_wall_south = 9999999.9, &
     641                 cthf = 0.0, cfl_factor = -1.0, cos_alpha_surface, &
     642                 coupling_start_time = 0.0, disturbance_amplitude = 0.25, &
     643                 disturbance_energy_limit = 0.01, &
     644                 disturbance_level_b = -9999999.9, &
     645                 disturbance_level_t = -9999999.9, &
     646                 dp_level_b = 0.0, drag_coefficient = 0.0, &
     647                 dt = -1.0, dt_averaging_input = 0.0, &
     648                 dt_averaging_input_pr = 9999999.9, dt_coupling = 9999999.9, &
     649                 dt_data_output = 9999999.9, &
     650                 dt_data_output_av = 9999999.9, dt_disturb = 9999999.9, &
     651                 dt_dopr = 9999999.9, dt_dopr_listing = 9999999.9, &
     652                 dt_dopts = 9999999.9, dt_dosp = 9999999.9, dt_dots = 9999999.9, &
     653                 dt_do2d_xy = 9999999.9, dt_do2d_xz = 9999999.9, &
     654                 dt_do2d_yz = 9999999.9, dt_do3d = 9999999.9, dt_dvrp = 9999999.9, &
     655                 dt_max = 20.0, dt_micro = -1.0, dt_restart = 9999999.9, &
     656                 dt_run_control = 60.0, dt_3d = -1.0, dz = -1.0, &
     657                 dz_max = 9999999.9, dz_stretch_factor = 1.08, &
     658                 dz_stretch_level = 100000.0, e_init = 0.0, e_min = 0.0, &
     659                 end_time = 0.0, &
     660                 f = 0.0, fs = 0.0, g = 9.81, inflow_damping_height = 9999999.9, &
     661                 inflow_damping_width = 9999999.9, kappa = 0.4, km_constant = -1.0,&
     662                 lad_surface = 0.0, leaf_surface_concentration = 0.0, &
     663                 mask_scale_x = 1.0, mask_scale_y = 1.0, mask_scale_z = 1.0, &
     664                 maximum_cpu_time_allowed = 0.0,  &
     665                 molecular_viscosity = 1.461E-5, &
     666                 old_dt = 1.0E-10, omega = 7.29212E-5, omega_sor = 1.8, &
     667                 particle_maximum_age = 9999999.9, &
     668                 phi = 55.0, prandtl_number = 1.0, &
     669                 precipitation_amount_interval = 9999999.9, prho_reference, &
     670                 pt_damping_factor = 0.0, pt_damping_width = 0.0, &
     671                 pt_reference = 9999999.9, pt_slope_offset = 0.0, &
     672                 pt_surface = 300.0, pt_surface_initial_change = 0.0, &
     673                 q_surface = 0.0, q_surface_initial_change = 0.0, &
     674                 rayleigh_damping_factor = -1.0, rayleigh_damping_height = -1.0, &
     675                 recycling_width = 9999999.9, residual_limit = 1.0E-4, &
     676                 restart_time = 9999999.9, rho_reference, rho_surface, &
     677                 rif_max = 1.0, rif_min = -5.0, roughness_length = 0.1, &
     678                 sa_surface = 35.0, scalar_exchange_coefficient = 0.0, &
     679                 simulated_time = 0.0, simulated_time_at_begin, sin_alpha_surface, &
     680                 skip_time_data_output = 0.0, skip_time_data_output_av = 9999999.9,&
     681                 skip_time_dopr = 9999999.9, skip_time_dosp = 9999999.9, &
     682                 skip_time_do2d_xy = 9999999.9, skip_time_do2d_xz = 9999999.9, &
     683                 skip_time_do2d_yz = 9999999.9, skip_time_do3d = 9999999.9, &
     684                 surface_heatflux = 9999999.9, surface_pressure = 1013.25, &
     685                 surface_scalarflux = 9999999.9, surface_waterflux = 9999999.9, &
     686                 s_surface = 0.0, s_surface_initial_change = 0.0, &
     687                 termination_time_needed = -1.0, time_coupling = 0.0, &
     688                 time_disturb = 0.0, time_dopr = 0.0, time_dopr_av = 0.0, &
     689                 time_dopr_listing = 0.0, time_dopts = 0.0, time_dosp = 0.0, &
     690                 time_dosp_av = 0.0, time_dots = 0.0, time_do2d_xy = 0.0, &
     691                 time_do2d_xz = 0.0, time_do2d_yz = 0.0, time_do3d = 0.0, &
     692                 time_do_av = 0.0, time_do_sla = 0.0, time_dvrp = 0.0, &
     693                 time_restart = 9999999.9, time_run_control = 0.0,&
     694                 time_since_reference_point, top_heatflux = 9999999.9, &
     695                 top_momentumflux_u = 9999999.9, &
     696                 top_momentumflux_v = 9999999.9, top_salinityflux = 9999999.9, &
     697                 ug_surface = 0.0, u_bulk = 0.0, u_gtrans = 0.0, &
     698                 vg_surface = 0.0, vpt_reference = 9999999.9, &
     699                 v_bulk = 0.0, v_gtrans = 0.0, wall_adjustment_factor = 1.8, &
     700                 z_max_do2d = -1.0, z0h_factor = 1.0
     701
     702    REAL(wp) ::  do2d_xy_last_time(0:1) = -1.0, do2d_xz_last_time(0:1) = -1.0, &
     703                 do2d_yz_last_time(0:1) = -1.0, dpdxy(1:2) = 0.0, &
     704                 dt_domask(max_masks) = 9999999.9, lad_vertical_gradient(10) = 0.0,&
     705                 lad_vertical_gradient_level(10) = -9999999.9, &
     706                 mask_scale(3), &
     707                 pt_vertical_gradient(10) = 0.0, &
     708                 pt_vertical_gradient_level(10) = -9999999.9, &
     709                 q_vertical_gradient(10) = 0.0, &
     710                 q_vertical_gradient_level(10) = -1.0, &
     711                 s_vertical_gradient(10) = 0.0, &
     712                 s_vertical_gradient_level(10) = -1.0, &
     713                 sa_vertical_gradient(10) = 0.0, &
     714                 sa_vertical_gradient_level(10) = -9999999.9, &
     715                 skip_time_domask(max_masks) = 9999999.9, threshold(20) = 0.0, &
     716                 time_domask(max_masks) = 0.0, &
     717                 tsc(10) = (/ 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 /), &
     718                 u_profile(100) = 9999999.9, uv_heights(100) = 9999999.9, &
     719                 v_profile(100) = 9999999.9, &
     720                 ug_vertical_gradient(10) = 0.0, &
     721                 ug_vertical_gradient_level(10) = -9999999.9, &
     722                 vg_vertical_gradient(10) = 0.0, &
     723                 vg_vertical_gradient_level(10) = -9999999.9, &
     724                 volume_flow(1:2) = 0.0, volume_flow_area(1:2) = 0.0, &
     725                 volume_flow_initial(1:2) = 0.0, wall_heatflux(0:4) = 0.0, &
     726                 wall_humidityflux(0:4) = 0.0, wall_nrflux(0:4) = 0.0, &
     727                 wall_qflux(0:4) = 0.0, wall_qrflux(0:4) = 0.0, &
     728                 wall_salinityflux(0:4) = 0.0, wall_scalarflux(0:4) = 0.0, &
     729                 subs_vertical_gradient(10) = 0.0, &
     730                 subs_vertical_gradient_level(10) = -9999999.9
     731
     732    REAL(wp), DIMENSION(:), ALLOCATABLE ::  dp_smooth_factor
     733
     734    REAL(wp), DIMENSION(max_masks,mask_xyz_dimension) :: &
     735            mask_x = -1.0, mask_y = -1.0, mask_z = -1.0
     736    REAL(wp), DIMENSION(max_masks,3) ::                  &
     737            mask_x_loop = -1.0, mask_y_loop = -1.0, mask_z_loop = -1.0
    938738   
    939739!
    940740!--    internal mask arrays ("mask,dimension,selection")
    941        REAL, DIMENSION(:,:,:), ALLOCATABLE ::  mask, mask_loop
     741       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  mask, mask_loop
    942742
    943743    SAVE
     
    954754! Definition of variables used with dvrp-software
    955755!------------------------------------------------------------------------------!
     756
     757     USE kinds
    956758
    957759    CHARACTER (LEN=10) ::  dvrp_output = 'rtsp', particle_color = 'none', &
     
    967769                           dvrp_username  = ' '
    968770
    969     INTEGER ::  cluster_size = 1, dvrp_colortable_entries = 4,                 &
    970                 dvrp_colortable_entries_prt = 22, islice_dvrp,                 &
    971                 nx_dvrp, nxl_dvrp, nxr_dvrp, ny_dvrp, nyn_dvrp, nys_dvrp,      &
    972                 nz_dvrp, pathlines_fadeintime = 5, pathlines_fadeouttime = 5,  &
    973                 pathlines_linecount = 1000, pathlines_maxhistory = 40,         &
    974                 pathlines_wavecount = 10, pathlines_wavetime = 50,             &
    975                 vc_gradient_normals = 0, vc_mode = 0, vc_size_x = 2,           &
    976                 vc_size_y = 2, vc_size_z = 2
    977 
    978     INTEGER, DIMENSION(10) ::  slicer_position_dvrp
     771    INTEGER(iwp) ::  cluster_size = 1, dvrp_colortable_entries = 4,                 &
     772                     dvrp_colortable_entries_prt = 22, islice_dvrp,                 &
     773                     nx_dvrp, nxl_dvrp, nxr_dvrp, ny_dvrp, nyn_dvrp, nys_dvrp,      &
     774                     nz_dvrp, pathlines_fadeintime = 5, pathlines_fadeouttime = 5,  &
     775                     pathlines_linecount = 1000, pathlines_maxhistory = 40,         &
     776                     pathlines_wavecount = 10, pathlines_wavetime = 50,             &
     777                     vc_gradient_normals = 0, vc_mode = 0, vc_size_x = 2,           &
     778                     vc_size_y = 2, vc_size_z = 2
     779
     780    INTEGER(iwp), DIMENSION(10) ::  slicer_position_dvrp
    979781
    980782    LOGICAL ::  cyclic_dvrp = .FALSE., dvrp_overlap, dvrp_total_overlap, &
     
    982784                use_seperate_pe_for_dvrp_output = .FALSE.
    983785
    984     REAL    ::  clip_dvrp_l = 9999999.9, clip_dvrp_n = 9999999.9, &
    985                 clip_dvrp_r = 9999999.9, clip_dvrp_s = 9999999.9, &
    986                 superelevation = 1.0, superelevation_x = 1.0,     &
    987                 superelevation_y = 1.0, vc_alpha = 38.0
    988 
    989     REAL, DIMENSION(2) ::  color_interval = (/ 0.0, 1.0 /), &
    990                            dvrpsize_interval = (/ 0.0, 1.0 /)
    991 
    992     REAL, DIMENSION(3) ::  groundplate_color = (/ 0.0, 0.6, 0.0 /), &
    993                            topography_color = (/ 0.8, 0.7, 0.6 /)
     786    REAL(wp)    ::  clip_dvrp_l = 9999999.9, clip_dvrp_n = 9999999.9, &
     787                    clip_dvrp_r = 9999999.9, clip_dvrp_s = 9999999.9, &
     788                    superelevation = 1.0, superelevation_x = 1.0,     &
     789                    superelevation_y = 1.0, vc_alpha = 38.0
     790
     791    REAL(wp), DIMENSION(2) ::  color_interval = (/ 0.0, 1.0 /), &
     792                               dvrpsize_interval = (/ 0.0, 1.0 /)
     793
     794    REAL(wp), DIMENSION(3) ::  groundplate_color = (/ 0.0, 0.6, 0.0 /), &
     795                               topography_color = (/ 0.8, 0.7, 0.6 /)
    994796
    995797#if defined( __decalpha )
    996     REAL, DIMENSION(2,10)  ::  slicer_range_limits_dvrp = RESHAPE( (/       &
    997                                 -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
    998                                 -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
    999                                 -1.0, 1.0, -1.0, 1.0 /), (/ 2, 10 /) )
    1000 
    1001     REAL, DIMENSION(3,10)  ::  isosurface_color = RESHAPE( (/                  &
    1002                                 0.9, 0.9, 0.9,  0.8, 0.1, 0.1,  0.1, 0.1, 0.8, &
    1003                                 0.1, 0.8, 0.1,  0.6, 0.1, 0.1,  0.1, 0.1, 0.6, &
    1004                                 0.1, 0.6, 0.1,  0.4, 0.1, 0.1,  0.1, 0.1, 0.4, &
    1005                                 0.1, 0.4, 0.1 /), (/ 3, 10 /) )
    1006 
    1007     REAL(4), DIMENSION(2,100) ::  interval_values_dvrp, interval_h_dvrp =      &
    1008                                   RESHAPE( (/ 270.0, 225.0, 225.0, 180.0,      &
    1009                                                70.0,  25.0,  25.0, -25.0,      &
    1010                                               ( 0.0, i9 = 1, 192 ) /),         &
    1011                                            (/ 2, 100 /) ),                     &
    1012                                   interval_l_dvrp = 0.5, interval_s_dvrp = 1.0,&
    1013                                   interval_a_dvrp = 0.0,                       &
    1014                                   interval_values_dvrp_prt,                    &
    1015                                   interval_h_dvrp_prt = RESHAPE(               &
    1016                                   (/ 270.0, 225.0, 225.0, 180.0, 70.0, 25.0,   &
    1017                                      25.0, -25.0, ( 0.0, i9 = 1, 192 ) /),     &
    1018                                                   (/ 2, 100 /) ),              &
    1019                                   interval_l_dvrp_prt = 0.5,                   &
    1020                                   interval_s_dvrp_prt = 1.0,                   &
    1021                                   interval_a_dvrp_prt = 0.0
     798    REAL(wp), DIMENSION(2,10)  ::  slicer_range_limits_dvrp = RESHAPE( (/      &
     799                                   -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
     800                                   -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
     801                                   -1.0, 1.0, -1.0, 1.0 /), (/ 2, 10 /) )
     802
     803    REAL(wp), DIMENSION(3,10)  ::  isosurface_color = RESHAPE( (/                 &
     804                                   0.9, 0.9, 0.9,  0.8, 0.1, 0.1,  0.1, 0.1, 0.8, &
     805                                   0.1, 0.8, 0.1,  0.6, 0.1, 0.1,  0.1, 0.1, 0.6, &
     806                                   0.1, 0.6, 0.1,  0.4, 0.1, 0.1,  0.1, 0.1, 0.4, &
     807                                   0.1, 0.4, 0.1 /), (/ 3, 10 /) )
     808
     809    REAL(sp), DIMENSION(2,100) ::  interval_values_dvrp, interval_h_dvrp =      &
     810                                   RESHAPE( (/ 270.0, 225.0, 225.0, 180.0,      &
     811                                                70.0,  25.0,  25.0, -25.0,      &
     812                                               ( 0.0, i9 = 1, 192 ) /),         &
     813                                            (/ 2, 100 /) ),                     &
     814                                   interval_l_dvrp = 0.5, interval_s_dvrp = 1.0,&
     815                                   interval_a_dvrp = 0.0,                       &
     816                                   interval_values_dvrp_prt,                    &
     817                                   interval_h_dvrp_prt = RESHAPE(               &
     818                                   (/ 270.0, 225.0, 225.0, 180.0, 70.0, 25.0,   &
     819                                      25.0, -25.0, ( 0.0, i9 = 1, 192 ) /),     &
     820                                                   (/ 2, 100 /) ),              &
     821                                   interval_l_dvrp_prt = 0.5,                   &
     822                                   interval_s_dvrp_prt = 1.0,                   &
     823                                   interval_a_dvrp_prt = 0.0
    1022824#else
    1023     REAL, DIMENSION(2,10)     ::  slicer_range_limits_dvrp
    1024 
    1025     REAL, DIMENSION(3,10)     ::  isosurface_color
    1026 
    1027     REAL(4), DIMENSION(2,100) ::  interval_values_dvrp,                       &
    1028                                   interval_values_dvrp_prt, interval_h_dvrp,  &
    1029                                   interval_h_dvrp_prt, interval_l_dvrp = 0.5, &
    1030                                   interval_l_dvrp_prt = 0.5, interval_s_dvrp = 1.0, &
    1031                                   interval_s_dvrp_prt = 1.0, interval_a_dvrp = 0.0, &
    1032                                   interval_a_dvrp_prt = 0.0
     825    REAL(wp), DIMENSION(2,10)     ::  slicer_range_limits_dvrp
     826
     827    REAL(wp), DIMENSION(3,10)     ::  isosurface_color
     828
     829    REAL(sp), DIMENSION(2,100) ::  interval_values_dvrp,                       &
     830                                   interval_values_dvrp_prt, interval_h_dvrp,  &
     831                                   interval_h_dvrp_prt, interval_l_dvrp = 0.5, &
     832                                   interval_l_dvrp_prt = 0.5, interval_s_dvrp = 1.0, &
     833                                   interval_s_dvrp_prt = 1.0, interval_a_dvrp = 0.0, &
     834                                   interval_a_dvrp_prt = 0.0
    1033835
    1034836    DATA  slicer_range_limits_dvrp / -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, &
     
    1049851#endif
    1050852
    1051     REAL(4), DIMENSION(:), ALLOCATABLE ::  xcoor_dvrp, ycoor_dvrp, zcoor_dvrp
     853    REAL(sp), DIMENSION(:), ALLOCATABLE ::  xcoor_dvrp, ycoor_dvrp, zcoor_dvrp
    1052854
    1053855    TYPE steering
    1054856       CHARACTER (LEN=24) ::  name
    1055        REAL(4)            ::  min, max
    1056        INTEGER            ::  imin, imax
     857       REAL(sp)           ::  min, max
     858       INTEGER(iwp)       ::  imin, imax
    1057859    END TYPE steering
    1058860
     
    1074876!------------------------------------------------------------------------------!
    1075877
    1076     REAL ::  ddx, ddx2, dx = 1.0, dx2, ddy, ddy2, dy = 1.0, dy2
    1077 
    1078     REAL, DIMENSION(:), ALLOCATABLE ::  ddx2_mg, ddy2_mg
    1079 
    1080     REAL, DIMENSION(:,:), ALLOCATABLE ::  fwxm, fwxp, fwym, fwyp, fxm, fxp,   &
    1081                                           fym, fyp, wall_e_x, wall_e_y,       &
    1082                                           wall_u, wall_v, wall_w_x, wall_w_y, &
    1083                                           zu_s_inner, zw_w_inner
     878    USE kinds
     879
     880    REAL(wp) ::  ddx, ddx2, dx = 1.0, dx2, ddy, ddy2, dy = 1.0, dy2
     881
     882    REAL(wp), DIMENSION(:), ALLOCATABLE ::  ddx2_mg, ddy2_mg
     883
     884    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fwxm, fwxp, fwym, fwyp, fxm, fxp,   &
     885                                              fym, fyp, wall_e_x, wall_e_y,       &
     886                                              wall_u, wall_v, wall_w_x, wall_w_y, &
     887                                              zu_s_inner, zw_w_inner
    1084888
    1085889    SAVE
     
    1098902!------------------------------------------------------------------------------!
    1099903
    1100     INTEGER ::  i_left, i_right, j_north, j_south, nbgp = 3, ngp_sums, nnx,    &
    1101                 nx = 0, nx_a, nx_o, nxl, nxlg, nxlu, nxr, nxrg, nx_on_file,    &
    1102                 nny, ny = 0, ny_a, ny_o, nyn, nyng, nys, nysg, nysv,           &
    1103                 ny_on_file, nnz, nz = 0, nzb, nzb_diff, nzb_max, nzt, nzt_diff
    1104 
    1105 
    1106     INTEGER( KIND = SELECTED_INT_KIND(18) ), DIMENSION(:), ALLOCATABLE ::      &
     904    USE kinds
     905
     906    INTEGER(iwp) ::  i_left, i_right, j_north, j_south, nbgp = 3, ngp_sums, nnx,    &
     907                     nx = 0, nx_a, nx_o, nxl, nxlg, nxlu, nxr, nxrg, nx_on_file,    &
     908                     nny, ny = 0, ny_a, ny_o, nyn, nyng, nys, nysg, nysv,           &
     909                     ny_on_file, nnz, nz = 0, nzb, nzb_diff, nzb_max, nzt, nzt_diff
     910
     911
     912    INTEGER(idp), DIMENSION(:), ALLOCATABLE ::      &
    1107913                ngp_3d, ngp_3d_inner   ! need to have 64 bit for grids > 2E9
    1108914
    1109     INTEGER, DIMENSION(:), ALLOCATABLE ::                                      &
    1110                 ngp_2dh, nxl_mg, nxr_mg, nyn_mg, nys_mg, nzt_mg
    1111 
    1112 
    1113     INTEGER, DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_outer, ngp_2dh_s_inner,    &
    1114                 mg_loc_ind, nzb_diff_s_inner, nzb_diff_s_outer, nzb_diff_u,    &
    1115                 nzb_diff_v, nzb_inner, nzb_outer, nzb_s_inner, nzb_s_outer,    &
    1116                 nzb_u_inner, nzb_u_outer, nzb_v_inner, nzb_v_outer,            &
    1117                 nzb_w_inner, nzb_w_outer, nzb_2d
    1118 
    1119     INTEGER, DIMENSION(:,:,:), POINTER ::  flags
    1120 
    1121     INTEGER, DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_0, wall_flags_00
    1122 
    1123     INTEGER, DIMENSION(:,:,:), ALLOCATABLE,  TARGET ::                         &
    1124                 wall_flags_1, wall_flags_2, wall_flags_3, wall_flags_4,        &
    1125                 wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,        &
    1126                 wall_flags_9, wall_flags_10
    1127 
    1128     REAL, DIMENSION(:,:,:), ALLOCATABLE ::  rflags_s_inner, rflags_invers
     915    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::                                  &
     916                   ngp_2dh, nxl_mg, nxr_mg, nyn_mg, nys_mg, nzt_mg
     917
     918
     919    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_outer, ngp_2dh_s_inner,  &
     920                   mg_loc_ind, nzb_diff_s_inner, nzb_diff_s_outer, nzb_diff_u,    &
     921                   nzb_diff_v, nzb_inner, nzb_outer, nzb_s_inner, nzb_s_outer,    &
     922                   nzb_u_inner, nzb_u_outer, nzb_v_inner, nzb_v_outer,            &
     923                   nzb_w_inner, nzb_w_outer, nzb_2d
     924
     925    INTEGER(iwp), DIMENSION(:,:,:), POINTER ::  flags
     926
     927    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_0, wall_flags_00
     928
     929    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE,  TARGET ::                       &
     930                   wall_flags_1, wall_flags_2, wall_flags_3, wall_flags_4,        &
     931                   wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,        &
     932                   wall_flags_9, wall_flags_10
     933
     934    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  rflags_s_inner, rflags_invers
    1129935
    1130936    SAVE
     
    1147953       SUBROUTINE global_min_max ( i1, i2, j1, j2, k1, k2, feld, mode, offset, &
    1148954                                   wert, wert_ijk, wert1, wert1_ijk )
    1149           CHARACTER (LEN=*), INTENT(IN) ::  mode
    1150           INTEGER, INTENT(IN)           ::  i1, i2, j1, j2, k1, k2
    1151           INTEGER                       ::  wert_ijk(3)
    1152           INTEGER, OPTIONAL             ::  wert1_ijk(3)
    1153           REAL                          ::  offset, wert
    1154           REAL, OPTIONAL                ::  wert1
    1155           REAL, INTENT(IN)              ::  feld(i1:i2,j1:j2,k1:k2)
     955
     956          USE kinds
     957
     958          CHARACTER (LEN=*), INTENT(IN)      ::  mode
     959          INTEGER(iwp), INTENT(IN)           ::  i1, i2, j1, j2, k1, k2
     960          INTEGER(iwp)                       ::  wert_ijk(3)
     961          INTEGER(iwp), OPTIONAL             ::  wert1_ijk(3)
     962          REAL(wp)                           ::  offset, wert
     963          REAL(wp), OPTIONAL                 ::  wert1
     964          REAL(wp), INTENT(IN)               ::  feld(i1:i2,j1:j2,k1:k2)
    1156965
    1157966       END SUBROUTINE global_min_max
     
    1178987       SUBROUTINE advec_s_bc( sk, sk_char )
    1179988
     989          USE kinds
     990
    1180991          CHARACTER (LEN=*), INTENT(IN)   ::  sk_char
    1181992#if defined( __nopointer )
    1182           REAL, DIMENSION(:,:,:) ::  sk
     993          REAL(wp), DIMENSION(:,:,:) ::  sk
    1183994#else
    1184           REAL, DIMENSION(:,:,:), POINTER ::  sk
     995          REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
    1185996#endif
    1186997       END SUBROUTINE advec_s_bc
     
    12041015!------------------------------------------------------------------------------!
    12051016
    1206     INTEGER ::  current_timestep_number_1d = 0, damp_level_ind_1d
     1017    USE kinds
     1018
     1019    INTEGER(iwp) ::  current_timestep_number_1d = 0, damp_level_ind_1d
    12071020
    12081021    LOGICAL ::  run_control_header_1d = .FALSE., stop_dt_1d = .FALSE.
    12091022
    1210     REAL ::     damp_level_1d = -1.0, dt_1d = 60.0, dt_max_1d = 300.0, &
    1211                 dt_pr_1d = 9999999.9, dt_run_control_1d = 60.0, &
    1212                 end_time_1d = 864000.0, old_dt_1d = 1.0E-10, &
    1213                 qs1d, simulated_time_1d = 0.0, time_pr_1d = 0.0, &
    1214                 time_run_control_1d = 0.0, ts1d, us1d, usws1d, &
    1215                 vsws1d, z01d, z0h1d
    1216 
    1217 
    1218     REAL, DIMENSION(:), ALLOCATABLE ::  e1d, e1d_p, kh1d, km1d, l_black, l1d,  &
    1219                                         rif1d, te_e, te_em, te_u, te_um, te_v, &
    1220                                         te_vm, u1d, u1d_p, v1d, v1d_p
     1023    REAL(wp) ::     damp_level_1d = -1.0, dt_1d = 60.0, dt_max_1d = 300.0, &
     1024                    dt_pr_1d = 9999999.9, dt_run_control_1d = 60.0, &
     1025                    end_time_1d = 864000.0, old_dt_1d = 1.0E-10, &
     1026                    qs1d, simulated_time_1d = 0.0, time_pr_1d = 0.0, &
     1027                    time_run_control_1d = 0.0, ts1d, us1d, usws1d, &
     1028                    vsws1d, z01d, z0h1d
     1029
     1030
     1031    REAL(wp), DIMENSION(:), ALLOCATABLE ::  e1d, e1d_p, kh1d, km1d, l_black, l1d,  &
     1032                                            rif1d, te_e, te_em, te_u, te_um, te_v, &
     1033                                            te_vm, u1d, u1d_p, v1d, v1d_p
    12211034
    12221035    SAVE
     
    12351048!------------------------------------------------------------------------------!
    12361049
    1237     USE control_parameters
     1050    USE control_parameters, ONLY: max_masks
     1051    USE kinds
    12381052#if defined( __netcdf )
    12391053    USE netcdf
    12401054#endif
    12411055
    1242     INTEGER, PARAMETER ::  dopr_norm_num = 7, dopts_num = 29, dots_max = 100
    1243 
    1244     INTEGER ::  dots_num = 23
     1056    INTEGER(iwp), PARAMETER ::  dopr_norm_num = 7, dopts_num = 29, dots_max = 100
     1057
     1058    INTEGER(iwp) ::  dots_num = 23
    12451059
    12461060    CHARACTER (LEN=6), DIMENSION(dopr_norm_num) ::  dopr_norm_names =   &
     
    13061120             'not_used        ' /)
    13071121
    1308     INTEGER ::  id_dim_prtnum, id_dim_time_pr, id_dim_time_prt, &
    1309                 id_dim_time_pts, id_dim_time_sp, id_dim_time_ts, id_dim_x_sp, &
    1310                 id_dim_y_sp, id_dim_zu_sp, id_dim_zw_sp, id_set_pr, &
    1311                 id_set_prt, id_set_pts, id_set_sp, id_set_ts, id_var_prtnum, &
    1312                 id_var_rnop_prt, id_var_time_pr, id_var_time_prt, &
    1313                 id_var_time_pts, id_var_time_sp, id_var_time_ts, id_var_x_sp, &
    1314                 id_var_y_sp, id_var_zu_sp, id_var_zw_sp, nc_stat
    1315 
    1316     INTEGER, DIMENSION(0:1) ::  id_dim_time_xy, id_dim_time_xz, &
    1317                 id_dim_time_yz, id_dim_time_3d, id_dim_x_xy, id_dim_xu_xy, &
    1318                 id_dim_x_xz, id_dim_xu_xz, id_dim_x_yz, id_dim_xu_yz, &
    1319                 id_dim_x_3d, id_dim_xu_3d, id_dim_y_xy, id_dim_yv_xy, &
    1320                 id_dim_y_xz, id_dim_yv_xz, id_dim_y_yz, id_dim_yv_yz, &
    1321                 id_dim_y_3d, id_dim_yv_3d, id_dim_zu_xy, id_dim_zu1_xy, &
    1322                 id_dim_zu_xz, id_dim_zu_yz, id_dim_zu_3d, id_dim_zw_xy, &
    1323                 id_dim_zw_xz, id_dim_zw_yz, id_dim_zw_3d, id_set_xy, &
    1324                 id_set_xz, id_set_yz, id_set_3d, id_var_ind_x_yz, &
    1325                 id_var_ind_y_xz, id_var_ind_z_xy, id_var_time_xy, &
    1326                 id_var_time_xz, id_var_time_yz, id_var_time_3d, id_var_x_xy, &
    1327                 id_var_xu_xy, id_var_x_xz, id_var_xu_xz, id_var_x_yz, &
    1328                 id_var_xu_yz, id_var_x_3d, id_var_xu_3d, id_var_y_xy, &
    1329                 id_var_yv_xy, id_var_y_xz, id_var_yv_xz, id_var_y_yz, &
    1330                 id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zusi_xy, &
    1331                 id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, &
    1332                 id_var_zu_yz, id_var_zu_3d, id_var_zwwi_xy, id_var_zwwi_3d, &
    1333                 id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d
    1334 
    1335     INTEGER, DIMENSION(10)  ::  id_var_dospx, id_var_dospy
    1336     INTEGER, DIMENSION(20)  ::  id_var_prt
    1337     INTEGER, DIMENSION(11)  ::  nc_precision
    1338     INTEGER, DIMENSION(dopr_norm_num) ::  id_var_norm_dopr
    1339 
    1340     INTEGER, DIMENSION(dopts_num,0:10) ::  id_var_dopts
    1341     INTEGER, DIMENSION(0:1,100)        ::  id_var_do2d, id_var_do3d
    1342     INTEGER, DIMENSION(100,0:9)        ::  id_dim_z_pr, id_var_dopr, &
    1343                                            id_var_z_pr
    1344     INTEGER, DIMENSION(dots_max,0:9)   ::  id_var_dots
     1122    INTEGER(iwp) ::  id_dim_prtnum, id_dim_time_pr, id_dim_time_prt, &
     1123                     id_dim_time_pts, id_dim_time_sp, id_dim_time_ts, id_dim_x_sp, &
     1124                     id_dim_y_sp, id_dim_zu_sp, id_dim_zw_sp, id_set_pr, &
     1125                     id_set_prt, id_set_pts, id_set_sp, id_set_ts, id_var_prtnum, &
     1126                     id_var_rnop_prt, id_var_time_pr, id_var_time_prt, &
     1127                     id_var_time_pts, id_var_time_sp, id_var_time_ts, id_var_x_sp, &
     1128                     id_var_y_sp, id_var_zu_sp, id_var_zw_sp, nc_stat
     1129
     1130    INTEGER(iwp), DIMENSION(0:1) ::  id_dim_time_xy, id_dim_time_xz, &
     1131                    id_dim_time_yz, id_dim_time_3d, id_dim_x_xy, id_dim_xu_xy, &
     1132                    id_dim_x_xz, id_dim_xu_xz, id_dim_x_yz, id_dim_xu_yz, &
     1133                    id_dim_x_3d, id_dim_xu_3d, id_dim_y_xy, id_dim_yv_xy, &
     1134                    id_dim_y_xz, id_dim_yv_xz, id_dim_y_yz, id_dim_yv_yz, &
     1135                    id_dim_y_3d, id_dim_yv_3d, id_dim_zu_xy, id_dim_zu1_xy, &
     1136                    id_dim_zu_xz, id_dim_zu_yz, id_dim_zu_3d, id_dim_zw_xy, &
     1137                    id_dim_zw_xz, id_dim_zw_yz, id_dim_zw_3d, id_set_xy, &
     1138                    id_set_xz, id_set_yz, id_set_3d, id_var_ind_x_yz, &
     1139                    id_var_ind_y_xz, id_var_ind_z_xy, id_var_time_xy, &
     1140                    id_var_time_xz, id_var_time_yz, id_var_time_3d, id_var_x_xy, &
     1141                    id_var_xu_xy, id_var_x_xz, id_var_xu_xz, id_var_x_yz, &
     1142                    id_var_xu_yz, id_var_x_3d, id_var_xu_3d, id_var_y_xy, &
     1143                    id_var_yv_xy, id_var_y_xz, id_var_yv_xz, id_var_y_yz, &
     1144                    id_var_yv_yz, id_var_y_3d, id_var_yv_3d, id_var_zusi_xy, &
     1145                    id_var_zusi_3d, id_var_zu_xy, id_var_zu1_xy, id_var_zu_xz, &
     1146                    id_var_zu_yz, id_var_zu_3d, id_var_zwwi_xy, id_var_zwwi_3d, &
     1147                    id_var_zw_xy, id_var_zw_xz, id_var_zw_yz, id_var_zw_3d
     1148
     1149    INTEGER(iwp), DIMENSION(10)  ::  id_var_dospx, id_var_dospy
     1150    INTEGER(iwp), DIMENSION(20)  ::  id_var_prt
     1151    INTEGER(iwp), DIMENSION(11)  ::  nc_precision
     1152    INTEGER(iwp), DIMENSION(dopr_norm_num) ::  id_var_norm_dopr
     1153
     1154    INTEGER(iwp), DIMENSION(dopts_num,0:10) ::  id_var_dopts
     1155    INTEGER(iwp), DIMENSION(0:1,100)        ::  id_var_do2d, id_var_do3d
     1156    INTEGER(iwp), DIMENSION(100,0:9)        ::  id_dim_z_pr, id_var_dopr, &
     1157                                               id_var_z_pr
     1158    INTEGER(iwp), DIMENSION(dots_max,0:9)   ::  id_var_dots
    13451159
    13461160!
     
    13501164    LOGICAL ::  output_for_t0 = .FALSE.
    13511165
    1352     INTEGER, DIMENSION(1:max_masks,0:1) ::  id_dim_time_mask, id_dim_x_mask, &
    1353                 id_dim_xu_mask, id_dim_y_mask, id_dim_yv_mask, id_dim_zu_mask, &
    1354                 id_dim_zw_mask, &
    1355                 id_set_mask, &
    1356                 id_var_time_mask, id_var_x_mask, id_var_xu_mask, &
    1357                 id_var_y_mask, id_var_yv_mask, id_var_zu_mask, id_var_zw_mask, &
    1358                 id_var_zusi_mask, id_var_zwwi_mask
    1359 
    1360     INTEGER, DIMENSION(1:max_masks,0:1,100)         ::  id_var_domask
     1166    INTEGER(iwp), DIMENSION(1:max_masks,0:1) ::  id_dim_time_mask, id_dim_x_mask, &
     1167                   id_dim_xu_mask, id_dim_y_mask, id_dim_yv_mask, id_dim_zu_mask, &
     1168                   id_dim_zw_mask, &
     1169                   id_set_mask, &
     1170                   id_var_time_mask, id_var_x_mask, id_var_xu_mask, &
     1171                   id_var_y_mask, id_var_yv_mask, id_var_zu_mask, id_var_zw_mask, &
     1172                   id_var_zusi_mask, id_var_zwwi_mask
     1173
     1174    INTEGER(iwp), DIMENSION(1:max_masks,0:1,100)         ::  id_var_domask
    13611175
    13621176    SAVE
     
    13741188!------------------------------------------------------------------------------!
    13751189
    1376     USE precision_kind
     1190    USE kinds
    13771191
    13781192    CHARACTER (LEN=15)  ::  bc_par_lr = 'cyclic',  bc_par_ns = 'cyclic', &
     
    13801194                            collision_kernel = 'none'
    13811195
    1382 #if defined( __parallel )
    1383     INTEGER ::  mpi_particle_type
    1384 #endif
    1385     INTEGER ::  deleted_particles = 0, deleted_tails = 0,                      &
    1386                 dissipation_classes = 10, ibc_par_lr,                          &
    1387                 ibc_par_ns, ibc_par_b, ibc_par_t, iran_part = -1234567,        &
    1388                 maximum_number_of_particles = 1000,                            &
    1389                 maximum_number_of_tailpoints = 100,                            &
    1390                 maximum_number_of_tails = 0,                                   &
    1391                 number_of_sublayers = 20,                                      &
    1392                 number_of_initial_particles = 0, number_of_particles = 0,      &
    1393                 number_of_particle_groups = 1, number_of_tails = 0,            &
    1394                 number_of_initial_tails = 0, offset_ocean_nzt = 0,             &
    1395                 offset_ocean_nzt_m1 = 0, particles_per_point = 1,              &
    1396                 particle_file_count = 0, radius_classes = 20,                  &
    1397                 skip_particles_for_tail = 100, sort_count = 0,                 &
    1398                 total_number_of_particles, total_number_of_tails = 0,          &
    1399                 trlp_count_sum, trlp_count_recv_sum, trrp_count_sum,           &
    1400                 trrp_count_recv_sum, trsp_count_sum, trsp_count_recv_sum,      &
    1401                 trnp_count_sum, trnp_count_recv_sum
    1402 
    1403     INTEGER, PARAMETER ::  max_number_of_particle_groups = 10
    1404 
    1405     INTEGER, DIMENSION(:), ALLOCATABLE     ::  new_tail_id
    1406     INTEGER, DIMENSION(:,:,:), ALLOCATABLE ::  prt_count, prt_start_index
     1196    INTEGER(iwp) ::  deleted_particles = 0, deleted_tails = 0,                      &
     1197                     dissipation_classes = 10, ibc_par_lr,                          &
     1198                     ibc_par_ns, ibc_par_b, ibc_par_t, iran_part = -1234567,        &
     1199                     maximum_number_of_particles = 1000,                            &
     1200                     maximum_number_of_tailpoints = 100,                            &
     1201                     maximum_number_of_tails = 0,                                   &
     1202                     mpi_particle_type,                                             &
     1203                     number_of_sublayers = 20,                                      &
     1204                     number_of_initial_particles = 0, number_of_particles = 0,      &
     1205                     number_of_particle_groups = 1, number_of_tails = 0,            &
     1206                     number_of_initial_tails = 0, offset_ocean_nzt = 0,             &
     1207                     offset_ocean_nzt_m1 = 0, particles_per_point = 1,              &
     1208                     particle_file_count = 0, radius_classes = 20,                  &
     1209                     skip_particles_for_tail = 100, sort_count = 0,                 &
     1210                     total_number_of_particles, total_number_of_tails = 0,          &
     1211                     trlp_count_sum, trlp_count_recv_sum, trrp_count_sum,           &
     1212                     trrp_count_recv_sum, trsp_count_sum, trsp_count_recv_sum,      &
     1213                     trnp_count_sum, trnp_count_recv_sum
     1214
     1215    INTEGER(iwp), PARAMETER ::  max_number_of_particle_groups = 10
     1216
     1217    INTEGER(iwp), DIMENSION(:), ALLOCATABLE     ::  new_tail_id
     1218    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  prt_count, prt_start_index
    14071219
    14081220    LOGICAL ::  hall_kernel = .FALSE., palm_kernel = .FALSE.,                  &
     
    14181230    LOGICAL, DIMENSION(:), ALLOCATABLE ::  particle_mask, tail_mask
    14191231
    1420     REAL    ::  c_0 = 3.0, dt_min_part = 0.0002, dt_prel = 9999999.9,          &
    1421                 dt_sort_particles = 0.0, dt_write_particle_data = 9999999.9,   &
    1422                 dvrp_psize = 9999999.9, end_time_prel = 9999999.9,             &
    1423                 initial_weighting_factor = 1.0,                                &
    1424                 maximum_tailpoint_age = 100000.0,                              &
    1425                 minimum_tailpoint_distance = 0.0,                              &
    1426                 particle_advection_start = 0.0, sgs_wfu_part = 0.3333333,      &
    1427                 sgs_wfv_part = 0.3333333, sgs_wfw_part = 0.3333333,            &
    1428                 time_prel = 0.0, time_sort_particles = 0.0,                    &
    1429                 time_write_particle_data = 0.0, z0_av_global
    1430 
    1431     REAL, DIMENSION(max_number_of_particle_groups) ::  &
    1432                 density_ratio = 9999999.9, pdx = 9999999.9, pdy = 9999999.9, &
    1433                 pdz = 9999999.9, psb = 9999999.9, psl = 9999999.9,           &
    1434                 psn = 9999999.9, psr = 9999999.9, pss = 9999999.9,           &
    1435                 pst = 9999999.9, radius = 9999999.9
    1436 
    1437     REAL, DIMENSION(:), ALLOCATABLE     ::  log_z_z0
    1438 
    1439     REAL, DIMENSION(:,:,:), ALLOCATABLE ::  particle_tail_coordinates
     1232    REAL(wp)    ::  c_0 = 3.0, dt_min_part = 0.0002, dt_prel = 9999999.9,          &
     1233                    dt_sort_particles = 0.0, dt_write_particle_data = 9999999.9,   &
     1234                    dvrp_psize = 9999999.9, end_time_prel = 9999999.9,             &
     1235                    initial_weighting_factor = 1.0,                                &
     1236                    maximum_tailpoint_age = 100000.0,                              &
     1237                    minimum_tailpoint_distance = 0.0,                              &
     1238                    particle_advection_start = 0.0, sgs_wfu_part = 0.3333333,      &
     1239                    sgs_wfv_part = 0.3333333, sgs_wfw_part = 0.3333333,            &
     1240                    time_prel = 0.0, time_sort_particles = 0.0,                    &
     1241                    time_write_particle_data = 0.0, z0_av_global
     1242
     1243    REAL(wp), DIMENSION(max_number_of_particle_groups) ::  &
     1244                    density_ratio = 9999999.9, pdx = 9999999.9, pdy = 9999999.9, &
     1245                    pdz = 9999999.9, psb = 9999999.9, psl = 9999999.9,           &
     1246                    psn = 9999999.9, psr = 9999999.9, pss = 9999999.9,           &
     1247                    pst = 9999999.9, radius = 9999999.9
     1248
     1249    REAL(wp), DIMENSION(:), ALLOCATABLE     ::  log_z_z0
     1250
     1251    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  particle_tail_coordinates
    14401252
    14411253
    14421254    TYPE particle_type
    14431255       SEQUENCE
    1444        REAL    ::  age, age_m, dt_sum, dvrp_psize, e_m, origin_x, origin_y, &
    1445                    origin_z, radius, rvar1, rvar2, rvar3, speed_x, speed_y, &
    1446                    speed_z, weight_factor, x, y, z
    1447        INTEGER ::  class, group, tailpoints, tail_id
     1256       REAL(wp)    ::  age, age_m, dt_sum, dvrp_psize, e_m, origin_x, origin_y, &
     1257                       origin_z, radius, rvar1, rvar2, rvar3, speed_x, speed_y, &
     1258                       speed_z, weight_factor, x, y, z
     1259       INTEGER(iwp) ::  class, group, tailpoints, tail_id
    14481260    END TYPE particle_type
    14491261
     
    14541266    TYPE particle_groups_type
    14551267       SEQUENCE
    1456        REAL    ::  density_ratio, radius, exp_arg, exp_term
     1268       REAL(wp)    ::  density_ratio, radius, exp_arg, exp_term
    14571269    END TYPE particle_groups_type
    14581270
     
    14771289! MPI-calls.
    14781290!------------------------------------------------------------------------------!
     1291
     1292    USE kinds
    14791293
    14801294#if defined( __parallel ) && ! defined ( __check )
     
    14871301    CHARACTER(LEN=2) ::  send_receive = 'al'
    14881302    CHARACTER(LEN=5) ::  myid_char = ''
    1489     INTEGER          ::  acc_rank, comm1dx, comm1dy, comm2d, comm_inter,       &
    1490                          comm_palm, id_inflow = 0, id_recycling = 0, ierr,     &
    1491                          myid = 0, myidx = 0, myidy = 0, ndim = 2, ngp_a,      &
    1492                          ngp_o, ngp_xy, ngp_y, npex = -1, npey = -1,           &
    1493                          numprocs = 1, numprocs_previous_run = -1,             &
    1494                          num_acc_per_node = 0, pleft, pnorth, pright, psouth,  &
    1495                          req_count = 0, sendrecvcount_xy, sendrecvcount_yz,    &
    1496                          sendrecvcount_zx, sendrecvcount_zyd,                  &
    1497                          sendrecvcount_yxd, target_id, tasks_per_node = -9999, &
    1498                          threads_per_task = 1, type_x, type_x_int, type_xy,    &
    1499                          type_y, type_y_int
    1500 
    1501     INTEGER          ::  pdims(2) = 1, req(100)
    1502 
    1503     INTEGER, DIMENSION(:,:), ALLOCATABLE ::  hor_index_bounds, &
    1504                                              hor_index_bounds_previous_run
     1303    INTEGER(iwp)          ::  acc_rank, comm1dx, comm1dy, comm2d, comm_inter,       &
     1304                              comm_palm, id_inflow = 0, id_recycling = 0, ierr,     &
     1305                              myid = 0, myidx = 0, myidy = 0, ndim = 2, ngp_a,      &
     1306                              ngp_o, ngp_xy, ngp_y, npex = -1, npey = -1,           &
     1307                              numprocs = 1, numprocs_previous_run = -1,             &
     1308                              num_acc_per_node = 0, pleft, pnorth, pright, psouth,  &
     1309                              req_count = 0, sendrecvcount_xy, sendrecvcount_yz,    &
     1310                              sendrecvcount_zx, sendrecvcount_zyd,                  &
     1311                              sendrecvcount_yxd, target_id, tasks_per_node = -9999, &
     1312                              threads_per_task = 1, type_x, type_x_int, type_xy,    &
     1313                              type_y, type_y_int
     1314
     1315    INTEGER(iwp)          ::  pdims(2) = 1, req(100)
     1316
     1317    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  hor_index_bounds, &
     1318                                                  hor_index_bounds_previous_run
    15051319
    15061320    LOGICAL ::  background_communication =.FALSE., collective_wait = .FALSE., &
     
    15121326#endif
    15131327
    1514     INTEGER ::  ibuf(12), pcoord(2)
     1328    INTEGER(iwp) ::  ibuf(12), pcoord(2)
    15151329
    15161330#if ! defined ( __check )
    1517     INTEGER ::  status(MPI_STATUS_SIZE)
    1518     INTEGER, DIMENSION(MPI_STATUS_SIZE,100) ::  wait_stat
     1331    INTEGER(iwp) ::  status(MPI_STATUS_SIZE)
     1332    INTEGER(iwp), DIMENSION(MPI_STATUS_SIZE,100) ::  wait_stat
    15191333#endif
    15201334
    15211335
    1522     INTEGER, DIMENSION(:), ALLOCATABLE ::  ngp_yz, type_xz, type_yz
     1336    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ngp_yz, type_xz, type_yz
    15231337
    15241338    LOGICAL ::  left_border_pe  = .FALSE., north_border_pe = .FALSE., &
     
    15451359!------------------------------------------------------------------------------!
    15461360
    1547     INTEGER, PARAMETER ::  crmax = 100
     1361    USE kinds
     1362
     1363    INTEGER(iwp), PARAMETER ::  crmax = 100
    15481364
    15491365    CHARACTER (LEN=20), DIMENSION(20) ::  cross_ts_profiles = &
     
    15651381                         ( '                               ', i9 = 1, 94 ) /)
    15661382
    1567     INTEGER ::  profile_columns = 2, profile_rows = 3, profile_number = 0
    1568 
    1569     INTEGER ::  cross_ts_numbers(crmax,crmax) = 0, &
    1570                 cross_ts_number_count(crmax) = 0, &
    1571                 dopr_index(300) = 0, dopr_initial_index(300) = 0, &
    1572                 dots_crossindex(100) = 0, dots_index(100) = 0
     1383    INTEGER(iwp) ::  profile_columns = 2, profile_rows = 3, profile_number = 0
     1384
     1385    INTEGER(iwp) ::  cross_ts_numbers(crmax,crmax) = 0, &
     1386                     cross_ts_number_count(crmax) = 0, &
     1387                     dopr_index(300) = 0, dopr_initial_index(300) = 0, &
     1388                     dots_crossindex(100) = 0, dots_index(100) = 0
    15731389               
    15741390
    1575     REAL ::  cross_ts_uymax(20) = &
     1391    REAL(wp) ::  cross_ts_uymax(20) = &
    15761392                             (/ 999.999, 999.999, 999.999, 999.999, 999.999,   &
    15771393                                999.999, 999.999, 999.999, 999.999, 999.999,   &
    15781394                                999.999, 999.999, 999.999, 999.999, 999.999,   &
    15791395                                999.999, 999.999, 999.999, 999.999, 999.999 /),&
    1580              cross_ts_uymax_computed(20) = 999.999, &
    1581              cross_ts_uymin(20) = &
     1396                 cross_ts_uymax_computed(20) = 999.999, &
     1397                 cross_ts_uymin(20) = &
    15821398                             (/ 999.999, 999.999, 999.999,  -5.000, 999.999,   &
    15831399                                999.999,   0.000, 999.999, 999.999, 999.999,   &
    15841400                                999.999, 999.999, 999.999, 999.999, 999.999,   &
    15851401                                999.999, 999.999, 999.999, 999.999, 999.999 /),&
    1586              cross_ts_uymin_computed(20) = 999.999
     1402                 cross_ts_uymin_computed(20) = 999.999
    15871403
    15881404    SAVE
     
    16001416! Definition of quantities used for computing spectra
    16011417!------------------------------------------------------------------------------!
     1418
     1419    USE kinds
    16021420
    16031421    CHARACTER (LEN=6),  DIMENSION(1:5) ::  header_char = (/ 'PS(u) ', 'PS(v) ',&
     
    16181436                                    'k ^2236 ^2566^2569<q(k) in m>2s>->2    ' /)
    16191437
    1620     INTEGER ::  klist_x = 0, klist_y = 0, n_sp_x = 0, n_sp_y = 0
    1621 
    1622     INTEGER ::  comp_spectra_level(100) = 999999,                   &
    1623                 lstyles(100) = (/ 0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1624                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1625                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1626                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1627                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1628                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1629                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1630                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1631                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
    1632                                   0, 7, 3, 10, 1, 4, 9, 2, 6, 8 /), &
    1633                 plot_spectra_level(100) = 999999
    1634 
    1635     REAL    ::  time_to_start_sp = 0.0
     1438    INTEGER(iwp) ::  klist_x = 0, klist_y = 0, n_sp_x = 0, n_sp_y = 0
     1439
     1440    INTEGER(iwp) ::  comp_spectra_level(100) = 999999,                   &
     1441                     lstyles(100) = (/ 0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1442                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1443                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1444                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1445                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1446                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1447                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1448                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1449                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8,    &
     1450                                       0, 7, 3, 10, 1, 4, 9, 2, 6, 8 /), &
     1451                     plot_spectra_level(100) = 999999
     1452
     1453    REAL(wp)    ::  time_to_start_sp = 0.0
    16361454
    16371455    SAVE
     
    16501468!------------------------------------------------------------------------------!
    16511469
     1470    USE kinds
     1471
    16521472    CHARACTER (LEN=40) ::  region(0:9)
    1653     INTEGER ::  pr_palm = 90, statistic_regions = 0
    1654     INTEGER ::  u_max_ijk(3) = -1, v_max_ijk(3) = -1, w_max_ijk(3) = -1
     1473    INTEGER(iwp) ::  pr_palm = 90, statistic_regions = 0
     1474    INTEGER(iwp) ::  u_max_ijk(3) = -1, v_max_ijk(3) = -1, w_max_ijk(3) = -1
    16551475    LOGICAL ::  flow_statistics_called = .FALSE.
    1656     REAL ::     u_max, v_max, w_max
    1657     REAL, DIMENSION(:), ALLOCATABLE       ::  sums_divnew_l, sums_divold_l,   &
    1658                                               weight_substep, weight_pres
    1659     REAL, DIMENSION(:,:), ALLOCATABLE     ::  sums, sums_wsts_bc_l, ts_value, &
    1660                                               sums_wsus_ws_l, sums_wsvs_ws_l, &
    1661                                               sums_us2_ws_l, sums_vs2_ws_l,   &
    1662                                               sums_ws2_ws_l,                  &
    1663                                               sums_wsnrs_ws_l,                &
    1664                                               sums_wspts_ws_l,                &
    1665                                               sums_wssas_ws_l,                &
    1666                                               sums_wsqs_ws_l,                 &
    1667                                               sums_wsqrs_ws_l
     1476    REAL(wp) ::     u_max, v_max, w_max
     1477    REAL(wp), DIMENSION(:), ALLOCATABLE       ::  sums_divnew_l, sums_divold_l,   &
     1478                                                  weight_substep, weight_pres
     1479    REAL(wp), DIMENSION(:,:), ALLOCATABLE     ::  sums, sums_wsts_bc_l, ts_value, &
     1480                                                  sums_wsus_ws_l, sums_wsvs_ws_l, &
     1481                                                  sums_us2_ws_l, sums_vs2_ws_l,   &
     1482                                                  sums_ws2_ws_l,                  &
     1483                                                  sums_wsnrs_ws_l,                &
     1484                                                  sums_wspts_ws_l,                &
     1485                                                  sums_wssas_ws_l,                &
     1486                                                  sums_wsqs_ws_l,                 &
     1487                                                  sums_wsqrs_ws_l
    16681488                                             
    1669     REAL, DIMENSION(:,:,:), ALLOCATABLE   ::  hom_sum, rmask, spectrum_x, &
    1670                                               spectrum_y, sums_l, sums_l_l, &
    1671                                               sums_up_fraction_l
    1672     REAL, DIMENSION(:,:,:,:), ALLOCATABLE ::  hom
     1489    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  hom_sum, rmask, spectrum_x, &
     1490                                                  spectrum_y, sums_l, sums_l_l, &
     1491                                                  sums_up_fraction_l
     1492    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  hom
    16731493
    16741494    SAVE
     
    16871507!------------------------------------------------------------------------------!
    16881508
    1689     INTEGER ::  nxl_y, nxl_yd, nxl_z, nxr_y, nxr_yd, nxr_z, nyn_x, nyn_z,      &
    1690                 nys_x, nys_z, nzb_x, nzb_y, nzb_yd, nzt_x, nzt_y, nzt_yd
     1509    USE kinds
     1510
     1511    INTEGER(iwp) ::  nxl_y, nxl_yd, nxl_z, nxr_y, nxr_yd, nxr_z, nyn_x, nyn_z,      &
     1512                     nys_x, nys_z, nzb_x, nzb_y, nzb_yd, nzt_x, nzt_y, nzt_yd
    16911513               
    16921514
Note: See TracChangeset for help on using the changeset viewer.