## PointInELement

Clearly defined bug reports and their fixes
Franz Pichler
Posts: 196
Joined: 29 Sep 2011, 12:25
Antispam: Yes

### PointInELement

HI dear elmer community,

i think i found a bug in the pointinelement routine in the interpolation.F90

THere the distance to quadriterals (case 4) is calculated by

Code: Select all

``````      CASE(4)
sumdist = MAX( ug - 1.0, MAX( -ug -1.0, 0.0 ) )
sumdist = sumdist + MAX( vg - 1.0, MAX( -vg - 1.0, 0.0 ) )
``````
i think this should be

Code: Select all

``````      CASE(4)
sumdist = MAX( ug - 1.0, MAX( -ug , 0.0 ) )
sumdist = sumdist + MAX( vg - 1.0, MAX( -vg , 0.0 ) )
``````
An example is when the local coordinates are both negative e.g. u=-0.5 and v=-0.5, which should lead to positive distance.
then the term
max(-(-0.5)-1,0)=max(0.5-1,0)=max(-0.5,0)=0
does not give a positive distance as i think it is supposed to.
Also the other therm
max(-0.5-1,0)=max(-1.5,0)=0
does not deliver that. But i think that one should cover the case where u is bigger than 1, and so it is fine.

I think the analogous is true below for the hexagonal case (case 8(?))

best regard
Franz

raback
Posts: 3362
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

### Re: PointInELement

Hi Franz

For quads the local coordinate (u,v) are in interval [-1,1] so I think these should be ok. Point (-0.5,-0.5) is in fact within the element. For triangles the interval is [0,1] (except for p-elements to complicate things further...).

-Peter

Franz Pichler
Posts: 196
Joined: 29 Sep 2011, 12:25
Antispam: Yes

### Re: PointInELement

Then i apologize for being a smartass,
best regards
Franz