4
$\begingroup$

After working on this 2D domain, I'm trying to reproduce the same ideas to create a mesh of a sphere composed of QuadElement, instead of more simple and common TetrahedronElement. One of the reason for this choice is to reduce the computational effort, exploit simmetries, and possibly getting a higher quality mesh.

The key idea/requirement is still to increase the tangential density of QuadElement while moving away from the center.

In the referred question user21 recommended to use TriangleElement to join layers with different densities of QuadElement, but unfortunately in 3D we cannot use TetrahedronElement to join layers of HexahedronElement (peraphs, the use of TetrahedronElement will vanish the effort to reduce the computational cost).

So researching a bit, and implementing a lot, I managed to create a mesh of this type:

Mathematica graphics

The code I built to do this is very long and complex (for me at least), so I don't think it is useful to post here.

I encounter a problem when I try to convert my first-order mesh to second order using MeshOrderAlteration (see reffered question where user21 write about this undocumented function).

Also in this simpler case the function apparently do nothing.

Needs["NDSolve`FEM`"]
mesh = Import["http://1drv.ms/1Nu6qCC", "ExpressionML"];
NDSolve`FEM`ElementMeshQ[mesh]
MeshRegion@mesh
mesh = MeshOrderAlteration[mesh, 2];
mesh["MeshOrder"]

Mathematica graphics

True

1

I'm not sure if I made some mistake while creating the first-order mesh but I didn't get any error message.

UPDATE

Thanks to MichealE2 who discovered this behavior is related to the fact the mesh is created with several HexahedronElement for convenience (each one represents a "shell").

Please note that in 2D MeshOrderAlteration apparently works with many elements and also different types of elements.

Editing one sample in the tutorial Element Mesh Generation prove this behavior is not only related to my specific mesh.

coordinates = 
  N[Join[{{0, 0, 1}, {0, 0, 0}}, 
    Table[{Sin[i], Cos[i], 0}, {i, 0, 2 \[Pi] - \[Pi]/4, \[Pi]/4}]]];
mesh = ToElementMesh["Coordinates" -> coordinates, "MeshElements" ->
    TetrahedronElement@*
      List /@ {{1, 2, 3, 4}, {1, 2, 4, 5}, {1, 2, 5, 6}, {1, 2, 6, 
       7}, {1, 2, 7, 8}, {1, 2, 8, 9}, {1, 2, 9, 10}, {1, 2, 10, 3}}
   ];
mesh = MeshOrderAlteration[mesh, 2];
mesh["MeshOrder"]

1

mesh = ToElementMesh["Coordinates" -> coordinates, "MeshElements" -> {
     TetrahedronElement[{{1, 2, 3, 4}, {1, 2, 4, 5}, {1, 2, 5, 6}, {1,
         2, 6, 7}, {1, 2, 7, 8}, {1, 2, 8, 9}, {1, 2, 9, 10}, {1, 2, 
        10, 3}}, {1, 1, 1, 1, 2, 2, 2, 2}]
     }];
mesh = MeshOrderAlteration[mesh, 2];
mesh["MeshOrder"]

2

Also with my original mesh:

mesh = Import["http://1drv.ms/1ynockn", "ExpressionML"];
MeshRegion@mesh
mesh = MeshOrderAlteration[
   mesh /. elem : {__HexahedronElement} :> {HexahedronElement @@ 
       Join @@@ Transpose[elem /. HexahedronElement -> List]}, 2];
mesh["MeshOrder"]

2

$\endgroup$
  • 2
    $\begingroup$ In your simpler example, if you combine the several HexahedronElement into a single one, MeshOrderAlteration works: mesh2 = MeshOrderAlteration[mesh /. elem : {__HexahedronElement} :> {HexahedronElement @@ Join @@@ Transpose[elem /. HexahedronElement -> List]}, 2]. I don't know how MeshOrderAlteration works and its limitations, but let me know if it works on your actual mesh. $\endgroup$ – Michael E2 Apr 12 '15 at 13:10
  • $\begingroup$ @MichaelE2 Wow, Yes, It does, Thanks. How do you discovered/suspected this? $\endgroup$ – unlikely Apr 12 '15 at 15:40
  • $\begingroup$ I suppose it's a somewhat standard problem solving strategy: Find an example (or two) that works and compare it to the example that doesn't. An ElementMesh is not a very complicated data structure and there are not many things that can be different. The obvious and principal difference was that your example had a list of several HexahedronElement. Since MeshOrderAlteration is an internal function, it may not have the robustness that one expects of user-level functions. $\endgroup$ – Michael E2 Apr 12 '15 at 15:53
  • 2
    $\begingroup$ I filed this as a possible future improvement. You can also use MeshOrderAlteration[ ToElementMesh["Coordinates" -> mesh["Coordinates"], "MeshElements" -> MeshElementMerge[mesh["MeshElements"]]], 2] to merge the mesh elements. $\endgroup$ – user21 Apr 13 '15 at 8:32
  • $\begingroup$ @user21 Thanks. I'm experiencing another issue with MeshOrderAlteration and point markers in 3D. How MeshOrderAlteration assign point markers to 2nd order nodes? Sometimes - I noticed - a second nodes "inherits" its marker from adjacent first order nodes markers, if they are equal. But this doesn't happens always... $\endgroup$ – unlikely Apr 13 '15 at 9:59
3
$\begingroup$

The OP's simpler mesh has the form

mesh
(*
  ElementMesh[{{-0.707107, 0.707107}, {-1., -0.11547}, {-0.707107,  0.707107}},
   {HexahedronElement["<" 64 ">"], HexahedronElement["<" 64 ">"], 
    HexahedronElement["<" 64 ">"], HexahedronElement["<" 64 ">"], 
    HexahedronElement["<" 64 ">"], HexahedronElement["<" 64 ">"], 
    HexahedronElement["<" 64 ">"], HexahedronElement["<" 64 ">"], 
    HexahedronElement["<" 64 ">"], HexahedronElement["<" 64 ">"]}]
*)

If you combine the several HexahedronElement into a single one, MeshOrderAlteration works:

mesh2 = MeshOrderAlteration[
  mesh /. elem : {__HexahedronElement} :>
   {HexahedronElement @@ Join @@@ Transpose[elem /. HexahedronElement -> List]},
  2];
mesh["MeshOrder"]
(*  2  *)

I don't know how MeshOrderAlteration works nor its limitations, but it is possible that, since it is an undocumented internal function, it handles element meshes only in the form(s) in which they arise internally.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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