Details on the Level Set Method

TODO: fill this out

Main Level Set Tools

LevelSetSublimation.reinitialize_ϕ_HCR!Function
reinitialize_ϕ_HCR!(ϕ, dom::Domain; maxsteps = 50, tol=1e-4, err_reg=:B)

Reinitialize ϕ throughout the domain.

Implementation of Eq. 22 in Hartmann 2010, scheme HCR-2.

Checks L∞ error (of |∇ϕ|=1) against tol either in band around interface (err_reg=:B) or throughout domain (err_reg=:all), and ends iteration early if tolerance is met.

source
LevelSetSublimation.extrap_v_fastmarch!Function
extrap_v_fastmarch(v_front, u, dom::Domain)

Compute an extrapolated velocity field in place. v_front should be nonzero only on Γ⁺, positive side of interface.

Using fast marching, instead of the PDE-based approach, to get second order accuracy more easily.

source

Discretizations, Backend

LevelSetSublimation.𝒢_wenoFunction
𝒢_weno(ϕ, ir::Int, iz::Int, dom::Domain)
𝒢_weno(ϕ, ind::CartesianIndex{2}, dom::Domain)
𝒢_weno(ϕ, ir::Int, iz::Int, ϕ0sign, dom::Domain)
𝒢_weno(ϕ, ind::CartesianIndex{2}, ϕ0sign, dom::Domain)

Compute the norm of the gradient by Godunov's scheme with WENO differences (wenodiffs_local).

If supplied, ϕ0sign is used in Godunov's scheme, rather than the current sign of ϕ. Described in (Hartmann et al., 2009), eq. 6 to eq. 9. Boundary treatment of ghost cells handled by get_or_extrapolate_ϕ.

source
LevelSetSublimation.𝒢_weno_allFunction
𝒢_weno_all(ϕ, [dϕdx_all,] dom::Domain; signs=nothing)

Compute the norm of the gradient of ϕ throughout domain by Godunov's scheme with WENO derivatives. If signs of ϕ should refer to some prior state, can be provided. If dϕdx_all is provided, then is not recomputed internally.

Internally, calls 𝒢_weno on all computational cells.

source
LevelSetSublimation.dϕdx_all_WENOFunction
dϕdx_all_WENO(ϕ, dom)

Compute (∂ϕ/∂r west, ∂ϕ/∂r east, ∂ϕ/∂z south, ∂ϕ/∂z north) using WENO derivatives.

Implemented by computing WENO derivatives for each cell separately, which is a little wasteful. Beyond the boundaries of domain, ϕ is extrapolated according to get_or_extrapolate_ϕ.

source

Error evaluation

LevelSetSublimation.identify_BFunction
identify_B(Γc::Vector{CartesianIndex{2}}, dom::Domain; extra=0)
identify_B(Γ_field::Matrix{Bool}, dom::Domain)
identify_B(ϕ::Matrix{Float64}, dom::Domain)
identify_B(ϕ::Any, dom::Domain)

Return a field of bools identifying the band around the interface.

The width in the band around Γ is specified by the fields bwr and bwz, which represent number of cells in the 𝑟 and 𝑧 directions respectively. extra will tack on extra cells, if in some (but not all) places you need a larger band than the default.

source
LevelSetSublimation.sdf_err_L1Function
sdf_err_L1(ϕ, dom; region=:B)

Compute the L1 norm of the error in the Eikonal equation |∇ϕ| = 1, on the given region (either :B or :all).

source
LevelSetSublimation.sdf_err_L∞Function
sdf_err_L∞(ϕ, dom; region=:B)

Compute the L∞ norm of the error in the Eikonal equation |∇ϕ| = 1, on the given region (either :B or :all).

source

Volume and surface integrals and evaluations

Initial sublimation front shapes, for numerical testing

LevelSetSublimation.make_ϕ0Function
make_ϕ0(ϕtype::Symbol, dom::Domain; ϵ=1e-4)

Return a ϕ0 with appropriate size for the passed Domain.

Parameter ϵ * sqrt(dom.rmax*dom.zmax) is added to ensure that interface is within domain. Currently allowed setups:

  • :top, :flat – interface at zmax*(1 - ϵ)
  • :rad, :cyl – interface at rmax*(1 - ϵ)
  • :box – interface at both zmax(1-ϵ) and rmax(1-ϵ)
  • :cone – interface a line decreasing in r
  • :midflat – interface at zmax*0.5
  • :ell_bub – ellipse in center of vial, separated from boundaries
  • :circ – circle at r=0, z=0
  • :tinycirc – circle at r=0, z=0, very small radius
source