-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Description
When profiling a 3d Zalesak example, I see loads of time being spent in the _getindexrec function. In particular, time is spent trying to decide whether an index is near the boundary or not, so that we know if a boundary condition is needed. We should probably split the main loop into:
- loop over internal nodes, where we can just fetch the index normally
- loop over boundary nodes, where the fancy
_getindexrecis needed
For what is worth, here is a snapshot of the profile:
and the code that can be used to generate it:
using LevelSetMethods, StaticArrays
grid = CartesianGrid((-1, -1, -1), (1, 1, 1), (50, 50, 50))
center = (-1 / 3, 0, 0)
radius = 0.5
disk = LevelSetMethods.sphere(grid; center, radius)
rec = LevelSetMethods.rectangle(
grid;
center = center .+ (0, radius, 0),
width = (1 / 3, 1.0, 2),
)
ϕ = setdiff(disk, rec)
eq = LevelSetEquation(;
levelset = ϕ,
terms = AdvectionTerm((x, t) -> π * SVector(-x[2], x[1], 0)),
bc = NeumannBC(),
)
@profview integrate!(eq, 0.2) # from VScode, otherwise use @profileMetadata
Metadata
Assignees
Labels
No labels
