Message Boards Message Boards

[?] Get an accurate smooth boundary of the mesh generated by ToElementMesh?

Posted 6 years ago

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

enter image description here

The generated mesh is

enter image description here

If we zone-in we will find the bottom boundary is not the one as specified, see

enter image description here

The bottom looks very bad. I further try to generate the boundary first. Here is what I found.

enter image description here

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]
POSTED BY: Wilhelm Deng
2 Replies

Extend the bounding box to include a little outside the region:

\[ScriptCapitalR] = 
  ImplicitRegion[
   Abs[x] <= width/2 && y <= heigth + ydatum && 
    y >= x^2/(2 radius) + Aw (1 - Cos[(2 \[Pi] x)/\[Lambda]w]) + ydatum,
    {{x, -0.36, 0.36}, {y, -0.02, 0.3}}];    (* <--- N.B. *)
mesh1 = ToElementMesh[\[ScriptCapitalR], "MeshOrder" -> 1, 
  MaxCellMeasure -> {"Length" -> 0.01}, 
  MeshRefinementFunction -> meshrefine]
mesh1["Wireframe"]
POSTED BY: Michael Rogers
Posted 6 years ago

Thank you very much.

POSTED BY: Wilhelm Deng
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract