SUBROUTINE lpm_data_output_particles !--------------------------------------------------------------------------------! ! This file is part of PALM. ! ! PALM is free software: you can redistribute it and/or modify it under the terms ! of the GNU General Public License as published by the Free Software Foundation, ! either version 3 of the License, or (at your option) any later version. ! ! PALM is distributed in the hope that it will be useful, but WITHOUT ANY ! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR ! A PARTICULAR PURPOSE. See the GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License along with ! PALM. If not, see . ! ! Copyright 1997-2014 Leibniz Universitaet Hannover !--------------------------------------------------------------------------------! ! ! Current revisions: ! ------------------ ! ! ! Former revisions: ! ----------------- ! $Id: lpm_data_output_particles.f90 1360 2014-04-11 17:20:32Z letzel $ ! ! 1359 2014-04-11 17:15:14Z hoffmann ! netCDF output currently not available ! output of particle data in binary format adopted to new particle structure ! ! 1327 2014-03-21 11:00:16Z raasch ! -netcdf output queries ! ! 1320 2014-03-20 08:40:49Z raasch ! ONLY-attribute added to USE-statements, ! revision history before 2012 removed ! ! 1036 2012-10-22 13:43:42Z raasch ! code put under GPL (PALM 3.9) ! ! 849 2012-03-15 10:35:09Z raasch ! initial revision (former part of advec_particles) ! ! 22/02/12 - Initial version ! ! Description: ! ------------ ! Write particle data in FORTRAN binary and/or netCDF format !------------------------------------------------------------------------------! USE control_parameters, & ONLY: prt_time_count, simulated_time USE cpulog, & ONLY: cpu_log, log_point_s USE indices, & ONLY: nxl, nxr, nyn, nys, nzb, nzt USE kinds USE netcdf_control USE particle_attributes, & ONLY: grid_particles, maximum_number_of_particles, & maximum_number_of_tailpoints, maximum_number_of_tails, & number_of_particles, number_of_tails, particles, & particle_tail_coordinates, prt_count IMPLICIT NONE INTEGER(iwp) :: ip !: INTEGER(iwp) :: jp !: INTEGER(iwp) :: kp !: CALL cpu_log( log_point_s(40), 'lpm_data_output', 'start' ) ! !-- Attention: change version number for unit 85 (in routine check_open) !-- whenever the output format for this unit is changed! CALL check_open( 85 ) WRITE ( 85 ) simulated_time WRITE ( 85 ) prt_count DO ip = nxl, nxr DO jp = nys, nyn DO kp = nzb+1, nzt number_of_particles = prt_count(kp,jp,ip) particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles) IF ( number_of_particles <= 0 ) CYCLE WRITE ( 85 ) particles ENDDO ENDDO ENDDO ! !-- particle tails currently not available ! WRITE ( 85 ) maximum_number_of_tailpoints, maximum_number_of_tails, & ! number_of_tails ! IF ( maximum_number_of_tails > 0 ) THEN ! WRITE ( 85 ) particle_tail_coordinates, prt_time_count ! ENDIF CALL close_file( 85 ) #if defined( __netcdf ) ! ! ! !-- Output in netCDF format ! CALL check_open( 108 ) ! ! ! ! !-- Update the NetCDF time axis ! prt_time_count = prt_time_count + 1 ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_time_prt, & ! (/ simulated_time /), & ! start = (/ prt_time_count /), count = (/ 1 /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 1 ) ! ! ! ! !-- Output the real number of particles used ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_rnop_prt, & ! (/ number_of_particles /), & ! start = (/ prt_time_count /), count = (/ 1 /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 2 ) ! ! ! ! !-- Output all particle attributes ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(1), particles%age, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 3 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(2), particles%dvrp_psize,& ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 4 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(3), particles%origin_x, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 5 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(4), particles%origin_y, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 6 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(5), particles%origin_z, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 7 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(6), particles%radius, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 8 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(7), particles%speed_x, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 9 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(8), particles%speed_y, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 10 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(9), particles%speed_z, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 11 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt,id_var_prt(10), & ! particles%weight_factor, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 12 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(11), particles%x, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 13 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(12), particles%y, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 14 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(13), particles%z, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 15 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(14), particles%class, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 16 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(15), particles%group, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 17 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(16), & ! particles%tailpoints, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 18 ) ! ! nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(17), particles%tail_id, & ! start = (/ 1, prt_time_count /), & ! count = (/ maximum_number_of_particles /) ) ! CALL handle_netcdf_error( 'lpm_data_output_particles', 19 ) ! #endif CALL cpu_log( log_point_s(40), 'lpm_data_output', 'stop' ) END SUBROUTINE lpm_data_output_particles