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

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

Bugfix in plant-canopy model for output of averaged transpiration rate after a restart; Revise check for output for plant heating rate and rename error message number; Surface-data output: enable output of mixing ratio and passive scalar concentration at the surface; Surface-data input: Add possibility to prescribe surface sensible and latent heat fluxes via static input file

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