27 subroutine h_local(num_hor,num_ver,this_hor,this_ver,boundary,nrhs,stateDim,x&
31 integer,
parameter :: rk = kind(1.0d0)
32 integer,
intent(in) :: num_hor,num_ver,this_hor,this_ver,boundary,nrhs&
34 real(kind=rk),
dimension(stateDim,nrhs),
intent(in) :: x
35 real(kind=rk),
dimension(obsDim,nrhs),
intent(out) :: y
36 integer :: nx,ny,nnx,nny,start_x,end_x,start_y,end_y
37 integer :: i,j,k,ii,jj
42 start_x = max(nx*(this_hor-1)+1-boundary,1)
43 end_x = min(nx*(this_hor) + boundary,256)
46 start_y = max(ny*(this_ver-1)+1-boundary,1)
47 end_y = min(ny*(this_ver)+boundary,256)
59 if(mod(i,pf%redObs) .eq. 1 .and. mod(j,pf%redObs) .eq. 1)
then
61 y(k,:) = x((ii-1)*nny+jj,:)
72 integer,
parameter :: rk = kind(1.0d0)
73 integer,
intent(in) :: num_hor,num_ver,this_hor,this_ver,boundary,nrhs,obsDim
75 real(kind=rk),
dimension(obsDim,nrhs),
intent(in) :: y
76 real(kind=rk),
dimension(obsDim,nrhs),
intent(out) :: v
79 call daxpy(obsdim*nrhs,1.0_rk/0.05_rk,y,1,v,1)
87 integer,
parameter :: rk = kind(1.0d0)
88 integer,
intent(in) :: num_hor,num_ver,this_hor,this_ver,boundary,obsDim
89 real(kind=rk),
dimension(obsDim),
intent(out) :: y
90 real(kind=rk),
dimension(obs_dim) :: yfull
91 integer :: obs_number,ios,i,j,k
92 integer :: nx,ny,nnx,nny,start_x,end_x,start_y,end_y
93 character(14) :: filename
95 obs_number = ((pf%timestep-1)/pf%time_bwn_obs) + 1
97 write(filename,
'(A,i6.6)')
'obs_num_',obs_number
99 open(67,file=filename,iostat=ios,action=
'read',status=
'old',form=
'unformatted')
101 write(*,*)
'PARTICLE FILTER DATA ERROR!!!!! Cannot open file ',filename
102 write(*,*)
'Check it exists. I need a lie down.'
108 nx = (256/pf%redObs)/num_hor
109 ny = (256/pf%redObs)/num_ver
111 start_x = max(nx*(this_hor-1)+1-(boundary/pf%redObs),1)
112 end_x = min(nx*(this_hor) + (boundary/pf%redObs),256/pf%redObs)
117 nnx = end_x-start_x+1
119 start_y = max(ny*(this_ver-1)+1-(boundary/pf%redObs),1)
120 end_y = min(ny*(this_ver)+(boundary/pf%redObs),256/pf%redObs)
121 nny = end_y-start_y+1
128 y(k) = yfull((i-1)*nny+j)
131 if(k .ne. obsdim)
then
132 print*,.ne.
'WOAH!! k obsdim'
134 print*,this_hor,this_ver,nnx,nny
148 integer,
parameter :: rk = kind(1.0d0)
149 integer,
intent(in) :: enkf_analysis
150 real(kind=rk),
dimension(state_dim,pf%count) :: x_analysis
151 real(kind=rk),
dimension(:,:),
allocatable :: x_local
152 integer :: mpi_err,particle,tag
153 integer :: num_hor,num_ver,boundary,stateDim,Obsdim,obsx,obsy
154 integer :: nx,ny,nnx,nny,start_x,end_x,start_y,end_y,k,ii,jj,i,j
155 integer,
dimension(mpi_status_size) :: mpi_status
159 particle = pf%particles(k)
161 call mpi_send(pf%psi(:,k),state_dim,mpi_double_precision&
162 &,particle-1,tag,cpl_mpi_comm,mpi_err)
166 particle = pf%particles(k)
168 CALL mpi_recv(pf%psi(:,k), state_dim, mpi_double_precision, &
169 particle-1, tag, cpl_mpi_comm,mpi_status, mpi_err)
175 if(mod(pf%timestep,pf%time_bwn_obs) .eq. 0)
then
190 start_x = max(nx*(i-1)+1-boundary,1)
191 end_x = min(nx*(i) + boundary,256)
192 nnx = end_x-start_x+1
194 start_y = max(ny*(j-1)+1-boundary,1)
195 end_y = min(ny*(j)+boundary,256)
196 nny = end_y-start_y+1
201 do ii = start_x,end_x
202 if(mod(ii,pf%redObs) .eq. 1) obsx = obsx + 1
205 do jj = start_y,end_y
206 if(mod(jj,pf%redObs) .eq. 1) obsy = obsy + 1
211 allocate(x_local(statedim,pf%count))
213 do ii = start_x,end_x
214 do jj = start_y,end_y
216 x_local(k,:) = pf%psi((ii-1)*256 + jj,:)
221 if(enkf_analysis .eq. 3)
then
224 call
etkf_analysis(num_hor,num_ver,i,j,boundary,x_local,pf%count&
225 &,statedim,obsdim,pf%Qscale)
228 elseif(enkf_analysis .eq. 4)
then
229 call
eakf_analysis(num_hor,num_ver,i,j,boundary,x_local,pf%count&
230 &,statedim,obsdim,pf%Qscale)
235 stop
'ENKF SELECTED INCORRECTLY: 2013MONBLUE'
241 do ii = nx*(i-1)+1,nx*i
243 do jj = ny*(j-1)+1,ny*j
248 x_analysis((i-1)*nx*ny*num_ver + 256*mod(ii-1,nx) + jj,:)&
250 nny*( nx*(i-1)+1 - max(nx*(i-1)+1-boundary,1) ) +&
251 (ii-nx*(i-1) )*(ny*(j-1)+1 - max(ny*(j-1)+1-boundary,1) ) &
253 (ii-1-nx*(i-1))*(min(ny*(j)+boundary,256)-ny*j) ,:)
subroutine h_local(num_hor, num_ver, this_hor, this_ver, boundary, nrhs, stateDim, x, obsDim, y)
Module containing EMPIRE coupling data.
subroutine eakf_analysis(num_hor, num_ver, this_hor, this_ver, boundary, x, N, stateDim, obsDim, rho)
subroutine etkf_analysis(num_hor, num_ver, this_hor, this_ver, boundary, x, N, stateDim, obsDim, rho)
subroutine to perform the ensemble transform Kalman filter
Module that stores the dimension of observation and state spaces.
subroutine get_local_observation_data(num_hor, num_ver, this_hor, this_ver, boundary, obsDim, y)
subroutine localise_enkf(enkf_analysis)
module pf_control holds all the information to control the the main program
subroutine solve_rhalf_local(num_hor, num_ver, this_hor, this_ver, boundary, nrhs, obsDim, y, v)