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

Last change on this file since 4540 was 4525, checked in by raasch, 4 years ago

salsa: added reading/writing of global restart data + reading/writing restart data with MPI-IO, bugfix for MPI-IO in plant_canopy_model_mod, tutorial user-interface dispersion_eularian_and_lpm_extended updated

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