[1682] | 1 | !> @file lpm_write_exchange_statistics.f90 |
---|
[2000] | 2 | !------------------------------------------------------------------------------! |
---|
[2696] | 3 | ! This file is part of the PALM model system. |
---|
[1036] | 4 | ! |
---|
[2000] | 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. |
---|
[1036] | 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 | ! |
---|
[2718] | 17 | ! Copyright 1997-2018 Leibniz Universitaet Hannover |
---|
[2000] | 18 | !------------------------------------------------------------------------------! |
---|
[1036] | 19 | ! |
---|
[849] | 20 | ! Current revisions: |
---|
| 21 | ! ------------------ |
---|
[1360] | 22 | ! |
---|
[2001] | 23 | ! |
---|
[849] | 24 | ! Former revisions: |
---|
| 25 | ! ----------------- |
---|
| 26 | ! $Id: lpm_write_exchange_statistics.f90 2841 2018-02-27 15:02:57Z kanani $ |
---|
[2841] | 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 |
---|
[2801] | 31 | ! Introduce particle transfer in nested models. |
---|
| 32 | ! |
---|
| 33 | ! 2718 2018-01-02 08:49:38Z maronga |
---|
[2716] | 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 |
---|
[2265] | 40 | ! Unused variables removed. |
---|
| 41 | ! |
---|
| 42 | ! 2101 2017-01-05 16:42:31Z suehring |
---|
[849] | 43 | ! |
---|
[2001] | 44 | ! 2000 2016-08-20 18:09:15Z knoop |
---|
| 45 | ! Forced header and separation lines into 80 columns |
---|
| 46 | ! |
---|
[1823] | 47 | ! 1822 2016-04-07 07:49:42Z hoffmann |
---|
| 48 | ! Unused variables removed. |
---|
| 49 | ! |
---|
[1683] | 50 | ! 1682 2015-10-07 23:56:08Z knoop |
---|
| 51 | ! Code annotations made doxygen readable |
---|
| 52 | ! |
---|
[1360] | 53 | ! 1359 2014-04-11 17:15:14Z hoffmann |
---|
| 54 | ! New particle structure integrated. |
---|
| 55 | ! |
---|
[1321] | 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 | ! |
---|
[1037] | 61 | ! 1036 2012-10-22 13:43:42Z raasch |
---|
| 62 | ! code put under GPL (PALM 3.9) |
---|
| 63 | ! |
---|
[850] | 64 | ! 849 2012-03-15 10:35:09Z raasch |
---|
| 65 | ! initial revision (former part of advec_particles) |
---|
[849] | 66 | ! |
---|
[850] | 67 | ! |
---|
[849] | 68 | ! Description: |
---|
| 69 | ! ------------ |
---|
[1682] | 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. |
---|
[849] | 75 | !------------------------------------------------------------------------------! |
---|
[1682] | 76 | SUBROUTINE lpm_write_exchange_statistics |
---|
[2841] | 77 | |
---|
| 78 | #if !defined( __mpifh ) |
---|
[2801] | 79 | USE MPI |
---|
[2841] | 80 | #endif |
---|
[849] | 81 | |
---|
[1359] | 82 | USE control_parameters, & |
---|
[1320] | 83 | ONLY: current_timestep_number, dt_3d, simulated_time |
---|
| 84 | |
---|
[1359] | 85 | USE indices, & |
---|
| 86 | ONLY: nxl, nxr, nys, nyn, nzb, nzt |
---|
[1320] | 87 | |
---|
[2841] | 88 | USE kinds |
---|
| 89 | |
---|
[1359] | 90 | USE particle_attributes, & |
---|
[2265] | 91 | ONLY: grid_particles, number_of_particles, prt_count, & |
---|
[1359] | 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 | |
---|
[2801] | 96 | USE pmc_particle_interface, & |
---|
| 97 | ONLY: pmcp_g_print_number_of_particles |
---|
| 98 | |
---|
[2841] | 99 | USE pegrid, & |
---|
| 100 | ONLY: comm2d, ierr, pleft, pright, psouth, pnorth |
---|
[849] | 101 | |
---|
| 102 | IMPLICIT NONE |
---|
| 103 | |
---|
[2841] | 104 | #if defined( __mpifh ) |
---|
| 105 | INCLUDE "mpif.h" |
---|
| 106 | #endif |
---|
| 107 | |
---|
[1682] | 108 | INTEGER(iwp) :: ip !< |
---|
| 109 | INTEGER(iwp) :: jp !< |
---|
| 110 | INTEGER(iwp) :: kp !< |
---|
[2801] | 111 | INTEGER(iwp) :: tot_number_of_particles |
---|
[849] | 112 | |
---|
[2801] | 113 | |
---|
| 114 | |
---|
[1359] | 115 | ! |
---|
[2265] | 116 | !-- Determine the current number of particles |
---|
[1359] | 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 | |
---|
[849] | 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, & |
---|
[2265] | 134 | trnp_count_recv_sum |
---|
[849] | 135 | #else |
---|
| 136 | WRITE ( 80, 8000 ) current_timestep_number+1, simulated_time+dt_3d, & |
---|
[2265] | 137 | number_of_particles |
---|
[849] | 138 | #endif |
---|
[2801] | 139 | CALL close_file( 80 ) |
---|
[849] | 140 | |
---|
[2801] | 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 | |
---|
[849] | 154 | ! |
---|
| 155 | !-- Formats |
---|
[1359] | 156 | 8000 FORMAT (I6,1X,F7.2,4X,I10,5X,4(I3,1X,I4,'/',I4,2X),6X,I10) |
---|
[849] | 157 | |
---|
| 158 | |
---|
| 159 | END SUBROUTINE lpm_write_exchange_statistics |
---|