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

Last change on this file since 1318 was 1318, checked in by raasch, 10 years ago

former files/routines cpu_log and cpu_statistics combined to one module,
which also includes the former data module cpulog from the modules-file,
module interfaces removed

  • Property svn:keywords set to Id
File size: 8.2 KB
RevLine 
[849]1 SUBROUTINE lpm_data_output_particles
2
[1036]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!
[1310]17! Copyright 1997-2014 Leibniz Universitaet Hannover
[1036]18!--------------------------------------------------------------------------------!
19!
[849]20! Current revisions:
21! ------------------
[1318]22! module interfaces removed
[849]23!
24! Former revisions:
25! -----------------
26! $Id: lpm_data_output_particles.f90 1318 2014-03-17 13:35:16Z raasch $
27!
[1037]28! 1036 2012-10-22 13:43:42Z raasch
29! code put under GPL (PALM 3.9)
30!
[850]31! 849 2012-03-15 10:35:09Z raasch
32! initial revision (former part of advec_particles)
33!
[849]34! 22/02/12 - Initial version
35!
36! Description:
37! ------------
38! Write particle data in FORTRAN binary and/or netCDF format
39!------------------------------------------------------------------------------!
40
41    USE control_parameters
42    USE cpulog
43    USE netcdf_control
44    USE particle_attributes
45
46    IMPLICIT NONE
47
48
49    CALL cpu_log( log_point_s(40), 'lpm_data_output', 'start' )
50
51!
52!-- Attention: change version number for unit 85 (in routine check_open)
53!--            whenever the output format for this unit is changed!
54    CALL check_open( 85 )
55
56    WRITE ( 85 )  simulated_time, maximum_number_of_particles, &
57                  number_of_particles
58    WRITE ( 85 )  particles
59    WRITE ( 85 )  maximum_number_of_tailpoints, maximum_number_of_tails, &
60                  number_of_tails
61    IF ( maximum_number_of_tails > 0 )  THEN
62       WRITE ( 85 )  particle_tail_coordinates
63    ENDIF
64
65    CALL close_file( 85 )
66
67
68#if defined( __netcdf )
69!
70!-- Output in netCDF format
71    IF ( netcdf_output )  THEN
72
73       CALL check_open( 108 )
74
75!
76!--    Update the NetCDF time axis
77       prt_time_count = prt_time_count + 1
78
79       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_time_prt, &
80                               (/ simulated_time /),        &
81                               start = (/ prt_time_count /), count = (/ 1 /) )
82       CALL handle_netcdf_error( 'lpm_data_output_particles', 1 )
83
84!
85!--    Output the real number of particles used
86       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_rnop_prt, &
87                               (/ number_of_particles /),   &
88                               start = (/ prt_time_count /), count = (/ 1 /) )
89       CALL handle_netcdf_error( 'lpm_data_output_particles', 2 )
90
91!
92!--    Output all particle attributes
93       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(1), particles%age,      &
94                               start = (/ 1, prt_time_count /),               &
95                               count = (/ maximum_number_of_particles /) )
96       CALL handle_netcdf_error( 'lpm_data_output_particles', 3 )
97
98       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(2), particles%dvrp_psize,&
99                               start = (/ 1, prt_time_count /),                &
100                               count = (/ maximum_number_of_particles /) )
101       CALL handle_netcdf_error( 'lpm_data_output_particles', 4 )
102
103       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(3), particles%origin_x, &
104                               start = (/ 1, prt_time_count /),               &
105                               count = (/ maximum_number_of_particles /) )
106       CALL handle_netcdf_error( 'lpm_data_output_particles', 5 )
107
108       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(4), particles%origin_y, &
109                               start = (/ 1, prt_time_count /),               &
110                               count = (/ maximum_number_of_particles /) )
111       CALL handle_netcdf_error( 'lpm_data_output_particles', 6 )
112
113       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(5), particles%origin_z, &
114                               start = (/ 1, prt_time_count /),               &
115                               count = (/ maximum_number_of_particles /) )
116       CALL handle_netcdf_error( 'lpm_data_output_particles', 7 )
117
118       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(6), particles%radius,   &
119                               start = (/ 1, prt_time_count /),               &
120                               count = (/ maximum_number_of_particles /) )
121       CALL handle_netcdf_error( 'lpm_data_output_particles', 8 )
122
123       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(7), particles%speed_x,  &
124                               start = (/ 1, prt_time_count /),               &
125                               count = (/ maximum_number_of_particles /) )
126       CALL handle_netcdf_error( 'lpm_data_output_particles', 9 )
127
128       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(8), particles%speed_y,  &
129                               start = (/ 1, prt_time_count /),               &
130                               count = (/ maximum_number_of_particles /) )
131       CALL handle_netcdf_error( 'lpm_data_output_particles', 10 )
132
133       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(9), particles%speed_z,  &
134                               start = (/ 1, prt_time_count /),               &
135                               count = (/ maximum_number_of_particles /) )
136       CALL handle_netcdf_error( 'lpm_data_output_particles', 11 )
137
138       nc_stat = NF90_PUT_VAR( id_set_prt,id_var_prt(10),                     &
139                               particles%weight_factor,                       &
140                               start = (/ 1, prt_time_count /),               &
141                               count = (/ maximum_number_of_particles /) )
142       CALL handle_netcdf_error( 'lpm_data_output_particles', 12 )
143
144       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(11), particles%x,       &
145                               start = (/ 1, prt_time_count /),               &
146                               count = (/ maximum_number_of_particles /) )
147       CALL handle_netcdf_error( 'lpm_data_output_particles', 13 )
148
149       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(12), particles%y,       & 
150                               start = (/ 1, prt_time_count /),               &
151                               count = (/ maximum_number_of_particles /) )
152       CALL handle_netcdf_error( 'lpm_data_output_particles', 14 )
153
154       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(13), particles%z,       &
155                               start = (/ 1, prt_time_count /),               &
156                               count = (/ maximum_number_of_particles /) )
157       CALL handle_netcdf_error( 'lpm_data_output_particles', 15 )
158
159       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(14), particles%class,   &
160                               start = (/ 1, prt_time_count /),               &
161                               count = (/ maximum_number_of_particles /) )
162       CALL handle_netcdf_error( 'lpm_data_output_particles', 16 )
163
164       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(15), particles%group,   &
165                               start = (/ 1, prt_time_count /),               &
166                               count = (/ maximum_number_of_particles /) )
167       CALL handle_netcdf_error( 'lpm_data_output_particles', 17 )
168
169       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(16),                    &
170                               particles%tailpoints,                          &
171                               start = (/ 1, prt_time_count /),               &
172                               count = (/ maximum_number_of_particles /) )
173       CALL handle_netcdf_error( 'lpm_data_output_particles', 18 )
174
175       nc_stat = NF90_PUT_VAR( id_set_prt, id_var_prt(17), particles%tail_id, &
176                               start = (/ 1, prt_time_count /),               &
177                               count = (/ maximum_number_of_particles /) )
178       CALL handle_netcdf_error( 'lpm_data_output_particles', 19 )
179
180    ENDIF
181
182#endif
183
184    CALL cpu_log( log_point_s(40), 'lpm_data_output', 'stop' )
185
186 END SUBROUTINE lpm_data_output_particles
Note: See TracBrowser for help on using the repository browser.