[1682] | 1 | !> @file palm.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[1036] | 3 | ! This file is part of PALM. |
---|
| 4 | ! |
---|
[2000] | 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. |
---|
[1036] | 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 | ! |
---|
[2101] | 17 | ! Copyright 1997-2017 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[2233] | 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: palm.f90 2233 2017-05-30 18:08:54Z sward $ |
---|
| 27 | ! |
---|
| 28 | ! 2232 2017-05-30 17:47:52Z suehring |
---|
[2232] | 29 | ! Renamed wall_flags_0 and wall_flags_00 into advc_flags_1 and advc_flags_2, |
---|
| 30 | ! respectively, within copyin statement. Moreover, introduced further flag |
---|
| 31 | ! array wall_flags_0. |
---|
| 32 | ! Remove unused variables from ONLY list. |
---|
[1834] | 33 | ! |
---|
[2179] | 34 | ! 2178 2017-03-17 11:07:39Z hellstea |
---|
| 35 | ! Calls for pmci_ensure_nest_mass_conservation and pres are added after |
---|
| 36 | ! the nest initialization |
---|
| 37 | ! |
---|
[2119] | 38 | ! 2118 2017-01-17 16:38:49Z raasch |
---|
| 39 | ! OpenACC directives and related code removed |
---|
| 40 | ! |
---|
[2012] | 41 | ! 2011 2016-09-19 17:29:57Z kanani |
---|
| 42 | ! Flag urban_surface is now defined in module control_parameters. |
---|
| 43 | ! |
---|
[2008] | 44 | ! 2007 2016-08-24 15:47:17Z kanani |
---|
| 45 | ! Temporarily added CALL for writing of restart data for urban surface model |
---|
| 46 | ! |
---|
[2001] | 47 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 48 | ! Forced header and separation lines into 80 columns |
---|
| 49 | ! |
---|
[1977] | 50 | ! 1976 2016-07-27 13:28:04Z maronga |
---|
| 51 | ! Added call to radiation_last_actions for binary output of land surface model |
---|
| 52 | ! data |
---|
| 53 | ! |
---|
[1973] | 54 | ! 1972 2016-07-26 07:52:02Z maronga |
---|
| 55 | ! Added call to lsm_last_actions for binary output of land surface model data |
---|
| 56 | ! |
---|
[1961] | 57 | ! 1960 2016-07-12 16:34:24Z suehring |
---|
| 58 | ! Separate humidity and passive scalar |
---|
| 59 | ! |
---|
[1933] | 60 | ! 1834 2016-04-07 14:34:20Z raasch |
---|
| 61 | ! Initial version of purely vertical nesting introduced. |
---|
| 62 | ! |
---|
[1834] | 63 | ! 1833 2016-04-07 14:23:03Z raasch |
---|
| 64 | ! required user interface version changed |
---|
| 65 | ! |
---|
[1809] | 66 | ! 1808 2016-04-05 19:44:00Z raasch |
---|
| 67 | ! routine local_flush replaced by FORTRAN statement |
---|
| 68 | ! |
---|
[1784] | 69 | ! 1783 2016-03-06 18:36:17Z raasch |
---|
| 70 | ! required user interface version changed |
---|
| 71 | ! |
---|
[1782] | 72 | ! 1781 2016-03-03 15:12:23Z raasch |
---|
| 73 | ! pmc initialization moved from time_integration to here |
---|
| 74 | ! |
---|
[1780] | 75 | ! 1779 2016-03-03 08:01:28Z raasch |
---|
| 76 | ! setting of nest_domain and coupling_char moved to the pmci |
---|
| 77 | ! |
---|
[1765] | 78 | ! 1764 2016-02-28 12:45:19Z raasch |
---|
| 79 | ! cpp-statements for nesting removed, communicator settings cleaned up |
---|
| 80 | ! |
---|
[1763] | 81 | ! 1762 2016-02-25 12:31:13Z hellstea |
---|
| 82 | ! Introduction of nested domain feature |
---|
| 83 | ! |
---|
[1748] | 84 | ! 1747 2016-02-08 12:25:53Z raasch |
---|
| 85 | ! OpenACC-adjustment for new surface layer parameterization |
---|
| 86 | ! |
---|
[1683] | 87 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 88 | ! Code annotations made doxygen readable |
---|
| 89 | ! |
---|
[1669] | 90 | ! 1668 2015-09-23 13:45:36Z raasch |
---|
| 91 | ! warning replaced by abort in case of failed user interface check |
---|
| 92 | ! |
---|
[1667] | 93 | ! 1666 2015-09-23 07:31:10Z raasch |
---|
| 94 | ! check for user's interface version added |
---|
| 95 | ! |
---|
[1483] | 96 | ! 1482 2014-10-18 12:34:45Z raasch |
---|
| 97 | ! adjustments for using CUDA-aware OpenMPI |
---|
| 98 | ! |
---|
[1469] | 99 | ! 1468 2014-09-24 14:06:57Z maronga |
---|
| 100 | ! Adapted for use on up to 6-digit processor cores |
---|
| 101 | ! |
---|
[1403] | 102 | ! 1402 2014-05-09 14:25:13Z raasch |
---|
| 103 | ! location messages added |
---|
| 104 | ! |
---|
[1375] | 105 | ! 1374 2014-04-25 12:55:07Z raasch |
---|
| 106 | ! bugfix: various modules added |
---|
| 107 | ! |
---|
[1321] | 108 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
[1320] | 109 | ! ONLY-attribute added to USE-statements, |
---|
| 110 | ! kind-parameters added to all INTEGER and REAL declaration statements, |
---|
| 111 | ! kinds are defined in new module kinds, |
---|
| 112 | ! old module precision_kind is removed, |
---|
| 113 | ! revision history before 2012 removed, |
---|
| 114 | ! comment fields (!:) to be used for variable explanations added to |
---|
| 115 | ! all variable declaration statements |
---|
[77] | 116 | ! |
---|
[1319] | 117 | ! 1318 2014-03-17 13:35:16Z raasch |
---|
| 118 | ! module interfaces removed |
---|
| 119 | ! |
---|
[1242] | 120 | ! 1241 2013-10-30 11:36:58Z heinze |
---|
| 121 | ! initialization of nuding and large scale forcing from external file |
---|
| 122 | ! |
---|
[1222] | 123 | ! 1221 2013-09-10 08:59:13Z raasch |
---|
| 124 | ! +wall_flags_00, rflags_invers, rflags_s_inner in copyin statement |
---|
| 125 | ! |
---|
[1213] | 126 | ! 1212 2013-08-15 08:46:27Z raasch |
---|
| 127 | ! +tri in copyin statement |
---|
| 128 | ! |
---|
[1182] | 129 | ! 1179 2013-06-14 05:57:58Z raasch |
---|
| 130 | ! ref_state added to copyin-list |
---|
| 131 | ! |
---|
[1114] | 132 | ! 1113 2013-03-10 02:48:14Z raasch |
---|
| 133 | ! openACC statements modified |
---|
| 134 | ! |
---|
[1112] | 135 | ! 1111 2013-03-08 23:54:10Z raasch |
---|
| 136 | ! openACC statements updated |
---|
| 137 | ! |
---|
[1093] | 138 | ! 1092 2013-02-02 11:24:22Z raasch |
---|
| 139 | ! unused variables removed |
---|
| 140 | ! |
---|
[1037] | 141 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 142 | ! code put under GPL (PALM 3.9) |
---|
| 143 | ! |
---|
[1017] | 144 | ! 1015 2012-09-27 09:23:24Z raasch |
---|
[863] | 145 | ! Version number changed from 3.8 to 3.8a. |
---|
[1017] | 146 | ! OpenACC statements added + code changes required for GPU optimization |
---|
[863] | 147 | ! |
---|
[850] | 148 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 149 | ! write_particles renamed lpm_write_restart_file |
---|
| 150 | ! |
---|
[1] | 151 | ! Revision 1.1 1997/07/24 11:23:35 raasch |
---|
| 152 | ! Initial revision |
---|
| 153 | ! |
---|
| 154 | ! |
---|
| 155 | ! Description: |
---|
| 156 | ! ------------ |
---|
[1682] | 157 | !> Large-Eddy Simulation (LES) model for the convective boundary layer, |
---|
| 158 | !> optimized for use on parallel machines (implementation realized using the |
---|
| 159 | !> Message Passing Interface (MPI)). The model can also be run on vector machines |
---|
| 160 | !> (less well optimized) and workstations. Versions for the different types of |
---|
| 161 | !> machines are controlled via cpp-directives. |
---|
| 162 | !> Model runs are only feasible using the ksh-script mrun. |
---|
[1976] | 163 | !> |
---|
| 164 | !> @todo create routine last_actions instead of calling lsm_last_actions etc. |
---|
[2007] | 165 | !> @todo eventually move CALL usm_write_restart_data to suitable location |
---|
[1] | 166 | !------------------------------------------------------------------------------! |
---|
[1682] | 167 | PROGRAM palm |
---|
| 168 | |
---|
[1] | 169 | |
---|
[1374] | 170 | USE arrays_3d |
---|
[1] | 171 | |
---|
[1320] | 172 | USE control_parameters, & |
---|
[2232] | 173 | |
---|
[2178] | 174 | ONLY: cloud_physics, constant_diffusion, coupling_char, coupling_mode,& |
---|
[2177] | 175 | do2d_at_begin, do3d_at_begin, humidity, initializing_actions, & |
---|
[2232] | 176 | land_surface, io_blocks, io_group, & |
---|
[2178] | 177 | large_scale_forcing, message_string, microphysics_seifert, & |
---|
| 178 | nest_domain, neutral, & |
---|
[1933] | 179 | nudging, passive_scalar, simulated_time, simulated_time_chr, & |
---|
[2011] | 180 | urban_surface, & |
---|
[1666] | 181 | user_interface_current_revision, & |
---|
| 182 | user_interface_required_revision, version, wall_heatflux, & |
---|
| 183 | write_binary |
---|
[1320] | 184 | |
---|
| 185 | USE cpulog, & |
---|
| 186 | ONLY: cpu_log, log_point, cpu_statistics |
---|
| 187 | |
---|
[1374] | 188 | USE indices, & |
---|
[2232] | 189 | ONLY: nbgp |
---|
[1374] | 190 | |
---|
[1320] | 191 | USE kinds |
---|
| 192 | |
---|
[1972] | 193 | USE land_surface_model_mod, & |
---|
[2232] | 194 | ONLY: lsm_last_actions |
---|
[1972] | 195 | |
---|
[1320] | 196 | USE ls_forcing_mod, & |
---|
| 197 | ONLY: init_ls_forcing |
---|
| 198 | |
---|
| 199 | USE nudge_mod, & |
---|
| 200 | ONLY: init_nudge |
---|
| 201 | |
---|
| 202 | USE particle_attributes, & |
---|
| 203 | ONLY: particle_advection |
---|
| 204 | |
---|
[1] | 205 | USE pegrid |
---|
| 206 | |
---|
[1762] | 207 | USE pmc_interface, & |
---|
[1933] | 208 | ONLY: cpl_id, nested_run, pmci_child_initialize, pmci_init, & |
---|
[2178] | 209 | pmci_modelconfiguration, pmci_parent_initialize, & |
---|
| 210 | pmci_ensure_nest_mass_conservation |
---|
[1762] | 211 | |
---|
[1976] | 212 | USE radiation_model_mod, & |
---|
| 213 | ONLY: radiation, radiation_last_actions |
---|
[2232] | 214 | |
---|
[2007] | 215 | USE urban_surface_mod, & |
---|
[2011] | 216 | ONLY: usm_write_restart_data |
---|
[1747] | 217 | |
---|
[1] | 218 | IMPLICIT NONE |
---|
| 219 | |
---|
| 220 | ! |
---|
| 221 | !-- Local variables |
---|
[1682] | 222 | CHARACTER(LEN=9) :: time_to_string !< |
---|
| 223 | CHARACTER(LEN=10) :: env_string !< to store string of environment var |
---|
| 224 | INTEGER(iwp) :: env_stat !< to hold status of GET_ENV |
---|
| 225 | INTEGER(iwp) :: i !< |
---|
| 226 | INTEGER(iwp) :: myid_openmpi !< OpenMPI local rank for CUDA aware MPI |
---|
[1] | 227 | |
---|
[1539] | 228 | version = 'PALM 4.0' |
---|
[1833] | 229 | user_interface_required_revision = 'r1819' |
---|
[75] | 230 | |
---|
[1] | 231 | #if defined( __parallel ) |
---|
| 232 | ! |
---|
| 233 | !-- MPI initialisation. comm2d is preliminary set, because |
---|
| 234 | !-- it will be defined in init_pegrid but is used before in cpu_log. |
---|
| 235 | CALL MPI_INIT( ierr ) |
---|
[1762] | 236 | |
---|
| 237 | ! |
---|
| 238 | !-- Initialize the coupling for nested-domain runs |
---|
[1764] | 239 | !-- comm_palm is the communicator which includes all PEs (MPI processes) |
---|
| 240 | !-- available for this (nested) model. If it is not a nested run, comm_palm |
---|
| 241 | !-- is returned as MPI_COMM_WORLD |
---|
[1762] | 242 | CALL pmci_init( comm_palm ) |
---|
| 243 | comm2d = comm_palm |
---|
[1764] | 244 | ! |
---|
| 245 | !-- Get the (preliminary) number of MPI processes and the local PE-id (in case |
---|
| 246 | !-- of a further communicator splitting in init_coupling, these numbers will |
---|
| 247 | !-- be changed in init_pegrid). |
---|
| 248 | IF ( nested_run ) THEN |
---|
[1762] | 249 | |
---|
[1764] | 250 | CALL MPI_COMM_SIZE( comm_palm, numprocs, ierr ) |
---|
| 251 | CALL MPI_COMM_RANK( comm_palm, myid, ierr ) |
---|
[1762] | 252 | |
---|
[1764] | 253 | ELSE |
---|
| 254 | |
---|
| 255 | CALL MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr ) |
---|
| 256 | CALL MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr ) |
---|
[1] | 257 | ! |
---|
[1764] | 258 | !-- Initialize PE topology in case of coupled atmosphere-ocean runs (comm_palm |
---|
| 259 | !-- will be splitted in init_coupling) |
---|
| 260 | CALL init_coupling |
---|
| 261 | ENDIF |
---|
[102] | 262 | #endif |
---|
| 263 | |
---|
| 264 | ! |
---|
[1] | 265 | !-- Initialize measuring of the CPU-time remaining to the run |
---|
| 266 | CALL local_tremain_ini |
---|
| 267 | |
---|
| 268 | ! |
---|
| 269 | !-- Start of total CPU time measuring. |
---|
| 270 | CALL cpu_log( log_point(1), 'total', 'start' ) |
---|
| 271 | CALL cpu_log( log_point(2), 'initialisation', 'start' ) |
---|
| 272 | |
---|
| 273 | ! |
---|
[206] | 274 | !-- Open a file for debug output |
---|
[1468] | 275 | WRITE (myid_char,'(''_'',I6.6)') myid |
---|
[206] | 276 | OPEN( 9, FILE='DEBUG'//TRIM( coupling_char )//myid_char, FORM='FORMATTED' ) |
---|
| 277 | |
---|
| 278 | ! |
---|
[1] | 279 | !-- Initialize dvrp logging. Also, one PE maybe split from the global |
---|
| 280 | !-- communicator for doing the dvrp output. In that case, the number of |
---|
| 281 | !-- PEs available for PALM is reduced by one and communicator comm_palm |
---|
| 282 | !-- is changed respectively. |
---|
| 283 | #if defined( __parallel ) |
---|
| 284 | CALL MPI_COMM_RANK( comm_palm, myid, ierr ) |
---|
| 285 | ! |
---|
[102] | 286 | !-- TEST OUTPUT (TO BE REMOVED) |
---|
| 287 | WRITE(9,*) '*** coupling_mode = "', TRIM( coupling_mode ), '"' |
---|
[1808] | 288 | FLUSH( 9 ) |
---|
[215] | 289 | IF ( TRIM( coupling_mode ) /= 'uncoupled' ) THEN |
---|
| 290 | PRINT*, '*** PE', myid, ' Global target PE:', target_id, & |
---|
| 291 | TRIM( coupling_mode ) |
---|
| 292 | ENDIF |
---|
[102] | 293 | #endif |
---|
| 294 | |
---|
[108] | 295 | CALL init_dvrp_logging |
---|
| 296 | |
---|
[102] | 297 | ! |
---|
[108] | 298 | !-- Read control parameters from NAMELIST files and read environment-variables |
---|
| 299 | CALL parin |
---|
| 300 | |
---|
| 301 | ! |
---|
[1666] | 302 | !-- Check for the user's interface version |
---|
| 303 | IF ( user_interface_current_revision /= user_interface_required_revision ) & |
---|
| 304 | THEN |
---|
| 305 | message_string = 'current user-interface revision "' // & |
---|
| 306 | TRIM( user_interface_current_revision ) // '" does ' // & |
---|
| 307 | 'not match the required revision ' // & |
---|
| 308 | TRIM( user_interface_required_revision ) |
---|
[1668] | 309 | CALL message( 'palm', 'PA0169', 1, 2, 0, 6, 0 ) |
---|
[1666] | 310 | ENDIF |
---|
| 311 | |
---|
| 312 | ! |
---|
[108] | 313 | !-- Determine processor topology and local array indices |
---|
| 314 | CALL init_pegrid |
---|
| 315 | |
---|
| 316 | ! |
---|
[1] | 317 | !-- Generate grid parameters |
---|
| 318 | CALL init_grid |
---|
| 319 | |
---|
| 320 | ! |
---|
[1241] | 321 | !-- Initialize nudging if required |
---|
| 322 | IF ( nudging ) THEN |
---|
| 323 | CALL init_nudge |
---|
| 324 | ENDIF |
---|
| 325 | |
---|
| 326 | ! |
---|
| 327 | !-- Initialize reading of large scale forcing from external file - if required |
---|
| 328 | IF ( large_scale_forcing ) THEN |
---|
| 329 | CALL init_ls_forcing |
---|
| 330 | ENDIF |
---|
| 331 | |
---|
| 332 | ! |
---|
[1] | 333 | !-- Check control parameters and deduce further quantities |
---|
| 334 | CALL check_parameters |
---|
| 335 | |
---|
| 336 | ! |
---|
| 337 | !-- Initialize all necessary variables |
---|
| 338 | CALL init_3d_model |
---|
| 339 | |
---|
| 340 | ! |
---|
[1762] | 341 | !-- Coupling protocol setup for nested-domain runs |
---|
[1764] | 342 | IF ( nested_run ) THEN |
---|
| 343 | CALL pmci_modelconfiguration |
---|
[1781] | 344 | ! |
---|
[1933] | 345 | !-- Receive and interpolate initial data on children. |
---|
| 346 | !-- Child initialization must be made first if the model is both child and |
---|
[2177] | 347 | !-- parent if necessary |
---|
| 348 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
| 349 | CALL pmci_child_initialize |
---|
[1781] | 350 | ! |
---|
[2177] | 351 | !-- Send initial condition data from parent to children |
---|
| 352 | CALL pmci_parent_initialize |
---|
[1781] | 353 | ! |
---|
| 354 | !-- Exchange_horiz is needed after the nest initialization |
---|
[2178] | 355 | IF ( nest_domain ) THEN |
---|
| 356 | CALL exchange_horiz( u, nbgp ) |
---|
| 357 | CALL exchange_horiz( v, nbgp ) |
---|
| 358 | CALL exchange_horiz( w, nbgp ) |
---|
| 359 | IF ( .NOT. neutral ) THEN |
---|
| 360 | CALL exchange_horiz( pt, nbgp ) |
---|
| 361 | ENDIF |
---|
| 362 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e, nbgp ) |
---|
| 363 | IF ( humidity ) THEN |
---|
| 364 | CALL exchange_horiz( q, nbgp ) |
---|
| 365 | IF ( cloud_physics .AND. microphysics_seifert ) THEN |
---|
| 366 | ! CALL exchange_horiz( qc, nbgp ) |
---|
| 367 | CALL exchange_horiz( qr, nbgp ) |
---|
| 368 | ! CALL exchange_horiz( nc, nbgp ) |
---|
| 369 | CALL exchange_horiz( nr, nbgp ) |
---|
| 370 | ENDIF |
---|
| 371 | ENDIF |
---|
| 372 | IF ( passive_scalar ) CALL exchange_horiz( s, nbgp ) |
---|
| 373 | |
---|
| 374 | CALL pmci_ensure_nest_mass_conservation |
---|
| 375 | CALL pres |
---|
[1933] | 376 | ENDIF |
---|
[1781] | 377 | ENDIF |
---|
| 378 | |
---|
[1764] | 379 | ENDIF |
---|
[1762] | 380 | |
---|
| 381 | ! |
---|
[1] | 382 | !-- Output of program header |
---|
| 383 | IF ( myid == 0 ) CALL header |
---|
| 384 | |
---|
| 385 | CALL cpu_log( log_point(2), 'initialisation', 'stop' ) |
---|
| 386 | |
---|
| 387 | ! |
---|
| 388 | !-- Set start time in format hh:mm:ss |
---|
| 389 | simulated_time_chr = time_to_string( simulated_time ) |
---|
| 390 | |
---|
| 391 | ! |
---|
| 392 | !-- If required, output of initial arrays |
---|
| 393 | IF ( do2d_at_begin ) THEN |
---|
| 394 | CALL data_output_2d( 'xy', 0 ) |
---|
| 395 | CALL data_output_2d( 'xz', 0 ) |
---|
| 396 | CALL data_output_2d( 'yz', 0 ) |
---|
| 397 | ENDIF |
---|
[1976] | 398 | |
---|
[1] | 399 | IF ( do3d_at_begin ) THEN |
---|
| 400 | CALL data_output_3d( 0 ) |
---|
| 401 | ENDIF |
---|
| 402 | |
---|
| 403 | ! |
---|
[495] | 404 | !-- Integration of the model equations using timestep-scheme |
---|
[1] | 405 | CALL time_integration |
---|
| 406 | |
---|
| 407 | ! |
---|
[495] | 408 | !-- If required, write binary data for restart runs |
---|
| 409 | IF ( write_binary(1:4) == 'true' ) THEN |
---|
[759] | 410 | |
---|
| 411 | CALL cpu_log( log_point(22), 'write_3d_binary', 'start' ) |
---|
| 412 | |
---|
[1402] | 413 | CALL location_message( 'writing restart data', .FALSE. ) |
---|
| 414 | |
---|
[759] | 415 | CALL check_open( 14 ) |
---|
| 416 | |
---|
| 417 | DO i = 0, io_blocks-1 |
---|
| 418 | IF ( i == io_group ) THEN |
---|
[1] | 419 | ! |
---|
[759] | 420 | !-- Write flow field data |
---|
| 421 | CALL write_3d_binary |
---|
| 422 | ENDIF |
---|
| 423 | #if defined( __parallel ) |
---|
| 424 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 425 | #endif |
---|
| 426 | ENDDO |
---|
| 427 | |
---|
[1402] | 428 | CALL location_message( 'finished', .TRUE. ) |
---|
| 429 | |
---|
[759] | 430 | CALL cpu_log( log_point(22), 'write_3d_binary', 'stop' ) |
---|
| 431 | |
---|
[495] | 432 | ! |
---|
| 433 | !-- If required, write particle data |
---|
[849] | 434 | IF ( particle_advection ) CALL lpm_write_restart_file |
---|
[2007] | 435 | ! |
---|
| 436 | !-- If required, write urban surface data |
---|
| 437 | IF (urban_surface) CALL usm_write_restart_data |
---|
| 438 | |
---|
[495] | 439 | ENDIF |
---|
[1] | 440 | |
---|
| 441 | ! |
---|
| 442 | !-- If required, repeat output of header including the required CPU-time |
---|
| 443 | IF ( myid == 0 ) CALL header |
---|
| 444 | ! |
---|
[1972] | 445 | !-- If required, final land surface and user-defined actions, and |
---|
[1] | 446 | !-- last actions on the open files and close files. Unit 14 was opened |
---|
| 447 | !-- in write_3d_binary but it is closed here, to allow writing on this |
---|
| 448 | !-- unit in routine user_last_actions. |
---|
| 449 | CALL cpu_log( log_point(4), 'last actions', 'start' ) |
---|
[759] | 450 | DO i = 0, io_blocks-1 |
---|
| 451 | IF ( i == io_group ) THEN |
---|
[1972] | 452 | IF ( land_surface ) THEN |
---|
| 453 | CALL lsm_last_actions |
---|
| 454 | ENDIF |
---|
[1976] | 455 | IF ( radiation ) THEN |
---|
| 456 | CALL radiation_last_actions |
---|
| 457 | ENDIF |
---|
[759] | 458 | CALL user_last_actions |
---|
| 459 | IF ( write_binary(1:4) == 'true' ) CALL close_file( 14 ) |
---|
| 460 | ENDIF |
---|
| 461 | #if defined( __parallel ) |
---|
| 462 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
| 463 | #endif |
---|
| 464 | ENDDO |
---|
[1] | 465 | CALL close_file( 0 ) |
---|
| 466 | CALL close_dvrp |
---|
| 467 | CALL cpu_log( log_point(4), 'last actions', 'stop' ) |
---|
| 468 | |
---|
[102] | 469 | #if defined( __mpi2 ) |
---|
[1] | 470 | ! |
---|
[206] | 471 | !-- Test exchange via intercommunicator in case of a MPI-2 coupling |
---|
[102] | 472 | IF ( coupling_mode == 'atmosphere_to_ocean' ) THEN |
---|
| 473 | i = 12345 + myid |
---|
| 474 | CALL MPI_SEND( i, 1, MPI_INTEGER, myid, 11, comm_inter, ierr ) |
---|
| 475 | ELSEIF ( coupling_mode == 'ocean_to_atmosphere' ) THEN |
---|
| 476 | CALL MPI_RECV( i, 1, MPI_INTEGER, myid, 11, comm_inter, status, ierr ) |
---|
| 477 | PRINT*, '### myid: ', myid, ' received from atmosphere: i = ', i |
---|
| 478 | ENDIF |
---|
| 479 | #endif |
---|
| 480 | |
---|
| 481 | ! |
---|
[1] | 482 | !-- Take final CPU-time for CPU-time analysis |
---|
| 483 | CALL cpu_log( log_point(1), 'total', 'stop' ) |
---|
| 484 | CALL cpu_statistics |
---|
| 485 | |
---|
| 486 | #if defined( __parallel ) |
---|
| 487 | CALL MPI_FINALIZE( ierr ) |
---|
| 488 | #endif |
---|
| 489 | |
---|
| 490 | END PROGRAM palm |
---|