Page 1 of 1

PointInELement

Posted: 14 Apr 2016, 19:21
by Franz Pichler
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

Re: PointInELement

Posted: 18 Apr 2016, 15:18
by raback
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

Re: PointInELement

Posted: 25 Apr 2016, 11:23
by Franz Pichler
Then i apologize for being a smartass,
best regards
Franz