Hi everybody,
I am working on a solver that loops on an unstructured mesh, and I've got a couple of coordinates for a given point (x, y) (2 dimensions). I need to find the position corresponding to this given x-value on one given boundary.
I was wondering if there is any function or routines allowing the user to find all the nodes ore element that belong to a given boundary ?
Thank you
Jean
Find the nodes that belong to a BC
Re: Find the nodes that belong to a BC
Hi Jean,
Just a suggestion: if your mesh file is in the Elmer format (mesh.header, mesh.nodes, mesh.boundary, mesh.elements) just take a look at the mesh.boundary files and to the reference in the ElmerSolver Manual appendix A. If you are familiar with any programming language, you will find easy to write your own routine to extract the nodes or the coordinates.
Regards,
Cesar
Just a suggestion: if your mesh file is in the Elmer format (mesh.header, mesh.nodes, mesh.boundary, mesh.elements) just take a look at the mesh.boundary files and to the reference in the ElmerSolver Manual appendix A. If you are familiar with any programming language, you will find easy to write your own routine to extract the nodes or the coordinates.
Regards,
Cesar
-
- Site Admin
- Posts: 4825
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: Find the nodes that belong to a BC
Hi Jean
Well, if you have just some nodes you can perhaps do a dummy search in the style of
If you need to go through just some elements you could use the MakePermUsingMask subroutine to create a permutation vector for the candidate nodes and then loop only over them.
If you you need to map a large number of nodes then there are better algorithms. For example the InterpolateMeshToMesh uses some octtree data structures to find the target element for each node.
-Peter
Well, if you have just some nodes you can perhaps do a dummy search in the style of
Code: Select all
MinDist = HUGE(MinDist)
DO i=1,Model % NumberOfNodes
x = Mesh % Nodes % x(i)
y = Mesh % Nodes % y(i)
Dist = (x-Point(1))**2 + (y-Point(2))**2
IF(Dist < MinDist) THEN
MinDist = Dist
NodeIndex = i
END IF
END DO
If you you need to map a large number of nodes then there are better algorithms. For example the InterpolateMeshToMesh uses some octtree data structures to find the target element for each node.
-Peter
Re: Find the nodes that belong to a BC
Thank you both for your solutions. Now it works.
I finally combined a loop on each boundary element and the code given by Peter. I will probably spend more time on the MakePermUsingMask subroutine, but first I am looking in the source files to see how this subroutine is used...
By the way, thank you !
I finally combined a loop on each boundary element and the code given by Peter. I will probably spend more time on the MakePermUsingMask subroutine, but first I am looking in the source files to see how this subroutine is used...
By the way, thank you !