SUBROUTINE lpm_write_restart_file !------------------------------------------------------------------------------! ! Current revisions: ! ------------------ ! ! ! Former revisions: ! ----------------- ! $Id: lpm_write_restart_file.f90 850 2012-03-15 12:09:25Z franke $ ! ! 849 2012-03-15 10:35:09Z raasch ! initial revision (former part of advec_particles) ! ! ! Description: ! ------------ ! Write particle data in FORTRAN binary format on restart file !------------------------------------------------------------------------------! USE control_parameters USE particle_attributes USE pegrid IMPLICIT NONE CHARACTER (LEN=10) :: particle_binary_version INTEGER :: i ! !-- First open the output unit. IF ( myid_char == '' ) THEN OPEN ( 90, FILE='PARTICLE_RESTART_DATA_OUT'//myid_char, & FORM='UNFORMATTED') ELSE IF ( myid == 0 ) CALL local_system( 'mkdir PARTICLE_RESTART_DATA_OUT' ) #if defined( __parallel ) ! !-- Set a barrier in order to allow that thereafter all other processors !-- in the directory created by PE0 can open their file CALL MPI_BARRIER( comm2d, ierr ) #endif OPEN ( 90, FILE='PARTICLE_RESTART_DATA_OUT/'//myid_char, & FORM='UNFORMATTED' ) ENDIF DO i = 0, io_blocks-1 IF ( i == io_group ) THEN ! !-- Write the version number of the binary format. !-- Attention: After changes to the following output commands the version !-- --------- number of the variable particle_binary_version must be !-- changed! Also, the version number and the list of arrays !-- to be read in lpm_read_restart_file must be adjusted !-- accordingly. particle_binary_version = '3.0' WRITE ( 90 ) particle_binary_version ! !-- Write some particle parameters, the size of the particle arrays as !-- well as other dvrp-plot variables. WRITE ( 90 ) bc_par_b, bc_par_lr, bc_par_ns, bc_par_t, & maximum_number_of_particles, & maximum_number_of_tailpoints, maximum_number_of_tails, & number_of_initial_particles, number_of_particles, & number_of_particle_groups, number_of_tails, & particle_groups, time_prel, time_write_particle_data, & uniform_particles IF ( number_of_initial_particles /= 0 ) WRITE ( 90 ) initial_particles WRITE ( 90 ) prt_count, prt_start_index WRITE ( 90 ) particles IF ( use_particle_tails ) THEN WRITE ( 90 ) particle_tail_coordinates ENDIF CLOSE ( 90 ) ENDIF #if defined( __parallel ) CALL MPI_BARRIER( comm2d, ierr ) #endif ENDDO END SUBROUTINE lpm_write_restart_file