ETS  \$Id: Doxyfile 2162 2020-02-26 14:16:09Z g2dpc $
 All Classes Files Functions Variables Pages
rtran2.f90
Go to the documentation of this file.
1 subroutine rtran2(data, nr, kr, ktran)
2 !
3 ! ******************************************************************
4 ! * interface between rft2, rfi2, and fft2. *
5 ! * the calling program should have data dimensioned with at least *
6 ! * (nr+1)*kr+1 elements. *
7 ! * lasl routine may 75, called from rft2 and rfi2. *
8 ! ******************************************************************
9 
10  use itm_types
11 
12  implicit none
13 
14  integer(itm_i4), intent(in) :: nr, kr, ktran
15  real(r8), dimension((nr + 1) * kr + 1), intent(inout) :: data
16 
17  real(r8) :: theta, dc, ds, ws, wc, sumr, difr, sumi, difi, tr, ti, wca
18  integer(itm_i4) :: ks, n, nmax, kmax, k, nk
19 
20  ks = 2 * kr
21  n = nr / 2
22  nmax = n * ks + 2
23  kmax = nmax / 2
24  theta = 1.5707963267949_r8 / dble(n)
25  dc = 2._r8 * sin(theta)**2
26  ds = sin(2._r8 * theta)
27  ws = 0._r8
28 
29  if (ktran <= 0) then
30  wc = -1.0_r8
31  ds = -ds
32  else
33  wc = 1.0_r8
34  data(nmax - 1) = data(1)
35  data(nmax - 1 + kr) = data(kr + 1)
36  end if
37 
38  do k = 1, kmax, ks
39  nk = nmax - k
40  sumr = .5_r8 * (data(k) + data(nk))
41  difr = .5_r8 * (data(k) - data(nk))
42  sumi =.5_r8 * (data(k + kr) + data(nk + kr))
43  difi =.5_r8 * (data(k + kr) - data(nk + kr))
44  tr =wc * sumi - ws * difr
45  ti =ws * sumi + wc * difr
46  data(k) = sumr + tr
47  data(k + kr) = difi - ti
48  data(nk) = sumr - tr
49  data(nk + kr) = -difi - ti
50  wca = wc - dc * wc - ds * ws
51  ws = ws + ds * wc -dc * ws
52  wc = wca
53  end do
54 
55  return
56 end subroutine rtran2
subroutine rtran2(data, nr, kr, ktran)
Definition: rtran2.f90:1