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

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

changes in LPM and bulk cloud microphysics

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