⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fourier2d.f90

📁 Ground state of the time-independent Gross-Pitaevskii equation
💻 F90
字号:
!***! The following code is for use with the IMSL library!***module fft_data  integer, parameter :: dp=kind(1.d0)  real(dp) :: fact  real(dp), dimension(:,:), allocatable :: wsaveend module fft_datasubroutine fft_init(ng)  !  ! Initialize the Fourier transform  !  use fft_data  implicit none  integer, dimension(0:2), intent(in) :: ng  integer :: m    allocate(wsave(2*ng(0)+15,2))  do m=1,2     call dffti(ng(m),wsave(1,m))  end do  fact = 1.d0/real(ng(1)*ng(2),dp)  returnend subroutine fft_initsubroutine fourier2D(ng,fin,fout,direction)  !  ! 2D Fourier transform  !  use fft_data  implicit none  integer, dimension(0:2), intent(in) :: ng  real(dp), dimension(ng(1),ng(2)), intent(in) :: fin  real(dp), dimension(ng(1),ng(2)), intent(out) :: fout  integer, intent(in) :: direction  integer :: i,k  real(dp), dimension(ng(0)) :: f  if(direction >= 0) then     ! Forward transform     fout = fin     ! transform in x     do k = 1,ng(2)        call dfftf(ng(1),fout(1,k),wsave(1,1))     end do     ! transform in z     do i = 1,ng(1)        f(1:ng(2)) = fout(i,:)        call dfftf(ng(2),f,wsave(1,2))        fout(i,:) = f(1:ng(2))     end do  else     ! Backward transform     fout = fin     ! transform in x     do k = 1,ng(2)        call dfftb(ng(1),fout(1,k),wsave(1,1))     end do     ! transform in z     do i = 1,ng(1)        f(1:ng(2)) = fout(i,:)        call dfftb(ng(2),f,wsave(1,2))        fout(i,:) = f(1:ng(2))     end do          fout = fout*fact  end if  returnend subroutine fourier2D

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -