[849] | 1 | SUBROUTINE lpm_data_output_particles |
---|
| 2 | |
---|
[1036] | 3 | !--------------------------------------------------------------------------------! |
---|
| 4 | ! This file is part of PALM. |
---|
| 5 | ! |
---|
| 6 | ! PALM is free software: you can redistribute it and/or modify it under the terms |
---|
| 7 | ! of the GNU General Public License as published by the Free Software Foundation, |
---|
| 8 | ! either version 3 of the License, or (at your option) any later version. |
---|
| 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 | ! |
---|
[1310] | 17 | ! Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1036] | 18 | !--------------------------------------------------------------------------------! |
---|
| 19 | ! |
---|
[849] | 20 | ! Current revisions: |
---|
| 21 | ! ------------------ |
---|
| 22 | ! |
---|
| 23 | ! Former revisions: |
---|
| 24 | ! ----------------- |
---|
| 25 | ! $Id: lpm_data_output_particles.f90 1321 2014-03-20 09:40:40Z raasch $ |
---|
| 26 | ! |
---|
[1321] | 27 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
| 28 | ! ONLY-attribute added to USE-statements, |
---|
| 29 | ! revision history before 2012 removed |
---|
| 30 | ! |
---|
[1037] | 31 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 32 | ! code put under GPL (PALM 3.9) |
---|
| 33 | ! |
---|
[850] | 34 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 35 | ! initial revision (former part of advec_particles) |
---|
| 36 | ! |
---|
[849] | 37 | ! 22/02/12 - Initial version |
---|
| 38 | ! |
---|
| 39 | ! Description: |
---|
| 40 | ! ------------ |
---|
| 41 | ! Write particle data in FORTRAN binary and/or netCDF format |
---|
| 42 | !------------------------------------------------------------------------------! |
---|
| 43 | |
---|
[1320] | 44 | USE control_parameters, & |
---|
| 45 | ONLY: netcdf_output, prt_time_count, simulated_time |
---|
| 46 | |
---|
| 47 | USE cpulog, & |
---|
| 48 | ONLY: cpu_log, log_point_s |
---|
| 49 | |
---|
[849] | 50 | USE netcdf_control |
---|
| 51 | |
---|
[1320] | 52 | USE particle_attributes, & |
---|
| 53 | ONLY: maximum_number_of_particles, maximum_number_of_tailpoints, & |
---|
| 54 | maximum_number_of_tails, number_of_particles, number_of_tails, & |
---|
| 55 | particles, particle_tail_coordinates |
---|
| 56 | |
---|
[849] | 57 | IMPLICIT NONE |
---|
| 58 | |
---|
| 59 | |
---|
| 60 | CALL cpu_log( log_point_s(40), 'lpm_data_output', 'start' ) |
---|
| 61 | |
---|
| 62 | ! |
---|
| 63 | !-- Attention: change version number for unit 85 (in routine check_open) |
---|
| 64 | !-- whenever the output format for this unit is changed! |
---|
| 65 | CALL check_open( 85 ) |
---|
| 66 | |
---|
| 67 | WRITE ( 85 ) simulated_time, maximum_number_of_particles, & |
---|
| 68 | number_of_particles |
---|
| 69 | WRITE ( 85 ) particles |
---|
| 70 | WRITE ( 85 ) maximum_number_of_tailpoints, maximum_number_of_tails, & |
---|
| 71 | number_of_tails |
---|
| 72 | IF ( maximum_number_of_tails > 0 ) THEN |
---|
[1320] | 73 | WRITE ( 85 ) particle_tail_coordinates, prt_time_count |
---|
[849] | 74 | ENDIF |
---|
| 75 | |
---|
| 76 | CALL close_file( 85 ) |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | #if defined( __netcdf ) |
---|
| 80 | ! |
---|
| 81 | !-- Output in netCDF format |
---|
| 82 | IF ( netcdf_output ) THEN |
---|
| 83 | |
---|
| 84 | CALL check_open( 108 ) |
---|
| 85 | |
---|
| 86 | ! |
---|
| 87 | !-- Update the NetCDF time axis |
---|
| 88 | prt_time_count = prt_time_count + 1 |
---|
| 89 | |
---|
| 90 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_time_prt, & |
---|
| 91 | (/ simulated_time /), & |
---|
| 92 | start = (/ prt_time_count /), count = (/ 1 /) ) |
---|
| 93 | CALL handle_netcdf_error( 'lpm_data_output_particles', 1 ) |
---|
| 94 | |
---|
| 95 | ! |
---|
| 96 | !-- Output the real number of particles used |
---|
| 97 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_rnop_prt, & |
---|
| 98 | (/ number_of_particles /), & |
---|
| 99 | start = (/ prt_time_count /), count = (/ 1 /) ) |
---|
| 100 | CALL handle_netcdf_error( 'lpm_data_output_particles', 2 ) |
---|
| 101 | |
---|
| 102 | ! |
---|
| 103 | !-- Output all particle attributes |
---|
| 104 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(1), particles%age, & |
---|
| 105 | start = (/ 1, prt_time_count /), & |
---|
| 106 | count = (/ maximum_number_of_particles /) ) |
---|
| 107 | CALL handle_netcdf_error( 'lpm_data_output_particles', 3 ) |
---|
| 108 | |
---|
| 109 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(2), particles%dvrp_psize,& |
---|
| 110 | start = (/ 1, prt_time_count /), & |
---|
| 111 | count = (/ maximum_number_of_particles /) ) |
---|
| 112 | CALL handle_netcdf_error( 'lpm_data_output_particles', 4 ) |
---|
| 113 | |
---|
| 114 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(3), particles%origin_x, & |
---|
| 115 | start = (/ 1, prt_time_count /), & |
---|
| 116 | count = (/ maximum_number_of_particles /) ) |
---|
| 117 | CALL handle_netcdf_error( 'lpm_data_output_particles', 5 ) |
---|
| 118 | |
---|
| 119 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(4), particles%origin_y, & |
---|
| 120 | start = (/ 1, prt_time_count /), & |
---|
| 121 | count = (/ maximum_number_of_particles /) ) |
---|
| 122 | CALL handle_netcdf_error( 'lpm_data_output_particles', 6 ) |
---|
| 123 | |
---|
| 124 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(5), particles%origin_z, & |
---|
| 125 | start = (/ 1, prt_time_count /), & |
---|
| 126 | count = (/ maximum_number_of_particles /) ) |
---|
| 127 | CALL handle_netcdf_error( 'lpm_data_output_particles', 7 ) |
---|
| 128 | |
---|
| 129 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(6), particles%radius, & |
---|
| 130 | start = (/ 1, prt_time_count /), & |
---|
| 131 | count = (/ maximum_number_of_particles /) ) |
---|
| 132 | CALL handle_netcdf_error( 'lpm_data_output_particles', 8 ) |
---|
| 133 | |
---|
| 134 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(7), particles%speed_x, & |
---|
| 135 | start = (/ 1, prt_time_count /), & |
---|
| 136 | count = (/ maximum_number_of_particles /) ) |
---|
| 137 | CALL handle_netcdf_error( 'lpm_data_output_particles', 9 ) |
---|
| 138 | |
---|
| 139 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(8), particles%speed_y, & |
---|
| 140 | start = (/ 1, prt_time_count /), & |
---|
| 141 | count = (/ maximum_number_of_particles /) ) |
---|
| 142 | CALL handle_netcdf_error( 'lpm_data_output_particles', 10 ) |
---|
| 143 | |
---|
| 144 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(9), particles%speed_z, & |
---|
| 145 | start = (/ 1, prt_time_count /), & |
---|
| 146 | count = (/ maximum_number_of_particles /) ) |
---|
| 147 | CALL handle_netcdf_error( 'lpm_data_output_particles', 11 ) |
---|
| 148 | |
---|
| 149 | nc_stat = NF90_PUT_VAR( id_set_prt,id_var_prt(10), & |
---|
| 150 | particles%weight_factor, & |
---|
| 151 | start = (/ 1, prt_time_count /), & |
---|
| 152 | count = (/ maximum_number_of_particles /) ) |
---|
| 153 | CALL handle_netcdf_error( 'lpm_data_output_particles', 12 ) |
---|
| 154 | |
---|
| 155 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(11), particles%x, & |
---|
| 156 | start = (/ 1, prt_time_count /), & |
---|
| 157 | count = (/ maximum_number_of_particles /) ) |
---|
| 158 | CALL handle_netcdf_error( 'lpm_data_output_particles', 13 ) |
---|
| 159 | |
---|
| 160 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(12), particles%y, & |
---|
| 161 | start = (/ 1, prt_time_count /), & |
---|
| 162 | count = (/ maximum_number_of_particles /) ) |
---|
| 163 | CALL handle_netcdf_error( 'lpm_data_output_particles', 14 ) |
---|
| 164 | |
---|
| 165 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(13), particles%z, & |
---|
| 166 | start = (/ 1, prt_time_count /), & |
---|
| 167 | count = (/ maximum_number_of_particles /) ) |
---|
| 168 | CALL handle_netcdf_error( 'lpm_data_output_particles', 15 ) |
---|
| 169 | |
---|
| 170 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(14), particles%class, & |
---|
| 171 | start = (/ 1, prt_time_count /), & |
---|
| 172 | count = (/ maximum_number_of_particles /) ) |
---|
| 173 | CALL handle_netcdf_error( 'lpm_data_output_particles', 16 ) |
---|
| 174 | |
---|
| 175 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(15), particles%group, & |
---|
| 176 | start = (/ 1, prt_time_count /), & |
---|
| 177 | count = (/ maximum_number_of_particles /) ) |
---|
| 178 | CALL handle_netcdf_error( 'lpm_data_output_particles', 17 ) |
---|
| 179 | |
---|
| 180 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(16), & |
---|
| 181 | particles%tailpoints, & |
---|
| 182 | start = (/ 1, prt_time_count /), & |
---|
| 183 | count = (/ maximum_number_of_particles /) ) |
---|
| 184 | CALL handle_netcdf_error( 'lpm_data_output_particles', 18 ) |
---|
| 185 | |
---|
| 186 | nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(17), particles%tail_id, & |
---|
| 187 | start = (/ 1, prt_time_count /), & |
---|
| 188 | count = (/ maximum_number_of_particles /) ) |
---|
| 189 | CALL handle_netcdf_error( 'lpm_data_output_particles', 19 ) |
---|
| 190 | |
---|
| 191 | ENDIF |
---|
| 192 | |
---|
| 193 | #endif |
---|
| 194 | |
---|
| 195 | CALL cpu_log( log_point_s(40), 'lpm_data_output', 'stop' ) |
---|
| 196 | |
---|
| 197 | END SUBROUTINE lpm_data_output_particles |
---|