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