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

Last change on this file since 1359 was 1359, checked in by hoffmann, 10 years ago

new Lagrangian particle structure integrated

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