33 &,unit_hist_readp,emp_e
40 integer,
parameter :: rk = kind(1.0d0)
41 real(kind=rk),
dimension(rhl_n,pf%nens) :: HHpsi
42 real(kind=rk),
dimension(pf%nens) :: bin_marker
43 real(kind=rk),
dimension(rhl_n) :: y
44 integer :: particle,time,i,j,mpi_err,lb,length
46 character(32) :: filename
47 integer,
dimension(rhn_n,pf%nens+1) :: reduced_talagrand
50 if(.not. pf%gen_data)
then
51 if(pf%use_talagrand)
then
53 inquire(iolength=length) pf%psi(1,1)
55 do particle = 1,pf%count
58 if(comm_version .eq. 1 .or. comm_version .eq. 2)
then
59 write(filename,
'(A,i7.7,A,i5.5)')
'hist/timestep',&
60 &pf%timestep,
'particle',pf%particles(particle)
62 write(filename,
'(A,i7.7,A,i5.5,A,i0)')
'hist/timestep',&
63 &pf%timestep,
'particle',pf%particles(particle),
'.',pf_member_rank
65 open(unit_hist_write,file=filename,action=
'write',status=
'replace',form=
'unforma&
66 &tted',access=
'direct',recl=length)
69 write(unit_hist_write,rec=i) pf%psi(rank_hist_list(i),particle)
71 close(unit_hist_write)
76 if(tsdata%completed_timesteps .eq. tsdata%total_timesteps)
then
78 call mpi_barrier(pf_mpi_comm,mpi_err)
80 do time = 1,pf%time_obs
82 if(mod(time,npfs) .eq. pf_ens_rank)
then
85 pf%timestep = tsdata%obs_times(time)
90 if(comm_version .eq. 1 .or. comm_version .eq. 2)
then
91 write(filename,
'(A,i7.7,A)')
'hist/timestep',&
94 write(filename,
'(A,i7.7,A,i0)')
'hist/timestep',&
95 &pf%timestep,
'truth.',pf_member_rank
98 open(unit_hist_readt,file=filename,action=
'read',status=
'old',form=
'unforma&
99 &tted',access=
'direct',recl=length)
103 read(unit_hist_readt,rec=i) y(i)
106 close(unit_hist_readt)
108 do particle = 1,pf%nens
110 if(comm_version .eq. 1 .or. comm_version .eq. 2)
then
111 write(filename,
'(A,i7.7,A,i5.5)')
'hist/timestep',&
112 &pf%timestep,
'particle',pf%particles(particle)
114 write(filename,
'(A,i7.7,A,i5.5,A,i0)')
'hist/timestep',&
115 &pf%timestep,
'particle',pf&
116 &%particles(particle),
'.',pf_member_rank
119 open(unit_hist_readp, file=filename,action=
'read',status=
'old',&
120 form=
'unformatted',access=
'direct',recl=length)
122 read(unit_hist_readp,rec=i) hhpsi(i,particle)
124 close(unit_hist_readp)
133 lb = sum(rank_hist_nums(1:j-1)) + 1
135 do i = lb,sum(rank_hist_nums(1:j))
137 do particle = 1,pf%nens
138 bin_marker(particle) = hhpsi(i,particle)
146 do particle = 1,pf%nens
147 if(y(i) .lt. bin_marker(particle))
then
148 pf%talagrand(j,particle) = pf&
149 &%talagrand(j,particle)&
157 if(.not. placed)
then
158 if(y(i) .ge. bin_marker(pf%nens))
then
159 pf%talagrand(j,pf%nens+1) = pf&
160 &%talagrand(j,pf%nens+1) + 1
162 write(emp_e,*)
'There was an error in the calculation of the p&
164 &in the rank histogram. Bums.'
177 call mpi_reduce(pf%talagrand,reduced_talagrand,rhn_n*(pf%nens+1)&
178 &,mpi_integer,mpi_sum,0,pf_mpi_comm,mpi_err)
182 if(pfrank .eq. 0)
then
184 write(filename,
'(A,i0)')
'histogram_',i
185 open(unit_hist_write,file=filename,action=
'write',status=
'replace')
187 write(unit_hist_write,
'(i8.8)') reduced_talagrand(i,j)
189 close(unit_hist_write)
194 pf%timestep = tsdata%total_timesteps
201 if(pf%use_talagrand)
then
203 inquire(iolength=length) pf%psi(1,1)
205 do particle = 1,pf%count
208 if(comm_version .eq. 1 .or. comm_version .eq. 2)
then
209 write(filename,
'(A,i7.7,A)')
'hist/timestep',pf&
212 write(filename,
'(A,i7.7,A,i0)')
'hist/timestep',pf&
213 &%timestep,
'truth.',pf_member_rank
215 open(unit_hist_write,file=filename,action=
'write',status=
'replace',form=
'unforma&
216 &tted',access=
'direct',recl=length)
219 write(unit_hist_write,rec=i) pf%psi(rank_hist_list(i),particle)
221 close(unit_hist_write)
Module containing EMPIRE coupling data.
Module that stores the information about the outputting from empire.
Module that stores the information about the timestepping process.
Module that stores the dimension of observation and state spaces.
subroutine diagnostics
Subroutine to give output diagnositics such as rank histograms.
Module to control what variables are used to generate rank histograms.
module pf_control holds all the information to control the the main program
recursive subroutine quicksort_d(a, na)
subroutine to sort using the quicksort algorithm