4
$\begingroup$

I am solving a PDE using the NDSolve over a cylinder (length L=0.03 m and radius r=0.0025 m). I define the cylinder using OpeCascadeLink and the mesh as shown below. The problem is, the output of the ElementMesh shows that the y-range is smaller than defined (0.00248 instead of 0.0025). I tried with a finer mesh (MaxCellMeasure) but the result didn't change. I tried DiscretizeRegion, but it gives an error. What causes this and how to fix it? Thanks!

Needs["NDSolve`FEM`"]
Needs["OpenCascadeLink`"]
L = 0.03; r = 0.0025;
OpenCascadeShapeType[cyl];
cyl = OpenCascadeShape[c1 = Cylinder[{{0, 0, 0}, {L, 0, 0}}, r]];
bmesh = OpenCascadeShapeSurfaceMeshToBoundaryMesh[cyl];
mesh = ToElementMesh[bmesh] (*returns smaller range for y*)
mesh = ToElementMesh[bmesh, "MaxCellMeasure" -> 10^-12,"MeshOrder" -> 2] (*returns same smaller range for y*)
DiscretizeRegion[cyl];(*returns error*)

The output is

   0.0025}}, {TetrahedronElement["<" 12735 ">"]}] 
ElementMesh[{{0., 0.03}, **{-0.00248177, 0.00248177}**, {-0.0025, 
   0.0025}}, {TetrahedronElement["<" 1101146 ">"]}]
DiscretizeRegion::regp: A correctly specified region expected at position 1 of DiscretizeRegion[OpenCascadeShapeExpression[13]]

The solution of the PDE is of course over the same incomplete domain.

enter image description here

$\endgroup$
0

1 Answer 1

6
$\begingroup$
Clear[bmesh];
bmesh = OpenCascadeShapeSurfaceMeshToBoundaryMesh[cyl, 
  "ShapeSurfaceMeshOptions" -> {"AngularDeflection" -> 0.05}]

ElementMesh[{{0., 0.03}, {-0.0025, 0.0025}, {-0.0025, 0.0025}}, Automatic]

Or

Clear[bmesh];
bmesh = OpenCascadeShapeSurfaceMeshToBoundaryMesh[cyl, 
  "ShapeSurfaceMeshOptions" -> {"LinearDeflection" -> 10^-5}]

ElementMesh[{{0., 0.03}, {-0.0025, 0.0025}, {-0.0025, 0.0025}}, Automatic]

bmesh // BoundaryMeshRegion

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you! This works well. $\endgroup$
    – user93372
    Jul 10, 2023 at 21:12

Your Answer

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

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