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