Initial and boundary conditions
To launch a simulation, initial and boundary conditions are necessary.
Initial conditions
The types of initial conditions are abstracted as
KitAMR.AbstractInitCond — Type
abstract type AbstractInitCondCurrently, available options are
KitAMR.Uniform — Type
struct Uniform <: AbstractInitCondUniform 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.
KitAMR.PCoordFn — Type
struct PCoordFn <: AbstractInitCondCoordinate-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) -> primreturning the primitive vector at a physical coordinate.
Boundary conditions
The type of the boundary conditions is determined by
KitAMR.AbstractBoundCond — Type
abstract type AbstractBoundCondCurrently, available options are
KitAMR.Maxwellian — Type
abstract type Maxwellian <: AbstractBoundCondFully diffused Maxwellian gas-surface interaction model.
KitAMR.SuperSonicInflow — Type
abstract type SuperSonicInflow <: AbstractBoundCondKitAMR.SuperSonicOutflow — Type
abstract type SuperSonicOutflow <: AbstractBoundCondKitAMR.UniformOutflow — Type
abstract type UniformOutflow <: AbstractBoundCondKitAMR.InterpolatedOutflow — Type
abstract type InterpolatedOutflow <: AbstractBoundCondKitAMR.Period — Type
abstract type Period <: AbstractBoundCondWith these types of boundary conditions,
KitAMR.AbstractBoundary — Type
abstract type AbstractBoundarycan 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.Domain — Type
struct Domain{T<:AbstractBoundCond} <: AbstractBoundaryStructure of domain boundary.
Fields
id::Int64: Index of the domain boundary. From 1 to 6, it represents the boundary ofxmin,xmax,ymin,ymax,zmin,zmax.refine::Bool: Whether refine at the domain boundary. Default isfalse.bc::Union{Function, AbstractVector}: The boundary condition at the domain boundary.
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.Circle — Type
struct Circle{T<:AbstractBoundCond} <: AbstractBoundarycenter::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.
KitAMR.Sphere — Type
struct Sphere{T<:AbstractBoundCond} <: AbstractBoundarycenter::Vectorradius::Realsolid::Boolsearch_coeffi::Realbc::Union{Function, AbstractVector}search_radius::Real
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.Vertices — Type
struct Vertices{DIM, T<:AbstractBoundCond} <: AbstractBoundaryvertices::Vector{Vector{Float64}}: Vertices of the boundary, sorted in clockwise or counterclockwise order.solid::Boolbc::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.
The most common constructor is
KitAMR.Vertices — Method
Vertices(
_::Type{T<:AbstractBoundCond},
file::String,
solid,
refine_coeffi,
bc
) -> Vertices
fileis the path to the.csvfile.
KitAMR.Triangles — Type
struct Triangles{T<:AbstractBoundCond} <: AbstractBoundarysolid::Boolbc::Union{Function, AbstractVector}search_radius::Realtkdt::TriangleKDT
The most common constructor is
KitAMR.Triangles — Method
Triangles(
_::Type{T<:AbstractBoundCond},
file::String,
solid,
search_radius,
bc
) -> Triangles
fileis the path to the.stlfile.
TriangleKDT is a struct containing information related to K-D tree for efficient mesh generation:
KitAMR.TriangleKDT — Type
struct TriangleKDTkdt::NearestNeighbors.KDTreemesh::GeometryBasics.Meshtable::Vector{NearestNeighbors.HyperRectangle{StaticArraysCore.SVector{3, Float64}}}triangle_recs::Vector{NearestNeighbors.HyperRectangle{StaticArraysCore.SVector{3, Float64}}}triangle_edges::Vector{Vector{StaticArraysCore.SVector{3, Float64}}}