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