# FEM Meshrefinement for 1D Interval and Elements of order 2

I would like to create a 1D mesh of the intervall (-pi/2,pi/2) for solving a DE with FEM, with more elements close to +-1 - these elements should be of order 2, since order 1 elements yield too low accuracy.

For the function ToElementMesh the option "MeshRefinementFunction" does not work in 1D, which is why I tried to first use the function Discretize region and convert the result a FEM mesh, this gives the wrong answer though:

Needs["NDSolveFEM"];
A = ImplicitRegion[True, {{x, -\[Pi]/2, \[Pi]/2}}];
f = Function[{vertices, area},
area > 0.01 (1 + 10*Abs[(Norm[Mean[vertices]] - 1)])];
B = DiscretizeRegion[A, MeshRefinementFunction -> f]

Z = ToElementMesh[B]
ElementMesh[{{-1.5708, 4.63385}}, {LineElement["<" 159 ">"]}]

The resulting mesh goes from -pi/2 to ~4.6 and not to pi/2 as it should be. Is there any way to get this to work? Thanks in advance.

• Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. Sep 29 at 13:25