Skip to main content
added 256 characters in body
Source Link
andre314
  • 19.6k
  • 1
  • 39
  • 77

The fact that the mesh order is 2 is confusing. It becomes clear (I hope) if you do the same thing with mesh order which is 1 :

It seems that in the case of a mesh order 2, the first 21 elements are the same as the 21 elements of order 1, and the new elements beyond 21 (0.05, 0.15 ...)are a addition to implement the order 2 mesh. I have always observed this kind of construction, though it is not documented.

The fact that the mesh order is 2 is confusing. It becomes clear (I hope) if you do the same thing with mesh order which is 1 :

The fact that the mesh order is 2 is confusing. It becomes clear (I hope) if you do the same thing with mesh order 1 :

It seems that in the case of a mesh order 2, the first 21 elements are the same as the 21 elements of order 1, and the new elements beyond 21 (0.05, 0.15 ...)are a addition to implement the order 2 mesh. I have always observed this kind of construction, though it is not documented.

added 1080 characters in body
Source Link
andre314
  • 19.6k
  • 1
  • 39
  • 77
(sol[[1]])["ElementMesh"] ["Coordinates"] {{0.}, {0.1}, {0.2}, {0.3}, {0.4}, {0.5}, {0.6}, {0.7}, {0.8}, {0.9}, \ {1.}, {1.1}, {1.2}, {1.3}, {1.4}, {1.5}, {1.6}, {1.7}, {1.8}, {1.9}, \ {2.}, {0.05}, {0.15}, {0.25}, {0.35}, {0.45}, {0.55}, {0.65}, {0.75}, \ {0.85}, {0.95}, {1.05}, {1.15}, {1.25}, {1.35}, {1.45}, {1.55}, \ {1.65}, {1.75}, {1.85}, {1.95}}  

EDIT

Some clarifications

The fact that the mesh order is 2 is confusing. It becomes clear (I hope) if you do the same thing with mesh order which is 1 :

w2 = 6; m = 2; T = 2.0; sol = NDSolveValue[{q'[t] == \[Zeta][t], \[Zeta]'[t] + w2*Sin[q[t]] == 0, DirichletCondition[{q[t] == Pi/3., \[Zeta][t] == 0}, t == 0]}, {q, \[Zeta]}, t \[Element] Line[{{0}, {T}}], Method -> { "FiniteElement", "MeshOptions" -> {"MeshOrder" -> 1} }]; (sol[[1]])["ElementMesh"]["MeshOrder"] (sol[[1]])["ElementMesh"]["MeshElements"] (sol[[1]])["ElementMesh"]["Coordinates"] 

1

{NDSolveFEMLineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}, {10, 11}, {11, 12}, {12, 13}, {13, 14}, {14, 15}, {15, 16}, {16, 17}, {17, 18}, {18, 19}, {19, 20}, {20, 21}}]}

{{0.}, {0.1}, {0.2}, {0.3}, {0.4}, {0.5}, {0.6}, {0.7}, {0.8}, {0.9}, {1.}, {1.1}, {1.2}, {1.3}, {1.4}, {1.5}, {1.6}, {1.7}, {1.8}, {1.9}, {2.}}

(sol[[1]])["ElementMesh"] ["Coordinates"] {{0.}, {0.1}, {0.2}, {0.3}, {0.4}, {0.5}, {0.6}, {0.7}, {0.8}, {0.9}, \ {1.}, {1.1}, {1.2}, {1.3}, {1.4}, {1.5}, {1.6}, {1.7}, {1.8}, {1.9}, \ {2.}, {0.05}, {0.15}, {0.25}, {0.35}, {0.45}, {0.55}, {0.65}, {0.75}, \ {0.85}, {0.95}, {1.05}, {1.15}, {1.25}, {1.35}, {1.45}, {1.55}, \ {1.65}, {1.75}, {1.85}, {1.95}} 
(sol[[1]])["ElementMesh"] ["Coordinates"] {{0.}, {0.1}, {0.2}, {0.3}, {0.4}, {0.5}, {0.6}, {0.7}, {0.8}, {0.9}, \ {1.}, {1.1}, {1.2}, {1.3}, {1.4}, {1.5}, {1.6}, {1.7}, {1.8}, {1.9}, \ {2.}, {0.05}, {0.15}, {0.25}, {0.35}, {0.45}, {0.55}, {0.65}, {0.75}, \ {0.85}, {0.95}, {1.05}, {1.15}, {1.25}, {1.35}, {1.45}, {1.55}, \ {1.65}, {1.75}, {1.85}, {1.95}}  

EDIT

Some clarifications

The fact that the mesh order is 2 is confusing. It becomes clear (I hope) if you do the same thing with mesh order which is 1 :

w2 = 6; m = 2; T = 2.0; sol = NDSolveValue[{q'[t] == \[Zeta][t], \[Zeta]'[t] + w2*Sin[q[t]] == 0, DirichletCondition[{q[t] == Pi/3., \[Zeta][t] == 0}, t == 0]}, {q, \[Zeta]}, t \[Element] Line[{{0}, {T}}], Method -> { "FiniteElement", "MeshOptions" -> {"MeshOrder" -> 1} }]; (sol[[1]])["ElementMesh"]["MeshOrder"] (sol[[1]])["ElementMesh"]["MeshElements"] (sol[[1]])["ElementMesh"]["Coordinates"] 

1

{NDSolveFEMLineElement[{{1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}, {10, 11}, {11, 12}, {12, 13}, {13, 14}, {14, 15}, {15, 16}, {16, 17}, {17, 18}, {18, 19}, {19, 20}, {20, 21}}]}

{{0.}, {0.1}, {0.2}, {0.3}, {0.4}, {0.5}, {0.6}, {0.7}, {0.8}, {0.9}, {1.}, {1.1}, {1.2}, {1.3}, {1.4}, {1.5}, {1.6}, {1.7}, {1.8}, {1.9}, {2.}}

Source Link
andre314
  • 19.6k
  • 1
  • 39
  • 77

sol is 2nd order mesh. You can see this with the folllowing code :

 (sol[[1]])["ElementMesh"] ["MeshOrder"] 

2

In 1D, the elements are segments of lines. Because the order is 2, there are 3 points per segments. The points indices are :

 (sol[[1]])["ElementMesh"] ["MeshElements"] 

{NDSolveFEMLineElement[{{1, 2, 22}, {2, 3, 23}, {3, 4, 24}, {4, 5, 25}, {5, 6, 26}, {6, 7, 27}, {7, 8, 28}, {8, 9, 29}, {9, 10, 30}, {10, 11, 31}, {11, 12, 32}, {12, 13, 33}, {13, 14, 34}, {14, 15, 35}, {15, 16, 36}, {16, 17, 37}, {17, 18, 38}, {18, 19, 39}, {19, 20, 40}, {20, 21, 41}}]}

The corresponding locations are :

(sol[[1]])["ElementMesh"] ["Coordinates"] {{0.}, {0.1}, {0.2}, {0.3}, {0.4}, {0.5}, {0.6}, {0.7}, {0.8}, {0.9}, \ {1.}, {1.1}, {1.2}, {1.3}, {1.4}, {1.5}, {1.6}, {1.7}, {1.8}, {1.9}, \ {2.}, {0.05}, {0.15}, {0.25}, {0.35}, {0.45}, {0.55}, {0.65}, {0.75}, \ {0.85}, {0.95}, {1.05}, {1.15}, {1.25}, {1.35}, {1.45}, {1.55}, \ {1.65}, {1.75}, {1.85}, {1.95}}