1 subroutine grid2nv(tin, tout, jpts, acc, igrd, ll)
18 integer(itm_i4),
intent(in) :: jpts
19 real(r8),
dimension(jpts),
intent(inout) :: tin
20 real(r8),
dimension(jpts),
intent(out) :: tout
21 real(r8),
intent(in) :: acc
22 integer(itm_i4),
intent(in) :: igrd, ll
24 real(r8),
dimension(jpts + 1) :: t, g
25 real(r8),
dimension(jpts / 2 - 1) :: gfcos, gfsin
27 real(r8),
parameter :: pi = 3.1415926535898_r8
28 integer(itm_i4),
parameter :: ninv = 100
29 real(r8) :: t1, y1, t0, y0, t2, y2
30 real(r8) :: sum1, sum2, gfnul
31 integer(itm_i4) :: mharm
32 integer(itm_i4) :: iout, iout_pr
33 integer(itm_i4) :: l, i, j, jj, j1, n
34 integer(itm_i4) :: igrdnv, ifirst, icirc
39 if (tin(jj - 1) > tin(jj)) tin(jj) = tin(jj) + 2._r8 * pi
43 iout_pr = iout * 10 + l
44 if (iout == 0) iout = 6
45 if (l /= 0)
write(iout, 3)
48 g(i) = tin(i) - 2._r8 * pi * (i - 1) / dble(jpts)
50 call
rft(g, gfnul, gfcos, gfsin, jpts, mharm)
52 call
prarr1(
'tin(j) : ', tin, jpts, iout_pr)
53 call
prarr1(
'g(i):', t, jpts, iout_pr)
55 call
prarr1(
'gfcos(m):', gfcos, mharm, iout_pr)
56 call
prarr1(
'gfsin(m):', gfsin, mharm, iout_pr)
59 t(i) = 2._r8 * pi * (i - 1) / dble(jpts)
64 icirc = -(int(tin(1) / (2._r8 * pi) + 10000) - 9999)
65 if (abs(tin(1)) < 1.e-12_r8) icirc = 0
67 loop_i:
do i = 1, jpts
69 t1 = t(j) + icirc * 2._r8 * pi
70 call
fsum2(sum1, t1, gfnul, gfcos, gfsin, mharm)
75 if (abs(y0) <= acc)
then
79 if (j == jpts + 1)
then
91 t1 = t(j) + icirc * 2._r8 * pi
92 call
fsum2(sum1, t1, gfnul, gfcos, gfsin, mharm)
94 if (sign(1._r8, y0) /= sign(1._r8, y1))
exit
100 t2 = t0 - (t1 - t0) * y0 / (y1 - y0)
101 call
fsum2(sum2, t2, gfnul, gfcos, gfsin, mharm)
102 y2 = t2 + sum2 - t(i)
103 if (l /= 0)
write(iout, 25) n, t0, t1, y0, y1, t2, y2, j
104 if (abs(y2) <= acc)
exit
105 if (sign(1._r8, y2) /= sign(1._r8, y1))
then
115 if (l /= 0)
write(iout, 55) i, n
116 if (n > igrdnv) igrdnv = n
122 3
format(///1x,
'subroutine gridinv')
123 25
format(1x,
'n=', i3,
' t0=', f10.5,
' t1=', f10.5, &
124 ' y0=', f10.5,
' y1=', f10.5,
' t2=', f10.5,
' y2=', f10.5,
' j=',i3)
125 55
format(1x,
'i=', i3, 5x,
'n=', i3)
126 56
format(/1x,
'gfnul = ', 1pe12.4)
127 70
format(/1x,
'***subroutine gridinv: no zero found ')
subroutine grid2nv(tin, tout, jpts, acc, igrd, ll)
subroutine prarr1(name, array, isize, ll)
subroutine fsum2(f, t, ffnul, ffcos, ffsin, mharm)
subroutine rft(f, ffnul, ffcos, ffsin, jpts, mharm)