Welcome, Guest
Username: Password: Remember me

TOPIC: TRIANGLE AREA OF AN ELEMENT

TRIANGLE AREA OF AN ELEMENT 7 years 2 months ago #27823

  • qilong
  • qilong's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 340
  • Thank you received: 33
Dear Telemac fellows,

I was looking at the code for calculating the sediment sliding.

There is part of the code giving the TRIANGLE AREA.
       DO IELEM=1,NELEM
!
          I1=IKLE(IELEM,1)
          I2=IKLE(IELEM,2)
          I3=IKLE(IELEM,3)
!
          X2=XEL(IELEM,2)
          X3=XEL(IELEM,3)
          Y2=YEL(IELEM,2)
          Y3=YEL(IELEM,3)
          Z2=ZF(I2)-ZF(I1)
          Z3=ZF(I3)-ZF(I1)
!
!         TWICE THE TRIANGLE AREA
!
          DEUXSURF=X2*Y3-X3*Y2
          ......
       ENDDO

I'm wondering is XEL(IELEM,n) arranged in certain order? As far as I know, the area is given differently by:

AREA = abs(X1*(Y2-Y3)+X2*(Y3-Y1)+X3*(Y1-Y2))/2

For example, if in an element,

X1 81082.82 Y1 352921.469
X2 81078.203 Y2 352906.344
X3 81094.32 Y3 352905.25

The area is 124.4103. But according to DEUXSURF, it's -5.7765e+06...

What's the theory behind the calculation of DEUXSURF?

Thanks!

Best regards,
Qilong
The administrator has disabled public write access.

TRIANGLE AREA OF AN ELEMENT 7 years 2 months ago #27827

  • qilong
  • qilong's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 340
  • Thank you received: 33
Dear Telemac fellows,

I was told that:

The coordinates in XEL and YEL are according to the coordinates of the element, which means that

xel(1) = 0
yel(1) =0
xel(2) = x(2)-x(1)
yel(2) = y(2)-y(1)
xel(3) = x(3)-x(1)
yel(3) = y(3)-y(1)

Now the area is indeed twice of the triangle area.

Hope this helps!
The administrator has disabled public write access.

TRIANGLE AREA OF AN ELEMENT 7 years 1 month ago #27906

  • jmhervouet
  • jmhervouet's Avatar
Dear Qilong,

Yes, in the coordinates given by elements point 1 is the origin. Note also that when you have spherical coordinates or Mercator projection the coordinates by elements have the real size, whereas X and Y may be distorted by the projection.

Wit(h best regards,

Jean-Michel Hervouet
The administrator has disabled public write access.

TRIANGLE AREA OF AN ELEMENT 7 years 1 month ago #27914

  • qilong
  • qilong's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 340
  • Thank you received: 33
Dear Jean-Michel,

Thanks for you explanation!
I'll be careful when I get into those special cases.

Best regards,
Qilong
The administrator has disabled public write access.
Moderators: Pablo, pavans

The open TELEMAC-MASCARET template for Joomla!2.5, the HTML 4 version.