How to Calculate Distance Function

From KratosWiki
Revision as of 11:18, 15 December 2007 by Rrossi (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The calculation of the distance of all of the points in a mesh from a set of other points constitutes a useful tool in many contexts.

The Kratos implements a "elementwise" distance calculation based on the article

Renato N. Elias, Marcos A. D. Martins, Alvaro L. G. A. Coutinho, Simple finite element-based computation of distance functions in unstructured grids , International Journal for Numerical Methods in Engineering,72,9,1095-1110,2007

The calculation needs the knowledge of the NEIGHBOUR_ELEMENTS and NEIGHBOUR_NODES and works Only for triangles and tetrahedra.


A few variables are used internally and should be initialized at the beginning of the program:


The user has to select a list of nodes FROM WHICH the distance will be computed. The possibility exists to assign a non-zero (even negative) distance to those nodes. The selection is performed by setting IS_VISITED=1 on the nodes. To make an example the python function

  def SelectVisited(nodes):
     for node in nodes:

selects as origin all of the nodes with negative abscissa and assigns a value of distance of -1.5 so that the distance starts from -1.5 and grows.

Personal tools