Reconstruction
Slope
In current version, the distribution function is reconstructed as a linear function. Besides the function value at center of the cell, the slope is also required. The slope is obtained by finite difference. To eliminate the oscillation near discontinuities, the vanLeer limiter is adopted.
The per-step entry point, which recomputes every slope and exchanges the ghost data over MPI, is
KitAMR.slope! — Function
slope!(
p4est::Union{Ptr{P4est.LibP4est.p4est}, Ptr{P4est.LibP4est.p8est}},
ka::KA{DIM}
)
Reconstruct the slopes used by the second-order flux: update the velocity-space slopes sdf in VsData and the macroscopic slopes sw in PsData. The reconstruction is done level by level (with the transverse correction applied on coarse/fine faces) and the freshly corrected mirror/ghost data is exchanged over MPI between levels.
Call once per step after adaptive_mesh_refinement! / limit_Δt! and before flux!, which consumes these slopes. (The solve! driver does this.)
KitAMR.vanleer — Function
vanleer(sL::AbstractArray, sR::AbstractArray) -> Any
vanleer(sL::Real, sR::Real) -> Any
The finite difference is not that simple considering cells in templates may exhibit different refinement level, in both physical and velocity space. Here we list related methods. For more detailed explanation, one may refer to our future paper.
KitAMR.diff_vs! — Function
diff_vs!(
vs_data::AbstractVsData{DIM, NDF},
vs_data_n::AbstractVsData{DIM, NDF},
dsL::Float64,
sL::AbstractMatrix
)
Difference through all velocity cells in two neighboring physical cells.
KitAMR.update_slope! — Method
update_slope!(ka::KA{DIM, NDF})
Outer function to update sdf in VsData and sw in PsData.
Here are methods corresponding to different cases in physical space. The first two argument types refer to the number of the neighboring cells in negative and positive direction along the dirth dimension. Val{i} refers to there are i neighboring cells across the face. -1 represents a single cell with lower refinement level. Because the mesh is balanced, only following cases are required to consider.
KitAMR.update_slope! — Method
update_slope!(
_::Val{0},
_::Val{1},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{1},
_::Val{0},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{0},
_::Val{-1},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{-1},
_::Val{0},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{0},
_::Union{Val{2}, Val{4}},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Union{Val{2}, Val{4}},
_::Val{0},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
Update both micro and macro slopes in cells neighboring to domain edges.
KitAMR.update_slope! — Method
update_slope!(
_::Val{1},
_::Val{1},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{1},
_::Val{-1},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{-1},
_::Val{1},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{1},
_::Union{Val{2}, Val{4}},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Union{Val{2}, Val{4}},
_::Val{1},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{-1},
_::Union{Val{2}, Val{4}},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Union{Val{2}, Val{4}},
_::Val{-1},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Union{Val{2}, Val{4}},
_::Union{Val{2}, Val{4}},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope! — Method
update_slope!(
_::Val{-1},
_::Val{-1},
ps_data::PsData,
kinfo::KInfo{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dir::Integer,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64},
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
Update both micro and macro in internal cells.
KitAMR.update_slope_inner_vs! — Function
update_slope_inner_vs!(
vs_data::AbstractVsData{DIM, NDF},
Ldata::Vector,
Rdata::Vector,
dsL::Float64,
dsR::Float64,
dir::Int64,
ws_sL::Matrix{Float64},
ws_sR::Matrix{Float64}
)
KitAMR.update_slope_bound_vs! — Function
update_slope_bound_vs!(
vs_data::AbstractVsData{DIM, NDF},
neighbor_datas::AbstractVector,
ds::Float64,
dir::Int64,
ws_sdf::Matrix{Float64}
)
Update micro slope sdf.
KitAMR.update_slope_inner_ps! — Function
update_slope_inner_ps!(
ps_data::PsData{DIM, NDF},
Ldata::AbstractVector,
Rdata::AbstractVector,
dsL::Float64,
dsR::Float64,
dir::Int64,
ws_swL::Vector{Float64},
ws_swR::Vector{Float64}
)
KitAMR.update_slope_bound_ps! — Function
update_slope_bound_ps!(
ps_data::PsData{DIM, NDF},
Ldata::AbstractVector,
dsL::Float64,
dir::Int64,
ws_swL::Vector{Float64}
)
Update macro slope sw. Currently, sw is only used as an indicator for AMR in physical space. Hence, the calculation is carried out without a limiter. On the contrary, the slope with larger absolute value in two sides slopes is adopted for more sufficient refinement.
To preserve the positivity of the distribution function, a positivity-preserving reconstruction strategy is adopted. Detailed information is in Flux.
Immersed boundary method
Boundaries with complex geometry are resolved with immersed boundary method. More specifically, a sharp interface method with ghost cell is adopted. Detailed information can be found in our paper https://doi.org/10.48550/arXiv.2512.20252. KitAMR.jl provided interfaces for the reconstruction of the ghost cells
KitAMR.update_solid_cell! — Function
update_solid_cell!(ka::KA)
Update solid_cell in SolidNeighbor with interpolation.
KitAMR.update_solid_neighbor! — Function
update_solid_neighbor!(ka::KA{DIM, NDF})
Update VsData variables in SolidNeighbor with the immersed boundary method.