Need a help

General discussion about Elmer
Post Reply
MaxP
Posts: 1
Joined: 10 Sep 2019, 14:01
Antispam: Yes

Need a help

Post by MaxP »

Hi!

I would like to ask if there is already a function which one can get all the indices of elements sharing a same node with node index provided?
Or, if there is a function to find all the nodes which are connected to a certain node?

Thanks.
mzenker
Posts: 1999
Joined: 07 Dec 2009, 11:49
Location: Germany

Re: Need a help

Post by mzenker »

Hi,

in ElmerI don't know such a function which can be called from the sif or from the command line. You might write a user defined function which does this. You would have to study the solver and programmer's manuals and probably dig into the Elmersolver code to figure out how to get the indices you want.
If it hasn't to be in Elmer, you might find this functionality in gmsh API and/or a ParaView filter.

HTH,
Matthias
raback
Site Admin
Posts: 4812
Joined: 22 Aug 2009, 11:57
Antispam: Yes
Location: Espoo, Finland
Contact:

Re: Need a help

Post by raback »

Hi

Connectivity of nodes is actually available in the sparse matrix graph. Hence if you have scalar fields in the code you can do

Code: Select all

  TYPE(Matrix_t), POINTER :: A
  INTEGER :: i,j,k  
  A => Solver % Matrix
  
  DO i=1,A % NumberOfRows
     DO j=A % Rows(i),A % Rows(i+1)-1
        k = A % Cols(j))
        print *,'nodes are connected:',i,k
     END DO
  END DO
Note that this assumes that you don't do reordering of nodes. Hence "Optimize Bandwidth = False" should be used if you a looking for nodal connections.

Initially a connectivity matrix is usually created by using ListMatrix type and going through each element and adding all connections to the matrix. For efficiency the ListMatrix is then transformed thereafter to CRS matrix which you see above. If you have a very special need of your own using the ListMatrix may sometimes be easiest. For example, creating projection matrix between two meshes takes use of the ListMatrix to create the connectivity graph.

There is also code to create DualGraph i.e. the connectivity of elements. This is not needed that often.

-Peter
Post Reply