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

Last change on this file since 4556 was 4525, checked in by raasch, 4 years ago

salsa: added reading/writing of global restart data + reading/writing restart data with MPI-IO, bugfix for MPI-IO in plant_canopy_model_mod, tutorial user-interface dispersion_eularian_and_lpm_extended updated

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