2
|
4337 Views
|
2 Replies
|
9 Total Likes
View groups...
Share
GROUPS:

# Consistent usage of adaptive meshing

Posted 12 years ago
 I will define a style that Id like to work with:sty = {ColorFunction -> "DarkRainbow", Mesh -> All, MeshStyle -> Opacity[.1],        PlotPoints -> 25, PlotRange -> All, ImageSize -> 500};This is a simple closed-spline surface defined on a unit square domain:SeedRandom[5];f = BSplineFunction[RandomReal[1, {5, 5, 1}], SplineClosed -> True];Plot3D[f[x, y] , {x, 0, 1}, {y, 0, 1}, Evaluate@sty]Why does mesh changes from adaptive to uniform? What can I do to retain adaptive meshing?Plot3D[f[x/8 + 1/2, y/8 + 1/2], {x, -4, 4}, {y, -4, 4}, Evaluate@sty]
2 Replies
Sort By:
Posted 12 years ago
 The mesh is still adaptive, but with less refinement. (Note the small triangles in the corners.)Mesh refinement is based on the angles between polygons, and is computed using the natural coordinate system, without accounting for the rescaling that comes from Plot3D setting the BoxRatios option.  If we set BoxRatios->Automatic, then we can see that your second plot is stretched out to the point that it is "flat" enough to not trigger very much refinement (just the corners and a bit near (4,-2) for the tallest peak.)Plot3D[f[x, y], {x, 0, 1}, {y, 0, 1},        BoxRatios -> Automatic, Mesh -> All]Plot3D[f[x/8 + 1/2, y/8 + 1/2], {x, -4, 4}, {y, -4, 4},        BoxRatios -> Automatic, Mesh -> All]You can see how the refinement changes with scale with the following Manipulate:Manipulate[    Plot3D[f[x/(2 n) + 1/2, y/(2 n) + 1/2], {x, -n, n}, {y, -n, n},           PerformanceGoal -> "Quality", Mesh -> All],     {n, 0.5, 5}]
Posted 12 years ago
 In case you really want to trigger the refinement, you can use something like:Manipulate[ Plot3D[f[x/(2 n) + 1/2, y/(2 n) + 1/2], {x, -n, n}, {y, -n, n},   PerformanceGoal -> "Quality", Mesh -> All,   Method -> {"Refinement" -> {"ControlValue" -> rad}}], {n, 0.5,   5}, {{rad, Pi/12.}, 0, Pi/4.0, Pi/90.0}]The default value for the refinement is 20 Degrees for Polygons and around 5 Degrees for curves.Ideally we would want to have this value change with the aspect ratio, however, for functions with singular points/curves, a "good guess" will depend on how close the initial sampling is from these points/curves.