Problem setup
Boundary conditions
Each boundary has exactly one type of boundary conditions. For periodic boundary conditions, the opposite boundary must also be periodic.
abstract type AbstractBCBoundary condition for one side of the domain.
Fields
struct DirichletBC{U} <: IncompressibleNavierStokes.AbstractBCDirichlet 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
struct PeriodicBC <: IncompressibleNavierStokes.AbstractBCPeriodic boundary conditions. Must be periodic on both sides.
Fields
struct PressureBC <: IncompressibleNavierStokes.AbstractBCPressure 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
struct SymmetricBC <: IncompressibleNavierStokes.AbstractBCSymmetric boundary conditions. The parallel velocity and pressure is the same at each side of the boundary. The normal velocity is zero.
Fields
apply_bc_p!(p, t, setup; kwargs...) -> AnyApply pressure boundary conditions (in-place version).
apply_bc_p(p, t, setup; kwargs...) -> AnyApply pressure boundary conditions (differentiable version).
apply_bc_temp!(temp, t, setup; kwargs...) -> AnyApply temperature boundary conditions (in-place version).
apply_bc_temp(temp, t, setup; kwargs...) -> AnyApply temperature boundary conditions (differentiable version).
apply_bc_u!(u, t, setup; kwargs...) -> AnyApply velocity boundary conditions (in-place version).
apply_bc_u(u, t, setup; kwargs...) -> AnyApply velocity boundary conditions (differentiable version).
boundary(β, N, I, isright) -> AnyGet 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.
offset_p(bc, isnormal, isright)Number of non-DOF pressure components at boundary.
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.
Grid
struct Dimension{N}Represent an N-dimensional space. Returns N when called.
julia> d = Dimension(3)
Dimension{3}()
julia> d()
3Fields
Grid(x, boundary_conditions; ArrayType) -> NamedTupleCreate 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 volumesNu[α][β]: Number ofu[α]velocity DOFs in directionβNp[α]: Number of pressure DOFs in directionαIu[α]: Cartesian index range ofu[α]velocity DOFsIp: Cartesian index range of pressure DOFsxlims[α]: 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 volumexu[α][β]: β-coordinates ofu[α]velocity pointsxp[α]: α-coordinates of pressure pointsΔ[α]: All volume widths in directionαΔu[α]: Distance between pressure points in directionαA[α][β]: Interpolation weights from α-face centersto
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.
cosine_grid(a, b, N) -> AnyCreate a nonuniform grid of N + 1 points from a to b using a cosine profile, i.e.
See also stretched_grid.
max_size(grid) -> AnyGet size of the largest grid element.
stretched_grid(a, b, N) -> Any
stretched_grid(a, b, N, s) -> AnyCreate 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
Note that stretched_grid(a, b, N, s)[n] corresponds to
See also cosine_grid.
tanh_grid(a, b, N) -> Any
tanh_grid(a, b, N, γ) -> AnyCreate a nonuniform grid of N + 1 points from a to b, as proposed by Trias et al. [11].
Setup
Setup(
;
x,
boundary_conditions,
bodyforce,
issteadybodyforce,
closure_model,
projectorder,
ArrayType,
workgroupsize,
temperature,
Re
)Create problem setup (stored in a named tuple).
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.
Field initializers
random_field(setup; ...) -> Any
random_field(setup, t; A, kp, psolver, rng) -> AnyCreate random field, as in [12].
A: Eddy amplitude scalingkp: Peak energy wavenumber
scalarfield(setup) -> AnyCreate empty scalar field.
temperaturefield(setup, tempfunc) -> Any
temperaturefield(setup, tempfunc, t) -> AnyCreate temperature field from function with boundary conditions at time t.
vectorfield(setup) -> AnyCreate empty vector field.
velocityfield(setup, ufunc; ...) -> Any
velocityfield(setup, ufunc, t; psolver, doproject) -> AnyCreate divergence free velocity field u with boundary conditions at time t. The initial conditions of u[α] are specified by the function ufunc(α, x...).