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

Last change on this file since 4598 was 4590, checked in by suehring, 4 years ago

Biomet: Enable restart via mpi-IO; Restart: Bugfix in allocation of hom and hom_sum in case of mpi-io restart when chemistry or salsa are employed

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