Cell selection by nodes

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
Post Reply
deandrade87
Posts: 13
Joined: Wed Sep 17, 2014 4:12 pm

Cell selection by nodes

Post by deandrade87 »

Hello,

I would like to find all the cells whose grid nodes (not the cell centre!) satisfy a geometrical criterion.

I can loop all over the nodes, and select the ones that satisfy it. Afterwards, is there an array that contains all the faces related to one node (in my case I have a hexa mesh, so I should have 12 faces touching each internal node, less for the boundary nodes), or must I loop inside nodfac and nodfbr until I find all the (in this case 12 or less) positions in those arrays?

I don't know how common my request is, but it might be comfortable to have a function similar to getcel, but with nodes. Or, it might be useful to have an option in getcel, so that the geometric criterion must be satisfied not by the cell centre, but by either one or all the nodes of the cell.

I hope you can help me!

Cheers
Yvan Fournier
Posts: 4080
Joined: Mon Feb 20, 2012 3:25 pm

Re: Cell selection by nodes

Post by Yvan Fournier »

Hello,

There is currently no such "permanent" array in Code_Saturne (there are in many cases such arrays in subsystems, such as the fvm_nodal_t mesh structure used for postprocessing output), but they are less general, in the sense that the existence and duration of these structures may depend on code options used. Similarly, the cells->faces array (reverse of faces->cells) is built temporarily for some stages, but only kept permanently for Lagrangian calculations...

So currently, the only safe solution is the one you are already using: looping on nodfac and nodfbr.

You can make the loops more elegant by marking nodes first (using an array), then marking faces
based on nodes (using another array, dropping the first one after it is completed), and finally use the face cells connectivity, but there is not much more you can do.

I'll make a note of your suggestion of adding this as an option or alternative to getcell (but not promises for now, as this would require passing additional data to getcell, and is not as trivial as it looks).

Regards,

Yvan
Jacques Fontaine
Posts: 118
Joined: Mon Feb 20, 2012 2:07 pm

Re: Cell selection by nodes

Post by Jacques Fontaine »

Hello,

Is it possible to know for what purpose you want to select nodes (and associated faces)?
Regards,
Post Reply