Initial and boundary conditions

To launch a simulation, initial and boundary conditions are necessary.

Initial conditions

The types of initial conditions are abstracted as

Currently, available options are

KitAMR.UniformType
struct Uniform <: AbstractInitCond

Uniform initial condition: every cell is initialized to the Maxwellian distribution determined by one primitive-variable vector ic, identical across the whole domain.

The primitive vector is ordered [ρ, U₁, …, U_DIM, λ] (length DIM+2), where ρ is the density, Uᵢ the bulk-velocity components, and λ = ρ/(2p) the inverse temperature (p is the pressure). This ordering is shared by PCoordFn and the Domain boundary states.

Fields

  • ic::AbstractVector: Primitive macroscopic variables [ρ, U₁, …, U_DIM, λ] applied uniformly to every cell.
source
KitAMR.PCoordFnType
struct PCoordFn <: AbstractInitCond

Coordinate-dependent initial condition: each cell is initialized to the Maxwellian determined by the primitive vector returned by the user function PCIC_fn evaluated at the cell centre. Use this for any non-uniform initial state (shock tubes, Riemann/blast initial data, buffer zones around immersed bodies, …).

PCIC_fn must have the signature

PCIC_fn(midpoint::Vector{Float64}, kinfo::KInfo) -> Vector{Float64}

where midpoint is the cell-centre coordinate (length DIM) and the return value is the primitive vector [ρ, U₁, …, U_DIM, λ] (length DIM+2, λ = ρ/(2p)). See the User-defined functions page for the full convention and worked examples.

Fields

  • PCIC_fn::Function: Function (midpoint, kinfo) -> prim returning the primitive vector at a physical coordinate.
source

Boundary conditions

The type of the boundary conditions is determined by

Currently, available options are

KitAMR.MaxwellianType
abstract type Maxwellian <: AbstractBoundCond

Fully diffused Maxwellian gas-surface interaction model.

source

With these types of boundary conditions,

can be constructed. There are two types of the boundary.

Domain boundary

KitAMR.jl always adopts square simulation domain. At the edges of the domain, proper conditions are required to maintain the well-posedness.

KitAMR.DomainType
struct Domain{T<:AbstractBoundCond} <: AbstractBoundary

Structure of domain boundary.

Fields

  • id::Int64: Index of the domain boundary. From 1 to 6, it represents the boundary of xmin, xmax, ymin, ymax, zmin, zmax.

  • refine::Bool: Whether refine at the domain boundary. Default is false.

  • bc::Union{Function, AbstractVector}: The boundary condition at the domain boundary.

source

Immersed boundary

KitAMR.jl adopts the immersed boundary method (IBM) to resolve boundaries with complex geometry. To define the geometry, KitAMR.jl provides following interface.

As the special case, the cirlce in 2D and sphere in 3D are defined separately, and are abstracted as AbstractCircle=Union{Circle,Sphere}.

KitAMR.CircleType
struct Circle{T<:AbstractBoundCond} <: AbstractBoundary
  • center::Vector: Center of the circle.

  • radius::Real: Radius of the circle.

  • solid::Bool: Is solid inside the circle?

  • search_coeffi::Real: Refinement coefficient.

  • bc::Union{Function, AbstractVector}: Primary macroscopic variables of the solid.

  • search_radius::Real: Maximum distance of the refinement region from the boundary.

source
KitAMR.SphereType
struct Sphere{T<:AbstractBoundCond} <: AbstractBoundary
  • center::Vector

  • radius::Real

  • solid::Bool

  • search_coeffi::Real

  • bc::Union{Function, AbstractVector}

  • search_radius::Real

source

For other cases, KitAMR.jl read .csv file for 2D, which defines the vertices coordinates of the closed boundary curve; and .stl file for 3D, which provides the triangular discretization of the boundary surface. The example can be find in /example/airfoil and /example/X38 respectively.

KitAMR.VerticesType
struct Vertices{DIM, T<:AbstractBoundCond} <: AbstractBoundary
  • vertices::Vector{Vector{Float64}}: Vertices of the boundary, sorted in clockwise or counterclockwise order.

  • solid::Bool

  • bc::Union{Function, AbstractVector}

  • box::Vector{Vector{Float64}}: The outer box of the vertices as [[xmin,ymin,zmin],[xmax,ymax,zmax]].

  • search_radius::Real: The number of cell layers refined from the boundary.

source

The most common constructor is

KitAMR.VerticesMethod
Vertices(
    _::Type{T<:AbstractBoundCond},
    file::String,
    solid,
    refine_coeffi,
    bc
) -> Vertices
  • file is the path to the .csv file.
source
KitAMR.TrianglesType
struct Triangles{T<:AbstractBoundCond} <: AbstractBoundary
  • solid::Bool

  • bc::Union{Function, AbstractVector}

  • search_radius::Real

  • tkdt::TriangleKDT

source

The most common constructor is

KitAMR.TrianglesMethod
Triangles(
    _::Type{T<:AbstractBoundCond},
    file::String,
    solid,
    search_radius,
    bc
) -> Triangles
  • file is the path to the .stl file.
source

TriangleKDT is a struct containing information related to K-D tree for efficient mesh generation:

KitAMR.TriangleKDTType
struct TriangleKDT
  • kdt::NearestNeighbors.KDTree

  • mesh::GeometryBasics.Mesh

  • table::Vector{NearestNeighbors.HyperRectangle{StaticArraysCore.SVector{3, Float64}}}

  • triangle_recs::Vector{NearestNeighbors.HyperRectangle{StaticArraysCore.SVector{3, Float64}}}

  • triangle_edges::Vector{Vector{StaticArraysCore.SVector{3, Float64}}}

source