1 | !> @file lpm_write_exchange_statistics.f90 |
---|
2 | !------------------------------------------------------------------------------! |
---|
3 | ! This file is part of the PALM model system. |
---|
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-2018 Leibniz Universitaet Hannover |
---|
18 | !------------------------------------------------------------------------------! |
---|
19 | ! |
---|
20 | ! Current revisions: |
---|
21 | ! ------------------ |
---|
22 | ! |
---|
23 | ! |
---|
24 | ! Former revisions: |
---|
25 | ! ----------------- |
---|
26 | ! $Id: lpm_write_exchange_statistics.f90 2841 2018-02-27 15:02:57Z kanani $ |
---|
27 | ! Bugfix: wrong placement of include 'mpif.h' corrected, |
---|
28 | ! kinds module added and pegrid module scope restricted |
---|
29 | ! |
---|
30 | ! 2801 2018-02-14 16:01:55Z thiele |
---|
31 | ! Introduce particle transfer in nested models. |
---|
32 | ! |
---|
33 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
34 | ! Corrected "Former revisions" section |
---|
35 | ! |
---|
36 | ! 2696 2017-12-14 17:12:51Z kanani |
---|
37 | ! Change in file header (GPL part) |
---|
38 | ! |
---|
39 | ! 2265 2017-06-08 16:58:28Z schwenkel |
---|
40 | ! Unused variables removed. |
---|
41 | ! |
---|
42 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
43 | ! |
---|
44 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
45 | ! Forced header and separation lines into 80 columns |
---|
46 | ! |
---|
47 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
48 | ! Unused variables removed. |
---|
49 | ! |
---|
50 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
51 | ! Code annotations made doxygen readable |
---|
52 | ! |
---|
53 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
54 | ! New particle structure integrated. |
---|
55 | ! |
---|
56 | ! 1320 2014-03-20 08:40:49Z raasch |
---|
57 | ! ONLY-attribute added to USE-statements, |
---|
58 | ! comment fields (!:) to be used for variable explanations added to |
---|
59 | ! all variable declaration statements |
---|
60 | ! |
---|
61 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
62 | ! code put under GPL (PALM 3.9) |
---|
63 | ! |
---|
64 | ! 849 2012-03-15 10:35:09Z raasch |
---|
65 | ! initial revision (former part of advec_particles) |
---|
66 | ! |
---|
67 | ! |
---|
68 | ! Description: |
---|
69 | ! ------------ |
---|
70 | !> Write particle statistics (total particle numbers and number of particles |
---|
71 | !> exchanged between subdomains) on ASCII file. |
---|
72 | !> |
---|
73 | !> @attention Output format of this file could be further improved! At current |
---|
74 | !> stage it is only a test output. |
---|
75 | !------------------------------------------------------------------------------! |
---|
76 | SUBROUTINE lpm_write_exchange_statistics |
---|
77 | |
---|
78 | #if !defined( __mpifh ) |
---|
79 | USE MPI |
---|
80 | #endif |
---|
81 | |
---|
82 | USE control_parameters, & |
---|
83 | ONLY: current_timestep_number, dt_3d, simulated_time |
---|
84 | |
---|
85 | USE indices, & |
---|
86 | ONLY: nxl, nxr, nys, nyn, nzb, nzt |
---|
87 | |
---|
88 | USE kinds |
---|
89 | |
---|
90 | USE particle_attributes, & |
---|
91 | ONLY: grid_particles, number_of_particles, prt_count, & |
---|
92 | trlp_count_sum, trlp_count_recv_sum, trnp_count_sum, & |
---|
93 | trnp_count_recv_sum, trrp_count_sum, trrp_count_recv_sum, & |
---|
94 | trsp_count_sum, trsp_count_recv_sum |
---|
95 | |
---|
96 | USE pmc_particle_interface, & |
---|
97 | ONLY: pmcp_g_print_number_of_particles |
---|
98 | |
---|
99 | USE pegrid, & |
---|
100 | ONLY: comm2d, ierr, pleft, pright, psouth, pnorth |
---|
101 | |
---|
102 | IMPLICIT NONE |
---|
103 | |
---|
104 | #if defined( __mpifh ) |
---|
105 | INCLUDE "mpif.h" |
---|
106 | #endif |
---|
107 | |
---|
108 | INTEGER(iwp) :: ip !< |
---|
109 | INTEGER(iwp) :: jp !< |
---|
110 | INTEGER(iwp) :: kp !< |
---|
111 | INTEGER(iwp) :: tot_number_of_particles |
---|
112 | |
---|
113 | |
---|
114 | |
---|
115 | ! |
---|
116 | !-- Determine the current number of particles |
---|
117 | number_of_particles = 0 |
---|
118 | DO ip = nxl, nxr |
---|
119 | DO jp = nys, nyn |
---|
120 | DO kp = nzb+1, nzt |
---|
121 | number_of_particles = number_of_particles & |
---|
122 | + prt_count(kp,jp,ip) |
---|
123 | ENDDO |
---|
124 | ENDDO |
---|
125 | ENDDO |
---|
126 | |
---|
127 | CALL check_open( 80 ) |
---|
128 | #if defined( __parallel ) |
---|
129 | WRITE ( 80, 8000 ) current_timestep_number+1, simulated_time+dt_3d, & |
---|
130 | number_of_particles, pleft, trlp_count_sum, & |
---|
131 | trlp_count_recv_sum, pright, trrp_count_sum, & |
---|
132 | trrp_count_recv_sum, psouth, trsp_count_sum, & |
---|
133 | trsp_count_recv_sum, pnorth, trnp_count_sum, & |
---|
134 | trnp_count_recv_sum |
---|
135 | #else |
---|
136 | WRITE ( 80, 8000 ) current_timestep_number+1, simulated_time+dt_3d, & |
---|
137 | number_of_particles |
---|
138 | #endif |
---|
139 | CALL close_file( 80 ) |
---|
140 | |
---|
141 | IF ( number_of_particles > 0 ) THEN |
---|
142 | WRITE(9,*) 'number_of_particles ', number_of_particles, current_timestep_number + 1, simulated_time + dt_3d |
---|
143 | ENDIF |
---|
144 | |
---|
145 | #if defined( __parallel ) |
---|
146 | CALL MPI_ALLREDUCE( number_of_particles, tot_number_of_particles, 1, MPI_INTEGER, & |
---|
147 | MPI_SUM, comm2d, ierr) |
---|
148 | #else |
---|
149 | tot_number_of_particles = number_of_particles |
---|
150 | #endif |
---|
151 | |
---|
152 | CALL pmcp_g_print_number_of_particles (simulated_time+dt_3d, tot_number_of_particles) |
---|
153 | |
---|
154 | ! |
---|
155 | !-- Formats |
---|
156 | 8000 FORMAT (I6,1X,F7.2,4X,I10,5X,4(I3,1X,I4,'/',I4,2X),6X,I10) |
---|
157 | |
---|
158 | |
---|
159 | END SUBROUTINE lpm_write_exchange_statistics |
---|