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 1329 2014-03-21 11:09:15Z maronga $ ! ! 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 netcdf_control USE particle_attributes, & ONLY: maximum_number_of_particles, maximum_number_of_tailpoints, & maximum_number_of_tails, number_of_particles, number_of_tails, & particles, particle_tail_coordinates IMPLICIT NONE 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, maximum_number_of_particles, & number_of_particles WRITE ( 85 ) particles 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