12 use fckit_log_module,
only: fckit_log
32 type(
qg_geom),
intent(in) :: geom
33 real(kind_real),
intent(in) :: c
34 real(kind_real),
intent(in) :: b(geom%nx,geom%ny)
35 real(kind_real),
intent(out) :: x(geom%nx,geom%ny)
38 integer :: kx,iri,ix,iy
39 real(kind_real) :: v(geom%ny),w(geom%ny),z(geom%ny)
40 real(kind_real) :: bext(geom%nx+2,geom%ny),xext(geom%nx+2,geom%ny)
41 real(kind_real) :: am,bm
42 real(kind_real) :: tmp_in(geom%nx,geom%ny),tmp_out(geom%nx,geom%ny)
43 character(len=2014) :: record
47 call fft_fwd(geom%nx,b(:,iy),bext(:,iy))
53 am = c+2.0*(cos(2.0*real(kx,kind_real)*
pi/real(geom%nx,kind_real))-1.0)/geom%deltax**2-2.0/geom%deltay**2
54 bm = 1.0/geom%deltay**2
65 z(1) = bext(2*kx+iri,1)/am
67 z(iy) = (bext(2*kx+iri,iy)-bm*z(iy-1))/w(iy)
71 xext(2*kx+iri,geom%ny) = z(geom%ny)
73 xext(2*kx+iri,iy) = z(iy)-v(iy)*xext(2*kx+iri,iy+1)
80 call fft_inv(geom%nx,xext(:,iy),x(:,iy))
91 type(
qg_geom),
intent(in) :: geom
92 real(kind_real),
intent(in) :: c
93 real(kind_real),
intent(in) :: x(geom%nx,geom%ny)
94 real(kind_real),
intent(inout) :: b(geom%nx,geom%ny)
97 real(kind_real) :: v(geom%ny),w(geom%ny),z(geom%ny)
98 real(kind_real) :: bext(geom%nx+2,geom%ny),xext(geom%nx+2,geom%ny)
99 real(kind_real) :: btmp(geom%nx,geom%ny)
100 real(kind_real) :: am,bm
108 call fft_fwd(geom%nx,x(:,iy),xext(:,iy))
114 am = c+2.0*(cos(2.0*real(kx,kind_real)*
pi/real(geom%nx,kind_real))-1.0)/geom%deltax**2-2.0/geom%deltay**2
115 bm = 1.0/geom%deltay**2
121 w(iy) = am-bm*v(iy-1)
130 xext(2*kx+iri,iy+1) = xext(2*kx+iri,iy+1)-v(iy)*xext(2*kx+iri,iy)
131 z(iy) = z(iy)+xext(2*kx+iri,iy)
133 z(geom%ny) = z(geom%ny)+xext(2*kx+iri,geom%ny)
137 bext(2*kx+iri,iy) = bext(2*kx+iri,iy)+z(iy)/w(iy)
138 z(iy-1) = z(iy-1)-bm*z(iy)/w(iy)
140 bext(2*kx+iri,1) = bext(2*kx+iri,1)+z(1)/am
146 call fft_inv(geom%nx,bext(:,iy),btmp(:,iy))
158 type(
qg_geom),
intent(in) :: geom
159 real(kind_real),
intent(in) :: x(geom%nx,geom%ny,geom%nz)
160 real(kind_real),
intent(out) :: del2x(geom%nx,geom%ny,geom%nz)
168 del2x(:,:,iz) = -2.0*x(:,:,iz)*(1.0/geom%deltax**2+1.0/geom%deltay**2)
169 del2x(1:geom%nx-1,:,iz) = del2x(1:geom%nx-1,:,iz)+x(2:geom%nx,:,iz)/geom%deltax**2
170 del2x(geom%nx,:,iz) = del2x(geom%nx,:,iz)+x(1,:,iz)/geom%deltax**2
171 del2x(2:geom%nx,:,iz) = del2x(2:geom%nx,:,iz)+x(1:geom%nx-1,:,iz)/geom%deltax**2
172 del2x(1,:,iz) = del2x(1,:,iz)+x(geom%nx,:,iz)/geom%deltax**2
173 del2x(:,1:geom%ny-1,iz) = del2x(:,1:geom%ny-1,iz)+x(:,2:geom%ny,iz)/geom%deltay**2
174 del2x(:,2:geom%ny,iz) = del2x(:,2:geom%ny,iz)+x(:,1:geom%ny-1,iz)/geom%deltay**2
186 type(
qg_geom),
intent(in) :: geom
187 real(kind_real),
intent(in) :: del2x(geom%nx,geom%ny,geom%nz)
188 real(kind_real),
intent(inout) :: x(geom%nx,geom%ny,geom%nz)
195 x(:,1:geom%ny-1,iz) = x(:,1:geom%ny-1,iz)+del2x(:,2:geom%ny,iz)/geom%deltay**2
196 x(:,2:geom%ny,iz) = x(:,2:geom%ny,iz)+del2x(:,1:geom%ny-1,iz)/geom%deltay**2
197 x(geom%nx,:,iz) = x(geom%nx,:,iz)+del2x(1,:,iz)/geom%deltax**2
198 x(1:geom%nx-1,:,iz) = x(1:geom%nx-1,:,iz)+del2x(2:geom%nx,:,iz)/geom%deltax**2
199 x(1,:,iz) = x(1,:,iz)+del2x(geom%nx,:,iz)/geom%deltax**2
200 x(2:geom%nx,:,iz) = x(2:geom%nx,:,iz)+del2x(1:geom%nx-1,:,iz)/geom%deltax**2
201 x(:,:,iz) = x(:,:,iz)-2.0*del2x(:,:,iz)*(1.0/geom%deltax**2+1.0/geom%deltay**2)
subroutine, public solve_helmholz_ad(geom, c, x, b)
Solve a Helmholz equation - adjoint.
subroutine, public laplacian_2d_ad(geom, del2x, x)
Horizontal Laplacian operator - adjoint.
subroutine, public laplacian_2d(geom, x, del2x)
Horizontal Laplacian operator.
subroutine, public solve_helmholz(geom, c, b, x)
Solve a Helmholz equation.
Fortran module for Eigen FFTs.
subroutine, public fft_inv(kk, pf, pg)
subroutine, public fft_fwd(kk, pg, pf)
real(kind_real), parameter, public pi
Pi.