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

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

last commit documented

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