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