5
$\begingroup$

I need to manage the mesh size for finite element method solution to a differential equation, where properties change over two regions. This is for one dimension. I created a boundary mesh of three points to create two linear regions.

<< NDSolve`FEM`  

 bmesh = ToBoundaryMesh["Coordinates" -> {{0}, {2}, {4}},   
"BoundaryElements" -> {PointElement[{{1}, {2}, {3}}, {1, 1, 3}]},   
"PointElements" -> {PointElement[{{1}, {2}, {3}}, {1, 1, 3}]}]; 



 m3 = ToElementMesh[bmesh, "RegionMarker" -> {{{1}, 1, 0.2}, {{2}, 
 2, 0.05}}]


 m3["MeshElements"]

 m3["Coordinates"]

When I check the element coordinates, the second region does not seem to have the element spacing that I requested. I should be 0.05, but it seems to stay at 0.2.

Table[{m3["Coordinates"][[i]], i}, {i,1,Length[m3["Coordinates"]]}]

m3["Wireframe"["MeshElementIDStyle" -> Red]]

Can anyone help?

$\endgroup$
1
  • 1
    $\begingroup$ When you define m3, use { {3}, 2, 0.05} }. That is, the marker should be 3 instead of 2. $\endgroup$
    – LouisB
    Aug 20, 2019 at 23:20

1 Answer 1

5
$\begingroup$

As pointed out in the comments the coordinate for the region marker needs to be within the region and not on the boundary of the region. This works:

m3 = ToElementMesh[bmesh, 
  "RegionMarker" -> {{{1}, 1, 0.2}, {{3}, 2, 0.05}}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.