25 subroutine advect_q(geom,dt,u,v,q,q_north,q_south,qnew)
30 type(
qg_geom),
intent(in) :: geom
31 real(kind_real),
intent(in) :: dt
32 real(kind_real),
intent(in) :: u(geom%nx,geom%ny,geom%nz)
33 real(kind_real),
intent(in) :: v(geom%nx,geom%ny,geom%nz)
34 real(kind_real),
intent(in) :: q(geom%nx,geom%ny,geom%nz)
35 real(kind_real),
intent(in) :: q_north(geom%nx,geom%nz)
36 real(kind_real),
intent(in) :: q_south(geom%nx,geom%nz)
37 real(kind_real),
intent(out) :: qnew(geom%nx,geom%ny,geom%nz)
41 real(kind_real) :: x,y
42 real(kind_real) :: qext(geom%nx,-1:geom%ny+2,geom%nz)
45 qext(:,1:geom%ny,:) = q
46 qext(:,-1,:) = q_south
48 qext(:,geom%ny+1,:) = q_north
49 qext(:,geom%ny+2,:) = q_north
57 x = geom%x(ix)-u(ix,iy,iz)*dt
58 y = geom%y(iy)-v(ix,iy,iz)*dt
70 subroutine advect_q_tl(geom,dt,u_traj,v_traj,q_traj,q_traj_north,q_traj_south,u,v,q,qnew)
75 type(
qg_geom),
intent(in) :: geom
76 real(kind_real),
intent(in) :: dt
77 real(kind_real),
intent(in) :: u_traj(geom%nx,geom%ny,geom%nz)
78 real(kind_real),
intent(in) :: v_traj(geom%nx,geom%ny,geom%nz)
79 real(kind_real),
intent(in) :: q_traj(geom%nx,geom%ny,geom%nz)
80 real(kind_real),
intent(in) :: q_traj_north(geom%nx,geom%nz)
81 real(kind_real),
intent(in) :: q_traj_south(geom%nx,geom%nz)
82 real(kind_real),
intent(in) :: u(geom%nx,geom%ny,geom%nz)
83 real(kind_real),
intent(in) :: v(geom%nx,geom%ny,geom%nz)
84 real(kind_real),
intent(in) :: q(geom%nx,geom%ny,geom%nz)
85 real(kind_real),
intent(out) :: qnew(geom%nx,geom%ny,geom%nz)
89 real(kind_real) :: x,y,dx,dy
90 real(kind_real) :: qext_traj(geom%nx,-1:geom%ny+2,geom%nz),qext(geom%nx,-1:geom%ny+2,geom%nz)
93 qext_traj(:,1:geom%ny,:) = q_traj
94 qext_traj(:,-1,:) = q_traj_south
95 qext_traj(:,0,:) = q_traj_south
96 qext_traj(:,geom%ny+1,:) = q_traj_north
97 qext_traj(:,geom%ny+2,:) = q_traj_north
100 qext(:,1:geom%ny,:) = q
103 qext(:,geom%ny+1,:) = 0.0
104 qext(:,geom%ny+2,:) = 0.0
112 x = geom%x(ix)-u_traj(ix,iy,iz)*dt
113 y = geom%y(iy)-v_traj(ix,iy,iz)*dt
120 call qg_interp_bicubic_tl(geom,x,y,qext_traj(:,:,iz),dx,dy,qext(:,:,iz),qnew(ix,iy,iz))
129 subroutine advect_q_ad(geom,dt,u_traj,v_traj,q_traj,q_traj_north,q_traj_south,qnew,u,v,q)
134 type(
qg_geom),
intent(in) :: geom
135 real(kind_real),
intent(in) :: dt
136 real(kind_real),
intent(in) :: u_traj(geom%nx,geom%ny,geom%nz)
137 real(kind_real),
intent(in) :: v_traj(geom%nx,geom%ny,geom%nz)
138 real(kind_real),
intent(in) :: q_traj(geom%nx,geom%ny,geom%nz)
139 real(kind_real),
intent(in) :: q_traj_north(geom%nx,geom%nz)
140 real(kind_real),
intent(in) :: q_traj_south(geom%nx,geom%nz)
141 real(kind_real),
intent(in) :: qnew(geom%nx,geom%ny,geom%nz)
142 real(kind_real),
intent(inout) :: u(geom%nx,geom%ny,geom%nz)
143 real(kind_real),
intent(inout) :: v(geom%nx,geom%ny,geom%nz)
144 real(kind_real),
intent(inout) :: q(geom%nx,geom%ny,geom%nz)
148 real(kind_real) :: x,y,dx,dy
149 real(kind_real) :: qext_traj(geom%nx,-1:geom%ny+2,geom%nz),qext(geom%nx,-1:geom%ny+2,geom%nz)
152 qext_traj(:,1:geom%ny,:) = q_traj
153 qext_traj(:,-1,:) = q_traj_south
154 qext_traj(:,0,:) = q_traj_south
155 qext_traj(:,geom%ny+1,:) = q_traj_north
156 qext_traj(:,geom%ny+2,:) = q_traj_north
166 x = geom%x(ix)-u_traj(ix,iy,iz)*dt
167 y = geom%y(iy)-v_traj(ix,iy,iz)*dt
174 call qg_interp_bicubic_ad(geom,x,y,qext_traj(:,:,iz),qnew(ix,iy,iz),dx,dy,qext(:,:,iz))
177 u(ix,iy,iz) = u(ix,iy,iz)-dx*dt
178 v(ix,iy,iz) = v(ix,iy,iz)-dy*dt
184 q = q+qext(:,1:geom%ny,:)
subroutine, public advect_q_tl(geom, dt, u_traj, v_traj, q_traj, q_traj_north, q_traj_south, u, v, q, qnew)
Advect potential vorticity - tangent linear.
subroutine, public advect_q_ad(geom, dt, u_traj, v_traj, q_traj, q_traj_north, q_traj_south, qnew, u, v, q)
Advect potential vorticity - adjoint.
subroutine, public advect_q(geom, dt, u, v, q, q_north, q_south, qnew)
Advect potential vorticity.
subroutine, public qg_interp_bicubic_ad(geom, x, y, gfld2dext_traj, val, dx, dy, gfld2dext)
Bicubic horizontal interpolation - adjoint.
subroutine, public qg_interp_bicubic_tl(geom, x, y, gfld2dext_traj, dx, dy, gfld2dext, val)
Bicubic horizontal interpolation - tangent linear.
subroutine, public qg_interp_bicubic(geom, x, y, gfld2dext, val)
Bicubic horizontal interpolation.