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

Last change on this file since 4143 was 4132, checked in by suehring, 5 years ago

Bugfix in masked data output for prognostic quantities

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