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

Last change on this file since 4714 was 4708, checked in by suehring, 4 years ago

Bugfix, correct mapping of RRTMG heating rates, as well as incoming/outgoing radiation onto the topography-following grid; add fill values to the radiation output

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