4
$\begingroup$

In Mathematica 10 the following command

Interpolation[
{
 {{0.866813938823117, 0.5423450152937263}, 0.48587553881935885},
 {{0.866813938823117, 0.5560244960082968}, 0.4956037792132533},
 {{0.866813938823117, 0.5695093696476679}, 0.5077606233995668},
 {{0.866813938823117, 0.5828324787268993}, 0.5222282841083907},
 {{0.866813938823117, 0.7086926323135655}, -0.6900827945720005}, 
 {{0.866813938823117,0.7260055139929099}, -0.6262667904371532}, 
 {{0.8669471248842942, 0.5000027132582743}, 0.4737931421560489},  
 {{0.8669471248842942, 0.514074428033246}, 0.4751546829044355},
 {{0.8669471248842942, 0.528382453867242}, 0.4796086179166059}, 
 {{0.8669471248842942, 0.5423749562767681}, 0.4868076633493537},
 {{0.8669471248842942, 0.556064381988382},  0.4965418541306331}, 
 {{0.8669471248842942, 0.5695590898965045}, 0.5087063329394024}, 
 {{0.8669471248842942, 0.5828919216835621}, 0.5231833074578365}, 
 {{0.8670801777594099, 0.5000027132583846}, 0.474717889651932}, 
 {{0.8670801777594099, 0.5140838415347714}, 0.47608005822194477}, 
 {{0.8670801777594099, 0.5284021960177904},0.48053652697922294}, 
 {{0.8670801777594099, 0.5424049074613507}, 0.4877398901277563}, 
 {{0.8670801777594099, 0.556104282453453}, 0.49748003663812895}, 
 {{0.8670801777594099, 0.5696088291491808},0.5096521573924226},
 {{0.8670801777594099, 0.582951388404485}, 0.5241384552774104}, 
 {{0.8672130975816504, 0.5000027132582597}, 0.47564273335237717}}]

gives the following two error messages

Interpolation::femimq: The element mesh has insufficient quality of 0.'. A quality estimate below 0. may be caused by a wrong ordering of element incidents or self-intersecting elements.

Interpolation::fememtlq: The quality 0.' of the underlying mesh is too low. The quality needs to be larger than 0.'.

Do you know what is the reason for error? and how to correct it?

p.s. I would create "Finite element method" tag for this question, as fem at the beginning of the error is for finite element method, but I don't have enough reputation.

$\endgroup$
8
$\begingroup$

If you set the contents of your interpolation function to be the variable data={{..,..},..} (such that Interpolation[data] gives the message), you can look at the mesh generated with:

Needs["NDSolve`FEM`"]
mesh = ToElementMesh[data[[All, 1]]]

That also gives the message. Looking at

mesh["Wireframe"]

gives you an idea what is going on. You can then use

q = mesh["Quality"];
pos = Position[q, _?(# <= Min[q] &)]

to find the element with the minimal quality.

badTriangle = 
 First[Extract[ElementIncidents[mesh["MeshElements"]], pos]]
{14, 7, 21}

mesh["Coordinates"][[badTriangle]]
{{0.10838502221992624`, 0.10000054265167693`}, {0.10836839061053677`, 
  0.10000054265165487`}, {0.1084016371977063`, 0.10000054265165195`}}

Area[Triangle[mesh["Coordinates"][[badTriangle]]]]
3.910393645788995`*^-19

You see that this element does not have an area. So, the points are co-linear.

Either you fix that triangle (measurement point?) or perhaps it's possible to move the coordinates a bit? Like so:

mesh = ToElementMesh[
   data[[All, 1]] + RandomReal[{-10^-8, 10^-8}, {Length[data]}]];
if = ElementMeshInterpolation[{mesh}, data[[All, 2]]] 
|improve this answer|||||
$\endgroup$
  • $\begingroup$ ElementMeshInterpolation allows to specify InterpolationOrder -> 3, Method -> "Spline" but then if["InterpolationOrder"] returns {1, -1}. What does it mean? Interpolation order higher than 1 is still unsupported? $\endgroup$ – Alexey Popkov Nov 14 '14 at 18:07
  • $\begingroup$ @AlexeyPopkov, Method ->"Spline" and "InterpolationOrder"->XY does not do anything for ElementMeshInteroilation; it could give a message. Higher order interpolation is possible for ElementMeshInterpolation. For that you have to give a mesh where mesh["MeshOrder"] is 2. It's not generally possible to reconstruct a 2nd order mesh from a bunch of coordinates. The story is different for structured data (Interpolation) and there setting an interpolation oder works as you think it would. Hope that helps. $\endgroup$ – user21 Nov 14 '14 at 18:17
3
$\begingroup$

The data is nearly colinear, so much so that it appears to be colinear to the mesh generator. Rescale the data so that it appear to occupy a region. Let data be the argument to Interpolation in the OP's question. The values of x are too close, and some experimentation shows that scaling by 100 produces a result:

ifn[x_?NumericQ, y_?NumericQ] = 
 Interpolation[MapAt[100 # &, data, {All, 1, 1}]][x/100, y]

Interpolation::udeg: Interpolation on unstructured grids is currently only supported for InterpolationOrder->1 or InterpolationOrder->All. Order will be reduced to 1. >>

(*  InterpolatingFunction[{{86.6814, 86.7213}, {0.500003, 0.726006}}, <>][x/100, y]  *)
|improve this answer|||||
$\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.