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