I try to generate a mesh over a region, which has a wavy boundary at its bottom and needs very fine mesh around the bottom.
However, the generated mesh boundary is not as smooth as the specified region. The region is
The generated mesh is
If we zone-in we will find the bottom boundary is not the one as specified, see
The bottom looks very bad. I further try to generate the boundary first. Here is what I found.
The boundary is not generated correctly. Anyone know how to generate the correct meshed boundary?
The minimum work code is as follows.
Needs["NDSolve`FEM`"];
width = 1;
heigth = 0.25;
radius = 10;
ydatum = 0.006;
Aw = 5 10^-3;
\[Lambda]w = 0.1;
\[ScriptCapitalR] =
ImplicitRegion[
Abs[x] <= width/2 && y <= heigth + ydatum &&
y >= x^2/(2 radius) + Aw (1 - Cos[(2 \[Pi] x)/\[Lambda]w]) +
ydatum, {x, y}];
RegionPlot[\[ScriptCapitalR], FrameTicks -> None,
AspectRatio -> Automatic, ImageSize -> Large,
PlotRange -> {{-0.35, 0.35}, {0.005, 0.256}}]
bmesh = ToBoundaryMesh[\[ScriptCapitalR],
"BoundaryMeshGenerator" -> "Continuation", AccuracyGoal -> 2]
bmesh["Wireframe"]
meshrefine =
Function[{vertices, area},
Block[{x, y}, {x, y} = Mean[vertices];
If[ydatum < y < ydatum + 0.025, area > 3.0*10^-7, area > 0.0002]]];
mesh1 = ToElementMesh[\[ScriptCapitalR], "MeshOrder" -> 1,
MaxCellMeasure -> {"Length" -> 0.01},
MeshRefinementFunction -> meshrefine]
mesh1["Wireframe"]
Show[mesh1["Wireframe"], PlotRange -> {{-0.05, 0.05}, {0.005, 0.04}},
ImageSize -> 800]