fluidfft.fft3d.operators

Operators 3d (fluidfft.fft3d.operators)

class fluidfft.fft3d.operators.OperatorsPseudoSpectral3D(nx, ny, nz, lx, ly, lz, fft=None, coef_dealiasing=1.0)[source]

Bases: OperatorsBase

Perform 2D FFT and operations on data.

Parameters:
nxint

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

nyint

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

nzint

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.

lzfloat

Length of the domain along the z-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
Ky: float64[:,:,:]
Kx: float64[:,:,:]
Kz: float64[:,:,:]
inv_K_square_nozero: float64[:,:,:]
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.

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.

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.

project_perpk3d_noloop(vx_fft: Array_TypeIfloat64_complex128I_3d, vy_fft: Array_TypeIfloat64_complex128I_3d, vz_fft: Array_TypeIfloat64_complex128I_3d)[source]

Project (inplace) a vector perpendicular to the wavevector.

The resulting vector is divergence-free.

project_perpk3d(vx_fft: Array_TypeIfloat64_complex128I_3d, vy_fft: Array_TypeIfloat64_complex128I_3d, vz_fft: Array_TypeIfloat64_complex128I_3d)[source]

Project (inplace) a vector perpendicular to the wavevector.

The resulting vector is divergence-free.

divfft_from_vecfft(vx_fft: complex128[:,:,:], vy_fft: complex128[:,:,:], vz_fft: complex128[:,:,:])[source]

Return the divergence of a vector in spectral space.

rotfft_from_vecfft(vx_fft: complex128[:,:,:], vy_fft: complex128[:,:,:], vz_fft: complex128[:,:,:])[source]

Return the curl of a vector in spectral space.

rotfft_from_vecfft_outin(vx_fft: complex128[:,:,:], vy_fft: complex128[:,:,:], vz_fft: complex128[:,:,:], rotxfft: complex128[:,:,:], rotyfft: complex128[:,:,:], rotzfft: complex128[:,:,:])[source]

Return the curl of a vector in spectral space.

div_vb_fft_from_vb(vx, vy, vz, b)[source]

Compute \(\nabla \cdot (\boldsymbol{v} b)\) in spectral space.

rotzfft_from_vxvyfft(vx_fft: complex128[:,:,:], vy_fft: complex128[:,:,:])[source]

Compute the z component of the curl in spectral space.

get_XYZ_loc()[source]

Compute the local 3d arrays with the x, y, and y values.

compute_1dspectra(energy_fft)[source]

Compute the 1D spectra.

Returns:
spectrum_kx
spectrum_ky
spectrum_kz
compute_3dspectrum(energy_fft)[source]

Compute the 3D spectrum.

The corresponding wavenumber array is self.k_spectra3d.

compute_spectrum_kzkh(energy_fft)[source]

Compute the kz-kh spectrum.

compute_spectra_2vars(energy_fft)[source]

Compute spectra vs 2 variables.

Warning

Not implemented!

Todo

Implement the method compute_spectra_2vars().

Returns:
E_kx_kyz
E_ky_kzx
E_kz_kxy

Functions

get_simple_3d_mpi_method()

Get a simple 3d parallel method

get_simple_3d_seq_method()

Get a simple 3d sequential method

loop_spectra3d(spectrum_k0k1k2, ks, K2)

Compute the 3d spectrum.

loop_spectra_kzkh(spectrum_k0k1k2, khs, KH, ...)

Compute the kz-kh spectrum.

vector_product(ax, ay, az, bx, by, bz)

Compute the vector product.

Classes

OperatorsPseudoSpectral3D(nx, ny, nz, lx, ly, lz)

Perform 2D FFT and operations on data.