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

Last change on this file since 4751 was 4731, checked in by schwenkel, 4 years ago

Move exchange_horiz from time_integration to modules

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