Refinement meshgrids

Hi, all. I am trying to plot the curves of potential 1/r on mesh grid xg and yg (xg and yg are 2d mesh grids, r = @. sqrt(xg^2 + yg^2)). I want to solve the curves where the potential equals 1. I want to refine the grids near the curve. Is there any simple way to construct refined meshes?

Hi,
I’m not quite sure what you mean by solve for curves, but if you want to construct the level set for value 1, you could just use something like

using GLMakie

xs = LinRange(-1.5, 1.5, 100)  # 100 equidistant points between -1.5 and 1.5 (inclusive)
ys = LinRange(-1.5, 1.5, 100)
f(x, y) = sqrt(x^2 + y^2)

contour(xs, ys, [f(x, y) for x in xs, y in ys], levels=[1])

Now if you would want to refine this to get a higher resolution, what does that mean for xs and ys (or your xg and yg)? Would you want to obtain something like xs = ys = LinRange(-1.5, 1.5, 200)? Do you want to abandon the grid structure in favour of something like a quadtree?