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

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

Diagnostic output: Define arrays over ghost points in order to allow for standard mpi-io treatment. By this modularization of restart-data input is possible with the module interface. Move input of restart data to doq_rrd_local. Enable mpi-io for restart data. Bugfix: add missing restart input of wtheta_av, wq_av, wu_av, and wv_av.

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