Initialization
KitAMR.initialize — Function
initialize(
config::Configure{DIM, NDF};
prerefine_steps,
prerefine_recursive,
prerefine_reinit_ic
) -> Tuple{Union{Ptr{P4est.LibP4est.p4est}, Ptr{P4est.LibP4est.p8est}}, KA}
Build the full solver state from a Configure and return (p4est, ka). This is the entry point of every run and must be called before any time stepping.
It creates the p4est forest, generates and geometry-adaptively refines the physical mesh, builds the velocity-space grids, initializes the field from the configuration's initial condition, sets up ghost layers, neighbor maps, faces and immersed boundaries, performs the first load-balancing partition, runs the solution-driven initial mesh pre-refinement (see the keyword arguments below), and finally reports the initial status.
Returns (p4est, ka):
p4est— opaque pointer to the p4est forest (the parallel mesh topology);ka— theKAobject holding all solver data, configuration and status.
Pass both to solve! (or to the individual per-step driver functions), then to save_result and finalize!.
Keyword arguments — initial mesh pre-refinement
prerefine_steps::Integer = solver.AMR_DYNAMIC_PS_MAXLEVEL— number ofps_adaptive_mesh_refinement!passes applied after the base setup; the default builds the mesh up to the dynamic physical-space max level. Pass0to skip.prerefine_recursive::Bool = false—recursiveflag for those passes.prerefine_reinit_ic::Bool = true— re-apply the initial condition (reinitialize_initial_condition!) after each pass, so newly refined cells get the exact IC (recommended for sharp initial conditions, e.g. Riemann / blast waves).
The initial condition can be re-applied to a (re)refined mesh — e.g. between the initial pre-refinement passes — with
KitAMR.reinitialize_initial_condition! — Function
reinitialize_initial_condition!(ka::KA{DIM, NDF})
Reapply the configured initial condition on the current physical mesh.
This is intended for initial physical-space AMR: after refinement creates children from interpolated parent data, call this before rebuilding ghosts so new fine cells receive the exact initial state at their own cell centers.
KitAMR.initialize_ghost — Function
initialize_ghost(
p4est::Union{Ptr{P4est.LibP4est.p4est}, Ptr{P4est.LibP4est.p8est}},
kinfo::KInfo
) -> Ghost
Initialize Ghost structure.
KitAMR.initialize_trees! — Function
initialize_trees!(
kinfo::KInfo{DIM, NDF}
) -> Tuple{Union{Ptr{P4est.LibP4est.p4est}, Ptr{P4est.LibP4est.p8est}}, Any}
Initialize field for 2D case.
initialize_trees!(
kinfo::KInfo{3, NDF}
) -> Tuple{Union{Ptr{P4est.LibP4est.p4est}, Ptr{P4est.LibP4est.p8est}}, Any}
Initialize field for 3D case.
In this function, p4est is initialized. Mesh (in both physical and velocity space) is generated and adaptively refined. Field (in both physical and velocity space) is initialized according to initial conditions. Mapping between Julia data and p4est is established. Currently, realizations for 2D and 3D cases are different. The method for 3D case can be more complicated but more efficient. The method for 2D will be improved to be consistent with the 3D case.
KitAMR.initialize_ps! — Function
initialize_ps!(
p4est::Ptr{P4est.LibP4est.p4est},
kinfo::KInfo{DIM, NDF}
) -> Any
initialize_ps!(
p4est::Ptr{P4est.LibP4est.p8est},
kinfo::KInfo{DIM, NDF}
) -> Any
Initialize PsData and establish the mapping between Julia data and p4est.
KitAMR.pre_refine! — Function
pre_refine!(
p4est::Ptr{P4est.LibP4est.p4est},
kinfo::KInfo
) -> Any
pre_refine!(
p4est::Ptr{P4est.LibP4est.p8est},
kinfo::KInfo
) -> Any
Mesh identification, geometric adaptive refinement, and initial partition.
KitAMR.initialize_faces! — Function
initialize_faces!(p4est::Ptr{P4est.LibP4est.p4est}, ka::KA)
initialize_faces!(p4est::Ptr{P4est.LibP4est.p8est}, ka::KA)
Initialize faces defined by AbstractFace.
KitAMR.AMR_ghost_new — Function
AMR_ghost_new(
p4est::Ptr{P4est.LibP4est.p4est}
) -> Ptr{P4est.LibP4est.p4est_ghost_t}
AMR_ghost_new(
p4est::Ptr{P4est.LibP4est.p8est}
) -> Ptr{P4est.LibP4est.p8est_ghost_t}
Initialize the ghost layer in p4est.
KitAMR.AMR_mesh_new — Function
AMR_mesh_new(
p4est::Ptr{P4est.LibP4est.p4est},
ghost::Ptr{P4est.LibP4est.p4est_ghost_t}
) -> Ptr{P4est.LibP4est.p4est_mesh_t}
AMR_mesh_new(
p4est::Ptr{P4est.LibP4est.p8est},
ghost::Ptr{P4est.LibP4est.p8est_ghost_t}
) -> Ptr{P4est.LibP4est.p8est_mesh_t}
Initialize the mesh in p4est that is used to look up the neighboring cell in physical space.
KitAMR.initialize_neighbor_data! — Function
initialize_neighbor_data!(
p4est::Union{Ptr{P4est.LibP4est.p4est}, Ptr{P4est.LibP4est.p8est}},
ka::KA
)
Initialize Neighbor in PsData.
KitAMR.initialize_solid_neighbor! — Function
initialize_solid_neighbor!(ka::KA)
initialize_solid_neighbor!(
ps_data::PsData{DIM, NDF},
ka::KA{DIM, NDF}
)
Initialize SolidNeighbors corresponding to the immersed boundaries.