Skip to content

Problem setup

Boundary conditions

Each boundary has exactly one type of boundary conditions. For periodic boundary conditions, the opposite boundary must also be periodic.

IncompressibleNavierStokes.AbstractBC Type
julia
abstract type AbstractBC

Boundary condition for one side of the domain.

Fields

source

IncompressibleNavierStokes.DirichletBC Type
julia
struct DirichletBC{U} <: IncompressibleNavierStokes.AbstractBC

Dirichlet boundary conditions for the velocity, where u[1] = (x..., t) -> u1_BC up to u[d] = (x..., t) -> ud_BC, where d is the dimension.

When u is nothing, then the boundary conditions are no slip boundary conditions, where all velocity components are zero.

Fields

  • u: Boundary condition

source

IncompressibleNavierStokes.PeriodicBC Type
julia
struct PeriodicBC <: IncompressibleNavierStokes.AbstractBC

Periodic boundary conditions. Must be periodic on both sides.

Fields

source

IncompressibleNavierStokes.PressureBC Type
julia
struct PressureBC <: IncompressibleNavierStokes.AbstractBC

Pressure boundary conditions. The pressure is prescribed on the boundary (usually an "outlet"). The velocity has zero Neumann conditions.

Note: Currently, the pressure is prescribed with the constant value of zero on the entire boundary.

Fields

source

IncompressibleNavierStokes.SymmetricBC Type
julia
struct SymmetricBC <: IncompressibleNavierStokes.AbstractBC

Symmetric boundary conditions. The parallel velocity and pressure is the same at each side of the boundary. The normal velocity is zero.

Fields

source

IncompressibleNavierStokes.apply_bc_p! Method
julia
apply_bc_p!(p, t, setup; kwargs...) -> Any

Apply pressure boundary conditions (in-place version).

source

IncompressibleNavierStokes.apply_bc_p Method
julia
apply_bc_p(p, t, setup; kwargs...) -> Any

Apply pressure boundary conditions (differentiable version).

source

IncompressibleNavierStokes.apply_bc_temp! Method
julia
apply_bc_temp!(temp, t, setup; kwargs...) -> Any

Apply temperature boundary conditions (in-place version).

source

IncompressibleNavierStokes.apply_bc_temp Method
julia
apply_bc_temp(temp, t, setup; kwargs...) -> Any

Apply temperature boundary conditions (differentiable version).

source

IncompressibleNavierStokes.apply_bc_u! Method
julia
apply_bc_u!(u, t, setup; kwargs...) -> Any

Apply velocity boundary conditions (in-place version).

source

IncompressibleNavierStokes.apply_bc_u Method
julia
apply_bc_u(u, t, setup; kwargs...) -> Any

Apply velocity boundary conditions (differentiable version).

source

IncompressibleNavierStokes.boundary Method
julia
boundary(β, N, I, isright) -> Any

Get boundary indices of boundary layer normal to β. The CartesianIndices given by I should contain those of the inner DOFs, typically Ip or Iu[α]. The boundary layer is then just outside those.

source

IncompressibleNavierStokes.offset_p Function
julia
offset_p(bc, isnormal, isright)

Number of non-DOF pressure components at boundary.

source

IncompressibleNavierStokes.offset_u Function
julia
offset_u(bc, isnormal, isright)

Number of non-DOF velocity components at boundary. If isnormal, then the velocity is normal to the boundary, else parallel. If isright, it is at the end/right/rear/top boundary, otherwise beginning.

source

Grid

IncompressibleNavierStokes.Dimension Type
julia
struct Dimension{N}

Represent an N-dimensional space. Returns N when called.

julia
julia> d = Dimension(3)
Dimension{3}()

julia> d()
3

Fields

source

IncompressibleNavierStokes.Grid Method
julia
Grid(; x, boundary_conditions, backend)

