17 subroutine advect_pv (qnew,q,q_north,q_south,u,v,nx,ny,deltax,deltay,dt)
24 real(kind_real),
intent(out) :: qnew(nx,ny,2)
25 real(kind_real),
intent(in) :: q(nx,ny,2)
26 real(kind_real),
intent(in) :: q_north(nx,2)
27 real(kind_real),
intent(in) :: q_south(nx,2)
28 real(kind_real),
intent(in) :: u(nx,ny,2)
29 real(kind_real),
intent(in) :: v(nx,ny,2)
30 integer,
intent(in) :: nx
31 integer,
intent(in) :: ny
32 real(kind_real),
intent(in) :: deltax
33 real(kind_real),
intent(in) :: deltay
34 real(kind_real),
intent(in) :: dt
36 integer :: ii,jj,kk,ixm1,ix,ixp1,ixp2,jym1,jy,jyp1,jyp2
37 real(kind_real) :: ax,ay,qjm1,qj,qjp1,qjp2
38 real(kind_real),
parameter :: one=1.0_kind_real
39 real(kind_real),
parameter :: two=2.0_kind_real
40 real(kind_real),
parameter :: half=0.5_kind_real
41 real(kind_real),
parameter :: sixth=1.0_kind_real/6.0_kind_real
51 ax =
real(ii,kind_real) - u(ii,jj,kk)*dt/deltax
53 ax = ax-
real(ix,kind_real)
54 ixm1 = 1 + modulo(ix-2,nx)
55 ixp1 = 1 + modulo(ix ,nx)
56 ixp2 = 1 + modulo(ix+1,nx)
57 ix = 1 + modulo(ix-1,nx)
59 ay =
real(jj,kind_real) - v(ii,jj,kk)*dt/deltay
61 ay = ay-
real(jy,kind_real)
69 qjm1 = ax *(ax-one)*(ax-two)*q_south(ixm1,kk)*(-sixth) + &
70 & (ax+one)*(ax-one)*(ax-two)*q_south(ix, kk)*half + &
71 & (ax+one)* ax *(ax-two)*q_south(ixp1,kk)*(-half) + &
72 & (ax+one)* ax *(ax-one)*q_south(ixp2,kk)*(sixth)
73 else if (jym1 > ny)
then 74 qjm1 = ax *(ax-one)*(ax-two)*q_north(ixm1,kk)*(-sixth) + &
75 & (ax+one)*(ax-one)*(ax-two)*q_north(ix, kk)*half + &
76 & (ax+one)* ax *(ax-two)*q_north(ixp1,kk)*(-half) + &
77 & (ax+one)* ax *(ax-one)*q_north(ixp2,kk)*(sixth)
79 qjm1 = ax *(ax-one)*(ax-two)*q(ixm1,jym1,kk)*(-sixth) + &
80 & (ax+one)*(ax-one)*(ax-two)*q(ix, jym1,kk)*half + &
81 & (ax+one)* ax *(ax-two)*q(ixp1,jym1,kk)*(-half) + &
82 & (ax+one)* ax *(ax-one)*q(ixp2,jym1,kk)*(sixth)
86 qj = ax *(ax-one)*(ax-two)*q_south(ixm1,kk)*(-sixth) + &
87 & (ax+one)*(ax-one)*(ax-two)*q_south(ix ,kk)*half + &
88 & (ax+one)* ax *(ax-two)*q_south(ixp1,kk)*(-half) + &
89 & (ax+one)* ax *(ax-one)*q_south(ixp2,kk)*(sixth)
90 else if (jy > ny)
then 91 qj = ax *(ax-one)*(ax-two)*q_north(ixm1,kk)*(-sixth) + &
92 & (ax+one)*(ax-one)*(ax-two)*q_north(ix ,kk)*half + &
93 & (ax+one)* ax *(ax-two)*q_north(ixp1,kk)*(-half) + &
94 & (ax+one)* ax *(ax-one)*q_north(ixp2,kk)*(sixth)
96 qj = ax *(ax-one)*(ax-two)*q(ixm1,jy,kk)*(-sixth) + &
97 & (ax+one)*(ax-one)*(ax-two)*q(ix ,jy,kk)*half + &
98 & (ax+one)* ax *(ax-two)*q(ixp1,jy,kk)*(-half) + &
99 & (ax+one)* ax *(ax-one)*q(ixp2,jy,kk)*(sixth)
103 qjp1 = ax *(ax-one)*(ax-two)*q_south(ixm1,kk)*(-sixth) + &
104 & (ax+one)*(ax-one)*(ax-two)*q_south(ix ,kk)*half + &
105 & (ax+one)* ax *(ax-two)*q_south(ixp1,kk)*(-half) + &
106 & (ax+one)* ax *(ax-one)*q_south(ixp2,kk)*(sixth)
107 else if (jyp1 > ny)
then 108 qjp1 = ax *(ax-one)*(ax-two)*q_north(ixm1,kk)*(-sixth) + &
109 & (ax+one)*(ax-one)*(ax-two)*q_north(ix ,kk)*half + &
110 & (ax+one)* ax *(ax-two)*q_north(ixp1,kk)*(-half) + &
111 & (ax+one)* ax *(ax-one)*q_north(ixp2,kk)*(sixth)
113 qjp1 = ax *(ax-one)*(ax-two)*q(ixm1,jyp1,kk)*(-sixth) + &
114 & (ax+one)*(ax-one)*(ax-two)*q(ix ,jyp1,kk)*half + &
115 & (ax+one)* ax *(ax-two)*q(ixp1,jyp1,kk)*(-half) + &
116 & (ax+one)* ax *(ax-one)*q(ixp2,jyp1,kk)*(sixth)
120 qjp2 = ax *(ax-one)*(ax-two)*q_south(ixm1,kk)*(-sixth) + &
121 & (ax+one)*(ax-one)*(ax-two)*q_south(ix ,kk)*half + &
122 & (ax+one)* ax *(ax-two)*q_south(ixp1,kk)*(-half) + &
123 & (ax+one)* ax *(ax-one)*q_south(ixp2,kk)*(sixth)
124 else if (jyp2 > ny)
then 125 qjp2 = ax *(ax-one)*(ax-two)*q_north(ixm1,kk)*(-sixth) + &
126 & (ax+one)*(ax-one)*(ax-two)*q_north(ix ,kk)*half + &
127 & (ax+one)* ax *(ax-two)*q_north(ixp1,kk)*(-half) + &
128 & (ax+one)* ax *(ax-one)*q_north(ixp2,kk)*(sixth)
130 qjp2 = ax *(ax-one)*(ax-two)*q(ixm1,jyp2,kk)*(-sixth) + &
131 & (ax+one)*(ax-one)*(ax-two)*q(ix ,jyp2,kk)*half + &
132 & (ax+one)* ax *(ax-two)*q(ixp1,jyp2,kk)*(-half) + &
133 & (ax+one)* ax *(ax-one)*q(ixp2,jyp2,kk)*(sixth)
138 qnew(ii,jj,kk) = ay *(ay-one)*(ay-two)*(-sixth)*qjm1 + &
139 & (ay+one)*(ay-one)*(ay-two)*half *qj + &
140 & (ay+one)* ay *(ay-two)*(-half) *qjp1 + &
141 & (ay+one)* ay *(ay-one)*(sixth) *qjp2
subroutine advect_pv(qnew, q, q_north, q_south, u, v, nx, ny, deltax, deltay, dt)
Advect potential vorticity.