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

Last change on this file since 2290 was 2123, checked in by hoffmann, 8 years ago

last commit documented

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