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 one. The region is
The generated mesh is
If we zone-in we will find the bottom boundary is not
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?
I have got the answer from http://community.wolfram.com/groups/-/m/t/1221340?sortMsg=Votes:
Adding a range of {{x,-0.6,0.6},{y,0,0.3}} in defining the region.
The minimum work code is as follows.
Needs["NDSolve`FEM`"];
width = 1;
heigth = 0.25;
radius = 10;
ydatum = 0.006;
Aw = 2 10^-3;
λw = 0.1;
ℛ =
ImplicitRegion[
Abs[x] <= width/2 && y <= heigth + ydatum &&
y >= x^2/(2 radius) + Aw (1 - Cos[(2 π x)/λw]) +
ydatum, {{x,-0.6,0.6},{y,0,0.3}}];
RegionPlot[ℛ, FrameTicks -> None, PlotPoints -> 20000,
AspectRatio -> Automatic, ImageSize -> Large,
PlotRange -> {{-0.48, 0.48}, {0.005, 0.256}}]
bmesh = ToBoundaryMesh[ℛ,
"BoundaryMeshGenerator" -> "Continuation", AccuracyGoal -> 2]
bmesh["Wireframe"]
meshrefine =
Function[{vertices, area},
Block[{x, y}, {x, y} = Mean[vertices];
If[ydatum < y < ydatum + 0.01, area > 2.1*10^-7, area > 0.001]]];
mesh1 = ToElementMesh[ℛ, "MeshOrder" -> 1,
MeshRefinementFunction -> meshrefine]
mesh1["Wireframe"]
Show[mesh1["Wireframe"],
PlotRange -> {{-0.025, 0.025}, {0.005, 0.02}}, ImageSize -> 800]
MaxCellMeasure -> 0.0002
to the call toToElementMesh
: This adds only a few thousand triangles but the boundary seems to be discretized accurately. $\endgroup$MeshRefinementFunction
will also help. $\endgroup$MeshRefinementFunction
you use has discontinuities iny = ydatum + 0.01
andy = ydatum
This causes that several triangles that are adjacent to each other are treated completely different. If I were a meshing algorithm, I wouldn't like to get such inputs/ $\endgroup$