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

Last change on this file since 1036 was 1036, checked in by raasch, 11 years ago

code has been put under the GNU General Public License (v3)

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