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

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

Biomet: Enable restart via mpi-IO; Restart: Bugfix in allocation of hom and hom_sum in case of mpi-io restart when chemistry or salsa are employed

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