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

Last change on this file since 2076 was 2001, checked in by knoop, 8 years ago

last commit documented

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