Defining mesh boundaries with list of nodes #1066
Replies: 1 comment 1 reply
-
Boundary names correspond to lists of facets. One facet is two or more nodes depending on the mesh type. For this reason it is not natural to define boundaries using nodes. Perhaps you want to include a facet if each of its nodes is in the list of nodes. It is possible to do but there is not a single built in function to achieve it. You need to first find which facets correspond to your list of nodes. There is a list of facets in Mesh.facets. For MeshTri it is 2 x N matrix where N is the number of facets, each column corresponds to a single facet. To turn a list of nodes into a list of facets, you need to go through this list and find columns where both indices are in your list of nodes. Say nodelist is your list of nodes. I suggest you do temporary array with ones at the indices of your nodes: tmp = np.zeros(mesh.p.shape[1]) And then index it using Mesh.facets: np.nonzero(tmp[Mesh.facets].sum(axis=0) == 2)[0] The result should be the list of facets. (I am now on mobile phone so cannot test it.) |
Beta Was this translation helpful? Give feedback.
-
Hi @kinnala, I hope this message finds you well.
I'm trying to define certain boundary names using lists of nodes. Is it possible to do this? I have been trying to find this on the forum and on the documentation, but I couldn't.
I have a list of nodes like: list_nodes=[node_1, node_2, node_3]
And later, when defining the mesh, I would like to do similar to when we define the boundary according to some conditions, like:
Thanks in advance and wish you a good weekend.
Kind regard,
Federico
Beta Was this translation helpful? Give feedback.
All reactions