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