fluidfft.fft2d

2d Fast Fourier Transform classes (fluidfft.fft2d)

This package contains extension modules containing classes for performing Fast Fourier Transform with different methods and libraries.

To use the FFT classes in real codes, it is simpler and recommended to use the class fluidfft.fft2d.operators.OperatorsPseudoSpectral2D defined in the package

operators

Operators 2d (fluidfft.fft2d.operators)

All FFT classes are very similar and provide the same public functions. Since these classes are defined in Cython extensions that can not easily be compiled on the readthedocs server, the API of the 2d classes is presented in this fake FFT class:

class fluidfft.fft2d.FFT2dFakeForDoc(n0=2, n1=2)[source]

Bases: object

Perform Fast Fourier Transform in 2d.

Parameters:
n0int

Global size over the first dimension in spatial space. This corresponds to the y direction.

n1int

Global size over the second dimension in spatial space. This corresponds to the x direction.

get_short_name()[source]

Produce a short name of this object.

get_local_size_X()[source]

Get the local size in the real space.

run_tests()[source]

Run the c++ tests.

run_benchs(nb_time_execute=10)[source]

Run the c++ benchmarcks

fft_as_arg(fieldX, fieldK)[source]

Perform the fft and copy the result in the second argument.

ifft_as_arg(fieldK, fieldX)[source]

Perform the ifft and copy the result in the second argument.

fft(fieldX)[source]

Perform the fft and returns the result.

ifft(fieldK)[source]

Perform the ifft and returns the result.

get_shapeX_loc()[source]

Get the local shape of the array in the “real space”.

get_shapeK_loc()[source]

Get the local shape of the array in the Fourier space

get_shapeX_seq()[source]

Get the shape of the real array as it would be with nb_proc = 1

get_shapeK_seq()[source]

Get the shape of the complex array as it would be with nb_proc = 1

Warning: if get_is_transposed(), the complex array would also be transposed, so in this case, one should write:

nKy = self.get_shapeK_seq[1]
get_is_transposed()[source]

Get the boolean “is_transposed”.

get_seq_indices_first_X()[source]

Get the “sequential” index of the first number in real space.

get_seq_indices_first_K()[source]

Get the “sequential” index of the first number in Fourier space.

get_k_adim_loc()[source]

Get the non-dimensional wavenumbers stored locally.

Returns:
k0_adim_locnp.ndarray
k1_adim_locnp.ndarray
The indices correspond to the index of the dimension in spectral space.
get_x_adim_loc()[source]

Get the coordinates of the points stored locally.

Returns:
x0locnp.ndarray
x1locnp.ndarray
The indices correspond to the index of the dimension in real space.
compute_energy_from_X(fieldX)[source]

Compute the mean energy from a real space array.

compute_energy_from_K(fieldK)[source]

Compute the mean energy from a Fourier space array.

sum_wavenumbers(fieldK)[source]

Compute the sum over all wavenumbers.

gather_Xspace(ff_loc, root=None)[source]

Gather an array in real space for a parallel run.

scatter_Xspace(ff_seq, root=None)[source]

Scatter an array in real space for a parallel run.

create_arrayX(value=None, shape=None)[source]

Return a constant array in real space.

create_arrayK(value=None, shape=None)[source]

Return a constant array in real space.

Functions

get_classes_mpi()

Return all parallel 2d classes.

get_classes_seq()

Return all sequential 2d classes.