EMPIRE DA  v1.9.1
Data assimilation codes using EMPIRE communication
 All Classes Files Functions Variables Pages
histogram.f90
Go to the documentation of this file.
1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2 !!! Time-stamp: <2016-08-16 15:22:48 pbrowne>
3 !!!
4 !!! Module to control what variables are used to generate rank histograms
5 !!! Copyright (C) 2014 Philip A. Browne
6 !!!
7 !!! This program is free software: you can redistribute it and/or modify
8 !!! it under the terms of the GNU General Public License as published by
9 !!! the Free Software Foundation, either version 3 of the License, or
10 !!! (at your option) any later version.
11 !!!
12 !!! This program is distributed in the hope that it will be useful,
13 !!! but WITHOUT ANY WARRANTY; without even the implied warranty of
14 !!! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 !!! GNU General Public License for more details.
16 !!!
17 !!! You should have received a copy of the GNU General Public License
18 !!! along with this program. If not, see <http://www.gnu.org/licenses/>.
19 !!!
20 !!! Email: p.browne @ reading.ac.uk
21 !!! Mail: School of Mathematical and Physical Sciences,
22 !!! University of Reading,
23 !!! Reading, UK
24 !!! RG6 6BB
25 !!!
26 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
27 
30  integer, allocatable, dimension(:) :: rank_hist_list
31  integer, allocatable, dimension(:) :: rank_hist_nums
32  integer :: rhl_n,rhn_n
33 
34 contains
72 
74  use output_empire, only : unit_hist_read
75  use comms
76  use sizes
77  implicit none
78  integer :: i
79  integer :: counter,lowerbound,upperbound
80  integer, allocatable, dimension(:) :: tempvar
81 
82 ! rhn_n = 9
83  open(unit_hist_read,file='variables_hist.dat',action='read',status='old')
84  read(unit_hist_read,'(i7.7)') rhn_n
85  allocate(rank_hist_nums(rhn_n))
86  do i = 1,rhn_n
87  read(unit_hist_read,'(i7.7)') rank_hist_nums(i)
88  end do
89  rhl_n = sum(rank_hist_nums)
90  allocate(rank_hist_list(rhl_n))
91  do i = 1,rhl_n
92  read(unit_hist_read,'(i7.7)') rank_hist_list(i)
93  end do
94  close(unit_hist_read)
95 
96 
97  if(comm_version .eq. 3) then
98 
99  lowerbound = state_displacements(pf_member_rank+1)
100  if(pf_member_rank .eq. pf_member_size-1) then
101  upperbound = state_dim_g
102  else
103  upperbound = state_displacements(pf_member_rank+2)
104  end if
105 
106  counter = 0
107  do i = 1,rhl_n
108  if(rank_hist_list(i) .gt. lowerbound .and. rank_hist_list(i) .le.&
109  & upperbound) then
110  counter = counter + 1
111  end if
112  end do
113 
114  allocate(tempvar(rhl_n))
115  tempvar = rank_hist_list
116  deallocate(rank_hist_list)
117  allocate(rank_hist_list(counter))
118 
119  counter = 0
120  do i = 1,rhl_n
121  if(tempvar(i) .gt. lowerbound .and. tempvar(i) .le.&
122  & upperbound) then
123  counter = counter + 1
124  rank_hist_list(counter) = tempvar(i)
125  end if
126  end do
127 
128  deallocate(tempvar)
129  rank_hist_list = rank_hist_list - lowerbound
130  end if
131 
132  end subroutine load_histogram_data
133 
136  if(allocated(rank_hist_list)) deallocate(rank_hist_list)
137  if(allocated(rank_hist_nums)) deallocate(rank_hist_nums)
138  end subroutine kill_histogram_data
139 end module histogram_data
Module containing EMPIRE coupling data.
Definition: comms.f90:57
Module that stores the information about the outputting from empire.
Module that stores the dimension of observation and state spaces.
Definition: sizes.f90:29
Module to control what variables are used to generate rank histograms.
Definition: histogram.f90:29
subroutine load_histogram_data
subroutine to read from variables_hist.dat which holds the variables to be used to make the rank hist...
Definition: histogram.f90:73
subroutine kill_histogram_data
subroutine to clean up arrays used in rank histograms
Definition: histogram.f90:135