Plotting and Accessing Simulation Results
Visualizing simulation results
LevelSetSublimation.summaryplot — Functionsummaryplot(sim; layout=(3,2), heatvar=:T)Return a 2x3 plot of simulation results from start to finish.
sim should have a field "sol" , which is passed to get_ϕ(sol, t, dom::Domain) . heatvar determines what is plotted as a heatmap in the results (:T or :ϕ, currently.)
LevelSetSublimation.resultsanim — Functionresultsanim(sim, casename; seconds_length=5, heatvar=:T)Generate a .gif of the given sim, with filename casename_heatvar_evol.gif.
Pass either :p or :T as heatvar. Passing ϕ will probably cause filename problems
LevelSetSublimation.plotframe — Functionplotframe(t::Float64, sim; maxT=nothing, heatvar=:T)Unpack simulation results and plot the state at time t.
heatvar = :T or =:ϕ or =:p decides whether temperature, level set function, or pressure is plotted as colors. If given, maxT sets an upper limit for the associated colorbar.
Accessing simulation results
The return from sim_from_dict is a dictionary, with a field "dom" containing a Domain and "sol" containing an ODESolution.
The ODESolution type comes from DifferentialEquations, and comes with lots of convenience functions documented here.
At a particular timestep, u is used to describe the system's state. With the current implementation, u is a vector, with nr*nz values of the level set function throughout the domain, followed by 1 value for frozen temperature Tf and one value for glass temperature Tvw. ϕ_T_from_u will return a tuple (ϕ, Tf, Tvw) ; this is just so you don't have to hard-code which indices are which variables.
Fine-grained plotting functions, used internally
LevelSetSublimation.plot_cylheat — Functionplot_cylheat(T, dom::Domain)In a mutating fashion, add a "cylindrical" heatmap of T to the current plot. ("Cylindrical" meaning reflected across x=0 axis.)
LevelSetSublimation.freshplot — Functionfreshplot(dom::Domain)Generate an empty plot, scaled to show only dom.
LevelSetSublimation.heat — Functionheat(field, dom::Domain)Return a heatmap of field, scaled to fit on dom.
This function generates a new plot.
LevelSetSublimation.LevelSet — TypeLevelSet(phi, dom::Domain)A small struct, used in dispatch for plotting.
The plot recipe can be variously called as:
plot(LevelSet(phi, dom), reflect=true)
plot(LevelSet(phi, dom), reflect=false)
plot!(LevelSet(phi, dom), reflect=true)
plot!(LevelSet(phi, dom), reflect=false)LevelSetSublimation.arrows — Functionarrows(Vf, dom::Domain)Add "quiver" to current plot, with velocity field Vf of shape (nx, ny, 2).
LevelSetSublimation.markfront — Functionmarkfront(phi, dom::Domain; lab="", c=:white)Add a star marker to Γ (front) cells based on ϕ for current plot, in mutating fashion.
Internally calls Γ_cells.
plot(::LevelSet, reflect=true) plots the zero-level set for a level set function LevelSet(phi, dom::Domain). reflect reflects across the y-axis to make cylindrical plots.