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

Last change on this file since 4306 was 4281, checked in by schwenkel, 4 years ago

Moved boundary_conds to dynamics module

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