# Long running ToElementMesh with very "large" domains

This is fixed in version 10.3.

I'm trying to solve a system of PDE over a large domain.

This doesn't means I need to have a huge amount of mesh points and mesh elements to discretize the domain. Just that the domains has a big bounding box in some units, e.g. a domain like Disk[{0,0}, 10.^6].

I can obviously choose a different unit and rescale the domain, but I'll then need to change the PDE and the nice physical constants involved in the PDE and I'll lose the nice and easy interpretation of the solution.

So I prefer to keep the more "natural" units of the domain, if possible.

However I notice that ToElementMesh keeps running continuously with my domain. Indeed:

Table[Timing@ToElementMesh[Disk[{0, 0}, r]], {r, 10^Range[4]}]


{{0.125000, ElementMesh[{{-10., 10.}, {-10., 10.}}, {TriangleElement[ "<" 488 ">"]}]}, {0.343750, ElementMesh[{{-100., 100.}, {-100., 100.}}, {TriangleElement[ "<" 488 ">"]}]}, {3.046875, ElementMesh[{{-999.998, 1000.}, {-999.998, 1000.}}, {TriangleElement["<" 474 ">"]}]}, {28.593750, ElementMesh[{{-10000., 10000.}, {-10000., 10000.}}, {TriangleElement["<" 504 ">"]}]}}

So the automatically generated mesh always has about 500 TriangleElement but the running time increase a lot with the radius of the domain.

Suspecting a relationship between this behavior and an AccuracyGoal requirement, I tried to play with the undocumented AccuracyGoal option without success.

As a workaround I can for sure 1) generate a mesh in a completely manual manner or 2) generate an automatic mesh for the unitary Disk and rescale the incidents coordinates.

But, it is possible to use directly ToElementMesh to accomplish this task, maybe adding a proper option?

System: Windows 8.1 x64, Mathematica 10.0.2.0

• I get all timings between 0.1 and 0.2 seconds on your code. Maybe a system-dependent issue? I have Mathematica 10.0.1.0 on Mac OS X Yosemite. (Also your copy-pasted result seems to be missing the first timing.)
– user484
Jan 22 '15 at 18:46
• @Rahul, Thanks, Fixed. Maybe also a Mathematica version issue? Jan 22 '15 at 21:58
• I can reproduce similar timings (to OP's) on M V10.0.2, Mac OSX 10.10.1. Jan 23 '15 at 11:00
• @MichaelE2, it seems this got introduces between V10.0.1 and V10.0.2 - what changed there is that the default boundary mesh generator was switched to the continuation method but I need to check what's going on there. Jan 24 '15 at 14:10

This seems to be a problem with the "Continuation" boundary mesh generator. The "RegionPlot" generator does not have this problem:

Table[Timing@
ToElementMesh[Disk[{0, 0}, r],
"BoundaryMeshGenerator" -> "RegionPlot"], {r, 10^Range[3]}]

{{0.254000,ElementMesh[{{-10.,10.},{-10.,10.}},{TriangleElement[<518>]}]},
{0.223000,ElementMesh[{{-100.,100.},{-100.,100.}},{TriangleElement[<514>]}]},
{0.232000,ElementMesh[{{-1000.,1000.},{-1000.,1000.}},{TriangleElement[<508>]}]},
{0.323000,ElementMesh[{{-10000.,10000.},{-10000.,10000.}},{TriangleElement[<504>]}]}}


I'll file this as a bug but can not say if it is one.

• That should be x^2 + y^2 <= r^2 in your ImplicitRegion. But also, see my comment on the question.
– user484
Jan 22 '15 at 18:47
• @Rahul, thanks, very attentive and indeed my forgetting the ^2 shows the same problem. I'll need to dig in a bit more. To see what's going one. Jan 23 '15 at 9:40
• @Rahul, thanks this has been fixed by a coworker. Jan 28 '15 at 16:07