Skip to content
Snippets Groups Projects
Commit d75b3a04 authored by Pierre Augier's avatar Pierre Augier
Browse files

Simpler code Python example fluidfft.

parent d5a42a33
No related branches found
No related tags found
No related merge requests found
......@@ -293,8 +293,6 @@
The equivalent pseudo-spectral implementation in \fluidpack{fft} is as follows:
\begin{minted}[fontsize=\footnotesize]{python}
import numpy as np
from fluidfft import import_fft_class
from fluidfft.fft2d.operators import OperatorsPseudoSpectral2D
from fluidfft.fft2d.operators import OperatorsPseudoSpectral2D, pi
nx = ny = 100
......@@ -299,10 +297,7 @@
nx = ny = 100
lx = ly = 2 * np.pi
# Create an FFT object
o = FFTClass(nx, ny)
# And an operator object
lx = ly = 2 * pi
oper = OperatorsPseudoSpectral2D(nx, ny, lx, ly, fft='fft2d.with_fftw2d')
u = np.sin(oper.XX + oper.YY)
......@@ -306,5 +301,5 @@
oper = OperatorsPseudoSpectral2D(nx, ny, lx, ly, fft='fft2d.with_fftw2d')
u = np.sin(oper.XX + oper.YY)
u_fft = o.fft(u)
u_fft = oper.fft(u)
px_u_fft, py_u_fft = oper.gradfft_from_fft(u_fft)
......@@ -310,6 +305,6 @@
px_u_fft, py_u_fft = oper.gradfft_from_fft(u_fft)
px_u = o.ifft(px_u_fft)
py_u = o.ifft(py_u_fft)
px_u = oper.ifft(px_u_fft)
py_u = oper.ifft(py_u_fft)
grad_u = (px_u, py_u)
\end{minted}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment