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
abstract type AbstractBC
Boundary condition for one side of the domain.
Fields
IncompressibleNavierStokes.DirichletBC Type
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
IncompressibleNavierStokes.PeriodicBC Type
struct PeriodicBC <: IncompressibleNavierStokes.AbstractBC
Periodic boundary conditions. Must be periodic on both sides.
Fields
IncompressibleNavierStokes.PressureBC Type
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
IncompressibleNavierStokes.SymmetricBC Type
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
IncompressibleNavierStokes.apply_bc_p! Method
apply_bc_p!(p, t, setup; kwargs...) -> Any
Apply pressure boundary conditions (in-place version).
IncompressibleNavierStokes.apply_bc_p Method
apply_bc_p(p, t, setup; kwargs...) -> Any
Apply pressure boundary conditions (differentiable version).
IncompressibleNavierStokes.apply_bc_temp! Method
apply_bc_temp!(temp, t, setup; kwargs...) -> Any
Apply temperature boundary conditions (in-place version).
IncompressibleNavierStokes.apply_bc_temp Method
apply_bc_temp(temp, t, setup; kwargs...) -> Any
Apply temperature boundary conditions (differentiable version).
IncompressibleNavierStokes.apply_bc_u! Method
apply_bc_u!(u, t, setup; kwargs...) -> Any
Apply velocity boundary conditions (in-place version).
IncompressibleNavierStokes.apply_bc_u Method
apply_bc_u(u, t, setup; kwargs...) -> Any
Apply velocity boundary conditions (differentiable version).
IncompressibleNavierStokes.boundary Method
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.
IncompressibleNavierStokes.offset_p Function
offset_p(bc, isnormal, isright)
Number of non-DOF pressure components at boundary.
IncompressibleNavierStokes.offset_u Function
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
IncompressibleNavierStokes.Dimension Type
struct Dimension{N}
Represent an N
-dimensional space. Returns N
when called.
julia> d = Dimension(3)
Dimension{3}()
julia> d()
3
Fields
IncompressibleNavierStokes.Grid Method
Grid(; x, boundary_conditions, backend)
Create useful quantities for Cartesian box mesh ``x[1] \times \dots \times x[d]with boundary conditions
boundary_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.
IncompressibleNavierStokes.cosine_grid Method
cosine_grid(a, b, N) -> Any
Create a nonuniform grid of N + 1
points from a
to b
using a cosine profile, i.e.
See also stretched_grid
.
IncompressibleNavierStokes.max_size Method
max_size(grid) -> Any
Get size of the largest grid element.
IncompressibleNavierStokes.stretched_grid Function
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
Note that stretched_grid(a, b, N, s)[n]
corresponds to
See also cosine_grid
.
IncompressibleNavierStokes.tanh_grid Function
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].
Setup
Missing docstring.
Missing docstring for CPU
. Check Documenter's build log for details.
IncompressibleNavierStokes.Setup Method
Setup(
;
x,
boundary_conditions,
bodyforce,
issteadybodyforce,
closure_model,
backend,
workgroupsize,
temperature,
Re
)
Create problem setup (stored in a named tuple).
IncompressibleNavierStokes.temperature_equation Method
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
IncompressibleNavierStokes.random_field Function
random_field(setup; ...) -> Any
random_field(setup, t; A, kp, psolver, rng) -> Any
Create random field, as in [11].
A
: Eddy amplitude scalingkp
: Peak energy wavenumber
IncompressibleNavierStokes.scalarfield Method
scalarfield(setup) -> Any
Create empty scalar field.
IncompressibleNavierStokes.temperaturefield Function
temperaturefield(setup, tempfunc) -> Any
temperaturefield(setup, tempfunc, t) -> Any
Create temperature field from function with boundary conditions at time t
.
IncompressibleNavierStokes.vectorfield Method
vectorfield(setup) -> Any
Create empty vector field.
IncompressibleNavierStokes.velocityfield Function
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...)
.