[4017] | 1 | ! !> @file palm.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 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 | ! |
---|
[4360] | 17 | ! Copyright 1997-2020 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[484] | 20 | ! Current revisions: |
---|
[1] | 21 | ! ----------------- |
---|
[2233] | 22 | ! |
---|
| 23 | ! |
---|
| 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: palm.f90 4496 2020-04-15 08:37:26Z monakurppa $ |
---|
[4496] | 27 | ! bugfix: coupling character added to restart output filename |
---|
| 28 | ! |
---|
| 29 | ! 4495 2020-04-13 20:11:20Z raasch |
---|
[4495] | 30 | ! restart data handling with MPI-IO added |
---|
| 31 | ! |
---|
| 32 | ! 4457 2020-03-11 14:20:43Z raasch |
---|
[4457] | 33 | ! use statement for exchange horiz added |
---|
| 34 | ! |
---|
| 35 | ! 4444 2020-03-05 15:59:50Z raasch |
---|
[4444] | 36 | ! bugfix: cpp-directives for serial mode added |
---|
| 37 | ! |
---|
| 38 | ! 4414 2020-02-19 20:16:04Z suehring |
---|
[4414] | 39 | ! Call to module_interface_init_numerics |
---|
| 40 | ! |
---|
| 41 | ! 4400 2020-02-10 20:32:41Z suehring |
---|
[4400] | 42 | ! Add interface to initialize data output with dom |
---|
| 43 | ! |
---|
| 44 | ! 4360 2020-01-07 11:25:50Z suehring |
---|
[4227] | 45 | ! implement new palm_date_time_mod |
---|
| 46 | ! |
---|
| 47 | ! 4094 2019-07-12 09:24:21Z gronemeier |
---|
[4182] | 48 | ! Corrected "Former revisions" section |
---|
| 49 | ! |
---|
| 50 | ! 4039 2019-06-18 10:32:41Z suehring |
---|
[4039] | 51 | ! Rename subroutines in module for diagnostic quantities |
---|
| 52 | ! |
---|
| 53 | ! 4017 2019-06-06 12:16:46Z schwenkel |
---|
[3994] | 54 | ! new module for calculation and output of diagnostic quantities added |
---|
| 55 | ! |
---|
| 56 | ! 3885 2019-04-11 11:29:34Z kanani |
---|
[3885] | 57 | ! Changes related to global restructuring of location messages and introduction |
---|
| 58 | ! of additional debug messages |
---|
| 59 | ! |
---|
| 60 | ! 3761 2019-02-25 15:31:42Z raasch |
---|
[3761] | 61 | ! unused variable removed |
---|
| 62 | ! |
---|
| 63 | ! 3719 2019-02-06 13:10:18Z kanani |
---|
[3719] | 64 | ! Included cpu measurement for wall/soil spinup |
---|
| 65 | ! |
---|
| 66 | ! 3703 2019-01-29 16:43:53Z knoop |
---|
[3685] | 67 | ! Some interface calls moved to module_interface + cleanup |
---|
| 68 | ! |
---|
| 69 | ! 3648 2019-01-02 16:35:46Z suehring |
---|
[3648] | 70 | ! Rename subroutines for surface-data output |
---|
[3298] | 71 | ! |
---|
[4182] | 72 | ! Revision 1.1 1997/07/24 11:23:35 raasch |
---|
| 73 | ! Initial revision |
---|
| 74 | ! |
---|
| 75 | ! |
---|
[1] | 76 | ! Description: |
---|
| 77 | ! ------------ |
---|
[3232] | 78 | !> Large-Eddy Simulation (LES) model for atmospheric and oceanic boundary-layer |
---|
| 79 | !> flows |
---|
| 80 | !> see the PALM homepage https://palm-model.org for further information |
---|
[1] | 81 | !------------------------------------------------------------------------------! |
---|
[1682] | 82 | PROGRAM palm |
---|
| 83 | |
---|
[1] | 84 | |
---|
[1374] | 85 | USE arrays_3d |
---|
[1] | 86 | |
---|
[4444] | 87 | #if defined( __parallel ) |
---|
[3298] | 88 | USE bulk_cloud_model_mod, & |
---|
| 89 | ONLY: bulk_cloud_model, microphysics_morrison, microphysics_seifert |
---|
[4444] | 90 | #endif |
---|
[3298] | 91 | |
---|
[1320] | 92 | USE control_parameters, & |
---|
[4444] | 93 | ONLY: coupling_char, do2d_at_begin, do3d_at_begin, io_blocks, & |
---|
[4495] | 94 | io_group, message_string, restart_data_format_output, runnr, simulated_time_chr, spinup, & |
---|
[3241] | 95 | time_since_reference_point, user_interface_current_revision, & |
---|
| 96 | user_interface_required_revision, version, write_binary |
---|
[1320] | 97 | |
---|
[4444] | 98 | #if defined( __parallel ) |
---|
| 99 | USE control_parameters, & |
---|
| 100 | ONLY: child_domain, constant_diffusion, humidity, & |
---|
| 101 | initializing_actions, neutral, passive_scalar |
---|
| 102 | #endif |
---|
| 103 | |
---|
[1320] | 104 | USE cpulog, & |
---|
[4444] | 105 | ONLY: cpu_log, log_point, cpu_statistics |
---|
[1320] | 106 | |
---|
[4444] | 107 | #if defined( __parallel ) |
---|
| 108 | USE cpulog, & |
---|
| 109 | ONLY: log_point_s |
---|
| 110 | #endif |
---|
| 111 | |
---|
[3994] | 112 | USE diagnostic_output_quantities_mod, & |
---|
[4039] | 113 | ONLY: doq_calculate |
---|
[3994] | 114 | |
---|
[4444] | 115 | #if defined( __parallel ) |
---|
[4457] | 116 | USE exchange_horiz_mod, & |
---|
| 117 | ONLY: exchange_horiz |
---|
| 118 | |
---|
[1374] | 119 | USE indices, & |
---|
[2232] | 120 | ONLY: nbgp |
---|
[4444] | 121 | #endif |
---|
[1374] | 122 | |
---|
[3274] | 123 | USE kinds |
---|
| 124 | |
---|
[3687] | 125 | USE module_interface, & |
---|
[4414] | 126 | ONLY: module_interface_init_numerics, & |
---|
| 127 | module_interface_init_output, & |
---|
[4400] | 128 | module_interface_last_actions |
---|
[3687] | 129 | |
---|
[4400] | 130 | |
---|
[3235] | 131 | USE multi_agent_system_mod, & |
---|
| 132 | ONLY: agents_active, mas_last_actions |
---|
| 133 | |
---|
[2696] | 134 | USE netcdf_data_input_mod, & |
---|
[3685] | 135 | ONLY: netcdf_data_input_inquire_file, netcdf_data_input_init, & |
---|
[2696] | 136 | netcdf_data_input_surface_data, netcdf_data_input_topo |
---|
| 137 | |
---|
[1] | 138 | USE pegrid |
---|
| 139 | |
---|
[4444] | 140 | #if defined( __parallel ) |
---|
[2894] | 141 | USE pmc_particle_interface, & |
---|
| 142 | ONLY: pmcp_g_alloc_win |
---|
| 143 | |
---|
[1762] | 144 | USE pmc_interface, & |
---|
[3241] | 145 | ONLY: nested_run, pmci_child_initialize, pmci_init, & |
---|
[3484] | 146 | pmci_modelconfiguration, pmci_parent_initialize |
---|
[4444] | 147 | #endif |
---|
[4414] | 148 | |
---|
[4495] | 149 | USE restart_data_mpi_io_mod, & |
---|
| 150 | ONLY: rd_mpi_io_close, rd_mpi_io_open |
---|
| 151 | |
---|
[3648] | 152 | USE surface_data_output_mod, & |
---|
| 153 | ONLY: surface_data_output_last_action |
---|
[1762] | 154 | |
---|
[2894] | 155 | USE write_restart_data_mod, & |
---|
| 156 | ONLY: wrd_global, wrd_local |
---|
[2801] | 157 | |
---|
[4444] | 158 | #if defined( __parallel ) && defined( _OPENACC ) |
---|
[3689] | 159 | USE openacc |
---|
| 160 | #endif |
---|
[1747] | 161 | |
---|
[3689] | 162 | |
---|
[1] | 163 | IMPLICIT NONE |
---|
| 164 | |
---|
| 165 | ! |
---|
| 166 | !-- Local variables |
---|
[3241] | 167 | CHARACTER(LEN=9) :: time_to_string !< |
---|
| 168 | INTEGER(iwp) :: i !< loop counter for blocked I/O |
---|
[3689] | 169 | #if defined( __parallel) && defined( _OPENACC ) |
---|
| 170 | INTEGER(iwp) :: local_comm !< local communicator (shared memory) |
---|
| 171 | INTEGER(iwp) :: local_num_procs !< local number of processes |
---|
| 172 | INTEGER(iwp) :: local_id !< local id |
---|
| 173 | INTEGER(acc_device_kind) :: device_type !< device type for OpenACC |
---|
| 174 | INTEGER(iwp) :: num_devices !< number of devices visible to OpenACC |
---|
| 175 | INTEGER(iwp) :: my_device !< device used by this process |
---|
| 176 | #endif |
---|
[1] | 177 | |
---|
[3487] | 178 | version = 'PALM 6.0' |
---|
[4495] | 179 | user_interface_required_revision = 'r4495' |
---|
[75] | 180 | |
---|
[1] | 181 | #if defined( __parallel ) |
---|
| 182 | ! |
---|
| 183 | !-- MPI initialisation. comm2d is preliminary set, because |
---|
| 184 | !-- it will be defined in init_pegrid but is used before in cpu_log. |
---|
| 185 | CALL MPI_INIT( ierr ) |
---|
[1762] | 186 | |
---|
| 187 | ! |
---|
| 188 | !-- Initialize the coupling for nested-domain runs |
---|
[1764] | 189 | !-- comm_palm is the communicator which includes all PEs (MPI processes) |
---|
| 190 | !-- available for this (nested) model. If it is not a nested run, comm_palm |
---|
| 191 | !-- is returned as MPI_COMM_WORLD |
---|
[2951] | 192 | CALL cpu_log( log_point_s(70), 'pmci_init', 'start' ) |
---|
[1762] | 193 | CALL pmci_init( comm_palm ) |
---|
[2951] | 194 | CALL cpu_log( log_point_s(70), 'pmci_init', 'stop' ) |
---|
[1762] | 195 | comm2d = comm_palm |
---|
[1764] | 196 | ! |
---|
| 197 | !-- Get the (preliminary) number of MPI processes and the local PE-id (in case |
---|
| 198 | !-- of a further communicator splitting in init_coupling, these numbers will |
---|
| 199 | !-- be changed in init_pegrid). |
---|
| 200 | IF ( nested_run ) THEN |
---|
[1762] | 201 | |
---|
[1764] | 202 | CALL MPI_COMM_SIZE( comm_palm, numprocs, ierr ) |
---|
| 203 | CALL MPI_COMM_RANK( comm_palm, myid, ierr ) |
---|
[1762] | 204 | |
---|
[1764] | 205 | ELSE |
---|
| 206 | |
---|
| 207 | CALL MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr ) |
---|
| 208 | CALL MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr ) |
---|
[1] | 209 | ! |
---|
[1764] | 210 | !-- Initialize PE topology in case of coupled atmosphere-ocean runs (comm_palm |
---|
| 211 | !-- will be splitted in init_coupling) |
---|
| 212 | CALL init_coupling |
---|
| 213 | ENDIF |
---|
[3689] | 214 | |
---|
| 215 | #ifdef _OPENACC |
---|
| 216 | ! |
---|
| 217 | !-- Select OpenACC device to use in this process. For this find out how many |
---|
| 218 | !-- neighbors there are running on the same node and which id this process is. |
---|
| 219 | IF ( nested_run ) THEN |
---|
| 220 | CALL MPI_COMM_SPLIT_TYPE( comm_palm, MPI_COMM_TYPE_SHARED, 0, & |
---|
| 221 | MPI_INFO_NULL, local_comm, ierr ) |
---|
| 222 | ELSE |
---|
| 223 | CALL MPI_COMM_SPLIT_TYPE( MPI_COMM_WORLD, MPI_COMM_TYPE_SHARED, 0, & |
---|
| 224 | MPI_INFO_NULL, local_comm, ierr ) |
---|
| 225 | ENDIF |
---|
| 226 | CALL MPI_COMM_SIZE( local_comm, local_num_procs, ierr ) |
---|
| 227 | CALL MPI_COMM_RANK( local_comm, local_id, ierr ) |
---|
| 228 | |
---|
| 229 | ! |
---|
| 230 | !-- This loop including the barrier is a workaround for PGI compiler versions |
---|
| 231 | !-- up to and including 18.4. Later releases are able to select their GPUs in |
---|
| 232 | !-- parallel, without running into spurious errors. |
---|
| 233 | DO i = 0, local_num_procs-1 |
---|
| 234 | CALL MPI_BARRIER( local_comm, ierr ) |
---|
| 235 | |
---|
| 236 | IF ( i == local_id ) THEN |
---|
| 237 | device_type = acc_get_device_type() |
---|
| 238 | num_devices = acc_get_num_devices( device_type ) |
---|
| 239 | my_device = MOD( local_id, num_devices ) |
---|
| 240 | CALL acc_set_device_num( my_device, device_type ) |
---|
| 241 | ENDIF |
---|
| 242 | ENDDO |
---|
| 243 | |
---|
| 244 | CALL MPI_COMM_FREE( local_comm, ierr ) |
---|
[102] | 245 | #endif |
---|
[3689] | 246 | #endif |
---|
[102] | 247 | |
---|
| 248 | ! |
---|
[1] | 249 | !-- Initialize measuring of the CPU-time remaining to the run |
---|
| 250 | CALL local_tremain_ini |
---|
| 251 | |
---|
| 252 | ! |
---|
| 253 | !-- Start of total CPU time measuring. |
---|
| 254 | CALL cpu_log( log_point(1), 'total', 'start' ) |
---|
| 255 | CALL cpu_log( log_point(2), 'initialisation', 'start' ) |
---|
| 256 | |
---|
| 257 | ! |
---|
[206] | 258 | !-- Open a file for debug output |
---|
[1468] | 259 | WRITE (myid_char,'(''_'',I6.6)') myid |
---|
[206] | 260 | OPEN( 9, FILE='DEBUG'//TRIM( coupling_char )//myid_char, FORM='FORMATTED' ) |
---|
| 261 | |
---|
| 262 | ! |
---|
[1] | 263 | !-- Initialize dvrp logging. Also, one PE maybe split from the global |
---|
| 264 | !-- communicator for doing the dvrp output. In that case, the number of |
---|
| 265 | !-- PEs available for PALM is reduced by one and communicator comm_palm |
---|
| 266 | !-- is changed respectively. |
---|
| 267 | #if defined( __parallel ) |
---|
| 268 | CALL MPI_COMM_RANK( comm_palm, myid, ierr ) |
---|
[102] | 269 | #endif |
---|
| 270 | |
---|
| 271 | ! |
---|
[108] | 272 | !-- Read control parameters from NAMELIST files and read environment-variables |
---|
| 273 | CALL parin |
---|
| 274 | |
---|
| 275 | ! |
---|
[1666] | 276 | !-- Check for the user's interface version |
---|
| 277 | IF ( user_interface_current_revision /= user_interface_required_revision ) & |
---|
| 278 | THEN |
---|
| 279 | message_string = 'current user-interface revision "' // & |
---|
| 280 | TRIM( user_interface_current_revision ) // '" does ' // & |
---|
| 281 | 'not match the required revision ' // & |
---|
| 282 | TRIM( user_interface_required_revision ) |
---|
[1668] | 283 | CALL message( 'palm', 'PA0169', 1, 2, 0, 6, 0 ) |
---|
[1666] | 284 | ENDIF |
---|
| 285 | |
---|
| 286 | ! |
---|
[108] | 287 | !-- Determine processor topology and local array indices |
---|
| 288 | CALL init_pegrid |
---|
| 289 | ! |
---|
[2696] | 290 | !-- Check if input file according to input-data standard exists |
---|
| 291 | CALL netcdf_data_input_inquire_file |
---|
| 292 | ! |
---|
| 293 | !-- Read topography input data if required. This is required before the |
---|
| 294 | !-- numerical grid is finally created in init_grid |
---|
| 295 | CALL netcdf_data_input_topo |
---|
| 296 | ! |
---|
| 297 | !-- Generate grid parameters, initialize generic topography and further process |
---|
| 298 | !-- topography information if required |
---|
[1] | 299 | CALL init_grid |
---|
| 300 | ! |
---|
[4414] | 301 | !-- Initialize boundary conditions and numerics such as the multigrid solver or |
---|
| 302 | !-- the advection routine |
---|
| 303 | CALL module_interface_init_numerics |
---|
| 304 | ! |
---|
[2696] | 305 | !-- Read global attributes if available. |
---|
| 306 | CALL netcdf_data_input_init |
---|
| 307 | ! |
---|
| 308 | !-- Read surface classification data, e.g. vegetation and soil types, water |
---|
| 309 | !-- surfaces, etc., if available. Some of these data is required before |
---|
| 310 | !-- check parameters is invoked. |
---|
| 311 | CALL netcdf_data_input_surface_data |
---|
| 312 | ! |
---|
[1] | 313 | !-- Check control parameters and deduce further quantities |
---|
| 314 | CALL check_parameters |
---|
[3298] | 315 | |
---|
[1] | 316 | CALL init_3d_model |
---|
| 317 | |
---|
[4400] | 318 | CALL module_interface_init_output |
---|
| 319 | |
---|
[4444] | 320 | #if defined( __parallel ) |
---|
[1] | 321 | ! |
---|
[1762] | 322 | !-- Coupling protocol setup for nested-domain runs |
---|
[1764] | 323 | IF ( nested_run ) THEN |
---|
| 324 | CALL pmci_modelconfiguration |
---|
[1781] | 325 | ! |
---|
[1933] | 326 | !-- Receive and interpolate initial data on children. |
---|
| 327 | !-- Child initialization must be made first if the model is both child and |
---|
[2177] | 328 | !-- parent if necessary |
---|
| 329 | IF ( TRIM( initializing_actions ) /= 'read_restart_data' ) THEN |
---|
| 330 | CALL pmci_child_initialize |
---|
[1781] | 331 | ! |
---|
[2177] | 332 | !-- Send initial condition data from parent to children |
---|
| 333 | CALL pmci_parent_initialize |
---|
[1781] | 334 | ! |
---|
[3232] | 335 | !-- Exchange_horiz is needed after the nest initialization |
---|
[3182] | 336 | IF ( child_domain ) THEN |
---|
[2178] | 337 | CALL exchange_horiz( u, nbgp ) |
---|
| 338 | CALL exchange_horiz( v, nbgp ) |
---|
| 339 | CALL exchange_horiz( w, nbgp ) |
---|
| 340 | IF ( .NOT. neutral ) THEN |
---|
| 341 | CALL exchange_horiz( pt, nbgp ) |
---|
| 342 | ENDIF |
---|
| 343 | IF ( .NOT. constant_diffusion ) CALL exchange_horiz( e, nbgp ) |
---|
| 344 | IF ( humidity ) THEN |
---|
| 345 | CALL exchange_horiz( q, nbgp ) |
---|
[3274] | 346 | IF ( bulk_cloud_model .AND. microphysics_morrison ) THEN |
---|
[2292] | 347 | CALL exchange_horiz( qc, nbgp ) |
---|
| 348 | CALL exchange_horiz( nc, nbgp ) |
---|
| 349 | ENDIF |
---|
[3274] | 350 | IF ( bulk_cloud_model .AND. microphysics_seifert ) THEN |
---|
[2178] | 351 | CALL exchange_horiz( qr, nbgp ) |
---|
| 352 | CALL exchange_horiz( nr, nbgp ) |
---|
| 353 | ENDIF |
---|
| 354 | ENDIF |
---|
| 355 | IF ( passive_scalar ) CALL exchange_horiz( s, nbgp ) |
---|
[1933] | 356 | ENDIF |
---|
[1781] | 357 | ENDIF |
---|
| 358 | |
---|
[2801] | 359 | CALL pmcp_g_alloc_win ! Must be called after pmci_child_initialize and pmci_parent_initialize |
---|
[1764] | 360 | ENDIF |
---|
[4444] | 361 | #endif |
---|
[1762] | 362 | |
---|
| 363 | ! |
---|
[1] | 364 | !-- Output of program header |
---|
| 365 | IF ( myid == 0 ) CALL header |
---|
| 366 | |
---|
| 367 | CALL cpu_log( log_point(2), 'initialisation', 'stop' ) |
---|
| 368 | |
---|
| 369 | ! |
---|
[2296] | 370 | !-- Integration of the non-atmospheric equations (land surface model, urban |
---|
| 371 | !-- surface model) |
---|
| 372 | IF ( spinup ) THEN |
---|
[3719] | 373 | CALL cpu_log( log_point(41), 'wall/soil spinup', 'start' ) |
---|
[2296] | 374 | CALL time_integration_spinup |
---|
[3719] | 375 | CALL cpu_log( log_point(41), 'wall/soil spinup', 'stop' ) |
---|
[2296] | 376 | ENDIF |
---|
| 377 | |
---|
| 378 | ! |
---|
[1] | 379 | !-- Set start time in format hh:mm:ss |
---|
[2977] | 380 | simulated_time_chr = time_to_string( time_since_reference_point ) |
---|
[1] | 381 | |
---|
| 382 | ! |
---|
| 383 | !-- If required, output of initial arrays |
---|
| 384 | IF ( do2d_at_begin ) THEN |
---|
[4039] | 385 | CALL doq_calculate !TODO, will be called twice |
---|
[3994] | 386 | |
---|
[1] | 387 | CALL data_output_2d( 'xy', 0 ) |
---|
| 388 | CALL data_output_2d( 'xz', 0 ) |
---|
| 389 | CALL data_output_2d( 'yz', 0 ) |
---|
| 390 | ENDIF |
---|
[1976] | 391 | |
---|
[1] | 392 | IF ( do3d_at_begin ) THEN |
---|
[4039] | 393 | CALL doq_calculate !TODO, will be called twice |
---|
[3994] | 394 | |
---|
[1] | 395 | CALL data_output_3d( 0 ) |
---|
| 396 | ENDIF |
---|
| 397 | |
---|
| 398 | ! |
---|
[495] | 399 | !-- Integration of the model equations using timestep-scheme |
---|
[1] | 400 | CALL time_integration |
---|
| 401 | |
---|
| 402 | ! |
---|
[495] | 403 | !-- If required, write binary data for restart runs |
---|
[2298] | 404 | IF ( write_binary ) THEN |
---|
[759] | 405 | |
---|
[2894] | 406 | CALL cpu_log( log_point(22), 'wrd_local', 'start' ) |
---|
[759] | 407 | |
---|
[3885] | 408 | CALL location_message( 'writing restart data', 'start' ) |
---|
[1402] | 409 | |
---|
[4495] | 410 | IF ( TRIM( restart_data_format_output ) == 'fortran_binary' ) THEN |
---|
[2894] | 411 | |
---|
[4495] | 412 | DO i = 0, io_blocks-1 |
---|
| 413 | IF ( i == io_group ) THEN |
---|
| 414 | |
---|
[1] | 415 | ! |
---|
[4495] | 416 | !-- Open binary file |
---|
| 417 | CALL check_open( 14 ) |
---|
[2894] | 418 | ! |
---|
[4495] | 419 | !-- Write control parameters and other global variables for restart. |
---|
| 420 | IF ( myid == 0 ) CALL wrd_global |
---|
[2894] | 421 | ! |
---|
[4495] | 422 | !-- Write processor specific flow field data for restart runs |
---|
| 423 | CALL wrd_local |
---|
[2894] | 424 | ! |
---|
[4495] | 425 | !-- Close binary file |
---|
| 426 | CALL close_file( 14 ) |
---|
[2894] | 427 | |
---|
[4495] | 428 | ENDIF |
---|
[759] | 429 | #if defined( __parallel ) |
---|
[4495] | 430 | CALL MPI_BARRIER( comm2d, ierr ) |
---|
[759] | 431 | #endif |
---|
[4495] | 432 | ENDDO |
---|
[759] | 433 | |
---|
[4495] | 434 | ELSEIF ( TRIM( restart_data_format_output ) == 'mpi' ) THEN |
---|
| 435 | ! |
---|
| 436 | !-- Open MPI-IO restart file |
---|
[4496] | 437 | CALL rd_mpi_io_open( 'write', 'BINOUT' // TRIM( coupling_char ) ) |
---|
[4495] | 438 | ! |
---|
| 439 | !-- Write control parameters and other global variables for restart. |
---|
| 440 | CALL wrd_global |
---|
| 441 | ! |
---|
| 442 | !-- Write processor specific flow field data for restart runs |
---|
| 443 | CALL wrd_local |
---|
| 444 | ! |
---|
| 445 | !-- Close restart File |
---|
| 446 | CALL rd_mpi_io_close |
---|
| 447 | |
---|
| 448 | ENDIF |
---|
| 449 | |
---|
[3885] | 450 | CALL location_message( 'writing restart data', 'finished' ) |
---|
[1402] | 451 | |
---|
[2894] | 452 | CALL cpu_log( log_point(22), 'wrd_local', 'stop' ) |
---|
[2007] | 453 | |
---|
[495] | 454 | ENDIF |
---|
[3494] | 455 | ! |
---|
| 456 | !-- Last actions for surface output, for instantaneous and time-averaged data |
---|
[3648] | 457 | CALL surface_data_output_last_action( 0 ) |
---|
| 458 | CALL surface_data_output_last_action( 1 ) |
---|
[1] | 459 | |
---|
| 460 | ! |
---|
| 461 | !-- If required, repeat output of header including the required CPU-time |
---|
| 462 | IF ( myid == 0 ) CALL header |
---|
| 463 | ! |
---|
[3687] | 464 | !-- Perform module specific last actions |
---|
[1] | 465 | CALL cpu_log( log_point(4), 'last actions', 'start' ) |
---|
[3235] | 466 | |
---|
[3687] | 467 | IF ( myid == 0 .AND. agents_active ) CALL mas_last_actions ! ToDo: move to module_interface |
---|
[2894] | 468 | |
---|
[3687] | 469 | CALL module_interface_last_actions |
---|
| 470 | |
---|
[1] | 471 | CALL cpu_log( log_point(4), 'last actions', 'stop' ) |
---|
| 472 | |
---|
| 473 | ! |
---|
[3687] | 474 | !-- Close files |
---|
| 475 | CALL close_file( 0 ) |
---|
| 476 | |
---|
| 477 | ! |
---|
[3232] | 478 | !-- Write run number to file (used by palmrun to create unified cycle numbers |
---|
| 479 | !-- for output files |
---|
[2261] | 480 | IF ( myid == 0 .AND. runnr > 0 ) THEN |
---|
| 481 | OPEN( 90, FILE='RUN_NUMBER', FORM='FORMATTED' ) |
---|
| 482 | WRITE( 90, '(I4)' ) runnr |
---|
| 483 | CLOSE( 90 ) |
---|
| 484 | ENDIF |
---|
| 485 | |
---|
| 486 | ! |
---|
[1] | 487 | !-- Take final CPU-time for CPU-time analysis |
---|
| 488 | CALL cpu_log( log_point(1), 'total', 'stop' ) |
---|
| 489 | CALL cpu_statistics |
---|
| 490 | |
---|
| 491 | #if defined( __parallel ) |
---|
| 492 | CALL MPI_FINALIZE( ierr ) |
---|
| 493 | #endif |
---|
| 494 | |
---|
| 495 | END PROGRAM palm |
---|