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

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

Code annotations made doxygen readable

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