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

Last change on this file since 4733 was 4731, checked in by schwenkel, 4 years ago

Move exchange_horiz from time_integration to modules

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