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