fluidfft.fft2d.operators

Operators 2d (fluidfft.fft2d.operators)


class fluidfft.fft2d.operators.OperatorsPseudoSpectral2D(nx, ny, lx, ly, fft=None, coef_dealiasing=1.0)[source]

Bases: OperatorsBase

Perform 2D FFT and operations on data.

Parameters:
nxint

Global dimension over the x-axis (second dimension for the real arrays).

nyint

Global dimension over the y-axis (first dimension for the real arrays).

lxfloat

Length of the domain along the x-axis.

lyfloat

Length of the domain along the y-axis.

fftstr or FFT classes

Name of module or string characterizing a method. It has to correspond to a module of fluidfft. The first part “fluidfft.” of the module “path” can be omitted.

coef_dealiasingfloat
nK0_loc: int
nK1_loc: int
KY: float64[:,:]
KX: float64[:,:]
where_dealiased: uint8[][]
property K_not0
property K2_not0
property K4_not0
property KX_over_K2
property KY_over_K2
mean_global(field)[source]

Compute the global average over all processes

sum_wavenumbers(field_fft)[source]

Compute the sum over all wavenumbers.

sum_wavenumbers_versatile(field_fft)[source]

Compute the sum over all wavenumbers (versatile version).

This function should return the same result than sum_wavenumbers().

It is here mainly to check that the classes are well implemented.

produce_str_describing_grid()[source]

Produce a short string describing the grid.

produce_str_describing_oper()[source]

Produce a short string describing the operator.

produce_long_str_describing_oper()[source]

Produce a string describing the operator.

compute_1dspectra(energy_fft)[source]

Compute the 1D spectra. Return a dictionary.

compute_2dspectrum(E_fft)[source]

Compute the 2D spectrum.

compute_spectrum_kykx(energy_fft, folded=True)[source]

Compute a spectrum vs ky, kx. Return a dictionary.

Parameters:
energy_fftndarray[float]

A real valued 2D array representing the energy content in each wavenumber.

foldedbool

Computes a spectra with the (+ky, +kx) and (-ky, +kx) quadrants folded, when True.

projection_perp(fx_fft, fy_fft)[source]

Project (inplace) a vector perpendicular to the wavevector.

The resulting vector is divergence-free.

rotfft_from_vecfft(vecx_fft: complex128[:,:], vecy_fft: complex128[:,:])[source]

Return the rotational of a vector in spectral space.

divfft_from_vecfft(vecx_fft: complex128[:,:], vecy_fft: complex128[:,:])[source]

Return the divergence of a vector in spectral space.

vecfft_from_rotfft(rot_fft: complex128[:,:])[source]

Return the velocity in spectral space computed from the rotational.

vecfft_from_divfft(div_fft: complex128[:,:])[source]

Return the velocity in spectral space computed from the divergence.

gradfft_from_fft(f_fft: complex128[:,:])[source]

Return the gradient of f_fft in spectral space.

dealiasing_variable(f_fft: complex128[:,:])[source]

Dealiasing a variable.

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

Return a constant array in real space.

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

Return a constant array in spectral space.

create_arrayX_random(shape='loc', min_val=None, max_val=None)[source]

Return a random array in real space.

create_arrayK_random(shape='loc', min_val=None, max_val=None)[source]

Return a random array in real space.

Functions

get_simple_2d_mpi_method()

Get a simple 2d parallel method

get_simple_2d_seq_method()

Get a simple 2d sequential method

Classes

OperatorsPseudoSpectral2D(nx, ny, lx, ly[, ...])

Perform 2D FFT and operations on data.