fluidfft.fft3d

3d Fast Fourier Transform classes (fluidfft.fft3d)

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.fft3d.operators.OperatorsPseudoSpectral3D defined in the package

operators

Operators 3d (fluidfft.fft3d.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 3d classes is presented in this fake FFT class:

class fluidfft.fft3d.FFT3dFakeForDoc(n0=2, n1=2, n2=4)[source]

Bases: object

Perform Fast Fourier Transform in 3D.

Parameters:
n0int

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

n1int

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

n2int

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

get_short_name()[source]

Get a short name of the class.

get_dim_first_fft()[source]

The dimension (real space) over which the first fft is taken.

It is usually 2 but it seems to be 0 for p3dfft (written in Fortran!).

get_local_size_X()[source]

Get the local size in real space.

run_tests()[source]

Run simple tests from C++.

run_benchs(nb_time_execute=10)[source]

Run the C++ benchmarcks.

fft_as_arg(fieldX, fieldK)[source]

Perform FFT and put result in second argument.

ifft_as_arg(fieldK, fieldX)[source]

Perform iFFT and put result in second argument.

Note

The values in the input array would be retained by making a copy to an intermediate input array. This can have a performance impact.

ifft_as_arg_destroy(fieldK, fieldX)[source]

Perform iFFT and put result in second argument.

Note

The values in the input array would be destroyed for the better performance.

fft(fieldX)[source]

Perform FFT and return the result.

ifft(fieldK)[source]

Perform iFFT and return the result.

get_shapeX_loc()[source]

Get the shape of the array in real space for this mpi process.

get_shapeK_loc()[source]

Get the shape of the array in Fourier space for this mpi process.

get_shapeX_seq()[source]

Get the shape of an array in real space for a sequential run.

gather_Xspace(ff_loc, root=0)[source]

Gather an array in real space for a parallel run.

scatter_Xspace(ff_seq, root=0)[source]

Scatter an array in real space for a parallel run.

get_shapeK_seq()[source]

Get the shape of an array in Fourier space for a sequential run.

sum_wavenumbers(fieldK)[source]

Compute the sum over all wavenumbers.

get_dimX_K()[source]

Get the indices of the real space dimension in Fourier space.

get_seq_indices_first_K()[source]

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

get_seq_indices_first_X()[source]

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

get_k_adim_loc()[source]

Get the non-dimensional wavenumbers stored locally.

Returns:
k0_adim_locnp.ndarray
k1_adim_locnp.ndarray
k2_adim_locnp.ndarray
The indices correspond to the index of the dimension in spectral space.
build_invariant_arrayX_from_2d_indices12X(o2d, arr2d)[source]

Build an array in real space invariant in the third dim.

build_invariant_arrayK_from_2d_indices12X(o2d, arr2d)[source]

Build an array in Fourier space invariant in the third dim.

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.

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 3d classes.

get_classes_seq()

Return all sequential 3d classes.