source: palm/trunk/SOURCE/module_interface.f90 @ 4784

Last change on this file since 4784 was 4778, checked in by raasch, 3 years ago

first preliminary version for output of particle data time series

  • Property svn:keywords set to Id
File size: 103.0 KB
Line 
1!> @file module_interface.f90
2!--------------------------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
6! Public License as published by the Free Software Foundation, either version 3 of the License, or
7! (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11! Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with PALM. If not, see
14! <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2020 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------------------------!
18!
19! Current revisions:
20! -----------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: module_interface.f90 4778 2020-11-09 13:40:05Z suehring $
26! routine required for output of particle time series added
27!
28! 4768 2020-11-02 19:11:23Z suehring
29! Enable 3D data output also with 64-bit precision
30!
31! 4757 2020-10-26 10:23:38Z schwenkel
32! Implement doq calls
33!
34! 4753 2020-10-21 14:55:41Z raasch
35! file re-formatted to follow the PALM coding standard
36!
37! 4731 2020-10-07 13:25:11Z schwenkel
38! Move exchange_horiz from time_integration to modules
39!
40! 4708 2020-09-28 17:42:58Z suehring
41! pass fillvalue attribute to radiation output
42!
43! 4590 2020-07-06 14:34:59Z suehring
44! Enable mpi-io for biomet
45!
46! 4525 2020-05-10 17:05:07Z raasch
47! added restart I/O for global salsa data,
48! added restart with MPI-IO for salsa
49!
50! 4518 2020-05-04 15:44:28Z suehring
51! Call of doq_rrd_local enabled
52!
53! 4517 2020-05-03 14:29:30Z raasch
54! added restart with MPI-IO for reading local arrays
55!
56! 4514 2020-04-30 16:29:59Z suehring
57! Added global restart routines for plant-canopy model
58!
59! 4495 2020-04-13 20:11:20Z raasch
60! restart data handling with MPI-IO added
61!
62! 4414 2020-02-19 20:16:04Z suehring
63! Add module interface for basic initialization of numerics.
64!
65! 4411 2020-02-18 14:28:02Z maronga
66! Added output routines for WTM
67!
68! 4407 2020-02-13 20:31:44Z knoop
69! Changed program_debug_output_unit to 9 in dom_init call
70!
71! 4400 2020-02-10 20:32:41Z suehring
72! - Use data-output module for virtual measurement output
73! - Remove deprecated routines for virtual measurement module
74!
75! 4361 2020-01-07 12:22:38Z suehring
76! Remove unused arrays in pmc_rrd_local
77!
78! 4360 2020-01-07 11:25:50Z suehring
79! Add pcm_rrd_local and pcm_wrd_local
80!
81! 4331 2019-12-10 18:25:02Z suehring
82! Change interface for doq_check_data_output, in order to perform further output checks.
83!
84! 4281 2019-10-29 15:15:39Z schwenkel
85! Added dynamics boundary conditions
86!
87! 4272 2019-10-23 15:18:57Z schwenkel
88! Further modularization of boundary conditions: moved boundary conditions to respective modules
89!
90! 4268 2019-10-17 11:29:38Z schwenkel
91! Introduction of module_interface_boundary_conditions
92!
93! 4182 2019-08-22 15:20:23Z scharf
94! Corrected "Former revisions" section
95!
96! 4173 2019-08-20 12:04:06Z gronemeier
97! add vdi_internal_controls
98!
99! 4157 2019-08-14 09:19:12Z suehring
100! Call doq_init from module interface
101!
102! 4132 2019-08-02 12:34:17Z suehring
103! Bugfix in masked data output for diagnostic quantities
104!
105! 4131 2019-08-02 11:06:18Z monakurppa
106! Add output of 3D plant-canopy outputs (merge from branch resler)
107!
108! 4048 2019-06-21 21:00:21Z knoop
109! Moved turbulence_closure_mod calls into this module_interface
110!
111! 4047 2019-06-21 18:58:09Z knoop
112! Introduction of the dynamics module
113!
114! 4039 2019-06-18 10:32:41Z suehring
115! Introduce diagnostic output
116!
117! 4028 2019-06-13 12:21:37Z schwenkel
118! Further modularization of particle code components
119!
120! 4017 2019-06-06 12:16:46Z schwenkel
121! local_pf need INTENT(INOUT) attribute rather than INTENT(OUT). This is because INTENT(OUT) sets
122! the array to not-defined. Especially for outputs that are not defined everywhere, e.g.
123! land-surface outputs, this will be problematic as NaN will be output.
124!
125! 3987 2019-05-22 09:52:13Z kanani
126! Introduce switchable DEBUG file output via debug_message routine
127!
128! 3956 2019-05-07 12:32:52Z monakurppa
129! - Added calls for salsa_non_advective_processes and salsa_exchange_horiz_bounds
130! - Moved the call for salsa_data_output_2d/3d before that of radiation_data_output_2d/3d.
131!   radiation_data_output_2d/3d tries to read a salsa output variable and encounters a segmentation
132!   fault for "Ntot" due to the shortoutput name
133!
134! 3931 2019-04-24 16:34:28Z schwenkel
135! Changed non_transport_physics to non_advective_processes
136!
137! 3930 2019-04-24 14:57:18Z forkel
138! Correct/complete module_interface introduction for chemistry model
139!
140! 3887 2019 -04-12 08:47:41Z schwenkel
141! Changes related to global restructuring of location messages and introduction of additional debug
142! messages
143!
144! 3880 2019 -04-08 21:43:02Z knoop
145! Add a call for salsa_prognostic_equations
146!
147! 3840 2019-03-29 10:35:52Z knoop
148! bugfix: intent of dummy arguments changed to inout
149!
150! 3770 2019-02-28 11:22:32Z moh.hefny
151! removed unused variables in module_interface_check_data_output_ts
152!
153! 3767 08:18:02Z raasch
154! unused variable file_index removed from subroutine parameter list
155!
156! 3766 2019-02-26 16:23:41Z raasch
157! first argument removed from module_interface_rrd_*, statement added to avoid compiler warning
158! about unused variable, file reformatted with respect to coding standards
159!
160! 3762 2019-02-25 16:54:16Z suehring
161! only pass required arguments to surface_data_output_rrd_local
162!
163! 3747 2019-02-16 15:15:23Z gronemeier
164! Call user_init_arrays
165!
166! 3745 2019-02-15 18:57:56Z suehring
167! Add indoor model
168!
169! 3744 2019-02-15 18:38:58Z suehring
170! Removed bio_check_parameters as the method is empty.
171!
172! 3735 2019-02-12 09:52:40Z dom_dwd_user
173! Accepting variable j from check_parameters and passing it to bio_check_data_output
174! Add required restart data for surface output module
175!
176! 3731 2019-02-11 13:06:27Z suehring
177! Add check_parameters routine for virtual measurements
178!
179! 3711 2019-01-31 13:44:26Z knoop
180! Introduced module_interface_init_checks for post-init checks
181!
182! 3705 2019-01-29 19:56:39Z suehring
183! Add last_actions for virtual measurements
184!
185! 3704 2019-01-29 19:51:41Z suehring
186! Some interface calls moved to module_interface + cleanup
187!
188! 3684 2019-01-20 20:20:58Z knoop
189! Bugfix: made unit intend INOUT
190!
191! 3650 2019-01-04 13:01:33Z kanani
192! Add restart routines for biometeorology
193!
194! 3649 2019-01-02 16:52:21Z suehring
195! Initialize strings, in order to avoid compiler warnings for non-initialized characters with
196! intent(out) attribute
197!
198! 3648 2019-01-02 16:35:46Z suehring
199! 3641 2018-12-23 22:10:01Z knoop
200! Initial implementation of the PALM module interface
201!
202!
203! Description:
204! ------------
205!> This is the interface between the PALM model core and all its modules.
206!>
207!> @todo Re-format module to be consistent with coding standard
208!--------------------------------------------------------------------------------------------------!
209 MODULE module_interface
210
211    USE indices,                                                                                   &
212        ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt
213
214    USE kinds
215
216    USE pegrid,                                                                                    &
217        ONLY:  comm2d
218
219!
220!-- load module-specific control parameters.
221!-- ToDo: move all of them to respective module or a dedicated central module
222    USE data_output_module,                                                                        &
223        ONLY:  dom_def_end,                                                                        &
224               dom_finalize_output,                                                                &
225               dom_init
226
227    USE dynamics_mod,                                                                              &
228        ONLY:  dynamics_3d_data_averaging,                                                         &
229               dynamics_actions,                                                                   &
230               dynamics_boundary_conditions,                                                       &
231               dynamics_check_data_output,                                                         &
232               dynamics_check_data_output_pr,                                                      &
233               dynamics_check_data_output_ts,                                                      &
234               dynamics_check_parameters,                                                          &
235               dynamics_data_output_2d,                                                            &
236               dynamics_data_output_3d,                                                            &
237               dynamics_define_netcdf_grid,                                                        &
238               dynamics_exchange_horiz,                                                            &
239               dynamics_header,                                                                    &
240               dynamics_init,                                                                      &
241               dynamics_init_arrays,                                                               &
242               dynamics_init_checks,                                                               &
243               dynamics_init_masks,                                                                &
244               dynamics_last_actions,                                                              &
245               dynamics_non_advective_processes,                                                   &
246               dynamics_parin,                                                                     &
247               dynamics_prognostic_equations,                                                      &
248               dynamics_rrd_global,                                                                &
249               dynamics_rrd_local,                                                                 &
250               dynamics_statistics,                                                                &
251               dynamics_swap_timelevel,                                                            &
252               dynamics_wrd_global,                                                                &
253               dynamics_wrd_local
254
255    USE turbulence_closure_mod,                                                                    &
256        ONLY:  tcm_3d_data_averaging,                                                              &
257               tcm_actions,                                                                        &
258               tcm_boundary_conds,                                                                 &
259               tcm_check_data_output,                                                              &
260               tcm_check_parameters,                                                               &
261               tcm_data_output_2d,                                                                 &
262               tcm_data_output_3d,                                                                 &
263               tcm_init,                                                                           &
264               tcm_init_arrays,                                                                    &
265               tcm_prognostic_equations,                                                           &
266               tcm_swap_timelevel
267
268    USE control_parameters,                                                                        &
269        ONLY:  air_chemistry,                                                                      &
270               biometeorology,                                                                     &
271               coupling_char,                                                                      &
272               debug_output,                                                                       &
273               debug_output_timestep,                                                              &
274               indoor_model,                                                                       &
275               land_surface,                                                                       &
276               large_scale_forcing,                                                                &
277               nesting_offline,                                                                    &
278               nudging,                                                                            &
279               ocean_mode,                                                                         &
280               plant_canopy,                                                                       &
281               salsa,                                                                              &
282               surface_output,                                                                     &
283               syn_turb_gen,                                                                       &
284               urban_surface,                                                                      &
285               vdi_checks,                                                                         &
286               virtual_flight,                                                                     &
287               virtual_measurement,                                                                &
288               wind_turbine
289
290!
291!-- Load interface routines of all PALM modules
292    USE biometeorology_mod,                                                                        &
293        ONLY:  bio_3d_data_averaging,                                                              &
294               bio_check_data_output,                                                              &
295               bio_data_output_2d,                                                                 &
296               bio_data_output_3d,                                                                 &
297               bio_init,                                                                           &
298               bio_init_checks,                                                                    &
299               bio_header,                                                                         &
300               bio_parin,                                                                          &
301               bio_rrd_global,                                                                     &
302               bio_rrd_local,                                                                      &
303               bio_wrd_global,                                                                     &
304               bio_wrd_local
305
306    USE bulk_cloud_model_mod,                                                                      &
307        ONLY:  bcm_3d_data_averaging,                                                              &
308               bcm_actions,                                                                        &
309               bcm_boundary_conditions,                                                            &
310               bcm_check_data_output_pr,                                                           &
311               bcm_check_data_output,                                                              &
312               bcm_check_parameters,                                                               &
313               bcm_data_output_2d,                                                                 &
314               bcm_data_output_3d,                                                                 &
315               bcm_exchange_horiz,                                                                 &
316               bcm_header,                                                                         &
317               bcm_init_arrays,                                                                    &
318               bcm_init,                                                                           &
319               bcm_non_advective_processes,                                                        &
320               bcm_parin,                                                                          &
321               bcm_prognostic_equations,                                                           &
322               bcm_rrd_global,                                                                     &
323               bcm_rrd_local,                                                                      &
324               bcm_swap_timelevel,                                                                 &
325               bcm_wrd_global,                                                                     &
326               bcm_wrd_local,                                                                      &
327               bulk_cloud_model
328
329   USE chemistry_model_mod,                                                                        &
330       ONLY:  chem_3d_data_averaging,                                                              &
331              chem_actions,                                                                        &
332              chem_boundary_conditions,                                                            &
333              chem_check_data_output,                                                              &
334              chem_check_data_output_pr,                                                           &
335              chem_check_parameters,                                                               &
336              chem_data_output_2d,                                                                 &
337              chem_data_output_3d,                                                                 &
338              chem_exchange_horiz_bounds,                                                          &
339              chem_header,                                                                         &
340              chem_init,                                                                           &
341              chem_init_arrays,                                                                    &
342              chem_non_advective_processes,                                                        &
343              chem_parin,                                                                          &
344              chem_prognostic_equations,                                                           &
345              chem_rrd_local,                                                                      &
346              chem_statistics,                                                                     &
347              chem_swap_timelevel,                                                                 &
348              chem_wrd_local
349
350    USE diagnostic_output_quantities_mod,                                                          &
351        ONLY:  doq_3d_data_averaging,                                                              &
352               doq_check_data_output,                                                              &
353               doq_check_data_output_pr,                                                           &
354               doq_define_netcdf_grid,                                                             &
355               doq_init,                                                                           &
356               doq_output_2d,                                                                      &
357               doq_output_3d,                                                                      &
358               doq_statistics,                                                                     &
359               doq_rrd_local,                                                                      &
360               doq_wrd_local
361
362    USE flight_mod,                                                                                &
363        ONLY:  flight_header,                                                                      &
364               flight_init,                                                                        &
365               flight_parin,                                                                       &
366               flight_rrd_global,                                                                  &
367               flight_wrd_global
368
369    USE gust_mod,                                                                                  &
370        ONLY:  gust_3d_data_averaging,                                                             &
371               gust_actions,                                                                       &
372               gust_check_parameters,                                                              &
373               gust_check_data_output,                                                             &
374               gust_check_data_output_pr,                                                          &
375               gust_data_output_2d,                                                                &
376               gust_data_output_3d,                                                                &
377               gust_header,                                                                        &
378               gust_init,                                                                          &
379               gust_init_arrays,                                                                   &
380               gust_module_enabled,                                                                &
381               gust_parin,                                                                         &
382               gust_prognostic_equations,                                                          &
383               gust_rrd_global,                                                                    &
384               gust_rrd_local,                                                                     &
385               gust_statistics,                                                                    &
386               gust_swap_timelevel,                                                                &
387               gust_wrd_global,                                                                    &
388               gust_wrd_local
389
390    USE indoor_model_mod,                                                                          &
391        ONLY:  im_check_data_output,                                                               &
392               im_check_parameters,                                                                &
393               im_data_output_3d,                                                                  &
394               im_init,                                                                            &
395               im_parin
396
397    USE lagrangian_particle_model_mod,                                                             &
398        ONLY:  lpm_actions,                                                                        &
399               lpm_check_parameters,                                                               &
400               lpm_exchange_horiz_bounds,                                                          &
401               lpm_header,                                                                         &
402               lpm_init,                                                                           &
403               lpm_init_arrays,                                                                    &
404               lpm_last_actions,                                                                   &
405               lpm_parin,                                                                          &
406               lpm_rrd_global,                                                                     &
407               lpm_rrd_local,                                                                      &
408               lpm_wrd_local,                                                                      &
409               lpm_wrd_global
410
411    USE land_surface_model_mod,                                                                    &
412        ONLY:  lsm_3d_data_averaging,                                                              &
413               lsm_check_parameters,                                                               &
414               lsm_check_data_output,                                                              &
415               lsm_check_data_output_pr,                                                           &
416               lsm_data_output_2d,                                                                 &
417               lsm_header,                                                                         &
418               lsm_init,                                                                           &
419               lsm_init_arrays,                                                                    &
420               lsm_parin,                                                                          &
421               lsm_rrd_local,                                                                      &
422               lsm_swap_timelevel,                                                                 &
423               lsm_wrd_local
424
425    USE lsf_nudging_mod,                                                                           &
426        ONLY:  lsf_nudging_check_parameters,                                                       &
427               lsf_nudging_check_data_output_pr,                                                   &
428               lsf_nudging_header,                                                                 &
429               lsf_init,                                                                           &
430               nudge_init
431
432    USE multi_agent_system_mod,                                                                    &
433        ONLY:  mas_parin
434
435    USE nesting_offl_mod,                                                                          &
436        ONLY:  nesting_offl_check_parameters,                                                      &
437               nesting_offl_header,                                                                &
438               nesting_offl_parin
439
440    USE ocean_mod,                                                                                 &
441        ONLY:  ocean_3d_data_averaging,                                                            &
442               ocean_actions,                                                                      &
443               ocean_boundary_conditions,                                                          &
444               ocean_check_parameters,                                                             &
445               ocean_check_data_output,                                                            &
446               ocean_check_data_output_pr,                                                         &
447               ocean_data_output_2d,                                                               &
448               ocean_data_output_3d,                                                               &
449               ocean_exchange_horiz,                                                               &
450               ocean_init_arrays,                                                                  &
451               ocean_init,                                                                         &
452               ocean_header,                                                                       &
453               ocean_parin,                                                                        &
454               ocean_prognostic_equations,                                                         &
455               ocean_rrd_global,                                                                   &
456               ocean_rrd_local,                                                                    &
457               ocean_swap_timelevel,                                                               &
458               ocean_wrd_global,                                                                   &
459               ocean_wrd_local
460
461    USE particle_attributes,                                                                       &
462        ONLY:  particle_advection
463
464    USE poismg_noopt_mod,                                                                          &
465        ONLY:  poismg_noopt_init
466
467    USE plant_canopy_model_mod,                                                                    &
468         ONLY: pcm_3d_data_averaging,                                                              &
469               pcm_check_parameters,                                                               &
470               pcm_check_data_output,                                                              &
471               pcm_data_output_3d,                                                                 &
472               pcm_header,                                                                         &
473               pcm_init,                                                                           &
474               pcm_parin,                                                                          &
475               pcm_rrd_global,                                                                     &
476               pcm_rrd_local,                                                                      &
477               pcm_wrd_global,                                                                     &
478               pcm_wrd_local
479
480    USE radiation_model_mod,                                                                       &
481        ONLY:  radiation,                                                                          &
482               radiation_3d_data_averaging,                                                        &
483               radiation_check_parameters,                                                         &
484               radiation_check_data_output,                                                        &
485               radiation_check_data_output_pr,                                                     &
486               radiation_check_data_output_ts,                                                     &
487               radiation_data_output_2d,                                                           &
488               radiation_data_output_3d,                                                           &
489               radiation_header,                                                                   &
490               radiation_init,                                                                     &
491               radiation_parin,                                                                    &
492               radiation_rrd_local,                                                                &
493               radiation_wrd_local
494
495    USE salsa_mod,                                                                                 &
496        ONLY:  salsa_3d_data_averaging,                                                            &
497               salsa_actions,                                                                      &
498               salsa_boundary_conditions,                                                          &
499               salsa_check_data_output,                                                            &
500               salsa_check_data_output_pr,                                                         &
501               salsa_check_parameters,                                                             &
502               salsa_data_output_2d,                                                               &
503               salsa_data_output_3d,                                                               &
504               salsa_exchange_horiz_bounds,                                                        &
505               salsa_header,                                                                       &
506               salsa_init,                                                                         &
507               salsa_init_arrays,                                                                  &
508               salsa_non_advective_processes,                                                      &
509               salsa_parin,                                                                        &
510               salsa_prognostic_equations,                                                         &
511               salsa_rrd_global,                                                                   &
512               salsa_rrd_local,                                                                    &
513               salsa_statistics,                                                                   &
514               salsa_swap_timelevel,                                                               &
515               salsa_wrd_global,                                                                   &
516               salsa_wrd_local
517
518    USE spectra_mod,                                                                               &
519        ONLY:  calculate_spectra,                                                                  &
520               spectra_check_parameters,                                                           &
521               spectra_header,                                                                     &
522               spectra_parin
523
524    USE surface_data_output_mod,                                                                   &
525        ONLY:  surface_data_output_check_parameters,                                               &
526               surface_data_output_init_arrays,                                                    &
527               surface_data_output_parin,                                                          &
528               surface_data_output_rrd_global,                                                     &
529               surface_data_output_rrd_local,                                                      &
530               surface_data_output_wrd_global,                                                     &
531               surface_data_output_wrd_local
532
533    USE surface_mod,                                                                               &
534        ONLY:  init_bc
535
536    USE synthetic_turbulence_generator_mod,                                                        &
537        ONLY:  stg_check_parameters,                                                               &
538               stg_header,                                                                         &
539               stg_parin,                                                                          &
540               stg_rrd_global,                                                                     &
541               stg_wrd_global
542
543    USE urban_surface_mod,                                                                         &
544        ONLY:  usm_3d_data_averaging,                                                              &
545               usm_check_data_output,                                                              &
546               usm_check_parameters,                                                               &
547               usm_init,                                                                           &
548               usm_init_arrays,                                                                    &
549               usm_parin,                                                                          &
550               usm_swap_timelevel,                                                                 &
551               usm_rrd_local,                                                                      &
552               usm_wrd_local
553
554    USE vdi_internal_controls,                                                                     &
555        ONLY:  vdi_actions
556
557    USE virtual_measurement_mod,                                                                   &
558        ONLY:  vm_check_parameters,                                                                &
559               vm_init,                                                                            &
560               vm_init_output,                                                                     &
561               vm_parin
562
563    USE wind_turbine_model_mod,                                                                    &
564        ONLY:  wtm_actions,                                                                        &
565               wtm_check_parameters,                                                               &
566               wtm_init,                                                                           &
567               wtm_init_arrays,                                                                    &
568               wtm_init_output,                                                                    &
569               wtm_parin,                                                                          &
570               wtm_rrd_global,                                                                     &
571               wtm_wrd_global
572
573    USE user,                                                                                      &
574        ONLY:  user_3d_data_averaging,                                                             &
575               user_actions,                                                                       &
576               user_check_data_output,                                                             &
577               user_check_data_output_pr,                                                          &
578               user_check_data_output_ts,                                                          &
579               user_check_parameters,                                                              &
580               user_data_output_2d,                                                                &
581               user_data_output_3d,                                                                &
582               user_header,                                                                        &
583               user_init,                                                                          &
584               user_init_arrays,                                                                   &
585               user_last_actions,                                                                  &
586               user_module_enabled,                                                                &
587               user_parin,                                                                         &
588               user_statistics,                                                                    &
589               user_rrd_global,                                                                    &
590               user_rrd_local,                                                                     &
591               user_wrd_global,                                                                    &
592               user_wrd_local
593
594    IMPLICIT NONE
595
596    PRIVATE
597
598!
599!-- Public functions
600    PUBLIC                                                                                         &
601       module_interface_parin,                                                                     &
602       module_interface_check_parameters,                                                          &
603       module_interface_check_data_output_ts,                                                      &
604       module_interface_check_data_output_pr,                                                      &
605       module_interface_check_data_output,                                                         &
606       module_interface_init_masks,                                                                &
607       module_interface_define_netcdf_grid,                                                        &
608       module_interface_init_arrays,                                                               &
609       module_interface_init,                                                                      &
610       module_interface_init_checks,                                                               &
611       module_interface_init_numerics,                                                             &
612       module_interface_init_output,                                                               &
613       module_interface_header,                                                                    &
614       module_interface_actions,                                                                   &
615       module_interface_non_advective_processes,                                                   &
616       module_interface_exchange_horiz,                                                            &
617       module_interface_prognostic_equations,                                                      &
618       module_interface_boundary_conditions,                                                       &
619       module_interface_swap_timelevel,                                                            &
620       module_interface_3d_data_averaging,                                                         &
621       module_interface_data_output_2d,                                                            &
622       module_interface_data_output_3d,                                                            &
623       module_interface_statistics,                                                                &
624       module_interface_rrd_global,                                                                &
625       module_interface_wrd_global,                                                                &
626       module_interface_rrd_local,                                                                 &
627       module_interface_wrd_local,                                                                 &
628       module_interface_last_actions
629
630
631    INTERFACE module_interface_parin
632       MODULE PROCEDURE module_interface_parin
633    END INTERFACE module_interface_parin
634
635    INTERFACE module_interface_check_parameters
636       MODULE PROCEDURE module_interface_check_parameters
637    END INTERFACE module_interface_check_parameters
638
639    INTERFACE module_interface_check_data_output_ts
640       MODULE PROCEDURE module_interface_check_data_output_ts
641    END INTERFACE module_interface_check_data_output_ts
642
643    INTERFACE module_interface_check_data_output_pr
644       MODULE PROCEDURE module_interface_check_data_output_pr
645    END INTERFACE module_interface_check_data_output_pr
646
647    INTERFACE module_interface_check_data_output
648       MODULE PROCEDURE module_interface_check_data_output
649    END INTERFACE module_interface_check_data_output
650
651    INTERFACE module_interface_init_masks
652       MODULE PROCEDURE module_interface_init_masks
653    END INTERFACE module_interface_init_masks
654
655    INTERFACE module_interface_define_netcdf_grid
656       MODULE PROCEDURE module_interface_define_netcdf_grid
657    END INTERFACE module_interface_define_netcdf_grid
658
659    INTERFACE module_interface_init_arrays
660       MODULE PROCEDURE module_interface_init_arrays
661    END INTERFACE module_interface_init_arrays
662
663    INTERFACE module_interface_init
664       MODULE PROCEDURE module_interface_init
665    END INTERFACE module_interface_init
666
667    INTERFACE module_interface_init_checks
668       MODULE PROCEDURE module_interface_init_checks
669    END INTERFACE module_interface_init_checks
670
671    INTERFACE module_interface_init_numerics
672       MODULE PROCEDURE module_interface_init_numerics
673    END INTERFACE module_interface_init_numerics
674
675    INTERFACE module_interface_init_output
676       MODULE PROCEDURE module_interface_init_output
677    END INTERFACE module_interface_init_output
678
679    INTERFACE module_interface_header
680       MODULE PROCEDURE module_interface_header
681    END INTERFACE module_interface_header
682
683    INTERFACE module_interface_actions
684       MODULE PROCEDURE module_interface_actions
685       MODULE PROCEDURE module_interface_actions_ij
686    END INTERFACE module_interface_actions
687
688    INTERFACE module_interface_non_advective_processes
689       MODULE PROCEDURE module_interface_non_advective_processes
690       MODULE PROCEDURE module_interface_non_advective_processes_ij
691    END INTERFACE module_interface_non_advective_processes
692
693    INTERFACE module_interface_exchange_horiz
694       MODULE PROCEDURE module_interface_exchange_horiz
695    END INTERFACE module_interface_exchange_horiz
696
697    INTERFACE module_interface_prognostic_equations
698       MODULE PROCEDURE module_interface_prognostic_equations
699       MODULE PROCEDURE module_interface_prognostic_equations_ij
700    END INTERFACE module_interface_prognostic_equations
701
702    INTERFACE module_interface_swap_timelevel
703       MODULE PROCEDURE module_interface_swap_timelevel
704    END INTERFACE module_interface_swap_timelevel
705
706    INTERFACE module_interface_boundary_conditions
707       MODULE PROCEDURE module_interface_boundary_conditions
708    END INTERFACE module_interface_boundary_conditions
709
710    INTERFACE module_interface_3d_data_averaging
711       MODULE PROCEDURE module_interface_3d_data_averaging
712    END INTERFACE module_interface_3d_data_averaging
713
714    INTERFACE module_interface_data_output_2d
715       MODULE PROCEDURE module_interface_data_output_2d
716    END INTERFACE module_interface_data_output_2d
717
718    INTERFACE module_interface_data_output_3d
719       MODULE PROCEDURE module_interface_data_output_3d
720    END INTERFACE module_interface_data_output_3d
721
722    INTERFACE module_interface_statistics
723       MODULE PROCEDURE module_interface_statistics
724    END INTERFACE module_interface_statistics
725
726    INTERFACE module_interface_rrd_global
727       MODULE PROCEDURE module_interface_rrd_global_ftn
728       MODULE PROCEDURE module_interface_rrd_global_mpi
729    END INTERFACE module_interface_rrd_global
730
731    INTERFACE module_interface_wrd_global
732       MODULE PROCEDURE module_interface_wrd_global
733    END INTERFACE module_interface_wrd_global
734
735    INTERFACE module_interface_rrd_local
736       MODULE PROCEDURE module_interface_rrd_local_ftn
737       MODULE PROCEDURE module_interface_rrd_local_mpi
738    END INTERFACE module_interface_rrd_local
739
740    INTERFACE module_interface_wrd_local
741       MODULE PROCEDURE module_interface_wrd_local
742    END INTERFACE module_interface_wrd_local
743
744    INTERFACE module_interface_last_actions
745       MODULE PROCEDURE module_interface_last_actions
746    END INTERFACE module_interface_last_actions
747
748
749 CONTAINS
750
751
752!--------------------------------------------------------------------------------------------------!
753! Description:
754! ------------
755!> Read module-specific parameter namelists
756!------------------------------------------------------------------------------                    !
757 SUBROUTINE module_interface_parin
758
759
760    IF ( debug_output )  CALL debug_message( 'reading module-specific parameters', 'start' )
761
762    CALL dynamics_parin
763
764    CALL bio_parin
765    CALL bcm_parin
766    CALL chem_parin
767    CALL flight_parin ! ToDo: rename module to match filename
768    CALL gust_parin
769    CALL im_parin
770    CALL lpm_parin
771    CALL lsm_parin
772    ! ToDo: create parin routine for large_scale_forcing and nudging (should be seperate modules or new module switch)
773    CALL mas_parin
774    CALL nesting_offl_parin
775    CALL ocean_parin
776    CALL pcm_parin
777    CALL radiation_parin
778    CALL salsa_parin
779    CALL spectra_parin
780    CALL surface_data_output_parin
781    CALL stg_parin
782    CALL usm_parin
783    CALL vm_parin
784    CALL wtm_parin
785
786    CALL user_parin
787
788    IF ( debug_output )  CALL debug_message( 'reading module-specific parameters', 'end' )
789
790
791 END SUBROUTINE module_interface_parin
792
793
794!--------------------------------------------------------------------------------------------------!
795! Description:
796! ------------
797!> Perform module-specific initialization checks
798!--------------------------------------------------------------------------------------------------!
799 SUBROUTINE module_interface_check_parameters
800
801
802    IF ( debug_output )  CALL debug_message( 'checking module-specific parameters', 'start' )
803
804    CALL dynamics_check_parameters
805    CALL tcm_check_parameters
806
807    IF ( bulk_cloud_model )     CALL bcm_check_parameters
808    IF ( air_chemistry )        CALL chem_check_parameters
809    IF ( gust_module_enabled )  CALL gust_check_parameters
810    IF ( indoor_model )         CALL im_check_parameters
811    IF ( particle_advection )   CALL lpm_check_parameters
812    IF ( land_surface )         CALL lsm_check_parameters
813    IF ( large_scale_forcing  .OR.  nudging )  CALL lsf_nudging_check_parameters ! ToDo: create single module switch
814    IF ( nesting_offline )      CALL nesting_offl_check_parameters
815    IF ( ocean_mode )           CALL ocean_check_parameters
816    IF ( plant_canopy )         CALL pcm_check_parameters
817    IF ( radiation )            CALL radiation_check_parameters
818    IF ( salsa )                CALL salsa_check_parameters
819    IF ( calculate_spectra )    CALL spectra_check_parameters
820    IF ( surface_output )       CALL surface_data_output_check_parameters
821    IF ( syn_turb_gen )         CALL stg_check_parameters
822    IF ( urban_surface )        CALL usm_check_parameters
823    IF ( virtual_measurement )  CALL vm_check_parameters
824    IF ( wind_turbine )         CALL wtm_check_parameters
825
826    IF ( user_module_enabled )  CALL user_check_parameters
827
828    IF ( debug_output )  CALL debug_message( 'checking module-specific parameters', 'end' )
829
830
831 END SUBROUTINE module_interface_check_parameters
832
833
834!--------------------------------------------------------------------------------------------------!
835! Description:
836! ------------
837!> Check module-specific data output of timeseries
838!--------------------------------------------------------------------------------------------------!
839 SUBROUTINE module_interface_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit )
840
841    INTEGER(iwp),      INTENT(IN)       ::  dots_max !< variable output array index
842    INTEGER(iwp),      INTENT(INOUT)    ::  dots_num !< variable output array index
843
844    CHARACTER (LEN=*), DIMENSION(dots_max), INTENT(INOUT) :: dots_label
845    CHARACTER (LEN=*), DIMENSION(dots_max), INTENT(INOUT) :: dots_unit
846
847
848    IF ( debug_output )  CALL debug_message( 'checking module-specific data output ts', 'start' )
849
850    CALL dynamics_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit )
851
852    IF ( radiation )  THEN
853       CALL radiation_check_data_output_ts( dots_max, dots_num )
854    ENDIF
855
856    IF ( user_module_enabled )  THEN
857       CALL user_check_data_output_ts( dots_max, dots_num, dots_label, dots_unit )
858    ENDIF
859
860    IF ( debug_output )  CALL debug_message( 'checking module-specific data output ts', 'end' )
861
862
863 END SUBROUTINE module_interface_check_data_output_ts
864
865
866!--------------------------------------------------------------------------------------------------!
867! Description:
868! ------------
869!> Check module-specific data output of profiles
870!--------------------------------------------------------------------------------------------------!
871 SUBROUTINE module_interface_check_data_output_pr( variable, var_count, unit, dopr_unit )
872
873
874    CHARACTER (LEN=*), INTENT(IN)    ::  variable  !< variable name
875    CHARACTER (LEN=*), INTENT(INOUT) ::  unit      !< physical unit of variable
876    CHARACTER (LEN=*), INTENT(OUT)   ::  dopr_unit !< local value of dopr_unit
877
878    INTEGER(iwp),      INTENT(IN)    ::  var_count !< variable output array index
879
880
881    IF ( debug_output )  CALL debug_message( 'checking module-specific data output pr', 'start' )
882
883    CALL dynamics_check_data_output_pr( variable, var_count, unit, dopr_unit )
884    CALL doq_check_data_output_pr( variable, var_count, unit, dopr_unit )
885
886    IF ( unit == 'illegal'  .AND.  bulk_cloud_model )  THEN
887       CALL bcm_check_data_output_pr( variable, var_count, unit, dopr_unit )
888    ENDIF
889
890    IF ( unit == 'illegal'  .AND.  air_chemistry )  THEN
891       CALL chem_check_data_output_pr( variable, var_count, unit, dopr_unit )
892    ENDIF
893
894    IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
895       CALL gust_check_data_output_pr( variable, var_count, unit, dopr_unit )
896    ENDIF
897
898    IF ( unit == 'illegal' )  THEN ! ToDo: add module switch if possible
899       CALL lsm_check_data_output_pr( variable, var_count, unit, dopr_unit )
900    ENDIF
901
902    IF ( unit == 'illegal' )  THEN ! ToDo: add module switch if possible
903       CALL lsf_nudging_check_data_output_pr( variable, var_count, unit, dopr_unit )
904    ENDIF
905
906    IF ( unit == 'illegal'  .AND.  ocean_mode )  THEN
907       CALL ocean_check_data_output_pr( variable, var_count, unit, dopr_unit )
908    ENDIF
909
910    IF ( unit == 'illegal'  .AND.  radiation )  THEN
911       CALL radiation_check_data_output_pr( variable, var_count, unit, dopr_unit )
912    ENDIF
913
914    IF ( unit == 'illegal'  .AND.  salsa )  THEN
915       CALL salsa_check_data_output_pr( variable, var_count, unit, dopr_unit )
916    ENDIF
917
918    IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
919       unit = '' ! ToDo: Seems like a hack. Find a general soultion!
920       CALL user_check_data_output_pr( variable, var_count, unit, dopr_unit )
921    ENDIF
922
923    IF ( debug_output )  CALL debug_message( 'checking module-specific data output pr', 'end' )
924
925
926 END SUBROUTINE module_interface_check_data_output_pr
927
928!--------------------------------------------------------------------------------------------------!
929! Description:
930! ------------
931!> Check module-specific 2D and 3D data output
932!--------------------------------------------------------------------------------------------------!
933 SUBROUTINE module_interface_check_data_output( variable, unit, i, j, ilen, k )
934
935
936    CHARACTER (LEN=*), INTENT(IN)    ::  variable !< variable name
937    CHARACTER (LEN=*), INTENT(INOUT) ::  unit     !< physical unit of variable
938
939    INTEGER(iwp),      INTENT(IN)    :: i         !< ToDo: remove dummy argument, instead pass string from data_output
940    INTEGER(iwp),      INTENT(IN)    :: j         !< average quantity? 0 = no, 1 = yes
941    INTEGER(iwp),      INTENT(IN)    :: ilen      !< ToDo: remove dummy argument, instead pass string from data_output
942    INTEGER(iwp),      INTENT(IN)    :: k         !< ToDo: remove dummy argument, instead pass string from data_output
943
944
945    IF ( debug_output )  CALL debug_message( 'checking module-specific data output 2d/3d', 'start' )
946
947    CALL dynamics_check_data_output( variable, unit )
948
949    CALL tcm_check_data_output( variable, unit )
950
951    IF ( unit == 'illegal'  .AND.  biometeorology )  THEN
952       CALL bio_check_data_output( variable, unit, i, j, ilen, k )
953    ENDIF
954
955    IF ( unit == 'illegal'  .AND.  bulk_cloud_model  )  THEN
956       CALL bcm_check_data_output( variable, unit )
957    ENDIF
958
959    IF ( unit == 'illegal'  .AND.  air_chemistry  .AND.  (variable(1:3) == 'kc_'  .OR.             &
960         variable(1:3) == 'em_') )  THEN  ! ToDo: remove aditional conditions
961       CALL chem_check_data_output( variable, unit, i, ilen, k )
962    ENDIF
963
964    IF ( unit == 'illegal' )  THEN
965       CALL doq_check_data_output( variable, unit, i, ilen, k )
966    ENDIF
967
968    IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
969       CALL gust_check_data_output( variable, unit )
970    ENDIF
971
972    IF ( unit == 'illegal' )  THEN  ! ToDo: add module switch if possible
973       CALL lsm_check_data_output( variable, unit, i, ilen, k )
974    ENDIF
975
976    IF ( unit == 'illegal'  .AND.  ocean_mode )  THEN
977       CALL ocean_check_data_output( variable, unit )
978    ENDIF
979
980    IF ( unit == 'illegal'  .AND.  plant_canopy  .AND.  variable(1:4) == 'pcm_' )  THEN  ! ToDo: remove aditional conditions
981       CALL pcm_check_data_output( variable, unit )
982    ENDIF
983
984    IF ( unit == 'illegal'  .AND.  radiation )  THEN
985       CALL radiation_check_data_output( variable, unit, i, ilen, k )
986    ENDIF
987
988    IF ( unit == 'illegal' .AND. salsa ) THEN
989       CALL salsa_check_data_output( variable, unit )
990    ENDIF
991
992    IF ( unit == 'illegal' .AND. indoor_model ) THEN
993       CALL im_check_data_output( variable, unit )
994    ENDIF
995
996    IF ( unit == 'illegal'  .AND.  urban_surface  .AND.  variable(1:4) == 'usm_' )  THEN  ! ToDo: remove aditional conditions
997       CALL usm_check_data_output( variable, unit )
998    ENDIF
999
1000    IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
1001       unit = ''
1002       CALL user_check_data_output( variable, unit )
1003    ENDIF
1004
1005    IF ( debug_output )  CALL debug_message( 'checking module-specific data output 2d/3d', 'end' )
1006
1007
1008 END SUBROUTINE module_interface_check_data_output
1009
1010
1011!--------------------------------------------------------------------------------------------------!
1012!
1013! Description:
1014! ------------
1015!> Interface for init_masks. ToDo: get rid of these redundant calls!
1016!--------------------------------------------------------------------------------------------------!
1017 SUBROUTINE module_interface_init_masks( variable, unit )
1018
1019
1020    CHARACTER (LEN=*), INTENT(IN)    ::  variable !< variable name
1021    CHARACTER (LEN=*), INTENT(INOUT) ::  unit     !< physical unit of variable
1022
1023
1024    IF ( debug_output )  CALL debug_message( 'initializing module-specific masks', 'start' )
1025
1026    CALL dynamics_init_masks( variable, unit )
1027
1028    IF ( unit == 'illegal'  .AND.  air_chemistry  .AND.  (variable(1:3) == 'kc_'  .OR.             &
1029         variable(1:3) == 'em_') )  THEN  ! ToDo: remove aditional conditions
1030       CALL chem_check_data_output( variable, unit, 0, 0, 0 )
1031    ENDIF
1032
1033    IF ( unit == 'illegal' )  THEN
1034       CALL doq_check_data_output( variable, unit )
1035    ENDIF
1036
1037    IF ( unit == 'illegal'  .AND.  radiation )  THEN
1038       CALL radiation_check_data_output( variable, unit, 0, 0, 0 )
1039    ENDIF
1040
1041    IF ( unit == 'illegal'  .AND.  salsa )  THEN
1042       CALL salsa_check_data_output( variable, unit )
1043    ENDIF
1044
1045    IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
1046       unit = ''
1047       CALL user_check_data_output( variable, unit )
1048    ENDIF
1049
1050    IF ( debug_output )  CALL debug_message( 'initializing module-specific masks', 'end' )
1051
1052
1053 END SUBROUTINE module_interface_init_masks
1054
1055
1056!--------------------------------------------------------------------------------------------------!
1057!
1058! Description:
1059! ------------
1060!> Define appropriate grid for module-specific netcdf output variables.
1061!--------------------------------------------------------------------------------------------------!
1062 SUBROUTINE module_interface_define_netcdf_grid( var, found, grid_x, grid_y, grid_z )
1063
1064
1065    CHARACTER (LEN=*), INTENT(IN)  ::  var    !< variable name
1066    CHARACTER (LEN=*), INTENT(OUT) ::  grid_x !< netcdf dimension in x-direction
1067    CHARACTER (LEN=*), INTENT(OUT) ::  grid_y !< netcdf dimension in y-direction
1068    CHARACTER (LEN=*), INTENT(OUT) ::  grid_z !< netcdf dimension in z-direction
1069
1070    LOGICAL,           INTENT(OUT) ::  found  !< indicates if variable was found
1071
1072
1073    IF ( debug_output )  CALL debug_message( 'defining module-specific netcdf grids', 'start' )
1074!
1075!-- As long as no action is done in this subroutine, initialize strings with intent(out) attribute,
1076!-- in order to avoid compiler warnings.
1077    found  = .FALSE.
1078    grid_x = 'none'
1079    grid_y = 'none'
1080    grid_z = 'none'
1081!
1082!-- Use var to avoid compiler warning about unused variable
1083    IF ( var == ' ' )  RETURN
1084
1085    IF ( debug_output )  CALL debug_message( 'defining module-specific netcdf grids', 'end' )
1086
1087
1088 END SUBROUTINE module_interface_define_netcdf_grid
1089
1090
1091!--------------------------------------------------------------------------------------------------!
1092! Description:
1093! ------------
1094!> Allocate module-specific arrays and pointers
1095!--------------------------------------------------------------------------------------------------!
1096 SUBROUTINE module_interface_init_arrays
1097
1098
1099    IF ( debug_output )  CALL debug_message( 'initializing module-specific arrays', 'start' )
1100
1101    CALL dynamics_init_arrays
1102    CALL tcm_init_arrays
1103
1104    IF ( bulk_cloud_model    )  CALL bcm_init_arrays
1105    IF ( air_chemistry       )  CALL chem_init_arrays
1106    IF ( gust_module_enabled )  CALL gust_init_arrays
1107    IF ( particle_advection  )  CALL lpm_init_arrays
1108    IF ( land_surface        )  CALL lsm_init_arrays
1109    IF ( ocean_mode          )  CALL ocean_init_arrays
1110    IF ( salsa               )  CALL salsa_init_arrays
1111    IF ( urban_surface       )  CALL usm_init_arrays
1112    IF ( surface_output      )  CALL surface_data_output_init_arrays
1113    IF ( wind_turbine        )  CALL wtm_init_arrays
1114
1115    IF ( user_module_enabled )  CALL user_init_arrays
1116
1117    IF ( debug_output )  CALL debug_message( 'initializing module-specific arrays', 'end' )
1118
1119
1120 END SUBROUTINE module_interface_init_arrays
1121
1122
1123!--------------------------------------------------------------------------------------------------!
1124! Description:
1125! ------------
1126!> Perform module-specific initialization
1127!--------------------------------------------------------------------------------------------------!
1128 SUBROUTINE module_interface_init
1129
1130
1131    IF ( debug_output )  CALL debug_message( 'module-specific initialization', 'start' )
1132
1133    CALL dynamics_init
1134    CALL tcm_init
1135
1136    IF ( biometeorology      )  CALL bio_init
1137    IF ( bulk_cloud_model    )  CALL bcm_init
1138    IF ( air_chemistry       )  CALL chem_init
1139    IF ( virtual_flight      )  CALL flight_init
1140    IF ( gust_module_enabled )  CALL gust_init
1141    IF ( indoor_model        )  CALL im_init
1142    IF ( particle_advection  )  CALL lpm_init
1143    IF ( large_scale_forcing )  CALL lsf_init
1144    IF ( land_surface        )  CALL lsm_init
1145    IF ( nudging             )  CALL nudge_init
1146    IF ( ocean_mode          )  CALL ocean_init
1147    IF ( plant_canopy        )  CALL pcm_init
1148    IF ( salsa               )  CALL salsa_init
1149    IF ( urban_surface       )  CALL usm_init
1150    IF ( virtual_measurement )  CALL vm_init
1151    IF ( wind_turbine        )  CALL wtm_init
1152    IF ( radiation           )  CALL radiation_init
1153
1154    CALL doq_init
1155
1156    IF ( user_module_enabled )  CALL user_init
1157
1158    IF ( debug_output )  CALL debug_message( 'module-specific initialization', 'end' )
1159
1160 END SUBROUTINE module_interface_init
1161
1162!--------------------------------------------------------------------------------------------------!
1163! Description:
1164! ------------
1165!> Initialize boundary conditions and numerical schemes.
1166!--------------------------------------------------------------------------------------------------!
1167 SUBROUTINE module_interface_init_numerics
1168
1169!
1170!-- Initialize boundary conditions via surface type
1171    CALL init_bc
1172!
1173!-- Calculate wall flag arrays for the multigrid method.
1174!-- Please note, wall flags are only applied in the non-optimized version.
1175    CALL poismg_noopt_init
1176
1177 END SUBROUTINE module_interface_init_numerics
1178
1179
1180!--------------------------------------------------------------------------------------------------!
1181! Description:
1182! ------------
1183!> Initialize data output
1184!--------------------------------------------------------------------------------------------------!
1185 SUBROUTINE module_interface_init_output
1186
1187    INTEGER(iwp) ::  return_value  !< returned status value of called function
1188
1189!
1190!-- Initialize data-output module
1191    CALL dom_init( file_suffix_of_output_group=coupling_char,                                      &
1192                   mpi_comm_of_output_group=comm2d,                                                &
1193                   program_debug_output_unit=9,                                                    &
1194                   debug_output=debug_output )
1195!
1196!-- Define module-specific output quantities
1197    IF ( virtual_measurement )  CALL vm_init_output
1198    IF ( wind_turbine )         CALL wtm_init_output
1199!
1200!-- Leave output-definition state
1201    return_value = dom_def_end()
1202
1203 END SUBROUTINE module_interface_init_output
1204
1205!--------------------------------------------------------------------------------------------------!
1206! Description:
1207! ------------
1208!> Perform module-specific post-initialization checks
1209!--------------------------------------------------------------------------------------------------!
1210 SUBROUTINE module_interface_init_checks
1211
1212
1213    IF ( debug_output )  CALL debug_message( 'module-specific post-initialization checks', 'start' )
1214
1215    CALL dynamics_init_checks
1216
1217    IF ( biometeorology )  CALL bio_init_checks
1218
1219    IF ( debug_output )  CALL debug_message( 'module-specific post-initialization checks', 'end' )
1220
1221
1222 END SUBROUTINE module_interface_init_checks
1223
1224
1225!--------------------------------------------------------------------------------------------------!
1226! Description:
1227! ------------
1228!> Gather module-specific header output
1229!--------------------------------------------------------------------------------------------------!
1230 SUBROUTINE module_interface_header( io )
1231
1232
1233    INTEGER(iwp), INTENT(IN) ::  io  !< unit of the output file
1234
1235
1236    IF ( debug_output )  CALL debug_message( 'module-specific header output', 'start' )
1237
1238    CALL dynamics_header( io )
1239
1240    IF ( biometeorology      )  CALL bio_header ( io )
1241    IF ( bulk_cloud_model    )  CALL bcm_header( io )
1242    IF ( air_chemistry       )  CALL chem_header ( io )
1243    IF ( virtual_flight      )  CALL flight_header( io )
1244    IF ( gust_module_enabled )  CALL gust_header( io )
1245    IF ( particle_advection  )  CALL lpm_header( io )
1246    IF ( land_surface        )  CALL lsm_header( io )
1247    IF ( large_scale_forcing )  CALL lsf_nudging_header( io )
1248    IF ( nesting_offline     )  CALL nesting_offl_header( io )
1249    IF ( ocean_mode          )  CALL ocean_header( io )
1250    IF ( plant_canopy        )  CALL pcm_header( io )
1251    IF ( radiation           )  CALL radiation_header( io )
1252    IF ( salsa               )  CALL salsa_header( io )
1253    IF ( calculate_spectra   )  CALL spectra_header( io )
1254    IF ( syn_turb_gen        )  CALL stg_header( io )
1255
1256    IF ( user_module_enabled )  CALL user_header( io )
1257
1258    IF ( debug_output )  CALL debug_message( 'module-specific header output', 'end' )
1259
1260
1261 END SUBROUTINE module_interface_header
1262
1263
1264!--------------------------------------------------------------------------------------------------!
1265! Description:
1266! ------------
1267!> Perform module-specific actions while in time-integration (vector-optimized)
1268!--------------------------------------------------------------------------------------------------!
1269 SUBROUTINE module_interface_actions( location )
1270
1271
1272    CHARACTER (LEN=*), INTENT(IN) ::  location !< call location string
1273
1274    CALL dynamics_actions( location )
1275    CALL tcm_actions( location )
1276
1277    IF ( bulk_cloud_model    )  CALL bcm_actions( location )
1278    IF ( air_chemistry       )  CALL chem_actions( location )
1279    IF ( gust_module_enabled )  CALL gust_actions( location )
1280    IF ( particle_advection  )  CALL lpm_actions( location )
1281    IF ( ocean_mode          )  CALL ocean_actions( location )
1282    IF ( salsa               )  CALL salsa_actions( location )
1283    IF ( wind_turbine        )  CALL wtm_actions( location )
1284
1285    IF ( user_module_enabled )  CALL user_actions( location )
1286    IF ( vdi_checks          )  CALL vdi_actions( location )
1287
1288
1289 END SUBROUTINE module_interface_actions
1290
1291
1292!--------------------------------------------------------------------------------------------------!
1293! Description:
1294! ------------
1295!> Perform module-specific actions while in time-integration (cache-optimized)
1296!--------------------------------------------------------------------------------------------------!
1297 SUBROUTINE module_interface_actions_ij( i, j, location )
1298
1299    CHARACTER (LEN=*), INTENT(IN) ::  location  !< call location string
1300
1301    INTEGER(iwp),      INTENT(IN) ::  i         !< grid index in x-direction
1302    INTEGER(iwp),      INTENT(IN) ::  j         !< grid index in y-direction
1303
1304    CALL dynamics_actions( i, j, location )
1305    CALL tcm_actions( i, j, location )
1306
1307    IF ( bulk_cloud_model    )  CALL bcm_actions( i, j, location )
1308    IF ( air_chemistry       )  CALL chem_actions( i, j, location )
1309    IF ( gust_module_enabled )  CALL gust_actions( i, j, location )
1310    IF ( ocean_mode          )  CALL ocean_actions( i, j, location )
1311    IF ( salsa               )  CALL salsa_actions( i, j, location )
1312    IF ( wind_turbine        )  CALL wtm_actions( i, j, location )
1313
1314    IF ( user_module_enabled )  CALL user_actions( i, j, location )
1315
1316
1317 END SUBROUTINE module_interface_actions_ij
1318
1319
1320!--------------------------------------------------------------------------------------------------!
1321! Description:
1322! ------------
1323!> Compute module-specific non_advective_processes (vector-optimized)
1324!--------------------------------------------------------------------------------------------------!
1325 SUBROUTINE module_interface_non_advective_processes
1326
1327
1328    CALL dynamics_non_advective_processes
1329
1330    IF ( bulk_cloud_model    )  CALL bcm_non_advective_processes
1331    IF ( air_chemistry       )  CALL chem_non_advective_processes
1332    IF ( salsa               )  CALL salsa_non_advective_processes
1333
1334
1335 END SUBROUTINE module_interface_non_advective_processes
1336
1337
1338!--------------------------------------------------------------------------------------------------!
1339! Description:
1340! ------------
1341!> Compute module-specific non_advective_processes (cache-optimized)
1342!--------------------------------------------------------------------------------------------------!
1343 SUBROUTINE module_interface_non_advective_processes_ij( i, j )
1344
1345
1346    INTEGER(iwp), INTENT(IN) ::  i            !< grid index in x-direction
1347    INTEGER(iwp), INTENT(IN) ::  j            !< grid index in y-direction
1348
1349    CALL dynamics_non_advective_processes( i, j )
1350
1351    IF ( bulk_cloud_model    )  CALL bcm_non_advective_processes( i, j )
1352    IF ( air_chemistry       )  CALL chem_non_advective_processes( i, j )
1353    IF ( salsa               )  CALL salsa_non_advective_processes( i, j )
1354
1355
1356 END SUBROUTINE module_interface_non_advective_processes_ij
1357
1358!--------------------------------------------------------------------------------------------------!
1359! Description:
1360! ------------
1361!> Exchange horiz for module-specific quantities
1362!--------------------------------------------------------------------------------------------------!
1363 SUBROUTINE module_interface_exchange_horiz( location )
1364
1365    CHARACTER (LEN=*), INTENT(IN) ::  location !< call location string
1366
1367
1368    IF ( debug_output_timestep )  CALL debug_message( 'module-specific exchange_horiz', 'start' )
1369
1370    CALL dynamics_exchange_horiz( location )
1371
1372    IF ( bulk_cloud_model    )  CALL bcm_exchange_horiz( location )
1373    IF ( air_chemistry       )  CALL chem_exchange_horiz_bounds( location )
1374    IF ( ocean_mode          )  CALL ocean_exchange_horiz( location )
1375    IF ( particle_advection  )  CALL lpm_exchange_horiz_bounds( location )
1376    IF ( salsa               )  CALL salsa_exchange_horiz_bounds( location )
1377
1378    IF ( debug_output_timestep )  CALL debug_message( 'module-specific exchange_horiz', 'end' )
1379
1380
1381 END SUBROUTINE module_interface_exchange_horiz
1382
1383
1384!--------------------------------------------------------------------------------------------------!
1385! Description:
1386! ------------
1387!> Compute module-specific prognostic_equations (vector-optimized)
1388!--------------------------------------------------------------------------------------------------!
1389 SUBROUTINE module_interface_prognostic_equations
1390
1391
1392    CALL dynamics_prognostic_equations
1393    CALL tcm_prognostic_equations
1394
1395    IF ( bulk_cloud_model    )  CALL bcm_prognostic_equations
1396    IF ( air_chemistry       )  CALL chem_prognostic_equations
1397    IF ( gust_module_enabled )  CALL gust_prognostic_equations
1398    IF ( ocean_mode          )  CALL ocean_prognostic_equations
1399    IF ( salsa               )  CALL salsa_prognostic_equations
1400
1401
1402 END SUBROUTINE module_interface_prognostic_equations
1403
1404
1405!--------------------------------------------------------------------------------------------------!
1406! Description:
1407! ------------
1408!> Compute module-specific prognostic_equations (cache-optimized)
1409!--------------------------------------------------------------------------------------------------!
1410 SUBROUTINE module_interface_prognostic_equations_ij( i, j, i_omp_start, tn )
1411
1412
1413    INTEGER(iwp), INTENT(IN) ::  i            !< grid index in x-direction
1414    INTEGER(iwp), INTENT(IN) ::  j            !< grid index in y-direction
1415    INTEGER(iwp), INTENT(IN) ::  i_omp_start  !< first loop index of i-loop in prognostic_equations
1416    INTEGER(iwp), INTENT(IN) ::  tn           !< task number of openmp task
1417
1418    CALL dynamics_prognostic_equations( i, j, i_omp_start, tn )
1419    CALL tcm_prognostic_equations( i, j, i_omp_start, tn )
1420
1421    IF ( bulk_cloud_model    )  CALL bcm_prognostic_equations( i, j, i_omp_start, tn )
1422    IF ( air_chemistry       )  CALL chem_prognostic_equations( i, j, i_omp_start, tn )
1423    IF ( gust_module_enabled )  CALL gust_prognostic_equations( i, j, i_omp_start, tn )
1424    IF ( ocean_mode          )  CALL ocean_prognostic_equations( i, j, i_omp_start, tn )
1425    IF ( salsa               )  CALL salsa_prognostic_equations( i, j, i_omp_start, tn )
1426
1427
1428 END SUBROUTINE module_interface_prognostic_equations_ij
1429
1430!--------------------------------------------------------------------------------------------------!
1431! Description:
1432! ------------
1433!> Compute module-specific boundary conditions
1434!--------------------------------------------------------------------------------------------------!
1435 SUBROUTINE module_interface_boundary_conditions
1436
1437
1438    IF ( debug_output_timestep )  CALL debug_message( 'module-specific boundary_conditions', 'start' )
1439
1440    CALL dynamics_boundary_conditions
1441    CALL tcm_boundary_conds
1442
1443    IF ( bulk_cloud_model    )  CALL bcm_boundary_conditions
1444    IF ( air_chemistry       )  CALL chem_boundary_conditions
1445    IF ( ocean_mode          )  CALL ocean_boundary_conditions
1446    IF ( salsa               )  CALL salsa_boundary_conditions
1447
1448    IF ( debug_output_timestep )  CALL debug_message( 'module-specific boundary_conditions', 'end' )
1449
1450
1451 END SUBROUTINE module_interface_boundary_conditions
1452
1453!--------------------------------------------------------------------------------------------------!
1454! Description:
1455! ------------
1456!> Swap the timelevel pointers for module-specific arrays
1457!--------------------------------------------------------------------------------------------------!
1458 SUBROUTINE module_interface_swap_timelevel ( swap_mode )
1459
1460
1461    INTEGER(iwp), INTENT(IN) :: swap_mode !< determines procedure of pointer swap
1462
1463
1464    IF ( debug_output_timestep )  CALL debug_message( 'module-specific swap timelevel', 'start' )
1465
1466    CALL dynamics_swap_timelevel( swap_mode )
1467    CALL tcm_swap_timelevel( swap_mode )
1468
1469    IF ( bulk_cloud_model    )  CALL bcm_swap_timelevel( swap_mode )
1470    IF ( air_chemistry       )  CALL chem_swap_timelevel( swap_mode )
1471    IF ( gust_module_enabled )  CALL gust_swap_timelevel( swap_mode )
1472    IF ( land_surface        )  CALL lsm_swap_timelevel( swap_mode )
1473    IF ( ocean_mode          )  CALL ocean_swap_timelevel( swap_mode )
1474    IF ( salsa               )  CALL salsa_swap_timelevel( swap_mode )
1475    IF ( urban_surface       )  CALL usm_swap_timelevel( swap_mode )
1476
1477    IF ( debug_output_timestep )  CALL debug_message( 'module-specific swap timelevel', 'end' )
1478
1479
1480 END SUBROUTINE module_interface_swap_timelevel
1481
1482
1483!--------------------------------------------------------------------------------------------------!
1484!
1485! Description:
1486! ------------
1487!> Perform module-specific averaging of 3D data
1488!--------------------------------------------------------------------------------------------------!
1489 SUBROUTINE module_interface_3d_data_averaging( mode, variable )
1490
1491
1492    CHARACTER (LEN=*), INTENT(IN) ::  mode     !< averaging interface mode
1493    CHARACTER (LEN=*), INTENT(IN) ::  variable !< variable name
1494
1495
1496    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 3d data averaging', 'start' )
1497
1498    CALL dynamics_3d_data_averaging( mode, variable )
1499    CALL tcm_3d_data_averaging( mode, variable )
1500
1501    IF ( biometeorology      )  CALL bio_3d_data_averaging( mode, variable )
1502    IF ( bulk_cloud_model    )  CALL bcm_3d_data_averaging( mode, variable )
1503    IF ( air_chemistry       )  CALL chem_3d_data_averaging( mode, variable )
1504    CALL doq_3d_data_averaging( mode, variable )  ! ToDo: this seems to be not according to the design
1505    IF ( gust_module_enabled )  CALL gust_3d_data_averaging( mode, variable )
1506    IF ( land_surface        )  CALL lsm_3d_data_averaging( mode, variable )
1507    IF ( ocean_mode          )  CALL ocean_3d_data_averaging( mode, variable )
1508    IF ( plant_canopy        )  CALL pcm_3d_data_averaging( mode, variable )
1509    IF ( radiation           )  CALL radiation_3d_data_averaging( mode, variable )
1510    IF ( salsa               )  CALL salsa_3d_data_averaging( mode, variable )
1511    IF ( urban_surface       )  CALL usm_3d_data_averaging( mode, variable )
1512
1513    IF ( user_module_enabled )  CALL user_3d_data_averaging( mode, variable )
1514
1515    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 3d data averaging', 'end' )
1516
1517
1518 END SUBROUTINE module_interface_3d_data_averaging
1519
1520!--------------------------------------------------------------------------------------------------!
1521!
1522! Description:
1523! ------------
1524!> Define module-specific 2D output variables
1525!--------------------------------------------------------------------------------------------------!
1526 SUBROUTINE module_interface_data_output_2d( av, variable, found, grid, mode, local_pf, two_d,     &
1527                                             nzb_do, nzt_do, fill_value )
1528
1529    CHARACTER (LEN=*), INTENT(IN)    ::  mode       !< either 'xy', 'xz' or 'yz'
1530    CHARACTER (LEN=*), INTENT(IN)    ::  variable   !< variable name
1531    CHARACTER (LEN=*), INTENT(INOUT) ::  grid       !< name of vertical grid
1532
1533    INTEGER(iwp),      INTENT(IN)    ::  av         !< flag for (non-)average output
1534    INTEGER(iwp),      INTENT(IN)    ::  nzb_do     !< vertical output index (bottom) (usually 0)
1535    INTEGER(iwp),      INTENT(IN)    ::  nzt_do     !< vertical output index (top) (usually nz_do3d)
1536
1537    LOGICAL,           INTENT(INOUT) ::  found      !< flag if output variable is found
1538    LOGICAL,           INTENT(OUT)   ::  two_d      !< flag for 2D variables
1539
1540    REAL(wp),          INTENT(IN)    ::  fill_value !< to be removed
1541
1542    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do), INTENT(INOUT) ::  local_pf !< ToDo: can also be kind=sp
1543
1544
1545    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 2d data output', 'start' )
1546
1547    CALL dynamics_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do,&
1548                                  fill_value )
1549
1550    IF ( .NOT. found )  THEN
1551       CALL tcm_data_output_2d( av, variable, found, grid, mode, local_pf, nzb_do, nzt_do )
1552    ENDIF
1553
1554    IF ( .NOT. found  .AND.  biometeorology )  THEN
1555       CALL bio_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do )
1556    ENDIF
1557
1558    IF ( .NOT. found  .AND.  bulk_cloud_model )  THEN
1559       CALL bcm_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do )
1560    ENDIF
1561
1562    IF ( .NOT. found  .AND.  air_chemistry )  THEN
1563       CALL chem_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do, &
1564                                 fill_value )
1565    ENDIF
1566
1567    IF ( .NOT. found )  THEN
1568       CALL doq_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do,       &
1569                           fill_value )
1570    ENDIF
1571
1572    IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
1573       CALL gust_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do, &
1574                                 fill_value )
1575    ENDIF
1576
1577    IF ( .NOT. found  .AND.  land_surface )  THEN
1578       CALL lsm_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do )
1579    ENDIF
1580
1581    IF ( .NOT. found  .AND.  ocean_mode )  THEN
1582       CALL ocean_data_output_2d( av, variable, found, grid, mode, local_pf, nzb_do, nzt_do )
1583    ENDIF
1584
1585    IF ( .NOT. found  .AND.  radiation )  THEN
1586       CALL radiation_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do,    &
1587                                      nzt_do, fill_value )
1588    ENDIF
1589
1590    IF ( .NOT. found  .AND.  salsa )  THEN
1591       CALL salsa_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do )
1592    ENDIF
1593
1594    IF ( .NOT. found  .AND.  user_module_enabled )  THEN
1595       CALL user_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do )
1596    ENDIF
1597
1598    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 2d data output', 'end' )
1599
1600
1601 END SUBROUTINE module_interface_data_output_2d
1602
1603
1604!--------------------------------------------------------------------------------------------------!
1605!
1606! Description:
1607! ------------
1608!> Define module-specific 3D output variables
1609!--------------------------------------------------------------------------------------------------!
1610 SUBROUTINE module_interface_data_output_3d( av, variable, found, local_pf, fill_value, resorted,  &
1611                                             nzb_do, nzt_do )
1612
1613    CHARACTER (LEN=*), INTENT(IN)    ::  variable   !< variable name
1614
1615    INTEGER(iwp),      INTENT(IN)    ::  av         !< flag for (non-)average output
1616    INTEGER(iwp),      INTENT(IN)    ::  nzb_do     !< vertical output index (bottom) (usually 0)
1617    INTEGER(iwp),      INTENT(IN)    ::  nzt_do     !< vertical output index (top) (usually nz_do3d)
1618
1619    LOGICAL,           INTENT(INOUT) ::  found      !< flag if output variable is found
1620    LOGICAL,           INTENT(OUT)   ::  resorted   !< flag if output has been resorted
1621
1622    REAL(wp),          INTENT(IN)    ::  fill_value !< ToDo: refactor
1623
1624    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do), INTENT(INOUT) ::  local_pf
1625
1626
1627    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 3d data output', 'start' )
1628
1629    CALL dynamics_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1630    resorted = .FALSE.
1631
1632    IF ( .NOT. found )  THEN
1633       CALL tcm_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1634       resorted = .TRUE.
1635    ENDIF
1636
1637    IF ( .NOT. found  .AND.  biometeorology )  THEN
1638       CALL bio_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1639       resorted = .FALSE.
1640    ENDIF
1641
1642    IF ( .NOT. found  .AND.  bulk_cloud_model )  THEN
1643       CALL bcm_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1644       resorted = .TRUE.
1645    ENDIF
1646
1647    IF ( .NOT. found  .AND.  air_chemistry )  THEN
1648       CALL chem_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1649       resorted = .TRUE.
1650    ENDIF
1651
1652    IF ( .NOT. found )  THEN
1653       CALL doq_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1654       resorted = .TRUE.
1655    ENDIF
1656
1657    IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
1658       CALL gust_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1659       resorted = .TRUE.
1660    ENDIF
1661
1662    IF ( .NOT. found  .AND.  indoor_model )  THEN
1663       CALL im_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1664       resorted = .TRUE.
1665    ENDIF
1666
1667    IF ( .NOT. found  .AND.  ocean_mode )  THEN
1668       CALL ocean_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1669       resorted = .TRUE.
1670    ENDIF
1671
1672    IF ( .NOT. found  .AND.  plant_canopy )  THEN
1673       CALL pcm_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1674       resorted = .TRUE.
1675    ENDIF
1676
1677    IF ( .NOT. found  .AND.  radiation )  THEN
1678       CALL radiation_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1679       resorted = .TRUE.
1680    ENDIF
1681
1682    IF ( .NOT. found  .AND.  salsa )  THEN
1683       CALL salsa_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1684       resorted = .TRUE.
1685    ENDIF
1686
1687    IF ( .NOT. found  .AND.  user_module_enabled )  THEN
1688       CALL user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1689       resorted = .TRUE.
1690    ENDIF
1691
1692    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 3d data output', 'end' )
1693
1694
1695 END SUBROUTINE module_interface_data_output_3d
1696
1697
1698!--------------------------------------------------------------------------------------------------!
1699! Description:
1700! ------------
1701!> Compute module-specific profile and timeseries data
1702!--------------------------------------------------------------------------------------------------!
1703 SUBROUTINE module_interface_statistics( mode, sr, tn, dots_max )
1704
1705
1706    CHARACTER (LEN=*), INTENT(IN) ::  mode     !< statistical analysis mode
1707
1708    INTEGER(iwp),      INTENT(IN) ::  dots_max !< maximum number of timeseries
1709    INTEGER(iwp),      INTENT(IN) ::  sr       !<
1710    INTEGER(iwp),      INTENT(IN) ::  tn       !<
1711
1712
1713    IF ( debug_output_timestep )  CALL debug_message( 'module-specific statistics', 'start' )
1714
1715    CALL dynamics_statistics( mode, sr, tn )
1716    CALL doq_statistics( mode, sr, tn )
1717
1718    IF ( gust_module_enabled )  CALL gust_statistics( mode, sr, tn, dots_max )
1719    IF ( air_chemistry       )  CALL chem_statistics( mode, sr, tn )
1720    IF ( salsa               )  CALL salsa_statistics( mode, sr, tn )
1721
1722    IF ( user_module_enabled )  CALL user_statistics( mode, sr, tn )
1723
1724    IF ( debug_output_timestep )  CALL debug_message( 'module-specific statistics', 'end' )
1725
1726
1727 END SUBROUTINE module_interface_statistics
1728
1729
1730!--------------------------------------------------------------------------------------------------!
1731! Description:
1732! ------------
1733!> Read module-specific restart data in Fortran binary format globaly shared by all MPI ranks
1734!--------------------------------------------------------------------------------------------------!
1735 SUBROUTINE module_interface_rrd_global_ftn( found )
1736
1737
1738    LOGICAL, INTENT(INOUT) ::  found    !< flag if variable was found
1739
1740
1741    IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'start' )
1742
1743    CALL dynamics_rrd_global( found ) ! ToDo: change interface to pass variable
1744
1745    IF ( .NOT. found )  CALL bio_rrd_global( found ) ! ToDo: change interface to pass variable
1746    IF ( .NOT. found )  CALL bcm_rrd_global( found ) ! ToDo: change interface to pass variable
1747    IF ( .NOT. found )  CALL flight_rrd_global( found ) ! ToDo: change interface to pass variable
1748    IF ( .NOT. found )  CALL gust_rrd_global( found ) ! ToDo: change interface to pass variable
1749    IF ( .NOT. found )  CALL lpm_rrd_global( found ) ! ToDo: change interface to pass variable
1750    IF ( .NOT. found )  CALL pcm_rrd_global( found )
1751    IF ( .NOT. found )  CALL ocean_rrd_global( found ) ! ToDo: change interface to pass variable
1752    IF ( .NOT. found )  CALL salsa_rrd_global( found )
1753    IF ( .NOT. found )  CALL stg_rrd_global ( found ) ! ToDo: change interface to pass variable
1754    IF ( .NOT. found )  CALL wtm_rrd_global( found ) ! ToDo: change interface to pass variable
1755    IF ( .NOT. found )  CALL surface_data_output_rrd_global( found )
1756
1757    IF ( .NOT. found )  CALL user_rrd_global( found ) ! ToDo: change interface to pass variable
1758
1759    IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'end' )
1760
1761
1762 END SUBROUTINE module_interface_rrd_global_ftn
1763
1764
1765!--------------------------------------------------------------------------------------------------!
1766! Description:
1767! ------------
1768!> Read module-specific restart data in MPI format globaly shared by all MPI ranks
1769!--------------------------------------------------------------------------------------------------!
1770 SUBROUTINE module_interface_rrd_global_mpi
1771
1772
1773    IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'start' )
1774
1775    CALL dynamics_rrd_global
1776
1777    IF ( biometeorology )       CALL bio_rrd_global
1778    IF ( bulk_cloud_model )     CALL bcm_rrd_global
1779    IF ( virtual_flight )       CALL flight_rrd_global
1780    IF ( gust_module_enabled )  CALL gust_rrd_global
1781    IF ( particle_advection )   CALL lpm_rrd_global
1782    IF ( plant_canopy )         CALL pcm_rrd_global
1783    IF ( ocean_mode )           CALL ocean_rrd_global
1784    IF ( salsa )                CALL salsa_rrd_global
1785    IF ( syn_turb_gen )         CALL stg_rrd_global
1786    IF ( wind_turbine )         CALL wtm_rrd_global
1787    IF ( surface_output )       CALL surface_data_output_rrd_global
1788
1789    IF ( user_module_enabled )  CALL user_rrd_global
1790
1791    IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'end' )
1792
1793
1794 END SUBROUTINE module_interface_rrd_global_mpi
1795
1796
1797!--------------------------------------------------------------------------------------------------!
1798! Description:
1799! ------------
1800!> Write module-specific restart data globaly shared by all MPI ranks
1801!--------------------------------------------------------------------------------------------------!
1802 SUBROUTINE module_interface_wrd_global
1803
1804
1805    IF ( debug_output )  CALL debug_message( 'module-specific write global restart data', 'start' )
1806
1807    CALL dynamics_wrd_global
1808
1809    IF ( biometeorology )       CALL bio_wrd_global
1810    IF ( bulk_cloud_model )     CALL bcm_wrd_global
1811    IF ( virtual_flight )       CALL flight_wrd_global
1812    IF ( gust_module_enabled )  CALL gust_wrd_global
1813    IF ( particle_advection )   CALL lpm_wrd_global
1814    IF ( plant_canopy )         CALL pcm_wrd_global
1815    IF ( ocean_mode )           CALL ocean_wrd_global
1816    IF ( salsa )                CALL salsa_wrd_global
1817    IF ( syn_turb_gen )         CALL stg_wrd_global
1818    IF ( wind_turbine )         CALL wtm_wrd_global
1819    IF ( surface_output )       CALL surface_data_output_wrd_global
1820
1821    IF ( user_module_enabled )  CALL user_wrd_global
1822
1823    IF ( debug_output )  CALL debug_message( 'module-specific write global restart data', 'end' )
1824
1825
1826 END SUBROUTINE module_interface_wrd_global
1827
1828
1829!--------------------------------------------------------------------------------------------------!
1830! Description:
1831! ------------
1832!> Read module-specific local restart data arrays (Fortran binary format).
1833!--------------------------------------------------------------------------------------------------!
1834 SUBROUTINE module_interface_rrd_local_ftn( map_index,                                             &
1835                                            nxlf, nxlc, nxl_on_file,                               &
1836                                            nxrf, nxrc, nxr_on_file,                               &
1837                                            nynf, nync, nyn_on_file,                               &
1838                                            nysf, nysc, nys_on_file,                               &
1839                                            tmp_2d, tmp_3d, found )
1840
1841
1842    INTEGER(iwp), INTENT(IN)  ::  map_index    !<
1843    INTEGER(iwp), INTENT(IN)  ::  nxlc         !<
1844    INTEGER(iwp), INTENT(IN)  ::  nxlf         !<
1845    INTEGER(iwp), INTENT(IN)  ::  nxl_on_file  !<
1846    INTEGER(iwp), INTENT(IN)  ::  nxrc         !<
1847    INTEGER(iwp), INTENT(IN)  ::  nxrf         !<
1848    INTEGER(iwp), INTENT(IN)  ::  nxr_on_file  !<
1849    INTEGER(iwp), INTENT(IN)  ::  nync         !<
1850    INTEGER(iwp), INTENT(IN)  ::  nynf         !<
1851    INTEGER(iwp), INTENT(IN)  ::  nyn_on_file  !<
1852    INTEGER(iwp), INTENT(IN)  ::  nysc         !<
1853    INTEGER(iwp), INTENT(IN)  ::  nysf         !<
1854    INTEGER(iwp), INTENT(IN)  ::  nys_on_file  !<
1855
1856    LOGICAL,      INTENT(INOUT) ::  found        !< flag if variable was found
1857
1858    REAL(wp),                                                                                      &
1859       DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp),             &
1860       INTENT(OUT) :: tmp_2d   !<
1861    REAL(wp),                                                                                      &
1862       DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp),   &
1863       INTENT(OUT) :: tmp_3d   !<
1864
1865
1866    IF ( debug_output )  THEN
1867       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'start' )
1868    ENDIF
1869
1870    CALL dynamics_rrd_local( map_index,                                                            &
1871                             nxlf, nxlc, nxl_on_file,                                              &
1872                             nxrf, nxrc, nxr_on_file,                                              &
1873                             nynf, nync, nyn_on_file,                                              &
1874                             nysf, nysc, nys_on_file,                                              &
1875                             tmp_2d, tmp_3d, found                                                 &
1876                           ) ! ToDo: change interface to pass variable
1877
1878    IF ( .NOT. found )  CALL bio_rrd_local( found )
1879
1880    IF ( .NOT. found )  CALL bcm_rrd_local( map_index,                                             &
1881                                            nxlf, nxlc, nxl_on_file,                               &
1882                                            nxrf, nxrc, nxr_on_file,                               &
1883                                            nynf, nync, nyn_on_file,                               &
1884                                            nysf, nysc, nys_on_file,                               &
1885                                            tmp_2d, tmp_3d, found                                  &
1886                                          ) ! ToDo: change interface to pass variable
1887
1888    IF ( .NOT. found )  CALL chem_rrd_local( map_index,                                            &
1889                                             nxlf, nxlc, nxl_on_file,                              &
1890                                             nxrf, nxrc, nxr_on_file,                              &
1891                                             nynf, nync, nyn_on_file,                              &
1892                                             nysf, nysc, nys_on_file,                              &
1893                                             tmp_3d, found                                         &
1894                                           ) ! ToDo: change interface to pass variable
1895
1896    IF ( .NOT. found )  CALL doq_rrd_local( map_index,                                             &
1897                                            nxlf, nxlc, nxl_on_file,                               &
1898                                            nxrf, nxrc, nxr_on_file,                               &
1899                                            nynf, nync, nyn_on_file,                               &
1900                                            nysf, nysc, nys_on_file,                               &
1901                                            tmp_2d, tmp_3d, found                                  &
1902                                          ) ! ToDo: change interface to pass variable
1903
1904    IF ( .NOT. found )  CALL gust_rrd_local( map_index,                                            &
1905                                             nxlf, nxlc, nxl_on_file,                              &
1906                                             nxrf, nxrc, nxr_on_file,                              &
1907                                             nynf, nync, nyn_on_file,                              &
1908                                             nysf, nysc, nys_on_file,                              &
1909                                             tmp_2d, tmp_3d, found                                 &
1910                                           ) ! ToDo: change interface to pass variable
1911
1912    IF ( .NOT. found )  CALL lpm_rrd_local( map_index,                                             &
1913                                            nxlf, nxlc, nxl_on_file,                               &
1914                                            nxrf, nxrc, nxr_on_file,                               &
1915                                            nynf, nync, nyn_on_file,                               &
1916                                            nysf, nysc, nys_on_file,                               &
1917                                            tmp_3d, found                                          &
1918                                          ) ! ToDo: change interface to pass variable
1919
1920    IF ( .NOT. found )  CALL lsm_rrd_local( map_index,                                             &
1921                                            nxlf, nxlc, nxl_on_file,                               &
1922                                            nxrf, nxrc, nxr_on_file,                               &
1923                                            nynf, nync, nyn_on_file,                               &
1924                                            nysf, nysc, nys_on_file,                               &
1925                                            tmp_2d, found                                          &
1926                                          ) ! ToDo: change interface to pass variable
1927
1928     IF ( .NOT. found )  CALL pcm_rrd_local( map_index,                                            &
1929                                             nxlf, nxlc, nxl_on_file,                              &
1930                                             nxrf, nxrc, nxr_on_file,                              &
1931                                             nynf, nync, nyn_on_file,                              &
1932                                             nysf, nysc, nys_on_file,                              &
1933                                             found                                                 &
1934                                           )
1935
1936    IF ( .NOT. found )  CALL ocean_rrd_local( map_index,                                           &
1937                                              nxlf, nxlc, nxl_on_file,                             &
1938                                              nxrf, nxrc, nxr_on_file,                             &
1939                                              nynf, nync, nyn_on_file,                             &
1940                                              nysf, nysc, nys_on_file,                             &
1941                                              tmp_3d, found                                        &
1942                                            ) ! ToDo: change interface to pass variable
1943
1944    IF ( .NOT. found )  CALL radiation_rrd_local( map_index,                                       &
1945                                                  nxlf, nxlc, nxl_on_file,                         &
1946                                                  nxrf, nxrc, nxr_on_file,                         &
1947                                                  nynf, nync, nyn_on_file,                         &
1948                                                  nysf, nysc, nys_on_file,                         &
1949                                                  tmp_2d, tmp_3d, found                            &
1950                                                ) ! ToDo: change interface to pass variable
1951
1952    IF ( .NOT. found )  CALL salsa_rrd_local( map_index,                                           &
1953                                              nxlf, nxlc, nxl_on_file,                             &
1954                                              nxrf, nxrc, nxr_on_file,                             &
1955                                              nynf, nync, nyn_on_file,                             &
1956                                              nysf, nysc, nys_on_file,                             &
1957                                              tmp_3d, found                                        &
1958                                            ) ! ToDo: change interface to pass variable
1959
1960    IF ( .NOT. found )  CALL usm_rrd_local( map_index,                                             &
1961                                            nxlf, nxlc, nxl_on_file,                               &
1962                                            nxrf, nxr_on_file,                                     &
1963                                            nynf, nyn_on_file,                                     &
1964                                            nysf, nysc, nys_on_file,                               &
1965                                            found                                                  &
1966                                          ) ! ToDo: change interface to pass variable
1967!
1968!-- Surface data do not need overlap data, so do not pass these information.
1969    IF ( .NOT. found )  CALL surface_data_output_rrd_local( found )
1970
1971    IF ( .NOT. found )  CALL user_rrd_local( map_index,                                            &
1972                                             nxlf, nxlc, nxl_on_file,                              &
1973                                             nxrf, nxrc, nxr_on_file,                              &
1974                                             nynf, nync, nyn_on_file,                              &
1975                                             nysf, nysc, nys_on_file,                              &
1976                                             tmp_3d, found                                         &
1977                                           ) ! ToDo: change interface to pass variable
1978
1979    IF ( debug_output )  THEN
1980       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'end' )
1981    ENDIF
1982
1983 END SUBROUTINE module_interface_rrd_local_ftn
1984
1985
1986!--------------------------------------------------------------------------------------------------!
1987! Description:
1988! ------------
1989!> Read module-specific local restart data arrays (MPI-IO).
1990!--------------------------------------------------------------------------------------------------!
1991 SUBROUTINE module_interface_rrd_local_mpi
1992
1993    IF ( debug_output )  THEN
1994       CALL debug_message( 'module-specific read local restart data (MPI-IO)', 'start' )
1995    ENDIF
1996
1997    CALL dynamics_rrd_local
1998
1999    IF ( biometeorology )       CALL bio_rrd_local
2000    IF ( bulk_cloud_model )     CALL bcm_rrd_local
2001    IF ( air_chemistry )        CALL chem_rrd_local
2002    CALL doq_rrd_local
2003    IF ( gust_module_enabled )  CALL gust_rrd_local
2004    IF ( particle_advection )   CALL lpm_rrd_local
2005    IF ( land_surface )         CALL lsm_rrd_local
2006    IF ( plant_canopy )         CALL pcm_rrd_local
2007    IF ( ocean_mode )           CALL ocean_rrd_local
2008    IF ( radiation )            CALL radiation_rrd_local
2009    IF ( salsa )                CALL salsa_rrd_local
2010    IF ( urban_surface )        CALL usm_rrd_local
2011    IF ( surface_output )       CALL surface_data_output_rrd_local
2012
2013    IF ( user_module_enabled )  CALL user_rrd_local
2014
2015    IF ( debug_output )  THEN
2016       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'end' )
2017    ENDIF
2018
2019 END SUBROUTINE module_interface_rrd_local_mpi
2020
2021
2022!--------------------------------------------------------------------------------------------------!
2023! Description:
2024! ------------
2025!> Write module-specific restart data specific to local MPI ranks
2026!--------------------------------------------------------------------------------------------------!
2027 SUBROUTINE module_interface_wrd_local
2028
2029
2030    IF ( debug_output )  CALL debug_message( 'module-specific write local restart data', 'start' )
2031
2032    CALL dynamics_wrd_local
2033
2034    IF ( biometeorology )       CALL bio_wrd_local
2035    IF ( bulk_cloud_model )     CALL bcm_wrd_local
2036    IF ( air_chemistry )        CALL chem_wrd_local
2037    CALL doq_wrd_local
2038    IF ( gust_module_enabled )  CALL gust_wrd_local
2039    IF ( particle_advection )   CALL lpm_wrd_local
2040    IF ( land_surface )         CALL lsm_wrd_local
2041    IF ( plant_canopy )         CALL pcm_wrd_local
2042    IF ( ocean_mode )           CALL ocean_wrd_local
2043    IF ( radiation )            CALL radiation_wrd_local
2044    IF ( salsa )                CALL salsa_wrd_local
2045    IF ( urban_surface )        CALL usm_wrd_local
2046    IF ( surface_output )       CALL surface_data_output_wrd_local
2047
2048    IF ( user_module_enabled )  CALL user_wrd_local
2049
2050    IF ( debug_output )  CALL debug_message( 'module-specific write local restart data', 'end' )
2051
2052
2053 END SUBROUTINE module_interface_wrd_local
2054
2055
2056!--------------------------------------------------------------------------------------------------!
2057! Description:
2058! ------------
2059!> Perform module-specific last actions before the program terminates
2060!--------------------------------------------------------------------------------------------------!
2061 SUBROUTINE module_interface_last_actions
2062
2063    INTEGER ::  return_value  !< returned status value of a called function
2064
2065
2066    IF ( debug_output )  CALL debug_message( 'module-specific last actions', 'start' )
2067
2068    return_value = dom_finalize_output()
2069
2070    CALL dynamics_last_actions
2071    IF ( particle_advection )   CALL lpm_last_actions
2072    IF ( user_module_enabled )  CALL user_last_actions
2073
2074    IF ( debug_output )  CALL debug_message( 'module-specific last actions', 'end' )
2075
2076
2077 END SUBROUTINE module_interface_last_actions
2078
2079
2080 END MODULE module_interface
Note: See TracBrowser for help on using the repository browser.