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