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

Last change on this file since 4765 was 4757, checked in by schwenkel, 4 years ago

implement relative humidity as diagnostic output quantity

  • Property svn:keywords set to Id
File size: 102.6 KB
Line 
1!> @file module_interface.f90
2!--------------------------------------------------------------------------------------------------!
3! This file is part of the PALM model system.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms of the GNU General
6! Public License as published by the Free Software Foundation, either version 3 of the License, or
7! (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
10! implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
11! Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with PALM. If not, see
14! <http://www.gnu.org/licenses/>.
15!
16! Copyright 1997-2020 Leibniz Universitaet Hannover
17!--------------------------------------------------------------------------------------------------!
18!
19! Current revisions:
20! -----------------
21!
22!
23! Former revisions:
24! -----------------
25! $Id: module_interface.f90 4757 2020-10-26 10:23:38Z Giersch $
26! Implement doq calls
27!
28! 4753 2020-10-21 14:55:41Z raasch
29! file re-formatted to follow the PALM coding standard
30!
31! 4731 2020-10-07 13:25:11Z schwenkel
32! Move exchange_horiz from time_integration to modules
33!
34! 4708 2020-09-28 17:42:58Z suehring
35! pass fillvalue attribute to radiation output
36!
37! 4590 2020-07-06 14:34:59Z suehring
38! Enable mpi-io for biomet
39!
40! 4525 2020-05-10 17:05:07Z raasch
41! added restart I/O for global salsa data,
42! added restart with MPI-IO for salsa
43!
44! 4518 2020-05-04 15:44:28Z suehring
45! Call of doq_rrd_local enabled
46!
47! 4517 2020-05-03 14:29:30Z raasch
48! added restart with MPI-IO for reading local arrays
49!
50! 4514 2020-04-30 16:29:59Z suehring
51! Added global restart routines for plant-canopy model
52!
53! 4495 2020-04-13 20:11:20Z raasch
54! restart data handling with MPI-IO added
55!
56! 4414 2020-02-19 20:16:04Z suehring
57! Add module interface for basic initialization of numerics.
58!
59! 4411 2020-02-18 14:28:02Z maronga
60! Added output routines for WTM
61!
62! 4407 2020-02-13 20:31:44Z knoop
63! Changed program_debug_output_unit to 9 in dom_init call
64!
65! 4400 2020-02-10 20:32:41Z suehring
66! - Use data-output module for virtual measurement output
67! - Remove deprecated routines for virtual measurement module
68!
69! 4361 2020-01-07 12:22:38Z suehring
70! Remove unused arrays in pmc_rrd_local
71!
72! 4360 2020-01-07 11:25:50Z suehring
73! Add pcm_rrd_local and pcm_wrd_local
74!
75! 4331 2019-12-10 18:25:02Z suehring
76! Change interface for doq_check_data_output, in order to perform further output checks.
77!
78! 4281 2019-10-29 15:15:39Z schwenkel
79! Added dynamics boundary conditions
80!
81! 4272 2019-10-23 15:18:57Z schwenkel
82! Further modularization of boundary conditions: moved boundary conditions to respective modules
83!
84! 4268 2019-10-17 11:29:38Z schwenkel
85! Introduction of module_interface_boundary_conditions
86!
87! 4182 2019-08-22 15:20:23Z scharf
88! Corrected "Former revisions" section
89!
90! 4173 2019-08-20 12:04:06Z gronemeier
91! add vdi_internal_controls
92!
93! 4157 2019-08-14 09:19:12Z suehring
94! Call doq_init from module interface
95!
96! 4132 2019-08-02 12:34:17Z suehring
97! Bugfix in masked data output for diagnostic quantities
98!
99! 4131 2019-08-02 11:06:18Z monakurppa
100! Add output of 3D plant-canopy outputs (merge from branch resler)
101!
102! 4048 2019-06-21 21:00:21Z knoop
103! Moved turbulence_closure_mod calls into this module_interface
104!
105! 4047 2019-06-21 18:58:09Z knoop
106! Introduction of the dynamics module
107!
108! 4039 2019-06-18 10:32:41Z suehring
109! Introduce diagnostic output
110!
111! 4028 2019-06-13 12:21:37Z schwenkel
112! Further modularization of particle code components
113!
114! 4017 2019-06-06 12:16:46Z schwenkel
115! local_pf need INTENT(INOUT) attribute rather than INTENT(OUT). This is because INTENT(OUT) sets
116! the array to not-defined. Especially for outputs that are not defined everywhere, e.g.
117! land-surface outputs, this will be problematic as NaN will be output.
118!
119! 3987 2019-05-22 09:52:13Z kanani
120! Introduce switchable DEBUG file output via debug_message routine
121!
122! 3956 2019-05-07 12:32:52Z monakurppa
123! - Added calls for salsa_non_advective_processes and salsa_exchange_horiz_bounds
124! - Moved the call for salsa_data_output_2d/3d before that of radiation_data_output_2d/3d.
125!   radiation_data_output_2d/3d tries to read a salsa output variable and encounters a segmentation
126!   fault for "Ntot" due 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 of additional debug
136! 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 compiler warning
152! about unused variable, file reformatted with respect to coding standards
153!
154! 3762 2019-02-25 16:54:16Z suehring
155! only pass required arguments to surface_data_output_rrd_local
156!
157! 3747 2019-02-16 15:15:23Z gronemeier
158! Call user_init_arrays
159!
160! 3745 2019-02-15 18:57:56Z suehring
161! Add indoor model
162!
163! 3744 2019-02-15 18:38:58Z suehring
164! Removed bio_check_parameters as the method is empty.
165!
166! 3735 2019-02-12 09:52:40Z dom_dwd_user
167! Accepting variable j from check_parameters and passing it to bio_check_data_output
168! Add required restart data for surface output module
169!
170! 3731 2019-02-11 13:06:27Z suehring
171! Add check_parameters routine for virtual measurements
172!
173! 3711 2019-01-31 13:44:26Z knoop
174! Introduced module_interface_init_checks for post-init checks
175!
176! 3705 2019-01-29 19:56:39Z suehring
177! Add last_actions for virtual measurements
178!
179! 3704 2019-01-29 19:51:41Z suehring
180! Some interface calls moved to module_interface + cleanup
181!
182! 3684 2019-01-20 20:20:58Z knoop
183! Bugfix: made unit intend INOUT
184!
185! 3650 2019-01-04 13:01:33Z kanani
186! Add restart routines for biometeorology
187!
188! 3649 2019-01-02 16:52:21Z suehring
189! Initialize strings, in order to avoid compiler warnings for non-initialized characters with
190! intent(out) attribute
191!
192! 3648 2019-01-02 16:35:46Z suehring
193! 3641 2018-12-23 22:10:01Z knoop
194! Initial implementation of the PALM module interface
195!
196!
197! Description:
198! ------------
199!> This is the interface between the PALM model core and all its modules.
200!>
201!> @todo Re-format module to be consistent with coding standard
202!--------------------------------------------------------------------------------------------------!
203 MODULE module_interface
204
205    USE indices,                                                                                   &
206        ONLY:  nbgp, nxl, nxlg, nxr, nxrg, nys, nysg, nyn, nyng, nzb, nzt
207
208    USE kinds
209
210    USE pegrid,                                                                                    &
211        ONLY:  comm2d
212
213!
214!-- load module-specific control parameters.
215!-- ToDo: move all of them to respective module or a dedicated central module
216    USE data_output_module,                                                                        &
217        ONLY:  dom_def_end,                                                                        &
218               dom_finalize_output,                                                                &
219               dom_init
220
221    USE dynamics_mod,                                                                              &
222        ONLY:  dynamics_3d_data_averaging,                                                         &
223               dynamics_actions,                                                                   &
224               dynamics_boundary_conditions,                                                       &
225               dynamics_check_data_output,                                                         &
226               dynamics_check_data_output_pr,                                                      &
227               dynamics_check_data_output_ts,                                                      &
228               dynamics_check_parameters,                                                          &
229               dynamics_data_output_2d,                                                            &
230               dynamics_data_output_3d,                                                            &
231               dynamics_define_netcdf_grid,                                                        &
232               dynamics_exchange_horiz,                                                            &
233               dynamics_header,                                                                    &
234               dynamics_init,                                                                      &
235               dynamics_init_arrays,                                                               &
236               dynamics_init_checks,                                                               &
237               dynamics_init_masks,                                                                &
238               dynamics_last_actions,                                                              &
239               dynamics_non_advective_processes,                                                   &
240               dynamics_parin,                                                                     &
241               dynamics_prognostic_equations,                                                      &
242               dynamics_rrd_global,                                                                &
243               dynamics_rrd_local,                                                                 &
244               dynamics_statistics,                                                                &
245               dynamics_swap_timelevel,                                                            &
246               dynamics_wrd_global,                                                                &
247               dynamics_wrd_local
248
249    USE turbulence_closure_mod,                                                                    &
250        ONLY:  tcm_3d_data_averaging,                                                              &
251               tcm_actions,                                                                        &
252               tcm_boundary_conds,                                                                 &
253               tcm_check_data_output,                                                              &
254               tcm_check_parameters,                                                               &
255               tcm_data_output_2d,                                                                 &
256               tcm_data_output_3d,                                                                 &
257               tcm_init,                                                                           &
258               tcm_init_arrays,                                                                    &
259               tcm_prognostic_equations,                                                           &
260               tcm_swap_timelevel
261
262    USE control_parameters,                                                                        &
263        ONLY:  air_chemistry,                                                                      &
264               biometeorology,                                                                     &
265               coupling_char,                                                                      &
266               debug_output,                                                                       &
267               debug_output_timestep,                                                              &
268               indoor_model,                                                                       &
269               land_surface,                                                                       &
270               large_scale_forcing,                                                                &
271               nesting_offline,                                                                    &
272               nudging,                                                                            &
273               ocean_mode,                                                                         &
274               plant_canopy,                                                                       &
275               salsa,                                                                              &
276               surface_output,                                                                     &
277               syn_turb_gen,                                                                       &
278               urban_surface,                                                                      &
279               vdi_checks,                                                                         &
280               virtual_flight,                                                                     &
281               virtual_measurement,                                                                &
282               wind_turbine
283
284!
285!-- Load interface routines of all PALM modules
286    USE biometeorology_mod,                                                                        &
287        ONLY:  bio_3d_data_averaging,                                                              &
288               bio_check_data_output,                                                              &
289               bio_data_output_2d,                                                                 &
290               bio_data_output_3d,                                                                 &
291               bio_init,                                                                           &
292               bio_init_checks,                                                                    &
293               bio_header,                                                                         &
294               bio_parin,                                                                          &
295               bio_rrd_global,                                                                     &
296               bio_rrd_local,                                                                      &
297               bio_wrd_global,                                                                     &
298               bio_wrd_local
299
300    USE bulk_cloud_model_mod,                                                                      &
301        ONLY:  bcm_3d_data_averaging,                                                              &
302               bcm_actions,                                                                        &
303               bcm_boundary_conditions,                                                            &
304               bcm_check_data_output_pr,                                                           &
305               bcm_check_data_output,                                                              &
306               bcm_check_parameters,                                                               &
307               bcm_data_output_2d,                                                                 &
308               bcm_data_output_3d,                                                                 &
309               bcm_exchange_horiz,                                                                 &
310               bcm_header,                                                                         &
311               bcm_init_arrays,                                                                    &
312               bcm_init,                                                                           &
313               bcm_non_advective_processes,                                                        &
314               bcm_parin,                                                                          &
315               bcm_prognostic_equations,                                                           &
316               bcm_rrd_global,                                                                     &
317               bcm_rrd_local,                                                                      &
318               bcm_swap_timelevel,                                                                 &
319               bcm_wrd_global,                                                                     &
320               bcm_wrd_local,                                                                      &
321               bulk_cloud_model
322
323   USE chemistry_model_mod,                                                                        &
324       ONLY:  chem_3d_data_averaging,                                                              &
325              chem_actions,                                                                        &
326              chem_boundary_conditions,                                                            &
327              chem_check_data_output,                                                              &
328              chem_check_data_output_pr,                                                           &
329              chem_check_parameters,                                                               &
330              chem_data_output_2d,                                                                 &
331              chem_data_output_3d,                                                                 &
332              chem_exchange_horiz_bounds,                                                          &
333              chem_header,                                                                         &
334              chem_init,                                                                           &
335              chem_init_arrays,                                                                    &
336              chem_non_advective_processes,                                                        &
337              chem_parin,                                                                          &
338              chem_prognostic_equations,                                                           &
339              chem_rrd_local,                                                                      &
340              chem_statistics,                                                                     &
341              chem_swap_timelevel,                                                                 &
342              chem_wrd_local
343
344    USE diagnostic_output_quantities_mod,                                                          &
345        ONLY:  doq_3d_data_averaging,                                                              &
346               doq_check_data_output,                                                              &
347               doq_check_data_output_pr,                                                           &
348               doq_define_netcdf_grid,                                                             &
349               doq_init,                                                                           &
350               doq_output_2d,                                                                      &
351               doq_output_3d,                                                                      &
352               doq_statistics,                                                                     &
353               doq_rrd_local,                                                                      &
354               doq_wrd_local
355
356    USE flight_mod,                                                                                &
357        ONLY:  flight_header,                                                                      &
358               flight_init,                                                                        &
359               flight_parin,                                                                       &
360               flight_rrd_global,                                                                  &
361               flight_wrd_global
362
363    USE gust_mod,                                                                                  &
364        ONLY:  gust_3d_data_averaging,                                                             &
365               gust_actions,                                                                       &
366               gust_check_parameters,                                                              &
367               gust_check_data_output,                                                             &
368               gust_check_data_output_pr,                                                          &
369               gust_data_output_2d,                                                                &
370               gust_data_output_3d,                                                                &
371               gust_header,                                                                        &
372               gust_init,                                                                          &
373               gust_init_arrays,                                                                   &
374               gust_module_enabled,                                                                &
375               gust_parin,                                                                         &
376               gust_prognostic_equations,                                                          &
377               gust_rrd_global,                                                                    &
378               gust_rrd_local,                                                                     &
379               gust_statistics,                                                                    &
380               gust_swap_timelevel,                                                                &
381               gust_wrd_global,                                                                    &
382               gust_wrd_local
383
384    USE indoor_model_mod,                                                                          &
385        ONLY:  im_check_data_output,                                                               &
386               im_check_parameters,                                                                &
387               im_data_output_3d,                                                                  &
388               im_init,                                                                            &
389               im_parin
390
391    USE lagrangian_particle_model_mod,                                                             &
392        ONLY:  lpm_actions,                                                                        &
393               lpm_check_parameters,                                                               &
394               lpm_exchange_horiz_bounds,                                                          &
395               lpm_header,                                                                         &
396               lpm_init,                                                                           &
397               lpm_init_arrays,                                                                    &
398               lpm_parin,                                                                          &
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_3d_data_averaging,                                                              &
406               lsm_check_parameters,                                                               &
407               lsm_check_data_output,                                                              &
408               lsm_check_data_output_pr,                                                           &
409               lsm_data_output_2d,                                                                 &
410               lsm_header,                                                                         &
411               lsm_init,                                                                           &
412               lsm_init_arrays,                                                                    &
413               lsm_parin,                                                                          &
414               lsm_rrd_local,                                                                      &
415               lsm_swap_timelevel,                                                                 &
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_nudging_header,                                                                 &
422               lsf_init,                                                                           &
423               nudge_init
424
425    USE multi_agent_system_mod,                                                                    &
426        ONLY:  mas_parin
427
428    USE nesting_offl_mod,                                                                          &
429        ONLY:  nesting_offl_check_parameters,                                                      &
430               nesting_offl_header,                                                                &
431               nesting_offl_parin
432
433    USE ocean_mod,                                                                                 &
434        ONLY:  ocean_3d_data_averaging,                                                            &
435               ocean_actions,                                                                      &
436               ocean_boundary_conditions,                                                          &
437               ocean_check_parameters,                                                             &
438               ocean_check_data_output,                                                            &
439               ocean_check_data_output_pr,                                                         &
440               ocean_data_output_2d,                                                               &
441               ocean_data_output_3d,                                                               &
442               ocean_exchange_horiz,                                                               &
443               ocean_init_arrays,                                                                  &
444               ocean_init,                                                                         &
445               ocean_header,                                                                       &
446               ocean_parin,                                                                        &
447               ocean_prognostic_equations,                                                         &
448               ocean_rrd_global,                                                                   &
449               ocean_rrd_local,                                                                    &
450               ocean_swap_timelevel,                                                               &
451               ocean_wrd_global,                                                                   &
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_3d_data_averaging,                                                              &
462               pcm_check_parameters,                                                               &
463               pcm_check_data_output,                                                              &
464               pcm_data_output_3d,                                                                 &
465               pcm_header,                                                                         &
466               pcm_init,                                                                           &
467               pcm_parin,                                                                          &
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_3d_data_averaging,                                                        &
476               radiation_check_parameters,                                                         &
477               radiation_check_data_output,                                                        &
478               radiation_check_data_output_pr,                                                     &
479               radiation_check_data_output_ts,                                                     &
480               radiation_data_output_2d,                                                           &
481               radiation_data_output_3d,                                                           &
482               radiation_header,                                                                   &
483               radiation_init,                                                                     &
484               radiation_parin,                                                                    &
485               radiation_rrd_local,                                                                &
486               radiation_wrd_local
487
488    USE salsa_mod,                                                                                 &
489        ONLY:  salsa_3d_data_averaging,                                                            &
490               salsa_actions,                                                                      &
491               salsa_boundary_conditions,                                                          &
492               salsa_check_data_output,                                                            &
493               salsa_check_data_output_pr,                                                         &
494               salsa_check_parameters,                                                             &
495               salsa_data_output_2d,                                                               &
496               salsa_data_output_3d,                                                               &
497               salsa_exchange_horiz_bounds,                                                        &
498               salsa_header,                                                                       &
499               salsa_init,                                                                         &
500               salsa_init_arrays,                                                                  &
501               salsa_non_advective_processes,                                                      &
502               salsa_parin,                                                                        &
503               salsa_prognostic_equations,                                                         &
504               salsa_rrd_global,                                                                   &
505               salsa_rrd_local,                                                                    &
506               salsa_statistics,                                                                   &
507               salsa_swap_timelevel,                                                               &
508               salsa_wrd_global,                                                                   &
509               salsa_wrd_local
510
511    USE spectra_mod,                                                                               &
512        ONLY:  calculate_spectra,                                                                  &
513               spectra_check_parameters,                                                           &
514               spectra_header,                                                                     &
515               spectra_parin
516
517    USE surface_data_output_mod,                                                                   &
518        ONLY:  surface_data_output_check_parameters,                                               &
519               surface_data_output_init_arrays,                                                    &
520               surface_data_output_parin,                                                          &
521               surface_data_output_rrd_global,                                                     &
522               surface_data_output_rrd_local,                                                      &
523               surface_data_output_wrd_global,                                                     &
524               surface_data_output_wrd_local
525
526    USE surface_mod,                                                                               &
527        ONLY:  init_bc
528
529    USE synthetic_turbulence_generator_mod,                                                        &
530        ONLY:  stg_check_parameters,                                                               &
531               stg_header,                                                                         &
532               stg_parin,                                                                          &
533               stg_rrd_global,                                                                     &
534               stg_wrd_global
535
536    USE urban_surface_mod,                                                                         &
537        ONLY:  usm_3d_data_averaging,                                                              &
538               usm_check_data_output,                                                              &
539               usm_check_parameters,                                                               &
540               usm_init,                                                                           &
541               usm_init_arrays,                                                                    &
542               usm_parin,                                                                          &
543               usm_swap_timelevel,                                                                 &
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_actions,                                                                        &
558               wtm_check_parameters,                                                               &
559               wtm_init,                                                                           &
560               wtm_init_arrays,                                                                    &
561               wtm_init_output,                                                                    &
562               wtm_parin,                                                                          &
563               wtm_rrd_global,                                                                     &
564               wtm_wrd_global
565
566    USE user,                                                                                      &
567        ONLY:  user_3d_data_averaging,                                                             &
568               user_actions,                                                                       &
569               user_check_data_output,                                                             &
570               user_check_data_output_pr,                                                          &
571               user_check_data_output_ts,                                                          &
572               user_check_parameters,                                                              &
573               user_data_output_2d,                                                                &
574               user_data_output_3d,                                                                &
575               user_header,                                                                        &
576               user_init,                                                                          &
577               user_init_arrays,                                                                   &
578               user_last_actions,                                                                  &
579               user_module_enabled,                                                                &
580               user_parin,                                                                         &
581               user_statistics,                                                                    &
582               user_rrd_global,                                                                    &
583               user_rrd_local,                                                                     &
584               user_wrd_global,                                                                    &
585               user_wrd_local
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    INTEGER(iwp),      INTENT(IN)       ::  dots_max !< variable output array index
835    INTEGER(iwp),      INTENT(INOUT)    ::  dots_num !< variable output array index
836
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, dopr_unit )
865
866
867    CHARACTER (LEN=*), INTENT(IN)    ::  variable  !< variable name
868    CHARACTER (LEN=*), INTENT(INOUT) ::  unit      !< physical unit of variable
869    CHARACTER (LEN=*), INTENT(OUT)   ::  dopr_unit !< local value of dopr_unit
870
871    INTEGER(iwp),      INTENT(IN)    ::  var_count !< variable output array index
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    CALL doq_check_data_output_pr( variable, var_count, unit, dopr_unit )
878
879    IF ( unit == 'illegal'  .AND.  bulk_cloud_model )  THEN
880       CALL bcm_check_data_output_pr( variable, var_count, unit, dopr_unit )
881    ENDIF
882
883    IF ( unit == 'illegal'  .AND.  air_chemistry )  THEN
884       CALL chem_check_data_output_pr( variable, var_count, unit, dopr_unit )
885    ENDIF
886
887    IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
888       CALL gust_check_data_output_pr( variable, var_count, unit, dopr_unit )
889    ENDIF
890
891    IF ( unit == 'illegal' )  THEN ! ToDo: add module switch if possible
892       CALL lsm_check_data_output_pr( variable, var_count, unit, dopr_unit )
893    ENDIF
894
895    IF ( unit == 'illegal' )  THEN ! ToDo: add module switch if possible
896       CALL lsf_nudging_check_data_output_pr( variable, var_count, unit, dopr_unit )
897    ENDIF
898
899    IF ( unit == 'illegal'  .AND.  ocean_mode )  THEN
900       CALL ocean_check_data_output_pr( variable, var_count, unit, dopr_unit )
901    ENDIF
902
903    IF ( unit == 'illegal'  .AND.  radiation )  THEN
904       CALL radiation_check_data_output_pr( variable, var_count, unit, dopr_unit )
905    ENDIF
906
907    IF ( unit == 'illegal'  .AND.  salsa )  THEN
908       CALL salsa_check_data_output_pr( variable, var_count, unit, dopr_unit )
909    ENDIF
910
911    IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
912       unit = '' ! ToDo: Seems like a hack. Find a general soultion!
913       CALL user_check_data_output_pr( variable, var_count, unit, dopr_unit )
914    ENDIF
915
916    IF ( debug_output )  CALL debug_message( 'checking module-specific data output pr', 'end' )
917
918
919 END SUBROUTINE module_interface_check_data_output_pr
920
921!--------------------------------------------------------------------------------------------------!
922! Description:
923! ------------
924!> Check module-specific 2D and 3D data output
925!--------------------------------------------------------------------------------------------------!
926 SUBROUTINE module_interface_check_data_output( variable, unit, i, j, ilen, k )
927
928
929    CHARACTER (LEN=*), INTENT(IN)    ::  variable !< variable name
930    CHARACTER (LEN=*), INTENT(INOUT) ::  unit     !< physical unit of variable
931
932    INTEGER(iwp),      INTENT(IN)    :: i         !< ToDo: remove dummy argument, instead pass string from data_output
933    INTEGER(iwp),      INTENT(IN)    :: j         !< average quantity? 0 = no, 1 = yes
934    INTEGER(iwp),      INTENT(IN)    :: ilen      !< ToDo: remove dummy argument, instead pass string from data_output
935    INTEGER(iwp),      INTENT(IN)    :: k         !< ToDo: remove dummy argument, instead pass string from data_output
936
937
938    IF ( debug_output )  CALL debug_message( 'checking module-specific data output 2d/3d', 'start' )
939
940    CALL dynamics_check_data_output( variable, unit )
941
942    CALL tcm_check_data_output( variable, unit )
943
944    IF ( unit == 'illegal'  .AND.  biometeorology )  THEN
945       CALL bio_check_data_output( variable, unit, i, j, ilen, k )
946    ENDIF
947
948    IF ( unit == 'illegal'  .AND.  bulk_cloud_model  )  THEN
949       CALL bcm_check_data_output( variable, unit )
950    ENDIF
951
952    IF ( unit == 'illegal'  .AND.  air_chemistry  .AND.  (variable(1:3) == 'kc_'  .OR.             &
953         variable(1:3) == 'em_') )  THEN  ! ToDo: remove aditional conditions
954       CALL chem_check_data_output( variable, unit, i, ilen, k )
955    ENDIF
956
957    IF ( unit == 'illegal' )  THEN
958       CALL doq_check_data_output( variable, unit, i, ilen, k )
959    ENDIF
960
961    IF ( unit == 'illegal'  .AND.  gust_module_enabled  )  THEN
962       CALL gust_check_data_output( variable, unit )
963    ENDIF
964
965    IF ( unit == 'illegal' )  THEN  ! ToDo: add module switch if possible
966       CALL lsm_check_data_output( variable, unit, i, ilen, k )
967    ENDIF
968
969    IF ( unit == 'illegal'  .AND.  ocean_mode )  THEN
970       CALL ocean_check_data_output( variable, unit )
971    ENDIF
972
973    IF ( unit == 'illegal'  .AND.  plant_canopy  .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  .AND.  variable(1:4) == 'usm_' )  THEN  ! ToDo: remove aditional conditions
990       CALL usm_check_data_output( variable, unit )
991    ENDIF
992
993    IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
994       unit = ''
995       CALL user_check_data_output( variable, unit )
996    ENDIF
997
998    IF ( debug_output )  CALL debug_message( 'checking module-specific data output 2d/3d', 'end' )
999
1000
1001 END SUBROUTINE module_interface_check_data_output
1002
1003
1004!--------------------------------------------------------------------------------------------------!
1005!
1006! Description:
1007! ------------
1008!> Interface for init_masks. ToDo: get rid of these redundant calls!
1009!--------------------------------------------------------------------------------------------------!
1010 SUBROUTINE module_interface_init_masks( variable, unit )
1011
1012
1013    CHARACTER (LEN=*), INTENT(IN)    ::  variable !< variable name
1014    CHARACTER (LEN=*), INTENT(INOUT) ::  unit     !< physical unit of variable
1015
1016
1017    IF ( debug_output )  CALL debug_message( 'initializing module-specific masks', 'start' )
1018
1019    CALL dynamics_init_masks( variable, unit )
1020
1021    IF ( unit == 'illegal'  .AND.  air_chemistry  .AND.  (variable(1:3) == 'kc_'  .OR.             &
1022         variable(1:3) == 'em_') )  THEN  ! ToDo: remove aditional conditions
1023       CALL chem_check_data_output( variable, unit, 0, 0, 0 )
1024    ENDIF
1025
1026    IF ( unit == 'illegal' )  THEN
1027       CALL doq_check_data_output( variable, unit )
1028    ENDIF
1029
1030    IF ( unit == 'illegal'  .AND.  radiation )  THEN
1031       CALL radiation_check_data_output( variable, unit, 0, 0, 0 )
1032    ENDIF
1033
1034    IF ( unit == 'illegal'  .AND.  salsa )  THEN
1035       CALL salsa_check_data_output( variable, unit )
1036    ENDIF
1037
1038    IF ( unit == 'illegal'  .AND.  user_module_enabled )  THEN
1039       unit = ''
1040       CALL user_check_data_output( variable, unit )
1041    ENDIF
1042
1043    IF ( debug_output )  CALL debug_message( 'initializing module-specific masks', 'end' )
1044
1045
1046 END SUBROUTINE module_interface_init_masks
1047
1048
1049!--------------------------------------------------------------------------------------------------!
1050!
1051! Description:
1052! ------------
1053!> Define appropriate grid for module-specific netcdf output variables.
1054!--------------------------------------------------------------------------------------------------!
1055 SUBROUTINE module_interface_define_netcdf_grid( var, found, grid_x, grid_y, grid_z )
1056
1057
1058    CHARACTER (LEN=*), INTENT(IN)  ::  var    !< variable name
1059    CHARACTER (LEN=*), INTENT(OUT) ::  grid_x !< netcdf dimension in x-direction
1060    CHARACTER (LEN=*), INTENT(OUT) ::  grid_y !< netcdf dimension in y-direction
1061    CHARACTER (LEN=*), INTENT(OUT) ::  grid_z !< netcdf dimension in z-direction
1062
1063    LOGICAL,           INTENT(OUT) ::  found  !< indicates if variable was found
1064
1065
1066    IF ( debug_output )  CALL debug_message( 'defining module-specific netcdf grids', 'start' )
1067!
1068!-- As long as no action is done in this subroutine, initialize strings with intent(out) attribute,
1069!-- in order to avoid compiler warnings.
1070    found  = .FALSE.
1071    grid_x = 'none'
1072    grid_y = 'none'
1073    grid_z = 'none'
1074!
1075!-- Use var to avoid compiler warning about unused variable
1076    IF ( var == ' ' )  RETURN
1077
1078    IF ( debug_output )  CALL debug_message( 'defining module-specific netcdf grids', 'end' )
1079
1080
1081 END SUBROUTINE module_interface_define_netcdf_grid
1082
1083
1084!--------------------------------------------------------------------------------------------------!
1085! Description:
1086! ------------
1087!> Allocate module-specific arrays and pointers
1088!--------------------------------------------------------------------------------------------------!
1089 SUBROUTINE module_interface_init_arrays
1090
1091
1092    IF ( debug_output )  CALL debug_message( 'initializing module-specific arrays', 'start' )
1093
1094    CALL dynamics_init_arrays
1095    CALL tcm_init_arrays
1096
1097    IF ( bulk_cloud_model    )  CALL bcm_init_arrays
1098    IF ( air_chemistry       )  CALL chem_init_arrays
1099    IF ( gust_module_enabled )  CALL gust_init_arrays
1100    IF ( particle_advection  )  CALL lpm_init_arrays
1101    IF ( land_surface        )  CALL lsm_init_arrays
1102    IF ( ocean_mode          )  CALL ocean_init_arrays
1103    IF ( salsa               )  CALL salsa_init_arrays
1104    IF ( urban_surface       )  CALL usm_init_arrays
1105    IF ( surface_output      )  CALL surface_data_output_init_arrays
1106    IF ( wind_turbine        )  CALL wtm_init_arrays
1107
1108    IF ( user_module_enabled )  CALL user_init_arrays
1109
1110    IF ( debug_output )  CALL debug_message( 'initializing module-specific arrays', 'end' )
1111
1112
1113 END SUBROUTINE module_interface_init_arrays
1114
1115
1116!--------------------------------------------------------------------------------------------------!
1117! Description:
1118! ------------
1119!> Perform module-specific initialization
1120!--------------------------------------------------------------------------------------------------!
1121 SUBROUTINE module_interface_init
1122
1123
1124    IF ( debug_output )  CALL debug_message( 'module-specific initialization', 'start' )
1125
1126    CALL dynamics_init
1127    CALL tcm_init
1128
1129    IF ( biometeorology      )  CALL bio_init
1130    IF ( bulk_cloud_model    )  CALL bcm_init
1131    IF ( air_chemistry       )  CALL chem_init
1132    IF ( virtual_flight      )  CALL flight_init
1133    IF ( gust_module_enabled )  CALL gust_init
1134    IF ( indoor_model        )  CALL im_init
1135    IF ( particle_advection  )  CALL lpm_init
1136    IF ( large_scale_forcing )  CALL lsf_init
1137    IF ( land_surface        )  CALL lsm_init
1138    IF ( nudging             )  CALL nudge_init
1139    IF ( ocean_mode          )  CALL ocean_init
1140    IF ( plant_canopy        )  CALL pcm_init
1141    IF ( salsa               )  CALL salsa_init
1142    IF ( urban_surface       )  CALL usm_init
1143    IF ( virtual_measurement )  CALL vm_init
1144    IF ( wind_turbine        )  CALL wtm_init
1145    IF ( radiation           )  CALL radiation_init
1146
1147    CALL doq_init
1148
1149    IF ( user_module_enabled )  CALL user_init
1150
1151    IF ( debug_output )  CALL debug_message( 'module-specific initialization', 'end' )
1152
1153 END SUBROUTINE module_interface_init
1154
1155!--------------------------------------------------------------------------------------------------!
1156! Description:
1157! ------------
1158!> Initialize boundary conditions and numerical schemes.
1159!--------------------------------------------------------------------------------------------------!
1160 SUBROUTINE module_interface_init_numerics
1161
1162!
1163!-- Initialize boundary conditions via surface type
1164    CALL init_bc
1165!
1166!-- Calculate wall flag arrays for the multigrid method.
1167!-- Please note, wall flags are only applied in the non-optimized version.
1168    CALL poismg_noopt_init
1169
1170 END SUBROUTINE module_interface_init_numerics
1171
1172
1173!--------------------------------------------------------------------------------------------------!
1174! Description:
1175! ------------
1176!> Initialize data output
1177!--------------------------------------------------------------------------------------------------!
1178 SUBROUTINE module_interface_init_output
1179
1180    INTEGER(iwp) ::  return_value  !< returned status value of called function
1181
1182!
1183!-- Initialize data-output module
1184    CALL dom_init( file_suffix_of_output_group=coupling_char,                                      &
1185                   mpi_comm_of_output_group=comm2d,                                                &
1186                   program_debug_output_unit=9,                                                    &
1187                   debug_output=debug_output )
1188!
1189!-- Define module-specific output quantities
1190    IF ( virtual_measurement )  CALL vm_init_output
1191    IF ( wind_turbine )         CALL wtm_init_output
1192!
1193!-- Leave output-definition state
1194    return_value = dom_def_end()
1195
1196 END SUBROUTINE module_interface_init_output
1197
1198!--------------------------------------------------------------------------------------------------!
1199! Description:
1200! ------------
1201!> Perform module-specific post-initialization checks
1202!--------------------------------------------------------------------------------------------------!
1203 SUBROUTINE module_interface_init_checks
1204
1205
1206    IF ( debug_output )  CALL debug_message( 'module-specific post-initialization checks', 'start' )
1207
1208    CALL dynamics_init_checks
1209
1210    IF ( biometeorology )  CALL bio_init_checks
1211
1212    IF ( debug_output )  CALL debug_message( 'module-specific post-initialization checks', 'end' )
1213
1214
1215 END SUBROUTINE module_interface_init_checks
1216
1217
1218!--------------------------------------------------------------------------------------------------!
1219! Description:
1220! ------------
1221!> Gather module-specific header output
1222!--------------------------------------------------------------------------------------------------!
1223 SUBROUTINE module_interface_header( io )
1224
1225
1226    INTEGER(iwp), INTENT(IN) ::  io  !< unit of the output file
1227
1228
1229    IF ( debug_output )  CALL debug_message( 'module-specific header output', 'start' )
1230
1231    CALL dynamics_header( io )
1232
1233    IF ( biometeorology      )  CALL bio_header ( io )
1234    IF ( bulk_cloud_model    )  CALL bcm_header( io )
1235    IF ( air_chemistry       )  CALL chem_header ( io )
1236    IF ( virtual_flight      )  CALL flight_header( io )
1237    IF ( gust_module_enabled )  CALL gust_header( io )
1238    IF ( particle_advection  )  CALL lpm_header( io )
1239    IF ( land_surface        )  CALL lsm_header( io )
1240    IF ( large_scale_forcing )  CALL lsf_nudging_header( io )
1241    IF ( nesting_offline     )  CALL nesting_offl_header( io )
1242    IF ( ocean_mode          )  CALL ocean_header( io )
1243    IF ( plant_canopy        )  CALL pcm_header( io )
1244    IF ( radiation           )  CALL radiation_header( io )
1245    IF ( salsa               )  CALL salsa_header( io )
1246    IF ( calculate_spectra   )  CALL spectra_header( io )
1247    IF ( syn_turb_gen        )  CALL stg_header( io )
1248
1249    IF ( user_module_enabled )  CALL user_header( io )
1250
1251    IF ( debug_output )  CALL debug_message( 'module-specific header output', 'end' )
1252
1253
1254 END SUBROUTINE module_interface_header
1255
1256
1257!--------------------------------------------------------------------------------------------------!
1258! Description:
1259! ------------
1260!> Perform module-specific actions while in time-integration (vector-optimized)
1261!--------------------------------------------------------------------------------------------------!
1262 SUBROUTINE module_interface_actions( location )
1263
1264
1265    CHARACTER (LEN=*), INTENT(IN) ::  location !< call location string
1266
1267    CALL dynamics_actions( location )
1268    CALL tcm_actions( location )
1269
1270    IF ( bulk_cloud_model    )  CALL bcm_actions( location )
1271    IF ( air_chemistry       )  CALL chem_actions( location )
1272    IF ( gust_module_enabled )  CALL gust_actions( location )
1273    IF ( particle_advection  )  CALL lpm_actions( location )
1274    IF ( ocean_mode          )  CALL ocean_actions( location )
1275    IF ( salsa               )  CALL salsa_actions( location )
1276    IF ( wind_turbine        )  CALL wtm_actions( location )
1277
1278    IF ( user_module_enabled )  CALL user_actions( location )
1279    IF ( vdi_checks          )  CALL vdi_actions( location )
1280
1281
1282 END SUBROUTINE module_interface_actions
1283
1284
1285!--------------------------------------------------------------------------------------------------!
1286! Description:
1287! ------------
1288!> Perform module-specific actions while in time-integration (cache-optimized)
1289!--------------------------------------------------------------------------------------------------!
1290 SUBROUTINE module_interface_actions_ij( i, j, location )
1291
1292    CHARACTER (LEN=*), INTENT(IN) ::  location  !< call location string
1293
1294    INTEGER(iwp),      INTENT(IN) ::  i         !< grid index in x-direction
1295    INTEGER(iwp),      INTENT(IN) ::  j         !< grid index in y-direction
1296
1297    CALL dynamics_actions( i, j, location )
1298    CALL tcm_actions( i, j, location )
1299
1300    IF ( bulk_cloud_model    )  CALL bcm_actions( i, j, location )
1301    IF ( air_chemistry       )  CALL chem_actions( i, j, location )
1302    IF ( gust_module_enabled )  CALL gust_actions( i, j, location )
1303    IF ( ocean_mode          )  CALL ocean_actions( i, j, location )
1304    IF ( salsa               )  CALL salsa_actions( i, j, location )
1305    IF ( wind_turbine        )  CALL wtm_actions( i, j, location )
1306
1307    IF ( user_module_enabled )  CALL user_actions( i, j, location )
1308
1309
1310 END SUBROUTINE module_interface_actions_ij
1311
1312
1313!--------------------------------------------------------------------------------------------------!
1314! Description:
1315! ------------
1316!> Compute module-specific non_advective_processes (vector-optimized)
1317!--------------------------------------------------------------------------------------------------!
1318 SUBROUTINE module_interface_non_advective_processes
1319
1320
1321    CALL dynamics_non_advective_processes
1322
1323    IF ( bulk_cloud_model    )  CALL bcm_non_advective_processes
1324    IF ( air_chemistry       )  CALL chem_non_advective_processes
1325    IF ( salsa               )  CALL salsa_non_advective_processes
1326
1327
1328 END SUBROUTINE module_interface_non_advective_processes
1329
1330
1331!--------------------------------------------------------------------------------------------------!
1332! Description:
1333! ------------
1334!> Compute module-specific non_advective_processes (cache-optimized)
1335!--------------------------------------------------------------------------------------------------!
1336 SUBROUTINE module_interface_non_advective_processes_ij( i, j )
1337
1338
1339    INTEGER(iwp), INTENT(IN) ::  i            !< grid index in x-direction
1340    INTEGER(iwp), INTENT(IN) ::  j            !< grid index in y-direction
1341
1342    CALL dynamics_non_advective_processes( i, j )
1343
1344    IF ( bulk_cloud_model    )  CALL bcm_non_advective_processes( i, j )
1345    IF ( air_chemistry       )  CALL chem_non_advective_processes( i, j )
1346    IF ( salsa               )  CALL salsa_non_advective_processes( i, j )
1347
1348
1349 END SUBROUTINE module_interface_non_advective_processes_ij
1350
1351!--------------------------------------------------------------------------------------------------!
1352! Description:
1353! ------------
1354!> Exchange horiz for module-specific quantities
1355!--------------------------------------------------------------------------------------------------!
1356 SUBROUTINE module_interface_exchange_horiz( location )
1357
1358    CHARACTER (LEN=*), INTENT(IN) ::  location !< call location string
1359
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, local_pf, two_d,     &
1520                                             nzb_do, nzt_do, fill_value )
1521
1522    CHARACTER (LEN=*), INTENT(IN)    ::  mode       !< either 'xy', 'xz' or 'yz'
1523    CHARACTER (LEN=*), INTENT(IN)    ::  variable   !< variable name
1524    CHARACTER (LEN=*), INTENT(INOUT) ::  grid       !< name of vertical grid
1525
1526    INTEGER(iwp),      INTENT(IN)    ::  av         !< flag for (non-)average output
1527    INTEGER(iwp),      INTENT(IN)    ::  nzb_do     !< vertical output index (bottom) (usually 0)
1528    INTEGER(iwp),      INTENT(IN)    ::  nzt_do     !< vertical output index (top) (usually nz_do3d)
1529
1530    LOGICAL,           INTENT(INOUT) ::  found      !< flag if output variable is found
1531    LOGICAL,           INTENT(OUT)   ::  two_d      !< flag for 2D variables
1532
1533    REAL(wp),          INTENT(IN)    ::  fill_value !< to be removed
1534
1535    REAL(wp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do), INTENT(INOUT) ::  local_pf !< ToDo: can also be kind=sp
1536
1537
1538    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 2d data output', 'start' )
1539
1540    CALL dynamics_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do,&
1541                                  fill_value )
1542
1543    IF ( .NOT. found )  THEN
1544       CALL tcm_data_output_2d( av, variable, found, grid, mode, local_pf, nzb_do, nzt_do )
1545    ENDIF
1546
1547    IF ( .NOT. found  .AND.  biometeorology )  THEN
1548       CALL bio_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do )
1549    ENDIF
1550
1551    IF ( .NOT. found  .AND.  bulk_cloud_model )  THEN
1552       CALL bcm_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do )
1553    ENDIF
1554
1555    IF ( .NOT. found  .AND.  air_chemistry )  THEN
1556       CALL chem_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do, &
1557                                 fill_value )
1558    ENDIF
1559
1560    IF ( .NOT. found )  THEN
1561       CALL doq_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do,       &
1562                           fill_value )
1563    ENDIF
1564
1565    IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
1566       CALL gust_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do, &
1567                                 fill_value )
1568    ENDIF
1569
1570    IF ( .NOT. found  .AND.  land_surface )  THEN
1571       CALL lsm_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do )
1572    ENDIF
1573
1574    IF ( .NOT. found  .AND.  ocean_mode )  THEN
1575       CALL ocean_data_output_2d( av, variable, found, grid, mode, local_pf, nzb_do, nzt_do )
1576    ENDIF
1577
1578    IF ( .NOT. found  .AND.  radiation )  THEN
1579       CALL radiation_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do,    &
1580                                      nzt_do, fill_value )
1581    ENDIF
1582
1583    IF ( .NOT. found  .AND.  salsa )  THEN
1584       CALL salsa_data_output_2d( av, variable, found, grid, mode, local_pf, two_d, nzb_do, nzt_do )
1585    ENDIF
1586
1587    IF ( .NOT. found  .AND.  user_module_enabled )  THEN
1588       CALL user_data_output_2d( av, variable, found, grid, local_pf, two_d, nzb_do, nzt_do )
1589    ENDIF
1590
1591    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 2d data output', 'end' )
1592
1593
1594 END SUBROUTINE module_interface_data_output_2d
1595
1596
1597!--------------------------------------------------------------------------------------------------!
1598!
1599! Description:
1600! ------------
1601!> Define module-specific 3D output variables
1602!--------------------------------------------------------------------------------------------------!
1603 SUBROUTINE module_interface_data_output_3d( av, variable, found, local_pf, fill_value, resorted,  &
1604                                             nzb_do, nzt_do )
1605
1606    CHARACTER (LEN=*), INTENT(IN)    ::  variable   !< variable name
1607
1608    INTEGER(iwp),      INTENT(IN)    ::  av         !< flag for (non-)average output
1609    INTEGER(iwp),      INTENT(IN)    ::  nzb_do     !< vertical output index (bottom) (usually 0)
1610    INTEGER(iwp),      INTENT(IN)    ::  nzt_do     !< vertical output index (top) (usually nz_do3d)
1611
1612    LOGICAL,           INTENT(INOUT) ::  found      !< flag if output variable is found
1613    LOGICAL,           INTENT(OUT)   ::  resorted   !< flag if output has been resorted
1614
1615    REAL(wp),          INTENT(IN)    ::  fill_value !< ToDo: refactor
1616
1617    REAL(sp), DIMENSION(nxl:nxr,nys:nyn,nzb_do:nzt_do), INTENT(INOUT) ::  local_pf
1618
1619
1620    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 3d data output', 'start' )
1621
1622    CALL dynamics_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1623    resorted = .FALSE.
1624
1625    IF ( .NOT. found )  THEN
1626       CALL tcm_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1627       resorted = .TRUE.
1628    ENDIF
1629
1630    IF ( .NOT. found  .AND.  biometeorology )  THEN
1631       CALL bio_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1632       resorted = .FALSE.
1633    ENDIF
1634
1635    IF ( .NOT. found  .AND.  bulk_cloud_model )  THEN
1636       CALL bcm_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1637       resorted = .TRUE.
1638    ENDIF
1639
1640    IF ( .NOT. found  .AND.  air_chemistry )  THEN
1641       CALL chem_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1642       resorted = .TRUE.
1643    ENDIF
1644
1645    IF ( .NOT. found )  THEN
1646       CALL doq_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1647       resorted = .TRUE.
1648    ENDIF
1649
1650    IF ( .NOT. found  .AND.  gust_module_enabled )  THEN
1651       CALL gust_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1652       resorted = .TRUE.
1653    ENDIF
1654
1655    IF ( .NOT. found  .AND.  indoor_model )  THEN
1656       CALL im_data_output_3d( av, variable, found, local_pf, fill_value, nzb_do, nzt_do )
1657       resorted = .TRUE.
1658    ENDIF
1659
1660    IF ( .NOT. found  .AND.  ocean_mode )  THEN
1661       CALL ocean_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1662       resorted = .TRUE.
1663    ENDIF
1664
1665    IF ( .NOT. found  .AND.  plant_canopy )  THEN
1666       CALL pcm_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.  radiation )  THEN
1671       CALL radiation_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.  salsa )  THEN
1676       CALL salsa_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1677       resorted = .TRUE.
1678    ENDIF
1679
1680    IF ( .NOT. found  .AND.  user_module_enabled )  THEN
1681       CALL user_data_output_3d( av, variable, found, local_pf, nzb_do, nzt_do )
1682       resorted = .TRUE.
1683    ENDIF
1684
1685    IF ( debug_output_timestep )  CALL debug_message( 'module-specific 3d data output', 'end' )
1686
1687
1688 END SUBROUTINE module_interface_data_output_3d
1689
1690
1691!--------------------------------------------------------------------------------------------------!
1692! Description:
1693! ------------
1694!> Compute module-specific profile and timeseries data
1695!--------------------------------------------------------------------------------------------------!
1696 SUBROUTINE module_interface_statistics( mode, sr, tn, dots_max )
1697
1698
1699    CHARACTER (LEN=*), INTENT(IN) ::  mode     !< statistical analysis mode
1700
1701    INTEGER(iwp),      INTENT(IN) ::  dots_max !< maximum number of timeseries
1702    INTEGER(iwp),      INTENT(IN) ::  sr       !<
1703    INTEGER(iwp),      INTENT(IN) ::  tn       !<
1704
1705
1706    IF ( debug_output_timestep )  CALL debug_message( 'module-specific statistics', 'start' )
1707
1708    CALL dynamics_statistics( mode, sr, tn )
1709    CALL doq_statistics( mode, sr, tn )
1710
1711    IF ( gust_module_enabled )  CALL gust_statistics( mode, sr, tn, dots_max )
1712    IF ( air_chemistry       )  CALL chem_statistics( mode, sr, tn )
1713    IF ( salsa               )  CALL salsa_statistics( mode, sr, tn )
1714
1715    IF ( user_module_enabled )  CALL user_statistics( mode, sr, tn )
1716
1717    IF ( debug_output_timestep )  CALL debug_message( 'module-specific statistics', 'end' )
1718
1719
1720 END SUBROUTINE module_interface_statistics
1721
1722
1723!--------------------------------------------------------------------------------------------------!
1724! Description:
1725! ------------
1726!> Read module-specific restart data in Fortran binary format globaly shared by all MPI ranks
1727!--------------------------------------------------------------------------------------------------!
1728 SUBROUTINE module_interface_rrd_global_ftn( found )
1729
1730
1731    LOGICAL, INTENT(INOUT) ::  found    !< flag if variable was found
1732
1733
1734    IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'start' )
1735
1736    CALL dynamics_rrd_global( found ) ! ToDo: change interface to pass variable
1737
1738    IF ( .NOT. found )  CALL bio_rrd_global( found ) ! ToDo: change interface to pass variable
1739    IF ( .NOT. found )  CALL bcm_rrd_global( found ) ! ToDo: change interface to pass variable
1740    IF ( .NOT. found )  CALL flight_rrd_global( found ) ! ToDo: change interface to pass variable
1741    IF ( .NOT. found )  CALL gust_rrd_global( found ) ! ToDo: change interface to pass variable
1742    IF ( .NOT. found )  CALL lpm_rrd_global( found ) ! ToDo: change interface to pass variable
1743    IF ( .NOT. found )  CALL pcm_rrd_global( found )
1744    IF ( .NOT. found )  CALL ocean_rrd_global( found ) ! ToDo: change interface to pass variable
1745    IF ( .NOT. found )  CALL salsa_rrd_global( found )
1746    IF ( .NOT. found )  CALL stg_rrd_global ( found ) ! ToDo: change interface to pass variable
1747    IF ( .NOT. found )  CALL wtm_rrd_global( found ) ! ToDo: change interface to pass variable
1748    IF ( .NOT. found )  CALL surface_data_output_rrd_global( found )
1749
1750    IF ( .NOT. found )  CALL user_rrd_global( found ) ! ToDo: change interface to pass variable
1751
1752    IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'end' )
1753
1754
1755 END SUBROUTINE module_interface_rrd_global_ftn
1756
1757
1758!--------------------------------------------------------------------------------------------------!
1759! Description:
1760! ------------
1761!> Read module-specific restart data in MPI format globaly shared by all MPI ranks
1762!--------------------------------------------------------------------------------------------------!
1763 SUBROUTINE module_interface_rrd_global_mpi
1764
1765
1766    IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'start' )
1767
1768    CALL dynamics_rrd_global
1769
1770    IF ( biometeorology )       CALL bio_rrd_global
1771    IF ( bulk_cloud_model )     CALL bcm_rrd_global
1772    IF ( virtual_flight )       CALL flight_rrd_global
1773    IF ( gust_module_enabled )  CALL gust_rrd_global
1774    IF ( particle_advection )   CALL lpm_rrd_global
1775    IF ( plant_canopy )         CALL pcm_rrd_global
1776    IF ( ocean_mode )           CALL ocean_rrd_global
1777    IF ( salsa )                CALL salsa_rrd_global
1778    IF ( syn_turb_gen )         CALL stg_rrd_global
1779    IF ( wind_turbine )         CALL wtm_rrd_global
1780    IF ( surface_output )       CALL surface_data_output_rrd_global
1781
1782    IF ( user_module_enabled )  CALL user_rrd_global
1783
1784    IF ( debug_output )  CALL debug_message( 'module-specific read global restart data', 'end' )
1785
1786
1787 END SUBROUTINE module_interface_rrd_global_mpi
1788
1789
1790!--------------------------------------------------------------------------------------------------!
1791! Description:
1792! ------------
1793!> Write module-specific restart data globaly shared by all MPI ranks
1794!--------------------------------------------------------------------------------------------------!
1795 SUBROUTINE module_interface_wrd_global
1796
1797
1798    IF ( debug_output )  CALL debug_message( 'module-specific write global restart data', 'start' )
1799
1800    CALL dynamics_wrd_global
1801
1802    IF ( biometeorology )       CALL bio_wrd_global
1803    IF ( bulk_cloud_model )     CALL bcm_wrd_global
1804    IF ( virtual_flight )       CALL flight_wrd_global
1805    IF ( gust_module_enabled )  CALL gust_wrd_global
1806    IF ( particle_advection )   CALL lpm_wrd_global
1807    IF ( plant_canopy )         CALL pcm_wrd_global
1808    IF ( ocean_mode )           CALL ocean_wrd_global
1809    IF ( salsa )                CALL salsa_wrd_global
1810    IF ( syn_turb_gen )         CALL stg_wrd_global
1811    IF ( wind_turbine )         CALL wtm_wrd_global
1812    IF ( surface_output )       CALL surface_data_output_wrd_global
1813
1814    IF ( user_module_enabled )  CALL user_wrd_global
1815
1816    IF ( debug_output )  CALL debug_message( 'module-specific write global restart data', 'end' )
1817
1818
1819 END SUBROUTINE module_interface_wrd_global
1820
1821
1822!--------------------------------------------------------------------------------------------------!
1823! Description:
1824! ------------
1825!> Read module-specific local restart data arrays (Fortran binary format).
1826!--------------------------------------------------------------------------------------------------!
1827 SUBROUTINE module_interface_rrd_local_ftn( map_index,                                             &
1828                                            nxlf, nxlc, nxl_on_file,                               &
1829                                            nxrf, nxrc, nxr_on_file,                               &
1830                                            nynf, nync, nyn_on_file,                               &
1831                                            nysf, nysc, nys_on_file,                               &
1832                                            tmp_2d, tmp_3d, found )
1833
1834
1835    INTEGER(iwp), INTENT(IN)  ::  map_index    !<
1836    INTEGER(iwp), INTENT(IN)  ::  nxlc         !<
1837    INTEGER(iwp), INTENT(IN)  ::  nxlf         !<
1838    INTEGER(iwp), INTENT(IN)  ::  nxl_on_file  !<
1839    INTEGER(iwp), INTENT(IN)  ::  nxrc         !<
1840    INTEGER(iwp), INTENT(IN)  ::  nxrf         !<
1841    INTEGER(iwp), INTENT(IN)  ::  nxr_on_file  !<
1842    INTEGER(iwp), INTENT(IN)  ::  nync         !<
1843    INTEGER(iwp), INTENT(IN)  ::  nynf         !<
1844    INTEGER(iwp), INTENT(IN)  ::  nyn_on_file  !<
1845    INTEGER(iwp), INTENT(IN)  ::  nysc         !<
1846    INTEGER(iwp), INTENT(IN)  ::  nysf         !<
1847    INTEGER(iwp), INTENT(IN)  ::  nys_on_file  !<
1848
1849    LOGICAL,      INTENT(INOUT) ::  found        !< flag if variable was found
1850
1851    REAL(wp),                                                                                      &
1852       DIMENSION(nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp),             &
1853       INTENT(OUT) :: tmp_2d   !<
1854    REAL(wp),                                                                                      &
1855       DIMENSION(nzb:nzt+1,nys_on_file-nbgp:nyn_on_file+nbgp,nxl_on_file-nbgp:nxr_on_file+nbgp),   &
1856       INTENT(OUT) :: tmp_3d   !<
1857
1858
1859    IF ( debug_output )  THEN
1860       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'start' )
1861    ENDIF
1862
1863    CALL dynamics_rrd_local( map_index,                                                            &
1864                             nxlf, nxlc, nxl_on_file,                                              &
1865                             nxrf, nxrc, nxr_on_file,                                              &
1866                             nynf, nync, nyn_on_file,                                              &
1867                             nysf, nysc, nys_on_file,                                              &
1868                             tmp_2d, tmp_3d, found                                                 &
1869                           ) ! ToDo: change interface to pass variable
1870
1871    IF ( .NOT. found )  CALL bio_rrd_local( found )
1872
1873    IF ( .NOT. found )  CALL bcm_rrd_local( map_index,                                             &
1874                                            nxlf, nxlc, nxl_on_file,                               &
1875                                            nxrf, nxrc, nxr_on_file,                               &
1876                                            nynf, nync, nyn_on_file,                               &
1877                                            nysf, nysc, nys_on_file,                               &
1878                                            tmp_2d, tmp_3d, found                                  &
1879                                          ) ! ToDo: change interface to pass variable
1880
1881    IF ( .NOT. found )  CALL chem_rrd_local( map_index,                                            &
1882                                             nxlf, nxlc, nxl_on_file,                              &
1883                                             nxrf, nxrc, nxr_on_file,                              &
1884                                             nynf, nync, nyn_on_file,                              &
1885                                             nysf, nysc, nys_on_file,                              &
1886                                             tmp_3d, found                                         &
1887                                           ) ! ToDo: change interface to pass variable
1888
1889    IF ( .NOT. found )  CALL doq_rrd_local( 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 gust_rrd_local( map_index,                                            &
1898                                             nxlf, nxlc, nxl_on_file,                              &
1899                                             nxrf, nxrc, nxr_on_file,                              &
1900                                             nynf, nync, nyn_on_file,                              &
1901                                             nysf, nysc, nys_on_file,                              &
1902                                             tmp_2d, tmp_3d, found                                 &
1903                                           ) ! ToDo: change interface to pass variable
1904
1905    IF ( .NOT. found )  CALL lpm_rrd_local( map_index,                                             &
1906                                            nxlf, nxlc, nxl_on_file,                               &
1907                                            nxrf, nxrc, nxr_on_file,                               &
1908                                            nynf, nync, nyn_on_file,                               &
1909                                            nysf, nysc, nys_on_file,                               &
1910                                            tmp_3d, found                                          &
1911                                          ) ! ToDo: change interface to pass variable
1912
1913    IF ( .NOT. found )  CALL lsm_rrd_local( map_index,                                             &
1914                                            nxlf, nxlc, nxl_on_file,                               &
1915                                            nxrf, nxrc, nxr_on_file,                               &
1916                                            nynf, nync, nyn_on_file,                               &
1917                                            nysf, nysc, nys_on_file,                               &
1918                                            tmp_2d, found                                          &
1919                                          ) ! ToDo: change interface to pass variable
1920
1921     IF ( .NOT. found )  CALL pcm_rrd_local( map_index,                                            &
1922                                             nxlf, nxlc, nxl_on_file,                              &
1923                                             nxrf, nxrc, nxr_on_file,                              &
1924                                             nynf, nync, nyn_on_file,                              &
1925                                             nysf, nysc, nys_on_file,                              &
1926                                             found                                                 &
1927                                           )
1928
1929    IF ( .NOT. found )  CALL ocean_rrd_local( map_index,                                           &
1930                                              nxlf, nxlc, nxl_on_file,                             &
1931                                              nxrf, nxrc, nxr_on_file,                             &
1932                                              nynf, nync, nyn_on_file,                             &
1933                                              nysf, nysc, nys_on_file,                             &
1934                                              tmp_3d, found                                        &
1935                                            ) ! ToDo: change interface to pass variable
1936
1937    IF ( .NOT. found )  CALL radiation_rrd_local( map_index,                                       &
1938                                                  nxlf, nxlc, nxl_on_file,                         &
1939                                                  nxrf, nxrc, nxr_on_file,                         &
1940                                                  nynf, nync, nyn_on_file,                         &
1941                                                  nysf, nysc, nys_on_file,                         &
1942                                                  tmp_2d, tmp_3d, found                            &
1943                                                ) ! ToDo: change interface to pass variable
1944
1945    IF ( .NOT. found )  CALL salsa_rrd_local( map_index,                                           &
1946                                              nxlf, nxlc, nxl_on_file,                             &
1947                                              nxrf, nxrc, nxr_on_file,                             &
1948                                              nynf, nync, nyn_on_file,                             &
1949                                              nysf, nysc, nys_on_file,                             &
1950                                              tmp_3d, found                                        &
1951                                            ) ! ToDo: change interface to pass variable
1952
1953    IF ( .NOT. found )  CALL usm_rrd_local( map_index,                                             &
1954                                            nxlf, nxlc, nxl_on_file,                               &
1955                                            nxrf, nxr_on_file,                                     &
1956                                            nynf, nyn_on_file,                                     &
1957                                            nysf, nysc, nys_on_file,                               &
1958                                            found                                                  &
1959                                          ) ! ToDo: change interface to pass variable
1960!
1961!-- Surface data do not need overlap data, so do not pass these information.
1962    IF ( .NOT. found )  CALL surface_data_output_rrd_local( found )
1963
1964    IF ( .NOT. found )  CALL user_rrd_local( map_index,                                            &
1965                                             nxlf, nxlc, nxl_on_file,                              &
1966                                             nxrf, nxrc, nxr_on_file,                              &
1967                                             nynf, nync, nyn_on_file,                              &
1968                                             nysf, nysc, nys_on_file,                              &
1969                                             tmp_3d, found                                         &
1970                                           ) ! ToDo: change interface to pass variable
1971
1972    IF ( debug_output )  THEN
1973       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'end' )
1974    ENDIF
1975
1976 END SUBROUTINE module_interface_rrd_local_ftn
1977
1978
1979!--------------------------------------------------------------------------------------------------!
1980! Description:
1981! ------------
1982!> Read module-specific local restart data arrays (MPI-IO).
1983!--------------------------------------------------------------------------------------------------!
1984 SUBROUTINE module_interface_rrd_local_mpi
1985
1986    IF ( debug_output )  THEN
1987       CALL debug_message( 'module-specific read local restart data (MPI-IO)', 'start' )
1988    ENDIF
1989
1990    CALL dynamics_rrd_local
1991
1992    IF ( biometeorology )       CALL bio_rrd_local
1993    IF ( bulk_cloud_model )     CALL bcm_rrd_local
1994    IF ( air_chemistry )        CALL chem_rrd_local
1995    CALL doq_rrd_local
1996    IF ( gust_module_enabled )  CALL gust_rrd_local
1997    IF ( particle_advection )   CALL lpm_rrd_local
1998    IF ( land_surface )         CALL lsm_rrd_local
1999    IF ( plant_canopy )         CALL pcm_rrd_local
2000    IF ( ocean_mode )           CALL ocean_rrd_local
2001    IF ( radiation )            CALL radiation_rrd_local
2002    IF ( salsa )                CALL salsa_rrd_local
2003    IF ( urban_surface )        CALL usm_rrd_local
2004    IF ( surface_output )       CALL surface_data_output_rrd_local
2005
2006    IF ( user_module_enabled )  CALL user_rrd_local
2007
2008    IF ( debug_output )  THEN
2009       CALL debug_message( 'module-specific read local restart data (Fortran binary)', 'end' )
2010    ENDIF
2011
2012 END SUBROUTINE module_interface_rrd_local_mpi
2013
2014
2015!--------------------------------------------------------------------------------------------------!
2016! Description:
2017! ------------
2018!> Write module-specific restart data specific to local MPI ranks
2019!--------------------------------------------------------------------------------------------------!
2020 SUBROUTINE module_interface_wrd_local
2021
2022
2023    IF ( debug_output )  CALL debug_message( 'module-specific write local restart data', 'start' )
2024
2025    CALL dynamics_wrd_local
2026
2027    IF ( biometeorology )       CALL bio_wrd_local
2028    IF ( bulk_cloud_model )     CALL bcm_wrd_local
2029    IF ( air_chemistry )        CALL chem_wrd_local
2030    CALL doq_wrd_local
2031    IF ( gust_module_enabled )  CALL gust_wrd_local
2032    IF ( particle_advection )   CALL lpm_wrd_local
2033    IF ( land_surface )         CALL lsm_wrd_local
2034    IF ( plant_canopy )         CALL pcm_wrd_local
2035    IF ( ocean_mode )           CALL ocean_wrd_local
2036    IF ( radiation )            CALL radiation_wrd_local
2037    IF ( salsa )                CALL salsa_wrd_local
2038    IF ( urban_surface )        CALL usm_wrd_local
2039    IF ( surface_output )       CALL surface_data_output_wrd_local
2040
2041    IF ( user_module_enabled )  CALL user_wrd_local
2042
2043    IF ( debug_output )  CALL debug_message( 'module-specific write local restart data', 'end' )
2044
2045
2046 END SUBROUTINE module_interface_wrd_local
2047
2048
2049!--------------------------------------------------------------------------------------------------!
2050! Description:
2051! ------------
2052!> Perform module-specific last actions before the program terminates
2053!--------------------------------------------------------------------------------------------------!
2054 SUBROUTINE module_interface_last_actions
2055
2056    INTEGER ::  return_value  !< returned status value of a called function
2057
2058
2059    IF ( debug_output )  CALL debug_message( 'module-specific last actions', 'start' )
2060
2061    return_value = dom_finalize_output()
2062
2063    CALL dynamics_last_actions
2064
2065    IF ( user_module_enabled )  CALL user_last_actions
2066
2067    IF ( debug_output )  CALL debug_message( 'module-specific last actions', 'end' )
2068
2069
2070 END SUBROUTINE module_interface_last_actions
2071
2072
2073 END MODULE module_interface
Note: See TracBrowser for help on using the repository browser.