Aliasing

In pseudospectral methods, computing nonlinear terms results in aliasing errors. (Read more about aliasing errors in the FourierFlows.jl Documentation.) To avoid aliasing errors, we need to apply some dealiasing to our fields in Fourier space before transforming to physical space to compute nonlinear terms.

De-aliasing scheme

FourierFlows.jl currently implements dealiasing by zeroing out the highest-aliased_fraction wavenumber components on a grid. By default in FourierFlows.jl, aliased_fraction=1/3. Users can construct a grid with different aliased_fraction via

julia> grid = OneDGrid(; nx=64, Lx=2π, aliased_fraction=1/2)
OneDimensionalGrid
         ├─────────── Device: CPU
         ├──────── FloatType: Float64
         ├────────── size Lx: 6.283185307179586
         ├──── resolution nx: 64
         ├── grid spacing dx: 0.09817477042468103
         ├─────────── domain: x ∈ [-3.141592653589793, 3.0434178831651124]
         └─ aliased fraction: 0.5

or provide the keyword argument aliased_fraction to the Problem() constructor of each module, e.g.,

julia> prob = GeophysicalFlows.TwoDNavierStokes.Problem(; aliased_fraction=1/2)
Problem
  ├─────────── grid: grid (on CPU)
  ├───── parameters: params
  ├────── variables: vars
  ├─── state vector: sol
  ├─────── equation: eqn
  ├────────── clock: clock
  └──── timestepper: RK4TimeStepper
  
julia> prob.grid.aliased_fraction
0.5

The nonlinearities in most GeophysicalFlows.jl modules are quadratic, for which the default aliased_fraction of 1/3 removes aliasing errors exactly.

The exception is the ShallowWater module: its momentum fluxes, e.g., $h u^2 = q_u^2 / h$, involve division by the fluid depth $h$ and thus are not polynomial in the state variables. For such terms, de-aliasing reduces, but does not entirely remove, aliasing errors.

All modules apply de-aliasing by calling, e.g., dealias!(prob.sol, prob.grid) both before computing any nonlinear terms and also when updating all variables, i.e., within updatevars!.

To disable de-aliasing you need to create a problem with a grid that has been constructed with the keyword aliased_fraction=0.