source: palm/trunk/SOURCE/modules.f90 @ 2013

Last change on this file since 2013 was 2012, checked in by kanani, 8 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 58.2 KB
Line 
1!> @file modules.f90
2!------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the
6! terms of the GNU General Public License as published by the Free Software
7! Foundation, either version 3 of the License, or (at your option) any later
8! version.
9!
10! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
11! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13!
14! You should have received a copy of the GNU General Public License along with
15! PALM. If not, see <http://www.gnu.org/licenses/>.
16!
17! Copyright 1997-2016 Leibniz Universitaet Hannover
18!------------------------------------------------------------------------------!
19!
20! Current revisions:
21! ------------------
22!
23!
24! Former revisions:
25! -----------------
26! $Id: modules.f90 2012 2016-09-19 17:31:38Z suehring $
27!
28! 2011 2016-09-19 17:29:57Z kanani
29! +urban_surface, +lsf_exception, +varnamelength
30!
31! 2007 2016-08-24 15:47:17Z kanani
32! Increased DIMENSION of data_output, data_output_user, do2d, do3d
33!
34! 2000 2016-08-20 18:09:15Z knoop
35! Forced header and separation lines into 80 columns
36!
37! 1992 2016-08-12 15:14:59Z suehring
38! +constant_top_scalarflux, top_scalarflux
39! default of bc_s_t adjusted
40!
41! 1968 2016-07-18 12:01:49Z suehring
42! Changed dimension for MPI-datatypes type_x_int and type_y_int
43!
44! 1960 2016-07-12 16:34:24Z suehring
45! Separate humidity and passive scalar
46! +bc_s_t_val, diss_s_s, diss_l_s, flux_s_s, flux_l_s, s, sp, s1, s2, s3, ssws_av,
47!  s_init, s_surf, sums_wsss_ws_l, ss, ssws, sswst, ts_m, wall_sflux
48! +constant_scalarflux, ibc_s_b, ibc_s_t, s_vertical_gradient_level_ind
49!
50! Unused variables removed
51! -gamma_x, gamma_y, gamma_z, var_x, var_y, var_z
52!
53! Change initial values (in order to unify gradient calculation):
54! pt_vertical_gradient_level, sa_vertical_gradient_level
55!
56! 1957 2016-07-07 10:43:48Z suehring
57! +fl_max, num_leg, num_var_fl, num_var_fl_user, var_fl_max, virtual_flight
58!
59! 1918 2016-05-27 14:35:57Z raasch
60! default timestep switched from -1.0 to +1.0 in order to avoid wrong sign of
61! initially calculated divergence
62!
63! 1906 2016-05-24 14:38:08Z suehring
64! default value of mg_switch_to_pe0_level changed to -1
65!
66! 1849 2016-04-08 11:33:18Z hoffmann
67! bfactor, mass_of_solute, molecular_weight_of_solute, molecular_weight_of_water,
68! vanthoff moved to mod_particle_attributes.
69! dt_micro and several cloud_parameters moved to microphysics_mod.
70! 1d-microphysics profiles moved to microphysics_mod.
71!
72! 1845 2016-04-08 08:29:13Z raasch
73! -nzb_2d
74!
75! 1833 2016-04-07 14:23:03Z raasch
76! spectra parameter moved to spectra module
77!
78! 1831 2016-04-07 13:15:51Z hoffmann
79! curvature_solution_effects removed
80! turbulence renamed collision_turbulence, drizzle renamed
81! cloud_water_sedimentation
82!
83! 1822 2016-04-07 07:49:42Z hoffmann
84! icloud_scheme removed. microphysics_sat_adjust, microphysics_kessler,
85! microphysics_seifert added.
86!
87! 1815 2016-04-06 13:49:59Z raasch
88! cpp-directive for decalpha removed
89!
90! 1808 2016-04-05 19:44:00Z raasch
91! MPI module used by default on all machines
92!
93! 1804 2016-04-05 16:30:18Z maronga
94! Removed code for parameter file check (__check)
95!
96! 1788 2016-03-10 11:01:04Z maronga
97! Added roughness length for moisture (z0q)
98!
99! 1786 2016-03-08 05:49:27Z raasch
100! module spectrum moved to new separate module
101!
102! 1783 2016-03-06 18:36:17Z raasch
103! netcdf variables moved to the netcdf-interface module
104!
105! 1779 2016-03-03 08:01:28Z raasch
106! coupling_char extended to LEN=3
107!
108! 1764 2016-02-28 12:45:19Z raasch
109! some reformatting
110!
111! 1762 2016-02-25 12:31:13Z hellstea
112! +nest_* variables, size of volume_flow arrays increased by one element
113!
114! 1738 2015-12-18 13:56:05Z raasch
115! +mean_surface_level_height
116!
117! 1695 2015-10-27 10:03:11Z maronga
118! Removed rif (forgotten in last revision)
119!
120! 1693 2015-10-27 08:35:45Z maronga
121! Renamed zp -> z_mo
122!
123! 1691 2015-10-26 16:17:44Z maronga
124! Renamed Obukhov length. Added ol, removed rif. Increased number of profiles
125! (pr_palm). Changed default values for dissipation_1d to 'detering' and
126! (mixing_length_1d to 'blackadar'. Added most_method. rif_min and rif_max
127! renamed to zeta_min and zeta_max and new values assigned.
128!
129! 1682 2015-10-07 23:56:08Z knoop
130! Code annotations made doxygen readable
131!
132! 1677 2015-10-02 13:25:23Z boeske
133! +ngp_yz_int, type_xz_int, type_yz_int
134!
135! 1666 2015-09-23 07:31:10Z raasch
136! +user_interface_current_revision, user_interface_required_revision in
137! control_parameters
138!
139! 1639 2015-08-31 14:46:48Z knoop
140! Bugfix: string 'unknown' extended to match LEN=13
141!
142! 1575 2015-03-27 09:56:27Z raasch
143! +ngp_xz
144!
145! 1560 2015-03-06 10:48:54Z keck
146! +recycling_yshift
147!
148! 1557 2015-03-05 16:43:04Z suehring
149! +monotonic_adjustment
150!
151! 1551 2015-03-03 14:18:16Z maronga
152! Increased pr_palm to 120. Increased length of dots_unit and dots_label to 13
153! digits. Increased length of domask, do2d, and do3d to 20 digits.
154!
155! 1496 2014-12-02 17:25:50Z maronga
156! Renamed "radiation" -> "cloud_top_radiation"
157!
158! 1484 2014-10-21 10:53:05Z kanani
159! Changes due to new module structure of the plant canopy model:
160!   canopy-model related parameters/variables moved to module
161!   plant_canopy_model_mod
162!
163! 1468 2014-09-24 14:06:57Z maronga
164! Adapted for use on up to 6-digit processor cores.
165! Increased identifier string length for user-defined quantities to 20.
166!
167! 1450 2014-08-21 07:31:51Z heinze
168! ntnudge from 100 to 1000 increased to allow longer simulations
169!
170! 1431 2014-07-15 14:47:17Z suehring
171! +var_d
172!
173! 1429 2014-07-15 12:53:45Z knoop
174! +ensemble_member_nr to prepare the random_generator for ensemble runs
175!
176! 1382 2014-04-30 12:15:41Z boeske
177! Renamed variables which store large scale forcing tendencies
178! pt_lsa -> td_lsa_lpt, pt_subs -> td_sub_lpt,
179! q_lsa  -> td_lsa_q,   q_subs  -> td_sub_q
180!
181! 1365 2014-04-22 15:03:56Z boeske
182! Usage of large scale forcing enabled:
183! increase pr_palm from 90 to 100 to allow for more standard profiles
184! + ngp_sums_ls, pt_lsa, pt_subs, q_lsa, q_subs, tmp_tnudge, sums_ls_l,
185! use_subsidence_tendencies
186!
187! 1361 2014-04-16 15:17:48Z hoffmann
188! tend_* removed
189! call_microphysics_at_all_substeps added
190! default of drizzle set to true
191!
192! 1359 2014-04-11 17:15:14Z hoffmann
193! particle_attributes moved to mod_particle_attributes.f90
194!
195! 1353 2014-04-08 15:21:23Z heinze
196! REAL constants provided with KIND-attribute
197!
198! 1327 2014-03-21 11:00:16Z raasch
199! REAL constants defined as wp-kind
200! -avs_output, data_output_format, do3d_compress, iso2d_output, netcdf_output
201!
202! 1320 2014-03-20 08:40:49Z raasch
203! ONLY-attribute added to USE-statements,
204! kind-parameters added to all INTEGER and REAL declaration statements,
205! kinds are defined in new module kinds,
206! old module precision_kind is removed,
207! revision history before 2012 removed,
208! comment fields (!:) to be used for variable explanations added to
209! all variable declaration statements
210!
211! 1318 2014-03-17 13:35:16Z raasch
212! module cpulog moved to new separate module-file
213! interface for cpu_log removed
214!
215! 1314 2014-03-14 18:25:17Z suehring
216! + log_z_z0, number_of_sublayers, z0_av_global
217! 1308 2014-03-13 14:58:42Z fricke
218! +ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, ntdim_3d
219!
220! 1257 2013-11-08 15:18:40Z raasch
221! set default values for grid indices of maximum velocity components
222! u|v|w_max_ijk
223!
224! 1241 2013-10-30 11:36:58Z heinze
225! Usage of nudging enabled
226! +nudging, ntnudge, ptnudge, qnudge, tnudge, unudge, vnudge, wnudge
227! increase pr_palm from 80 to 90 to allow for more standard profiles
228!
229! Enable prescribed time depenend surface fluxes and geostrophic wind read in
230! from external file LSF_DATA
231! +large_scale_forcing, lsf_surf, lsf_vert, nlsf, time_surf, shf_surf, qsws_surf,
232!  pt_surf, q_surf, p_surf, time_vert, ug_vert, vg_vert, wsubs_vert
233!
234! 1221 2013-09-10 08:59:13Z raasch
235! wall_flags_0 changed to 32bit int, +wall_flags_00,
236! +rflags_s_inner, rflags_invers
237!
238! 1216 2013-08-26 09:31:42Z raasch
239! +transpose_compute_overlap,
240! several variables are now defined in the serial (non-parallel) case also
241!
242! 1212 2013-08-15 08:46:27Z raasch
243! +tri
244!
245! 1179 2013-06-14 05:57:58Z raasch
246! +reference_state, ref_state, use_initial_profile_as_reference, vpt_reference,
247! use_reference renamed use_single_reference_value
248!
249! 1159 2013-05-21 11:58:22Z fricke
250! -bc_lr_dirneu, bc_lr_neudir, bc_ns_dirneu, bc_ns_neudir
251! +use_cmax
252!
253! 1128 2013-04-12 06:19:32Z raasch
254! +background_communication, i_left, i_right, j_north, j_south, req, req_count,
255! send_receive, sendrecv_in_background, wait_stat
256!
257! 1115 2013-03-26 18:16:16Z hoffmann
258! unused variables removed
259!
260! 1113 2013-03-10 02:48:14Z raasch
261! +on_device
262!
263! 1111 2013-03-08 23:54:10Z raasch
264! +tric, nr_timesteps_this_run
265!
266! 1106 2013-03-04 05:31:38Z raasch
267! array_kind renamed precision_kind, pdims defined in serial code
268! bugfix: default value assigned to coupling_start_time
269!
270! 1095 2013-02-03 02:21:01Z raasch
271! FORTRAN error in r1092 removed
272!
273! 1092 2013-02-02 11:24:22Z raasch
274! character length in some derived type changed for better alignment
275!
276! 1065 2012-11-22 17:42:36Z hoffmann
277! + c_sedimentation, limiter_sedimentation, turbulence, a_1, a_2, a_3, b_1, b_2,
278! + b_3, c_1, c_2, c_3, beta_cc
279!
280! bottom boundary condition of qr, nr changed from Dirichlet to Neumann
281!
282! 1053 2012-11-13 17:11:03Z hoffmann
283! necessary expansions according to the two new prognostic equations (nr, qr)
284! of the two-moment cloud physics scheme:
285! +*_init, flux_l_*, diss_l_*, flux_s_*, diss_s_*, *sws, *swst, tend_*, *, *_p
286! +t*_m, *_1, *_2, *_3, *_av, bc_*_b, bc_*_t, ibc_*_b, ibc_*_t, bc_*_t_val,
287! +*_vertical_gradient, *_surface_initial_change, *_vertical_gradient_level,
288! +*_vertical_gradient_level_ind, *_surface, constant_waterflux_*, 
289! +cloud_scheme, icloud_scheme, surface_waterflux_*, sums_ws*s_ws_l, wall_*flux
290!
291! constants for the two-moment scheme:
292! +a_vent, a_term, b_vent, b_term, c_evap, c_term, cof, eps_sb, k_cc, k_cr, k_rr,
293! +k_br, kappa_rr, kin_vis_air, mu_constant_value, nc, pirho_l, dpirho_l, rho_1,
294! +schmidt, schmidt_p_1d3, stp, x0, xmin, xmax, dt_precipitation, w_precipitation
295!
296! steering parameters for the two_moment scheme:
297! +mu_constant, ventilation_effect
298!
299! 1036 2012-10-22 13:43:42Z raasch
300! code put under GPL (PALM 3.9)
301!
302! 1031 2012-10-19 14:35:30Z raasch
303! +output_format_netcdf
304!
305! 1015 2012-09-27 09:23:24Z raasch
306! +acc_rank, num_acc_per_node,
307! -adjust_mixing_length
308!
309! 1010 2012-09-20 07:59:54Z raasch
310! pointer free version can be generated with cpp switch __nopointer
311!
312! 1003 2012-09-14 14:35:53Z raasch
313! -grid_matching, nxa, nya, etc., nnx_pe, nny_pe, spl_*
314!
315! 1001 2012-09-13 14:08:46Z raasch
316! -asselin_filter_factor, cut_spline_overshoot, dt_changed, last_dt_change,
317! last_dt_change_1d, long_filter_factor, overshoot_limit_*, ups_limit_*
318! several pointer/target arrays converted to normal ones
319!
320! 996 2012-09-07 10:41:47Z raasch
321! -use_prior_plot1d_parameters
322!
323! 978 2012-08-09 08:28:32Z fricke
324! +c_u_m, c_u_m_l, c_v_m, c_v_m_l, c_w_m, c_w_m_l,
325! +bc_lr_dirneu, bc_lr_neudir, bc_ns_dirneu, bc_ns_neudir
326! -km_damp_x, km_damp_y, km_damp_max, outflow_damping_width
327! +z0h, z0h_av, z0h_factor, z0h1d
328! +ptdf_x, ptdf_y, pt_damping_width, pt_damping_factor
329!
330! 964 2012-07-26 09:14:24Z raasch
331! -cross_linecolors, cross_linestyles, cross_normalized_x, cross_normx_factor,
332! cross_normalized_y, cross_normy_factor, cross_pnc_local,
333! cross_profile_numbers, cross_profile_number_counter, cross_uxmax,
334! cross_uxmax_computed, cross_uxmax_normalized,
335! cross_uxmax_normalized_computed, cross_uxmin, cross_uxmin_computed,
336! cross_uxmin_normalized, cross_uxmin_normalized_computed, cross_uymax,
337! cross_uymin, cross_xtext, dopr_crossindex, dopr_label, linecolors, linestyles,
338! nz_do1d, profil_output, z_max_do1d, z_max_do1d_normalized
339!
340! 951 2012-07-19 14:22:52Z hoffmann
341! changing profile_columns and profile_rows
342!
343! 940 2012-07-09 14:31:00Z raasch
344! +neutral
345!
346! 927 2012-06-06 19:15:04Z raasch
347! +masking_method
348!
349! 880 2012-04-13 06:28:59Z raasch
350! gathered_size, subdomain_size moved to control_parameters
351!
352! 866 2012-03-28 06:44:41Z raasch
353! interface for global_min_max changed
354!
355! 861 2012-03-26 14:18:34Z suehring
356! +wall_flags_0
357! -boundary_flags
358! +nzb_max
359! +adv_sca_1, +adv_mom_1
360!
361! 849 2012-03-15 10:35:09Z raasch
362! +deleted_particles, deleted_tails, tr.._count_sum, tr.._count_recv_sum in
363! particle_attributes,
364! +de_dx, de_dy, de_dz in arrays_3d,
365! first_call_advec_particles renamed first_call_lpm
366!
367! 828 2012-02-21 12:00:36Z raasch
368! +dissipation_classes, radius_classes, use_kernel_tables,
369! particle feature color renamed class
370!
371! 825 2012-02-19 03:03:44Z raasch
372! +bfactor, curvature_solution_effects, eps_ros, molecular_weight_of_water,
373! vanthoff, -b_cond in cloud_parameters,
374! dopts_num increased to 29, particle attributes speed_x|y|z_sgs renamed
375! rvar1|2|3
376! wang_collision_kernel and turbulence_effects_on_collision replaced by
377! collision_kernel, hall_kernel, palm_kernel, wang_kernel
378!
379! 809 2012-01-30 13:32:58Z marongas
380! Bugfix: replaced .AND. and .NOT. with && and ! in the preprocessor directives
381!
382! 807 2012-01-25 11:53:51Z maronga
383! New cpp directive "__check" implemented which is used by check_namelist_files.
384! New parameter check_restart has been defined which is needed by
385! check_namelist_files only.
386!
387! 805 2012-01-17 15:53:28Z franke
388! Bugfix collective_wait must be out of parallel branch for runs in serial mode
389!
390! 801 2012-01-10 17:30:36Z suehring
391! Dimesion of sums_wsus_ws_l, ! sums_wsvs_ws_l, sums_us2_ws_l, sums_vs2_ws_l,
392! sums_ws2_ws_l, sums_wspts_ws_l, sums_wsqs_ws_l, sums_wssas_ws_l increased.
393! for thread-safe summation in advec_ws.
394!
395! RCS Log replace by Id keyword, revision history cleaned up
396!
397! Revision 1.95  2007/02/11 13:18:30  raasch
398! version 3.1b (last under RCS control)
399!
400! Revision 1.1  1997/07/24 11:21:26  raasch
401! Initial revision
402!
403!
404!------------------------------------------------------------------------------!
405! Description:
406! ------------
407!> Definition of all variables
408!>
409!> @todo Add description for each variable
410!------------------------------------------------------------------------------!
411
412
413!------------------------------------------------------------------------------!
414! Description:
415! ------------
416!> Definition of variables for special advection schemes.
417!------------------------------------------------------------------------------!
418 MODULE advection
419 
420    USE kinds
421
422    REAL(wp), DIMENSION(:), ALLOCATABLE   ::  aex, bex, dex, eex
423
424    SAVE
425
426 END MODULE advection
427
428
429!------------------------------------------------------------------------------!
430! Description:
431! ------------
432!> Definition of all arrays defined on the computational grid.
433!------------------------------------------------------------------------------!
434 MODULE arrays_3d
435
436    USE kinds
437
438    REAL(wp), DIMENSION(:), ALLOCATABLE ::                                     &
439          c_u_m, c_u_m_l, c_v_m, c_v_m_l, c_w_m, c_w_m_l, ddzu, ddzu_pres,     &
440          dd2zu, dzu, ddzw, dzw, hyp, inflow_damping_factor, l_grid,           &
441          ptdf_x, ptdf_y, p_surf, pt_surf, pt_init, qsws_surf, q_init, q_surf, &
442          rdf, rdf_sc, ref_state, s_init, s_surf, sa_init, shf_surf,           &
443          timenudge, time_surf, time_vert, tmp_tnudge, ug, u_init,             &
444          u_nzb_p1_for_vfc, vg, v_init, v_nzb_p1_for_vfc, w_subs, zu, zw
445
446    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::                                   &
447          c_u, c_v, c_w, diss_s_e, diss_s_nr, diss_s_pt, diss_s_q,             &
448          diss_s_qr, diss_s_s, diss_s_sa, diss_s_u, diss_s_v, diss_s_w, dzu_mg,&
449          dzw_mg, flux_s_e, flux_s_nr, flux_s_pt, flux_s_q, flux_s_qr,         &
450          flux_s_s, flux_s_sa, flux_s_u, flux_s_v, flux_s_w, f1_mg, f2_mg,     &
451          f3_mg, mean_inflow_profiles, nrs, nrsws, nrswst,                     &
452          ol,                                                                  & !< Obukhov length
453          precipitation_amount, precipitation_rate, ptnudge, pt_slope_ref,     &
454          qnudge, qs, qsws, qswst, qswst_remote, qrs, qrsws, qrswst,           &
455          saswsb, saswst, shf, ss, ssws, sswst, tnudge, td_lsa_lpt, td_lsa_q,  &
456          td_sub_lpt,                                                          &
457          td_sub_q, total_2d_a, total_2d_o, ts, tswst, ug_vert, unudge, us,    &
458          usws, uswst, vnudge, vg_vert, vsws, vswst, wnudge, wsubs_vert,       &
459          z0,                                                                  & !< roughness length for momentum
460          z0h,                                                                 & !< roughness length for heat
461          z0q                                                                    !< roughness length for moisture
462
463    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::                                 &
464          d, de_dx, de_dy, de_dz, diss, diss_l_e,                              &
465          diss_l_nr, diss_l_pt, diss_l_q, diss_l_qr, diss_l_s, diss_l_sa,      &
466          diss_l_u, diss_l_v, diss_l_w, flux_l_e, flux_l_nr, flux_l_pt,        &
467          flux_l_q, flux_l_qr, flux_l_s, flux_l_sa, flux_l_u, flux_l_v,        &
468          flux_l_w, kh, km, l_wall, prr, p_loc, tend, tric,                    &
469          u_m_l, u_m_n, u_m_r, u_m_s, v_m_l, v_m_n, v_m_r, v_m_s, w_m_l,       &
470          w_m_n, w_m_r, w_m_s
471
472#if defined( __nopointer )
473    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
474          e, e_p, nr, nr_p, p, prho, pt, pt_p, q, q_p, qc, ql, ql_c, ql_v,     &
475          ql_vp, qr, qr_p, rho, s, s_p, sa, sa_p, te_m, tnr_m, tpt_m, tq_m,    &
476          tqr_m, ts_m, tsa_m, tu_m, tv_m, tw_m, u, u_p, v, v_p, vpt, w, w_p
477#else
478    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
479          e_1, e_2, e_3, p, prho_1, nr_1, nr_2, nr_3, pt_1, pt_2, pt_3, q_1,   &
480          q_2, q_3, qc_1, ql_v, ql_vp, ql_1, ql_2, qr_1, qr_2, qr_3, rho_1,    &
481          s_1, s_2, s_3, sa_1, sa_2, sa_3, u_1, u_2, u_3, v_1, v_2, v_3, vpt_1,&
482          w_1, w_2, w_3
483
484    REAL(wp), DIMENSION(:,:,:), POINTER ::                                     &
485          e, e_p, nr, nr_p, prho, pt, pt_p, q, q_p, qc, ql, ql_c, qr, qr_p,    &
486          rho, s, s_p, sa, sa_p, te_m, tnr_m, tpt_m, tq_m, tqr_m, ts_m,        &
487          tsa_m, tu_m, tv_m, tw_m, u, u_p, v, v_p, vpt, w, w_p
488#endif
489
490    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  rif_wall, tri
491
492
493    SAVE
494
495 END MODULE arrays_3d
496
497
498!------------------------------------------------------------------------------!
499! Description:
500! ------------
501!> Definition of variables needed for time-averaging of 2d/3d data.
502!------------------------------------------------------------------------------!
503 MODULE averaging
504 
505    USE kinds
506
507    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  lwp_av,                & !< Avg. liquid water path
508                                              precipitation_rate_av, & !< Avg. of precipitation rate
509                                              ol_av,                 & !< Avg. of Obukhov length
510                                              qsws_av,               & !< Avg. of surface moisture flux
511                                              ssws_av,               & !< Avg. of surface scalar flux
512                                              shf_av,                & !< Avg. of surface heat flux
513                                              ts_av,                 & !< Avg. of characteristic temperature scale
514                                              us_av,                 & !< Avg. of friction velocity
515                                              z0_av,                 & !< Avg. of roughness length for momentum
516                                              z0h_av,                & !< Avg. of roughness length for heat
517                                              z0q_av                   !< Avg. of roughness length for moisture
518
519    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE, TARGET ::                         &
520          e_av, lpt_av, nr_av, p_av, pc_av, pr_av, prr_av, pt_av, q_av, qc_av, &
521          ql_av, ql_c_av, ql_v_av, ql_vp_av, qr_av, qv_av, rho_av, s_av, sa_av,&
522          u_av, v_av, vpt_av, w_av
523 
524 END MODULE averaging
525
526
527!------------------------------------------------------------------------------!
528! Description:
529! ------------
530!> Definition of variables and constants for cloud physics.
531!------------------------------------------------------------------------------!
532 MODULE cloud_parameters
533 
534    USE kinds
535
536    REAL(wp) :: cp = 1005.0_wp,       & !< heat capacity of dry air (J kg-1 K-1)
537                l_v = 2.5E+06_wp,     & !< latent heat of vaporization (J kg-1)
538                l_d_cp, l_d_r, l_d_rv, & !< l_v / cp, l_v / r_d, l_v / r_v
539                rho_l = 1.0E3_wp,     & !< density of water (kg m-3)
540                r_d = 287.0_wp,       & !< sp. gas const. dry air (J kg-1 K-1)
541                r_v = 461.51_wp         !< sp. gas const. water vapor (J kg-1 K-1)
542
543
544    REAL(wp), DIMENSION(:), ALLOCATABLE     ::  hyrho, pt_d_t, t_d_pt 
545
546    SAVE
547
548 END MODULE cloud_parameters
549
550
551!------------------------------------------------------------------------------!
552! Description:
553! ------------
554!> Definition of general constants.
555!------------------------------------------------------------------------------!
556 MODULE constants
557 
558    USE kinds
559
560    REAL(wp)  ::  pi = 3.141592654_wp
561    REAL(wp)  ::  adv_mom_1, adv_mom_3, adv_mom_5, adv_sca_1, adv_sca_3, adv_sca_5
562   
563
564    SAVE
565
566 END MODULE constants
567
568 
569!------------------------------------------------------------------------------!
570! Description:
571! ------------
572!> Definition of parameters for program control
573!------------------------------------------------------------------------------!
574 MODULE control_parameters
575
576    USE kinds
577
578    TYPE plot_precision
579       CHARACTER (LEN=8) ::  variable
580       INTEGER(iwp)      ::  precision
581    END TYPE plot_precision
582
583    TYPE(plot_precision), DIMENSION(100) ::  plot_3d_precision =               &
584                        (/ plot_precision( 'u', 2 ), plot_precision( 'v', 2 ), &
585                           plot_precision( 'w', 2 ), plot_precision( 'p', 5 ), &
586                           plot_precision( 'pt', 2 ),                          &
587                           ( plot_precision( ' ', 1 ), i9 = 1,95 ) /)
588
589    TYPE file_status
590       LOGICAL ::  opened, opened_before
591    END TYPE file_status
592   
593    INTEGER, PARAMETER :: mask_xyz_dimension = 100, max_masks = 50
594    INTEGER(iwp), PARAMETER ::  varnamelength = 30  !< length of output variable names
595
596    TYPE(file_status), DIMENSION(200+2*max_masks) ::                &
597                             openfile = file_status(.FALSE.,.FALSE.)
598
599    CHARACTER (LEN=1)    ::  cycle_mg = 'w', timestep_reason = ' '
600    CHARACTER (LEN=3)    ::  coupling_char = ''
601    CHARACTER (LEN=5)    ::  write_binary = 'false'
602    CHARACTER (LEN=8)    ::  most_method = 'lookup', & !< NAMELIST parameter defining method to be used to calculate Okukhov length,
603                             run_date,               & !<
604                             run_time                  !<
605    CHARACTER (LEN=9)    ::  simulated_time_chr
606    CHARACTER (LEN=11)   ::  topography_grid_convention = ' '
607    CHARACTER (LEN=12)   ::  version = ' ', revision = ' ', &
608                             user_interface_current_revision = ' ', &
609                             user_interface_required_revision = ' '
610    CHARACTER (LEN=16)   ::  conserve_volume_flow_mode = 'default', &
611                             loop_optimization = 'default', &
612                             momentum_advec = 'ws-scheme', &
613                             psolver = 'poisfft', &
614                             scalar_advec = 'ws-scheme'
615    CHARACTER (LEN=20)   ::  bc_e_b = 'neumann', bc_lr = 'cyclic', &
616                             bc_ns = 'cyclic', bc_p_b = 'neumann', &
617                             bc_p_t = 'dirichlet', bc_pt_b = 'dirichlet', &
618                             bc_pt_t = 'initial_gradient', &
619                             bc_q_b = 'dirichlet', bc_q_t = 'neumann', &
620                             bc_s_b = 'dirichlet', bc_s_t = 'initial_gradient', &
621                             bc_sa_t = 'neumann', &
622                             bc_uv_b = 'dirichlet', bc_uv_t = 'dirichlet', &
623                             cloud_scheme = 'saturation_adjust', &
624                             coupling_mode = 'uncoupled', &
625                             coupling_mode_remote = 'uncoupled', &
626                             dissipation_1d = 'detering', &
627                             fft_method = 'system-specific', &
628                             mixing_length_1d = 'blackadar', &
629                             random_generator = 'numerical-recipes', &
630                             reference_state = 'initial_profile', &
631                             return_addres, return_username, &
632                             timestep_scheme = 'runge-kutta-3'                             
633    CHARACTER (LEN=40)   ::  avs_data_file, topography = 'flat'
634    CHARACTER (LEN=64)   ::  host = ' '
635    CHARACTER (LEN=80)   ::  log_message, run_identifier
636    CHARACTER (LEN=100)  ::  initializing_actions = ' ' 
637    CHARACTER (LEN=110)  ::  run_description_header
638    CHARACTER (LEN=1000) ::  message_string = ' '
639
640    CHARACTER (LEN=varnamelength), DIMENSION(500) ::  data_output = ' ',    &
641                                           data_output_user = ' ', doav = ' '
642    CHARACTER (LEN=varnamelength), DIMENSION(max_masks,100) ::  &
643         data_output_masks = ' ', data_output_masks_user = ' '
644
645    CHARACTER (LEN=varnamelength), DIMENSION(300) ::  data_output_pr = ' '
646    CHARACTER (LEN=varnamelength), DIMENSION(200) ::  data_output_pr_user = ' '
647    CHARACTER (LEN=varnamelength), DIMENSION(max_masks,0:1,100) ::  domask = ' '
648    CHARACTER (LEN=varnamelength), DIMENSION(0:1,500) ::  do2d = ' ', do3d = ' '
649
650    INTEGER(iwp), PARAMETER :: fl_max = 100, var_fl_max = 20
651   
652    INTEGER(iwp) ::  abort_mode = 1, average_count_pr = 0, &
653                     average_count_3d = 0, current_timestep_number = 0, &
654                     coupling_topology = 0, &
655                     dist_range = 0, disturbance_level_ind_b, &
656                     disturbance_level_ind_t, doav_n = 0, dopr_n = 0, &
657                     dopr_time_count = 0, dopts_time_count = 0, &
658                     dots_time_count = 0, &
659                     do2d_xy_n = 0, do2d_xz_n = 0, do2d_yz_n = 0, do3d_avs_n = 0, &
660                     dp_level_ind_b = 0, dvrp_filecount = 0, &
661                     dz_stretch_level_index, ensemble_member_nr = 0, gamma_mg, gathered_size, &
662                     grid_level, ibc_e_b, ibc_p_b, ibc_p_t, &
663                     ibc_pt_b, ibc_pt_t, ibc_q_b, ibc_q_t, ibc_s_b, ibc_s_t, &
664                     ibc_sa_t, ibc_uv_b, ibc_uv_t, &
665                     inflow_disturbance_begin = -1, inflow_disturbance_end = -1, &
666                     intermediate_timestep_count, intermediate_timestep_count_max, &
667                     io_group = 0, io_blocks = 1, iran = -1234567, &
668                     masks = 0, maximum_grid_level, &
669                     maximum_parallel_io_streams = -1, max_pr_user = 0, &
670                     mgcycles = 0, mg_cycles = -1, mg_switch_to_pe0_level = -1, mid, &
671                     nlsf = 1000, ntnudge = 1000, ngsrb = 2, &
672                     nr_timesteps_this_run = 0, &
673                     nsor = 20, nsor_ini = 100, n_sor, normalizing_region = 0, &
674                     num_leg=0, num_var_fl, num_var_fl_user=0, &
675                     nz_do3d = -9999, prt_time_count = 0, &
676                     recycling_plane, runnr = 0, &
677                     skip_do_avs = 0, subdomain_size, terminate_coupled = 0, &
678                     terminate_coupled_remote = 0, timestep_count = 0
679
680    INTEGER(iwp) ::  dist_nxl(0:1), dist_nxr(0:1), dist_nyn(0:1), dist_nys(0:1), &
681                     do2d_no(0:1) = 0, do2d_xy_time_count(0:1), &
682                     do2d_xz_time_count(0:1), do2d_yz_time_count(0:1), &
683                     do3d_no(0:1) = 0, do3d_time_count(0:1), &
684                     domask_no(max_masks,0:1) = 0, domask_time_count(max_masks,0:1),&
685                     mask_size(max_masks,3) = -1, mask_size_l(max_masks,3) = -1, &
686                     mask_start_l(max_masks,3) = -1, &
687                     pt_vertical_gradient_level_ind(10) = -9999, &
688                     q_vertical_gradient_level_ind(10) = -9999, &
689                     s_vertical_gradient_level_ind(10) = -9999, &                     
690                     sa_vertical_gradient_level_ind(10) = -9999, &
691                     section(100,3), section_xy(100) = -9999, &
692                     section_xz(100) = -9999, section_yz(100) = -9999, &
693                     ug_vertical_gradient_level_ind(10) = -9999, &
694                     vg_vertical_gradient_level_ind(10) = -9999, &
695                     subs_vertical_gradient_level_i(10) = -9999
696
697
698    INTEGER(iwp), DIMENSION(0:1) :: ntdim_2d_xy, ntdim_2d_xz, ntdim_2d_yz, ntdim_3d
699
700    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  grid_level_count
701
702    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  mask_i, mask_j, mask_k
703    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE   ::  &
704                    mask_i_global, mask_j_global, mask_k_global
705
706    LOGICAL ::  bc_lr_cyc =.TRUE., bc_lr_dirrad = .FALSE., &
707                bc_lr_raddir = .FALSE., bc_ns_cyc = .TRUE., &
708                bc_ns_dirrad = .FALSE., bc_ns_raddir = .FALSE.,&
709                call_microphysics_at_all_substeps = .FALSE., &
710                call_psolver_at_all_substeps = .TRUE., &
711                cloud_droplets = .FALSE., cloud_physics = .FALSE., &
712                cloud_top_radiation = .FALSE., &
713                conserve_volume_flow = .FALSE., constant_diffusion = .FALSE., &
714                constant_flux_layer = .TRUE., &
715                constant_heatflux = .TRUE., constant_top_heatflux = .TRUE., &
716                constant_top_momentumflux = .FALSE., &
717                constant_top_salinityflux = .TRUE., &
718                constant_top_scalarflux = .TRUE., &
719                constant_scalarflux = .TRUE., &             
720                constant_waterflux = .TRUE., create_disturbances = .TRUE., &
721                data_output_2d_on_each_pe = .TRUE., & 
722                dissipation_control = .FALSE., disturbance_created = .FALSE., &
723                do2d_at_begin = .FALSE., do3d_at_begin = .FALSE., &
724                do_sum = .FALSE., &
725                dp_external = .FALSE., dp_smooth = .FALSE., &
726                dt_fixed = .FALSE., &
727                dt_3d_reached, dt_3d_reached_l, exchange_mg = .FALSE., &
728                first_call_lpm = .TRUE., &
729                force_print_header = .FALSE., galilei_transformation = .FALSE.,&
730                humidity = .FALSE., humidity_remote = .FALSE., &
731                inflow_l = .FALSE., inflow_n = .FALSE., &
732                inflow_r = .FALSE., inflow_s = .FALSE., &
733                large_scale_forcing = .FALSE., &
734                large_scale_subsidence = .FALSE.
735    LOGICAL ::  lsf_exception = .FALSE.  !< temporary flag for use of lsf with buildings on flat terrain
736    LOGICAL ::  lsf_surf = .TRUE., &
737                lsf_vert = .TRUE., lptnudge = .FALSE., lqnudge = .FALSE., &
738                lunudge = .FALSE., lvnudge = .FALSE., lwnudge = .FALSE., &
739                masking_method = .FALSE., &
740                microphysics_sat_adjust = .FALSE., &
741                microphysics_kessler = .FALSE., &
742                microphysics_seifert = .FALSE., &
743                mg_switch_to_pe0 = .FALSE., &
744                monotonic_adjustment = .FALSE.
745    LOGICAL ::  nest_bound_l = .FALSE. !< nested boundary on left side
746    LOGICAL ::  nest_bound_n = .FALSE. !< nested boundary on north side
747    LOGICAL ::  nest_bound_r = .FALSE. !< nested boundary on right side
748    LOGICAL ::  nest_bound_s = .FALSE. !< nested boundary on south side
749    LOGICAL ::  nest_domain  = .FALSE. !< domain is nested into a parent domain
750    LOGICAL ::  neutral = .FALSE., nudging = .FALSE., &
751                ocean = .FALSE., on_device = .FALSE., &
752                outflow_l = .FALSE., outflow_n = .FALSE., outflow_r = .FALSE., &
753                outflow_s = .FALSE., passive_scalar = .FALSE., &
754                precipitation = .FALSE., &
755                random_heatflux = .FALSE., recycling_yshift = .FALSE.,&
756                run_control_header = .FALSE., run_coupled = .TRUE., &
757                scalar_rayleigh_damping = .TRUE., sloping_surface = .FALSE., &
758                stop_dt = .FALSE., synchronous_exchange = .FALSE., &
759                terminate_run = .FALSE., transpose_compute_overlap = .FALSE., &
760                turbulent_inflow = .FALSE.
761    LOGICAL ::  urban_surface = .FALSE.  !< flag for urban surface model
762    LOGICAL ::  use_cmax = .TRUE., use_initial_profile_as_reference = .FALSE., &
763                use_prescribed_profile_data = .FALSE., &
764                use_single_reference_value = .FALSE., &
765                use_subsidence_tendencies = .FALSE., &
766                use_surface_fluxes = .FALSE., use_top_fluxes = .FALSE., &
767                use_ug_for_galilei_tr = .TRUE., use_upstream_for_tke = .FALSE.
768    LOGICAL ::  virtual_flight = .FALSE.  !< flag for virtual flight model
769    LOGICAL ::  wall_adjustment = .TRUE., ws_scheme_sca = .FALSE., &
770                ws_scheme_mom = .FALSE.
771
772    LOGICAL ::  data_output_xy(0:1) = .FALSE., data_output_xz(0:1) = .FALSE., &
773                data_output_yz(0:1) = .FALSE.
774
775    REAL(wp) ::  advected_distance_x = 0.0_wp, advected_distance_y = 0.0_wp, &
776                 alpha_surface = 0.0_wp, atmos_ocean_sign = 1.0_wp, &
777                 averaging_interval = 0.0_wp, averaging_interval_pr = 9999999.9_wp, &
778                 bc_pt_t_val, bc_q_t_val, bc_s_t_val, bottom_salinityflux = 0.0_wp, &
779                 building_height = 50.0_wp, building_length_x = 50.0_wp, &
780                 building_length_y = 50.0_wp, building_wall_left = 9999999.9_wp, &
781                 building_wall_south = 9999999.9_wp, canyon_height = 50.0_wp, &
782                 canyon_width_x = 9999999.9_wp, canyon_width_y = 9999999.9_wp, &
783                 canyon_wall_left = 9999999.9_wp, canyon_wall_south = 9999999.9_wp, &
784                 cfl_factor = -1.0_wp, cos_alpha_surface, &
785                 coupling_start_time = 0.0_wp, disturbance_amplitude = 0.25_wp, &
786                 disturbance_energy_limit = 0.01_wp, &
787                 disturbance_level_b = -9999999.9_wp, &
788                 disturbance_level_t = -9999999.9_wp, &
789                 dp_level_b = 0.0_wp, &
790                 dt = -1.0_wp, dt_averaging_input = 0.0_wp, &
791                 dt_averaging_input_pr = 9999999.9_wp, dt_coupling = 9999999.9_wp, &
792                 dt_data_output = 9999999.9_wp, &
793                 dt_data_output_av = 9999999.9_wp, dt_disturb = 9999999.9_wp, &
794                 dt_dopr = 9999999.9_wp, dt_dopr_listing = 9999999.9_wp, &
795                 dt_dopts = 9999999.9_wp, dt_dots = 9999999.9_wp, &
796                 dt_do2d_xy = 9999999.9_wp, dt_do2d_xz = 9999999.9_wp, &
797                 dt_do2d_yz = 9999999.9_wp, dt_do3d = 9999999.9_wp, dt_dvrp = 9999999.9_wp, &
798                 dt_max = 20.0_wp, &
799                 dt_restart = 9999999.9_wp, &
800                 dt_run_control = 60.0_wp, dt_3d = 1.0_wp, dz = -1.0_wp, &
801                 dz_max = 9999999.9_wp, dz_stretch_factor = 1.08_wp, &
802                 dz_stretch_level = 100000.0_wp, e_init = 0.0_wp, e_min = 0.0_wp, &
803                 end_time = 0.0_wp, &
804                 f = 0.0_wp, fs = 0.0_wp, g = 9.81_wp, inflow_damping_height = 9999999.9_wp, &
805                 inflow_damping_width = 9999999.9_wp, kappa = 0.4_wp, km_constant = -1.0_wp,&
806                 mask_scale_x = 1.0_wp, mask_scale_y = 1.0_wp, mask_scale_z = 1.0_wp, &
807                 maximum_cpu_time_allowed = 0.0_wp,  &
808                 molecular_viscosity = 1.461E-5_wp, &
809                 old_dt = 1.0E-10_wp, omega = 7.29212E-5_wp, omega_sor = 1.8_wp, &
810                 particle_maximum_age = 9999999.9_wp, &
811                 phi = 55.0_wp, prandtl_number = 1.0_wp, &
812                 precipitation_amount_interval = 9999999.9_wp, prho_reference, &
813                 pt_damping_factor = 0.0_wp, pt_damping_width = 0.0_wp, &
814                 pt_reference = 9999999.9_wp, pt_slope_offset = 0.0_wp, &
815                 pt_surface = 300.0_wp, pt_surface_initial_change = 0.0_wp, &
816                 q_surface = 0.0_wp, q_surface_initial_change = 0.0_wp, &
817                 rayleigh_damping_factor = -1.0_wp, rayleigh_damping_height = -1.0_wp, &
818                 recycling_width = 9999999.9_wp, residual_limit = 1.0E-4_wp, &
819                 restart_time = 9999999.9_wp, rho_reference, rho_surface, &
820                 roughness_length = 0.1_wp, &
821                 sa_surface = 35.0_wp, &
822                 simulated_time = 0.0_wp, simulated_time_at_begin, sin_alpha_surface, &
823                 skip_time_data_output = 0.0_wp, skip_time_data_output_av = 9999999.9_wp,&
824                 skip_time_dopr = 9999999.9_wp, &
825                 skip_time_do2d_xy = 9999999.9_wp, skip_time_do2d_xz = 9999999.9_wp, &
826                 skip_time_do2d_yz = 9999999.9_wp, skip_time_do3d = 9999999.9_wp, &
827                 surface_heatflux = 9999999.9_wp, surface_pressure = 1013.25_wp, &
828                 surface_scalarflux = 9999999.9_wp, surface_waterflux = 9999999.9_wp, &
829                 s_surface = 0.0_wp, s_surface_initial_change = 0.0_wp, &
830                 termination_time_needed = -1.0_wp, time_coupling = 0.0_wp, &
831                 time_disturb = 0.0_wp, time_dopr = 0.0_wp, time_dopr_av = 0.0_wp, &
832                 time_dopr_listing = 0.0_wp, time_dopts = 0.0_wp, time_dosp = 0.0_wp, &
833                 time_dosp_av = 0.0_wp, time_dots = 0.0_wp, time_do2d_xy = 0.0_wp, &
834                 time_do2d_xz = 0.0_wp, time_do2d_yz = 0.0_wp, time_do3d = 0.0_wp, &
835                 time_do_av = 0.0_wp, time_do_sla = 0.0_wp, time_dvrp = 0.0_wp, &
836                 time_restart = 9999999.9_wp, time_run_control = 0.0_wp,&
837                 time_since_reference_point, top_heatflux = 9999999.9_wp, &
838                 top_momentumflux_u = 9999999.9_wp, &
839                 top_momentumflux_v = 9999999.9_wp, top_salinityflux = 9999999.9_wp, &
840                 top_scalarflux = 9999999.9_wp, &
841                 ug_surface = 0.0_wp, u_bulk = 0.0_wp, u_gtrans = 0.0_wp, &
842                 vg_surface = 0.0_wp, vpt_reference = 9999999.9_wp, &
843                 v_bulk = 0.0_wp, v_gtrans = 0.0_wp, wall_adjustment_factor = 1.8_wp, &
844                 zeta_max = 20.0_wp,    & !< Maximum value of zeta = z/L
845                 zeta_min = -9990.0_wp, & !< Minimum value of zeta = z/L
846                 z_max_do2d = -1.0_wp, z0h_factor = 1.0_wp
847
848    REAL(wp) ::  do2d_xy_last_time(0:1) = -1.0_wp, do2d_xz_last_time(0:1) = -1.0_wp, &
849                 do2d_yz_last_time(0:1) = -1.0_wp, dpdxy(1:2) = 0.0_wp, &
850                 dt_domask(max_masks) = 9999999.9_wp, &
851                 mask_scale(3), &
852                 pt_vertical_gradient(10) = 0.0_wp, &
853                 pt_vertical_gradient_level(10) = -1.0_wp, &
854                 q_vertical_gradient(10) = 0.0_wp, &
855                 q_vertical_gradient_level(10) = -1.0_wp, &
856                 s_vertical_gradient(10) = 0.0_wp, &
857                 s_vertical_gradient_level(10) = -1.0_wp, &
858                 sa_vertical_gradient(10) = 0.0_wp, &
859                 sa_vertical_gradient_level(10) = -1.0_wp, &
860                 skip_time_domask(max_masks) = 9999999.9_wp, threshold(20) = 0.0_wp, &
861                 time_domask(max_masks) = 0.0_wp, &
862                 tsc(10) = (/ 1.0_wp, 1.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp, 0.0_wp /), &
863                 u_profile(100) = 9999999.9_wp, uv_heights(100) = 9999999.9_wp, &
864                 v_profile(100) = 9999999.9_wp, &
865                 ug_vertical_gradient(10) = 0.0_wp, &
866                 ug_vertical_gradient_level(10) = -9999999.9_wp, &
867                 vg_vertical_gradient(10) = 0.0_wp, &
868                 vg_vertical_gradient_level(10) = -9999999.9_wp, &
869                 volume_flow(1:3) = 0.0_wp, volume_flow_area(1:3) = 0.0_wp, &
870                 volume_flow_initial(1:3) = 0.0_wp, wall_heatflux(0:4) = 0.0_wp, &
871                 wall_humidityflux(0:4) = 0.0_wp, wall_nrflux(0:4) = 0.0_wp, &
872                 wall_qflux(0:4) = 0.0_wp, wall_qrflux(0:4) = 0.0_wp, &
873                 wall_salinityflux(0:4) = 0.0_wp, wall_sflux(0:4) = 0.0_wp, wall_scalarflux(0:4) = 0.0_wp, &
874                 subs_vertical_gradient(10) = 0.0_wp, &
875                 subs_vertical_gradient_level(10) = -9999999.9_wp
876
877    REAL(wp), DIMENSION(:), ALLOCATABLE ::  dp_smooth_factor
878
879    REAL(wp), DIMENSION(max_masks,mask_xyz_dimension) :: &
880            mask_x = -1.0_wp, mask_y = -1.0_wp, mask_z = -1.0_wp
881    REAL(wp), DIMENSION(max_masks,3) ::                  &
882            mask_x_loop = -1.0_wp, mask_y_loop = -1.0_wp, mask_z_loop = -1.0_wp
883   
884!
885!--    internal mask arrays ("mask,dimension,selection")
886       REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  mask, mask_loop
887
888    SAVE
889
890 END MODULE control_parameters
891
892
893!------------------------------------------------------------------------------!
894! Description:
895! ------------
896!> Definition of variables used with dvrp-software.
897!------------------------------------------------------------------------------!
898 MODULE dvrp_variables
899
900     USE kinds
901
902    CHARACTER (LEN=10) ::  dvrp_output = 'rtsp', particle_color = 'none', &
903                           particle_dvrpsize = 'none'
904
905    CHARACTER (LEN=20), DIMENSION(10) ::  mode_dvrp = &
906                                     (/ ( '                    ', i9 = 1,10 ) /)
907
908    CHARACTER (LEN=80) ::  dvrp_directory = 'default',                    &
909                           dvrp_file      = 'default',                    &
910                           dvrp_host      = 'origin.rvs.uni-hannover.de', &
911                           dvrp_password  = '********',                   &
912                           dvrp_username  = ' '
913
914    INTEGER(iwp) ::  cluster_size = 1, dvrp_colortable_entries = 4,                 &
915                     dvrp_colortable_entries_prt = 22, islice_dvrp,                 &
916                     nx_dvrp, nxl_dvrp, nxr_dvrp, ny_dvrp, nyn_dvrp, nys_dvrp,      &
917                     nz_dvrp, pathlines_fadeintime = 5, pathlines_fadeouttime = 5,  &
918                     pathlines_linecount = 1000, pathlines_maxhistory = 40,         &
919                     pathlines_wavecount = 10, pathlines_wavetime = 50,             &
920                     vc_gradient_normals = 0, vc_mode = 0, vc_size_x = 2,           &
921                     vc_size_y = 2, vc_size_z = 2
922
923    INTEGER(iwp), DIMENSION(10) ::  slicer_position_dvrp
924
925    LOGICAL ::  cyclic_dvrp = .FALSE., dvrp_overlap, dvrp_total_overlap, &
926                local_dvrserver_running, lock_steering_update = .FALSE., &
927                use_seperate_pe_for_dvrp_output = .FALSE.
928
929    REAL(wp)    ::  clip_dvrp_l = 9999999.9_wp, clip_dvrp_n = 9999999.9_wp, &
930                    clip_dvrp_r = 9999999.9_wp, clip_dvrp_s = 9999999.9_wp, &
931                    superelevation = 1.0_wp, superelevation_x = 1.0_wp,     &
932                    superelevation_y = 1.0_wp, vc_alpha = 38.0_wp
933
934    REAL(wp), DIMENSION(2) ::  color_interval = (/ 0.0_wp, 1.0_wp /), &
935                               dvrpsize_interval = (/ 0.0_wp, 1.0_wp /)
936
937    REAL(wp), DIMENSION(3) ::  groundplate_color = (/ 0.0_wp, 0.6_wp, 0.0_wp /), &
938                               topography_color = (/ 0.8_wp, 0.7_wp, 0.6_wp /)
939
940    REAL(wp), DIMENSION(2,10)     ::  slicer_range_limits_dvrp
941
942    REAL(wp), DIMENSION(3,10)     ::  isosurface_color
943
944    REAL(sp), DIMENSION(2,100) ::  interval_values_dvrp,                       &
945                                   interval_values_dvrp_prt, interval_h_dvrp,  &
946                                   interval_h_dvrp_prt, interval_l_dvrp = 0.5_sp, &
947                                   interval_l_dvrp_prt = 0.5_sp, interval_s_dvrp = 1.0_sp, &
948                                   interval_s_dvrp_prt = 1.0_sp, interval_a_dvrp = 0.0_sp, &
949                                   interval_a_dvrp_prt = 0.0_sp
950
951    DATA  slicer_range_limits_dvrp / -1.0_wp, 1.0_wp, -1.0_wp, 1.0_wp, -1.0_wp, 1.0_wp, &
952                                     -1.0_wp, 1.0_wp, -1.0_wp, 1.0_wp, -1.0_wp, 1.0_wp, &
953                                     -1.0_wp, 1.0_wp, -1.0_wp, 1.0_wp, -1.0_wp, 1.0_wp, &
954                                     -1.0_wp, 1.0_wp /
955
956    DATA  isosurface_color / 0.9_wp, 0.9_wp, 0.9_wp,  0.8_wp, 0.1_wp, 0.1_wp,  0.1_wp, 0.1_wp, 0.8_wp, &
957                             0.1_wp, 0.8_wp, 0.1_wp,  0.6_wp, 0.1_wp, 0.1_wp,  0.1_wp, 0.1_wp, 0.6_wp, &
958                             0.1_wp, 0.6_wp, 0.1_wp,  0.4_wp, 0.1_wp, 0.1_wp,  0.1_wp, 0.1_wp, 0.4_wp, &
959                             0.1_wp, 0.4_wp, 0.1_wp /
960
961    DATA  interval_h_dvrp / 270.0_wp, 225.0_wp, 225.0_wp, 180.0_wp, 70.0_wp, 25.0_wp, &
962                            25.0_wp, -25.0_wp, 192 * 0.0_wp /
963
964    DATA  interval_h_dvrp_prt / 270.0_wp, 225.0_wp, 225.0_wp, 180.0_wp, 70.0_wp, 25.0_wp, &
965                                25.0_wp, -25.0_wp, 192 * 0.0_wp /
966
967    REAL(sp), DIMENSION(:), ALLOCATABLE ::  xcoor_dvrp, ycoor_dvrp, zcoor_dvrp
968
969    TYPE steering
970       CHARACTER (LEN=24) ::  name
971       REAL(sp)           ::  min, max
972       INTEGER(iwp)       ::  imin, imax
973    END TYPE steering
974
975    TYPE(steering), DIMENSION(:), ALLOCATABLE ::  steering_dvrp
976
977    SAVE
978
979 END MODULE dvrp_variables
980
981
982!------------------------------------------------------------------------------!
983! Description:
984! ------------
985!> Definition of grid spacings.
986!------------------------------------------------------------------------------!
987 MODULE grid_variables
988
989    USE kinds
990
991    REAL(wp) ::  ddx, ddx2, dx = 1.0_wp, dx2, ddy, ddy2, dy = 1.0_wp, dy2
992
993    REAL(wp), DIMENSION(:), ALLOCATABLE ::  ddx2_mg, ddy2_mg
994
995    REAL(wp), DIMENSION(:,:), ALLOCATABLE ::  fwxm, fwxp, fwym, fwyp, fxm, fxp,   &
996                                              fym, fyp, wall_e_x, wall_e_y,       &
997                                              wall_u, wall_v, wall_w_x, wall_w_y, &
998                                              zu_s_inner, zw_w_inner
999
1000    SAVE
1001
1002 END MODULE grid_variables
1003
1004
1005!------------------------------------------------------------------------------!
1006! Description:
1007! ------------
1008!> Definition of array bounds, number of gridpoints, and wall flag arrays.
1009!------------------------------------------------------------------------------!
1010 MODULE indices
1011
1012    USE kinds
1013
1014    INTEGER(iwp) ::  i_left, i_right, j_north, j_south, nbgp = 3, ngp_sums,         &
1015                     ngp_sums_ls, nnx, nx = 0, nx_a, nx_o, nxl, nxlg, nxlu, nxr,    &
1016                     nxrg, nx_on_file, nny, ny = 0, ny_a, ny_o, nyn, nyng, nys,     &
1017                     nysg, nysv, ny_on_file, nnz, nz = 0, nzb, nzb_diff, nzb_max,   &
1018                     nzt, nzt_diff
1019
1020
1021    INTEGER(idp), DIMENSION(:), ALLOCATABLE ::      &
1022                ngp_3d, ngp_3d_inner   ! need to have 64 bit for grids > 2E9
1023
1024    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::                                  &
1025                   ngp_2dh, nxl_mg, nxr_mg, nyn_mg, nys_mg, nzt_mg
1026
1027
1028    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE :: ngp_2dh_outer, ngp_2dh_s_inner,  &
1029                   mg_loc_ind, nzb_diff_s_inner, nzb_diff_s_outer, nzb_diff_u,    &
1030                   nzb_diff_v, nzb_inner, nzb_outer, nzb_s_inner, nzb_s_outer,    &
1031                   nzb_u_inner, nzb_u_outer, nzb_v_inner, nzb_v_outer,            &
1032                   nzb_w_inner, nzb_w_outer
1033
1034    INTEGER(iwp), DIMENSION(:,:,:), POINTER ::  flags
1035
1036    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE ::  wall_flags_0, wall_flags_00
1037
1038    INTEGER(iwp), DIMENSION(:,:,:), ALLOCATABLE,  TARGET ::                       &
1039                   wall_flags_1, wall_flags_2, wall_flags_3, wall_flags_4,        &
1040                   wall_flags_5, wall_flags_6, wall_flags_7, wall_flags_8,        &
1041                   wall_flags_9, wall_flags_10
1042
1043    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::  rflags_s_inner, rflags_invers
1044
1045    SAVE
1046
1047 END MODULE indices
1048
1049
1050!------------------------------------------------------------------------------!
1051! Description:
1052! ------------
1053!> Interfaces for special subroutines which use optional parameters.
1054!------------------------------------------------------------------------------!
1055 MODULE interfaces
1056
1057    INTERFACE
1058
1059!------------------------------------------------------------------------------!
1060! Description:
1061! ------------
1062!> @todo Missing subroutine description.
1063!------------------------------------------------------------------------------!
1064       SUBROUTINE global_min_max ( i1, i2, j1, j2, k1, k2, feld, mode, offset, &
1065                                   wert, wert_ijk, wert1, wert1_ijk )
1066
1067          USE kinds
1068
1069          CHARACTER (LEN=*), INTENT(IN)      ::  mode
1070          INTEGER(iwp), INTENT(IN)           ::  i1, i2, j1, j2, k1, k2
1071          INTEGER(iwp)                       ::  wert_ijk(3)
1072          INTEGER(iwp), OPTIONAL             ::  wert1_ijk(3)
1073          REAL(wp)                           ::  offset, wert
1074          REAL(wp), OPTIONAL                 ::  wert1
1075          REAL(wp), INTENT(IN)               ::  feld(i1:i2,j1:j2,k1:k2)
1076
1077       END SUBROUTINE global_min_max
1078
1079    END INTERFACE
1080
1081    SAVE
1082
1083 END MODULE interfaces
1084
1085
1086!------------------------------------------------------------------------------!
1087! Description:
1088! ------------
1089!> Interfaces for subroutines with pointer arguments called in
1090!> prognostic_equations.
1091!------------------------------------------------------------------------------!
1092 MODULE pointer_interfaces
1093
1094    INTERFACE
1095
1096!------------------------------------------------------------------------------!
1097! Description:
1098! ------------
1099!> @todo Missing subroutine description.
1100!------------------------------------------------------------------------------!
1101       SUBROUTINE advec_s_bc( sk, sk_char )
1102
1103          USE kinds
1104
1105          CHARACTER (LEN=*), INTENT(IN)   ::  sk_char
1106#if defined( __nopointer )
1107          REAL(wp), DIMENSION(:,:,:) ::  sk
1108#else
1109          REAL(wp), DIMENSION(:,:,:), POINTER ::  sk
1110#endif
1111       END SUBROUTINE advec_s_bc
1112
1113    END INTERFACE
1114
1115
1116    SAVE
1117
1118 END MODULE pointer_interfaces
1119
1120
1121!------------------------------------------------------------------------------!
1122! Description:
1123! ------------
1124!> Definition of variables for the 1D-model.
1125!------------------------------------------------------------------------------!
1126 MODULE model_1d
1127
1128    USE kinds
1129
1130    INTEGER(iwp) ::  current_timestep_number_1d = 0, damp_level_ind_1d
1131
1132    LOGICAL ::  run_control_header_1d = .FALSE., stop_dt_1d = .FALSE. 
1133
1134    REAL(wp) ::     damp_level_1d = -1.0_wp, dt_1d = 60.0_wp, dt_max_1d = 300.0_wp, &
1135                    dt_pr_1d = 9999999.9_wp, dt_run_control_1d = 60.0_wp, &
1136                    end_time_1d = 864000.0_wp, old_dt_1d = 1.0E-10_wp, &
1137                    qs1d, simulated_time_1d = 0.0_wp, time_pr_1d = 0.0_wp, &
1138                    time_run_control_1d = 0.0_wp, ts1d, us1d, usws1d, &
1139                    vsws1d, z01d, z0h1d
1140
1141
1142    REAL(wp), DIMENSION(:), ALLOCATABLE ::  e1d, e1d_p, kh1d, km1d, l_black, l1d,  &
1143                                            rif1d, te_e, te_em, te_u, te_um, te_v, &
1144                                            te_vm, u1d, u1d_p, v1d, v1d_p
1145
1146    SAVE
1147
1148 END MODULE model_1d
1149
1150
1151
1152
1153!------------------------------------------------------------------------------!
1154! Description:
1155! ------------
1156!> Definition of variables which define processor topology and the exchange of
1157!> ghost point layers. This modules must be placed in all routines which contain
1158!> MPI-calls.
1159!------------------------------------------------------------------------------!
1160 MODULE pegrid
1161
1162    USE kinds
1163
1164#if defined( __parallel )
1165#if defined( __mpifh )
1166    INCLUDE "mpif.h"
1167#else
1168    USE MPI
1169#endif
1170#endif
1171    CHARACTER(LEN=2) ::  send_receive = 'al'
1172    CHARACTER(LEN=7) ::  myid_char = ''
1173    INTEGER(iwp)          ::  acc_rank, comm1dx, comm1dy, comm2d, comm_inter,       &
1174                              comm_palm, id_inflow = 0, id_recycling = 0, ierr,     &
1175                              myid = 0, myidx = 0, myidy = 0, ndim = 2, ngp_a,      &
1176                              ngp_o, ngp_xy, ngp_y, npex = -1, npey = -1,           &
1177                              numprocs = 1, numprocs_previous_run = -1,             &
1178                              num_acc_per_node = 0, pleft, pnorth, pright, psouth,  &
1179                              req_count = 0, sendrecvcount_xy, sendrecvcount_yz,    &
1180                              sendrecvcount_zx, sendrecvcount_zyd,                  &
1181                              sendrecvcount_yxd, target_id, tasks_per_node = -9999, &
1182                              threads_per_task = 1, type_x, type_xy,    &
1183                              type_y
1184
1185    INTEGER(iwp)          ::  pdims(2) = 1, req(100)
1186
1187    INTEGER(iwp), DIMENSION(:,:), ALLOCATABLE ::  hor_index_bounds, &
1188                                                  hor_index_bounds_previous_run
1189
1190    LOGICAL ::  background_communication =.FALSE., collective_wait = .FALSE., &
1191                sendrecv_in_background = .FALSE.
1192
1193#if defined( __parallel )
1194#if defined( __mpi2 )
1195    CHARACTER (LEN=MPI_MAX_PORT_NAME) ::  port_name
1196#endif
1197
1198    INTEGER(iwp) ::  ibuf(12), pcoord(2)
1199    INTEGER(iwp) ::  status(MPI_STATUS_SIZE)
1200    INTEGER(iwp), DIMENSION(MPI_STATUS_SIZE,100) ::  wait_stat
1201
1202    INTEGER(iwp) :: ngp_yz_int, type_xz_int, type_yz_int
1203    INTEGER(iwp), DIMENSION(:), ALLOCATABLE ::  ngp_xz, ngp_yz, type_x_int,    &
1204                                                type_xz, type_y_int, type_yz
1205
1206    LOGICAL ::  left_border_pe  = .FALSE., north_border_pe = .FALSE., &
1207                reorder = .TRUE., right_border_pe = .FALSE.,          &
1208                south_border_pe = .FALSE.
1209
1210    LOGICAL, DIMENSION(2) ::  cyclic = (/ .TRUE. , .TRUE. /), &
1211                              remain_dims
1212#endif
1213
1214    SAVE
1215
1216 END MODULE pegrid
1217
1218
1219!------------------------------------------------------------------------------!
1220! Description:
1221! ------------
1222!> Definition of variables which control PROFIL-output.
1223!------------------------------------------------------------------------------!
1224 MODULE profil_parameter
1225
1226    USE kinds
1227
1228    INTEGER(iwp), PARAMETER ::  crmax = 100
1229
1230    CHARACTER (LEN=20), DIMENSION(20) ::  cross_ts_profiles = &
1231                           (/ ' E E*               ', ' dt                 ', &
1232                              ' u* w*              ', ' th*                ', &
1233                              ' umax vmax wmax     ', ' div_old div_new    ', &
1234                              ' z_i_wpt z_i_pt     ', ' w"pt"0 w"pt" wpt   ', &
1235                              ' pt(0) pt(zp)       ', ' splux spluy spluz  ', &
1236                              ' L                  ',                         &
1237                            ( '                    ', i9 = 1, 9 ) /)
1238
1239    CHARACTER (LEN=100), DIMENSION(crmax) ::  cross_profiles = &
1240                           (/ ' u v                           ', &
1241                              ' pt                            ', &
1242                              ' w"pt" w*pt* w*pt*BC wpt wptBC ', &
1243                              ' w"u" w*u* wu w"v" w*v* wv     ', &
1244                              ' km kh                         ', &
1245                              ' l                             ', &
1246                         ( '                               ', i9 = 1, 94 ) /)
1247
1248    INTEGER(iwp) ::  profile_columns = 2, profile_rows = 3, profile_number = 0
1249
1250    INTEGER(iwp) ::  cross_ts_numbers(crmax,crmax) = 0, &
1251                     cross_ts_number_count(crmax) = 0, &
1252                     dopr_index(300) = 0, dopr_initial_index(300) = 0, &
1253                     dots_crossindex(100) = 0, dots_index(100) = 0
1254               
1255
1256    REAL(wp) ::  cross_ts_uymax(20) = &
1257                             (/ 999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp,   &
1258                                999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp,   &
1259                                999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp,   &
1260                                999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp /),&
1261                 cross_ts_uymax_computed(20) = 999.999_wp, &
1262                 cross_ts_uymin(20) = &
1263                             (/ 999.999_wp, 999.999_wp, 999.999_wp,  -5.000_wp, 999.999_wp,   &
1264                                999.999_wp,   0.000_wp, 999.999_wp, 999.999_wp, 999.999_wp,   &
1265                                999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp,   &
1266                                999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp, 999.999_wp /),&
1267                 cross_ts_uymin_computed(20) = 999.999_wp
1268
1269    SAVE
1270
1271 END MODULE profil_parameter
1272
1273!------------------------------------------------------------------------------!
1274! Description:
1275! ------------
1276!> Definition of statistical quantities, e.g. global sums.
1277!------------------------------------------------------------------------------!
1278 MODULE statistics
1279
1280    USE kinds
1281
1282    CHARACTER (LEN=40) ::  region(0:9)
1283    INTEGER(iwp) ::  pr_palm = 130, statistic_regions = 0
1284    INTEGER(iwp) ::  u_max_ijk(3) = -1, v_max_ijk(3) = -1, w_max_ijk(3) = -1
1285    LOGICAL ::  flow_statistics_called = .FALSE.
1286    REAL(wp) ::     u_max, v_max, w_max
1287    REAL(wp), DIMENSION(:), ALLOCATABLE       ::  mean_surface_level_height,      &
1288                                                  sums_divnew_l, sums_divold_l,   &
1289                                                  weight_substep, weight_pres
1290    REAL(wp), DIMENSION(:,:), ALLOCATABLE     ::  sums, sums_wsts_bc_l, ts_value, &
1291                                                  sums_wsus_ws_l, sums_wsvs_ws_l, &
1292                                                  sums_us2_ws_l, sums_vs2_ws_l,   &
1293                                                  sums_ws2_ws_l,                  &
1294                                                  sums_wsnrs_ws_l,                &
1295                                                  sums_wspts_ws_l,                &
1296                                                  sums_wsqs_ws_l,                 &   
1297                                                  sums_wsqrs_ws_l,                &
1298                                                  sums_wssas_ws_l,                &
1299                                                  sums_wsss_ws_l,                 &
1300                                                  sums_ls_l
1301                                             
1302    REAL(wp), DIMENSION(:,:,:), ALLOCATABLE   ::  hom_sum, rmask, sums_l,      &
1303                                                  sums_l_l, sums_up_fraction_l
1304
1305    REAL(wp), DIMENSION(:,:,:,:), ALLOCATABLE ::  hom
1306
1307    SAVE
1308
1309 END MODULE statistics
1310
1311
1312
1313!------------------------------------------------------------------------------!
1314! Description:
1315! ------------
1316!> Definition of indices for transposed arrays.
1317!------------------------------------------------------------------------------!
1318 MODULE transpose_indices
1319
1320    USE kinds
1321
1322    INTEGER(iwp) ::  nxl_y, nxl_yd, nxl_z, nxr_y, nxr_yd, nxr_z, nyn_x, nyn_z, &
1323                     nys_x, nys_z, nzb_x, nzb_y, nzb_yd, nzt_x, nzt_y, nzt_yd
1324               
1325    SAVE
1326
1327 END MODULE transpose_indices
Note: See TracBrowser for help on using the repository browser.