source: palm/trunk/SOURCE/lpm_write_restart_file.f90 @ 3358

Last change on this file since 3358 was 2718, checked in by maronga, 7 years ago

deleting of deprecated files; headers updated where needed

  • Property svn:keywords set to Id
File size: 4.7 KB
RevLine 
[1682]1!> @file lpm_write_restart_file.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!
[2718]17! Copyright 1997-2018 Leibniz Universitaet Hannover
[2000]18!------------------------------------------------------------------------------!
[1036]19!
[849]20! Current revisions:
21! ------------------
[1360]22!
[2001]23!
[1321]24! Former revisions:
25! -----------------
26! $Id: lpm_write_restart_file.f90 2718 2018-01-02 08:49:38Z knoop $
[2716]27! Corrected "Former revisions" section
28!
29! 2696 2017-12-14 17:12:51Z kanani
30! Change in file header (GPL part)
31!
32! 2265 2017-06-08 16:58:28Z schwenkel
[2265]33! Unused variables removed.
34!
35! 2101 2017-01-05 16:42:31Z suehring
[1321]36!
[2001]37! 2000 2016-08-20 18:09:15Z knoop
38! Forced header and separation lines into 80 columns
39!
[1823]40! 1822 2016-04-07 07:49:42Z hoffmann
41! Tails removed. Unused variables removed.
42!
[1683]43! 1682 2015-10-07 23:56:08Z knoop
44! Code annotations made doxygen readable
45!
[1360]46! 1359 2014-04-11 17:15:14Z hoffmann
47! New particle structure integrated.
48!
[1321]49! 1320 2014-03-20 08:40:49Z raasch
[1320]50! ONLY-attribute added to USE-statements,
51! kind-parameters added to all INTEGER and REAL declaration statements,
52! kinds are defined in new module kinds,
53! comment fields (!:) to be used for variable explanations added to
54! all variable declaration statements
[849]55!
[1037]56! 1036 2012-10-22 13:43:42Z raasch
57! code put under GPL (PALM 3.9)
58!
[850]59! 849 2012-03-15 10:35:09Z raasch
60! initial revision (former part of advec_particles)
[849]61!
[850]62!
[849]63! Description:
64! ------------
[1682]65!> Write particle data in FORTRAN binary format on restart file
[849]66!------------------------------------------------------------------------------!
[1682]67 SUBROUTINE lpm_write_restart_file
[849]68
[1320]69
[1359]70    USE indices,                                                               &
71        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
72
[1320]73    USE kinds
74
75    USE particle_attributes,                                                   &
[1359]76        ONLY:  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, grid_particles,       &
77               number_of_particles, number_of_particle_groups,                 &
[1822]78               particles, particle_groups, prt_count, time_prel,               &
[2265]79               time_write_particle_data
[1320]80
[849]81    USE pegrid
82
83    IMPLICIT NONE
84
[1682]85    CHARACTER (LEN=10) ::  particle_binary_version   !<
[1359]86
[1682]87    INTEGER(iwp) ::  ip                              !<
88    INTEGER(iwp) ::  jp                              !<
89    INTEGER(iwp) ::  kp                              !<
[849]90
91!
92!-- First open the output unit.
93    IF ( myid_char == '' )  THEN
94       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_OUT'//myid_char, &
95                  FORM='UNFORMATTED')
96    ELSE
97       IF ( myid == 0 )  CALL local_system( 'mkdir PARTICLE_RESTART_DATA_OUT' )
98#if defined( __parallel )
99!
100!--    Set a barrier in order to allow that thereafter all other processors
101!--    in the directory created by PE0 can open their file
102       CALL MPI_BARRIER( comm2d, ierr )
103#endif
104       OPEN ( 90, FILE='PARTICLE_RESTART_DATA_OUT/'//myid_char, &
105                  FORM='UNFORMATTED' )
106    ENDIF
107
108!
[1822]109!-- Write the version number of the binary format.
110!-- Attention: After changes to the following output commands the version
111!-- ---------  number of the variable particle_binary_version must be
112!--            changed! Also, the version number and the list of arrays
113!--            to be read in lpm_read_restart_file must be adjusted
114!--            accordingly.
115    particle_binary_version = '4.0'
116    WRITE ( 90 )  particle_binary_version
[849]117
118!
[1822]119!-- Write some particle parameters, the size of the particle arrays as
120!-- well as other dvrp-plot variables.
121    WRITE ( 90 )  bc_par_b, bc_par_lr, bc_par_ns, bc_par_t,              &
122                  number_of_particle_groups, particle_groups, time_prel, &
[2265]123                  time_write_particle_data
[849]124
[1822]125    WRITE ( 90 )  prt_count
[1359]126         
[1822]127    DO  ip = nxl, nxr
128       DO  jp = nys, nyn
129          DO  kp = nzb+1, nzt
130             number_of_particles = prt_count(kp,jp,ip)
131             particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles)
132             IF ( number_of_particles <= 0 )  CYCLE
133             WRITE ( 90 )  particles
[1359]134          ENDDO
[1822]135       ENDDO
136    ENDDO
[849]137
[1822]138    CLOSE ( 90 )
[849]139
140#if defined( __parallel )
141       CALL MPI_BARRIER( comm2d, ierr )
142#endif
143
144
145 END SUBROUTINE lpm_write_restart_file
Note: See TracBrowser for help on using the repository browser.