Create useful quantities for Cartesian box mesh ``x[1] \times \dots \times x[d]with boundary conditionsboundary_conditions. Return a named tuple ([α]` denotes a tuple index) with the following fields:

  • N[α]: Number of finite volumes in direction β, including ghost volumes

  • Nu[α][β]: Number of u[α] velocity DOFs in direction β

  • Np[α]: Number of pressure DOFs in direction α

  • Iu[α]: Cartesian index range of u[α] velocity DOFs

  • Ip: Cartesian index range of pressure DOFs

  • xlims[α]: Tuple containing the limits of the physical domain (not grid) in the direction α

  • x[α]: α-coordinates of all volume boundaries, including the left point of the first ghost volume

  • xu[α][β]: β-coordinates of u[α] velocity points

  • xp[α]: α-coordinates of pressure points

  • Δ[α]: All volume widths in direction α

  • Δu[α]: Distance between pressure points in direction α

  • A[α][β]: Interpolation weights from α-face centers xI to xI±hβ

Note that the memory footprint of the redundant 1D-arrays above is negligible compared to the memory footprint of the 2D/3D-fields used in the code.

source

IncompressibleNavierStokes.cosine_grid Method
julia
cosine_grid(a, b, N) -> Any

Create a nonuniform grid of N + 1 points from a to b using a cosine profile, i.e.

xi=a+12(1cos(πin))(ba),i=0,,N

See also stretched_grid.

source

IncompressibleNavierStokes.max_size Method
julia
max_size(grid) -> Any

Get size of the largest grid element.

source

IncompressibleNavierStokes.stretched_grid Function
julia
stretched_grid(a, b, N) -> Any
stretched_grid(a, b, N, s) -> Any

Create a nonuniform grid of N + 1 points from a to b with a stretch factor of s. If s = 1, return a uniform spacing from a to b. Otherwise, return a vector xRN+1 such that xn=a+i=1nsi1h for n=0,,N. Setting xN=b then gives h=(ba)1s1sN, resulting in

xn=a+(ba)1sn1sN,n=0,,N.

Note that stretched_grid(a, b, N, s)[n] corresponds to xn1.

See also cosine_grid.

source

IncompressibleNavierStokes.tanh_grid Function
julia
tanh_grid(a, b, N) -> Any
tanh_grid(a, b, N, γ) -> Any

Create a nonuniform grid of N + 1 points from a to b, as proposed by Trias et al. [10].

source

Setup

KernelAbstractions.CPU Type
julia
struct CPU <: KernelAbstractions.Backend
CPU(; static=false)

Instantiate a CPU (multi-threaded) backend.

Options:

  • static: Uses a static thread assignment, this can be beneficial for NUMA aware code. Defaults to false.

Fields

  • static

source

IncompressibleNavierStokes.Setup Method
julia
Setup(
;
    x,
    boundary_conditions,
    bodyforce,
    dbodyforce,
    issteadybodyforce,
    closure_model,
    backend,
    workgroupsize,
    temperature,
    Re
)

Create problem setup (stored in a named tuple).

source

IncompressibleNavierStokes.temperature_equation Method
julia
temperature_equation(
;
    Pr,
    Ra,
    Ge,
    dodissipation,
    boundary_conditions,
    gdir,
    nondim_type
)

Create temperature equation setup (stored in a named tuple).

The equation is parameterized by three dimensionless numbers (Prandtl number, Rayleigh number, and Gebhart number), and requires separate boundary conditions for the temperature field. The gdir keyword specifies the direction gravity, while non_dim_type specifies the type of non-dimensionalization.

source

Field initializers

IncompressibleNavierStokes.random_field Function
julia
random_field(setup; ...) -> Any
random_field(setup, t; A, kp, psolver, rng) -> Any

Create random field, as in [11].

  • A: Eddy amplitude scaling

  • kp: Peak energy wavenumber

source

IncompressibleNavierStokes.scalarfield Method
julia
scalarfield(setup) -> Any

Create empty scalar field.

source

IncompressibleNavierStokes.temperaturefield Function
julia
temperaturefield(setup, tempfunc) -> Any
temperaturefield(setup, tempfunc, t) -> Any

Create temperature field from function with boundary conditions at time t.

source

IncompressibleNavierStokes.vectorfield Method
julia
vectorfield(setup) -> Any

Create empty vector field.

source

IncompressibleNavierStokes.velocityfield Function
julia
velocityfield(setup, ufunc; ...) -> Any
velocityfield(setup, ufunc, t; psolver, doproject) -> Any

Create divergence free velocity field u with boundary conditions at time t. The initial conditions of u[α] are specified by the function ufunc(α, x...).

source