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

Last change on this file since 1598 was 1360, checked in by hoffmann, 11 years ago

last commit documented

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