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.AbstractBCType.
julia
abstract type AbstractBC

Boundary condition for one side of the domain.

Fields

source


# IncompressibleNavierStokes.DirichletBCType.
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.PeriodicBCType.
julia
struct PeriodicBC <: IncompressibleNavierStokes.AbstractBC

Periodic boundary conditions. Must be periodic on both sides.

Fields

source


# IncompressibleNavierStokes.PressureBCType.
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.SymmetricBCType.
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_pMethod.
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_tempMethod.
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_uMethod.
julia
apply_bc_u(u, t, setup; kwargs...) -> Any

Apply velocity boundary conditions (differentiable version).

source


# IncompressibleNavierStokes.boundaryMethod.
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_pFunction.
julia
offset_p(bc, isnormal, isright)

Number of non-DOF pressure components at boundary.

source


# IncompressibleNavierStokes.offset_uFunction.
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.DimensionType.
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.GridMethod.
julia
Grid(x, boundary_conditions; ArrayType) -> NamedTuple

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_gridMethod.
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_sizeMethod.
julia
max_size(grid) -> Any

Get size of the largest grid element.

source


# IncompressibleNavierStokes.stretched_gridFunction.
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_gridFunction.
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. [11].

source


Setup

# IncompressibleNavierStokes.SetupMethod.
julia
Setup(
;
    x,
    boundary_conditions,
    bodyforce,
    issteadybodyforce,
    closure_model,
    projectorder,
    ArrayType,
    workgroupsize,
    temperature,
    Re
)

Create problem setup (stored in a named tuple).

source


# IncompressibleNavierStokes.temperature_equationMethod.
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_fieldFunction.
julia
random_field(setup; ...) -> Any
random_field(setup, t; A, kp, psolver, rng) -> Any

Create random field, as in [12].

  • A: Eddy amplitude scaling

  • kp: Peak energy wavenumber

source


# IncompressibleNavierStokes.scalarfieldMethod.
julia
scalarfield(setup) -> Any

Create empty scalar field.

source


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

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

source


# IncompressibleNavierStokes.vectorfieldMethod.
julia
vectorfield(setup) -> Any

Create empty vector field.

source


# IncompressibleNavierStokes.velocityfieldFunction.
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