source: palm/trunk/SOURCE/lpm_data_output_particles.f90 @ 1329

Last change on this file since 1329 was 1329, checked in by raasch, 10 years ago

last commit documented

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