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

Last change on this file since 1787 was 1784, checked in by raasch, 9 years ago

last commit documented

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