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

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

ONLY-attribute added to USE-statements,
kind-parameters added to all INTEGER and REAL declaration statements,
kinds are defined in new module kinds,
old module precision_kind is removed,
revision history before 2012 removed,
comment fields (!:) to be used for variable explanations added to all variable declaration statements

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