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

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

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

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