34 subroutine etkf_analysis(num_hor,num_ver,this_hor,this_ver,boundary,x,N,stateDim,obsDim,rho)
37 integer,
parameter :: rk = kind(1.0d0)
39 integer,
intent(in) :: N,stateDim,obsDim
41 real(kind=rk),
dimension(stateDim,N),
intent(inout) :: x
44 real(kind=rk),
dimension(obsDim) :: y
47 real(kind=rk),
intent(in) :: rho
49 integer,
intent(in) :: num_hor,num_ver,this_hor,this_ver,boundary
53 real(kind=rk),
dimension(:,:),
allocatable :: V
54 real(kind=rk),
dimension(:),
allocatable :: S
55 real(kind=rk),
dimension(N,N) :: UT
57 real(kind=rk),
dimension(:),
allocatable :: WORK
60 real(kind=rk),
dimension(stateDim) :: mean_x
61 real(kind=rk),
dimension(stateDim,N) :: Xp
62 real(kind=rk),
dimension(obsDim) :: mean_yf,d,dd
63 real(kind=rk),
dimension(obsDim,N) :: yf,Ysf
70 mean_x = sum(x,dim=2)/
real(n,rk)
72 xp(:,i) = x(:,i) - mean_x
75 xp = (1.0_rk + rho) * xp
77 x(:,i) = mean_x + xp(:,i)
80 xp = xp/sqrt(
real(n-1,rk))
86 call
h_local(num_hor,num_ver,this_hor,this_ver,boundary,n,statedim,x&
88 mean_yf = sum(yf,dim=2)/
real(n,rk)
90 yf(:,i) = yf(:,i) - mean_yf
92 yf = yf/sqrt(
real(n-1,rk))
101 lwork = 2*max( 3*r+max(obsdim,n), 5*r )
102 allocate(work(lwork))
103 call dgesvd(
'S',
'A',obsdim,n,ysf,obsdim,s,v,obsdim,ut,n,work,lwork,info)
105 print*,
'SVD failed with INFO = ',info
106 print*,
'FYI WORK(1) = ',work(1)
114 call dgemm(
'N',
'T',statedim,n,n,1.0d0,xp,statedim,ut,n,0.0d0,x,statedim)
123 call dgemv(
'T',obsdim,r,1.0d0,v,obsdim,dd,1,0.0d0,d,1)
124 d(1:r) = s * d(1:r) / (1.0_rk + s**2)
126 call dgemv(
'N',statedim,r,1.0d0,x,statedim,d,1,1.0d0,mean_x,1)
130 x(:,i) = x(:,i) / sqrt(1.0_rk + s(i)**2)
132 call dgemm(
'N',
'N',statedim,n,n,1.0d0,x,statedim,ut,n,0.0d0,xp,statedim)
135 x = sqrt(
real(n-1,rk))*xp
137 x(:,i) = mean_x + x(:,i)
subroutine h_local(num_hor, num_ver, this_hor, this_ver, boundary, nrhs, stateDim, x, obsDim, y)
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
subroutine get_local_observation_data(num_hor, num_ver, this_hor, this_ver, boundary, obsDim, y)
subroutine solve_rhalf_local(num_hor, num_ver, this_hor, this_ver, boundary, nrhs, obsDim, y, v)