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

Last change on this file since 1752 was 1683, checked in by knoop, 9 years ago

last commit documented

  • Property svn:keywords set to Id
File size: 9.6 KB
RevLine 
[1682]1!> @file lpm_data_output_particles.f90
[1036]2!--------------------------------------------------------------------------------!
3! This file is part of PALM.
4!
5! PALM is free software: you can redistribute it and/or modify it under the terms
6! of the GNU General Public License as published by the Free Software Foundation,
7! either version 3 of the License, or (at your option) any later version.
8!
9! PALM is distributed in the hope that it will be useful, but WITHOUT ANY
10! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11! A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
12!
13! You should have received a copy of the GNU General Public License along with
14! PALM. If not, see <http://www.gnu.org/licenses/>.
15!
[1310]16! Copyright 1997-2014 Leibniz Universitaet Hannover
[1036]17!--------------------------------------------------------------------------------!
18!
[849]19! Current revisions:
20! ------------------
[1329]21!
[1683]22!
[849]23! Former revisions:
24! -----------------
25! $Id: lpm_data_output_particles.f90 1683 2015-10-07 23:57:51Z maronga $
26!
[1683]27! 1682 2015-10-07 23:56:08Z knoop
28! Code annotations made doxygen readable
29!
[1360]30! 1359 2014-04-11 17:15:14Z hoffmann
31! netCDF output currently not available
32! output of particle data in binary format adopted to new particle structure
33!
[1329]34! 1327 2014-03-21 11:00:16Z raasch
35! -netcdf output queries
36!
[1321]37! 1320 2014-03-20 08:40:49Z raasch
38! ONLY-attribute added to USE-statements,
39! revision history before 2012 removed
40!
[1037]41! 1036 2012-10-22 13:43:42Z raasch
42! code put under GPL (PALM 3.9)
43!
[850]44! 849 2012-03-15 10:35:09Z raasch
45! initial revision (former part of advec_particles)
46!
[849]47! 22/02/12 - Initial version
48!
49! Description:
50! ------------
[1682]51!> Write particle data in FORTRAN binary and/or netCDF format
[849]52!------------------------------------------------------------------------------!
[1682]53 SUBROUTINE lpm_data_output_particles
54 
[849]55
[1320]56    USE control_parameters,                                                    &
[1327]57        ONLY:  prt_time_count, simulated_time
[1320]58
59    USE cpulog,                                                                &
60        ONLY:  cpu_log, log_point_s
61
[1359]62    USE indices,                                                               &
63        ONLY:  nxl, nxr, nyn, nys, nzb, nzt
64
65    USE kinds
66
[849]67    USE netcdf_control
68
[1320]69    USE particle_attributes,                                                   &
[1359]70        ONLY:  grid_particles, maximum_number_of_particles,                    &
71               maximum_number_of_tailpoints, maximum_number_of_tails,          &
72               number_of_particles, number_of_tails, particles,                &
73               particle_tail_coordinates, prt_count
[1320]74
[849]75    IMPLICIT NONE
76
[1682]77    INTEGER(iwp) ::  ip !<
78    INTEGER(iwp) ::  jp !<
79    INTEGER(iwp) ::  kp !<
[849]80
81    CALL cpu_log( log_point_s(40), 'lpm_data_output', 'start' )
82
83!
84!-- Attention: change version number for unit 85 (in routine check_open)
85!--            whenever the output format for this unit is changed!
86    CALL check_open( 85 )
87
[1359]88    WRITE ( 85 )  simulated_time
89    WRITE ( 85 )  prt_count
90         
91    DO  ip = nxl, nxr
92       DO  jp = nys, nyn
93          DO  kp = nzb+1, nzt
94             number_of_particles = prt_count(kp,jp,ip)
95             particles => grid_particles(kp,jp,ip)%particles(1:number_of_particles)
96             IF ( number_of_particles <= 0 )  CYCLE
97             WRITE ( 85 )  particles
98          ENDDO
99       ENDDO
100    ENDDO
101!
102!-- particle tails currently not available
103!    WRITE ( 85 )  maximum_number_of_tailpoints, maximum_number_of_tails, &
104!                  number_of_tails
105!    IF ( maximum_number_of_tails > 0 )  THEN
106!       WRITE ( 85 )  particle_tail_coordinates, prt_time_count
107!    ENDIF
[849]108
109    CALL close_file( 85 )
110
111
112#if defined( __netcdf )
[1359]113! !
114! !-- Output in netCDF format
115!     CALL check_open( 108 )
116!
117! !
118! !-- Update the NetCDF time axis
119!     prt_time_count = prt_time_count + 1
120!
121!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_time_prt, &
122!                             (/ simulated_time /),        &
123!                             start = (/ prt_time_count /), count = (/ 1 /) )
124!     CALL handle_netcdf_error( 'lpm_data_output_particles', 1 )
125!
126! !
127! !-- Output the real number of particles used
128!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_rnop_prt, &
129!                             (/ number_of_particles /),   &
130!                             start = (/ prt_time_count /), count = (/ 1 /) )
131!     CALL handle_netcdf_error( 'lpm_data_output_particles', 2 )
132!
133! !
134! !-- Output all particle attributes
135!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(1), particles%age,      &
136!                             start = (/ 1, prt_time_count /),               &
137!                             count = (/ maximum_number_of_particles /) )
138!     CALL handle_netcdf_error( 'lpm_data_output_particles', 3 )
139!
140!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(2), particles%dvrp_psize,&
141!                             start = (/ 1, prt_time_count /),                &
142!                             count = (/ maximum_number_of_particles /) )
143!     CALL handle_netcdf_error( 'lpm_data_output_particles', 4 )
144!
145!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(3), particles%origin_x, &
146!                             start = (/ 1, prt_time_count /),               &
147!                             count = (/ maximum_number_of_particles /) )
148!     CALL handle_netcdf_error( 'lpm_data_output_particles', 5 )
149!
150!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(4), particles%origin_y, &
151!                             start = (/ 1, prt_time_count /),               &
152!                             count = (/ maximum_number_of_particles /) )
153!     CALL handle_netcdf_error( 'lpm_data_output_particles', 6 )
154!
155!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(5), particles%origin_z, &
156!                             start = (/ 1, prt_time_count /),               &
157!                             count = (/ maximum_number_of_particles /) )
158!     CALL handle_netcdf_error( 'lpm_data_output_particles', 7 )
159!
160!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(6), particles%radius,   &
161!                             start = (/ 1, prt_time_count /),               &
162!                             count = (/ maximum_number_of_particles /) )
163!     CALL handle_netcdf_error( 'lpm_data_output_particles', 8 )
164!
165!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(7), particles%speed_x,  &
166!                             start = (/ 1, prt_time_count /),               &
167!                             count = (/ maximum_number_of_particles /) )
168!     CALL handle_netcdf_error( 'lpm_data_output_particles', 9 )
169!
170!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(8), particles%speed_y,  &
171!                             start = (/ 1, prt_time_count /),               &
172!                             count = (/ maximum_number_of_particles /) )
173!     CALL handle_netcdf_error( 'lpm_data_output_particles', 10 )
174!
175!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(9), particles%speed_z,  &
176!                             start = (/ 1, prt_time_count /),               &
177!                             count = (/ maximum_number_of_particles /) )
178!     CALL handle_netcdf_error( 'lpm_data_output_particles', 11 )
179!
180!     nc_stat = NF90_PUT_VAR( id_set_prt,id_var_prt(10),                     &
181!                             particles%weight_factor,                       &
182!                             start = (/ 1, prt_time_count /),               &
183!                             count = (/ maximum_number_of_particles /) )
184!     CALL handle_netcdf_error( 'lpm_data_output_particles', 12 )
185!
186!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(11), particles%x,       &
187!                             start = (/ 1, prt_time_count /),               &
188!                             count = (/ maximum_number_of_particles /) )
189!     CALL handle_netcdf_error( 'lpm_data_output_particles', 13 )
190!
191!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(12), particles%y,       &
192!                             start = (/ 1, prt_time_count /),               &
193!                             count = (/ maximum_number_of_particles /) )
194!     CALL handle_netcdf_error( 'lpm_data_output_particles', 14 )
195!
196!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(13), particles%z,       &
197!                             start = (/ 1, prt_time_count /),               &
198!                             count = (/ maximum_number_of_particles /) )
199!     CALL handle_netcdf_error( 'lpm_data_output_particles', 15 )
200!
201!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(14), particles%class,   &
202!                             start = (/ 1, prt_time_count /),               &
203!                             count = (/ maximum_number_of_particles /) )
204!     CALL handle_netcdf_error( 'lpm_data_output_particles', 16 )
205!
206!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(15), particles%group,   &
207!                             start = (/ 1, prt_time_count /),               &
208!                             count = (/ maximum_number_of_particles /) )
209!     CALL handle_netcdf_error( 'lpm_data_output_particles', 17 )
210!
211!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(16),                    &
212!                             particles%tailpoints,                          &
213!                             start = (/ 1, prt_time_count /),               &
214!                             count = (/ maximum_number_of_particles /) )
215!     CALL handle_netcdf_error( 'lpm_data_output_particles', 18 )
216!
217!     nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(17), particles%tail_id, &
218!                             start = (/ 1, prt_time_count /),               &
219!                             count = (/ maximum_number_of_particles /) )
220!     CALL handle_netcdf_error( 'lpm_data_output_particles', 19 )
221!
[849]222#endif
223
224    CALL cpu_log( log_point_s(40), 'lpm_data_output', 'stop' )
225
226 END SUBROUTINE lpm_data_output_particles
Note: See TracBrowser for help on using the repository browser.