Re: [ibsimu-forum] Secondary emission off STL surfaces
Status: Beta
Brought to you by:
tvkalvas
|
From: Kalvas, T. <tan...@jy...> - 2019-04-23 13:17:07
|
Hi Scott, I know. It is irritating. There is so much potential in the triangulation that is not implemented. Geometry::surface_normal_3d() seems to be using the inside() method to probe for locations. If the geometry is produced by a load from a file the solids do not exist any more in memory. The advantage of the STL geometry is that it would be possible to implement the save. Current it seems that the save-routine of the STL just prints out "Warning: saving of STLSolid not implemented". Even though programming that would be very straightforward, I do not have the time currently. Also, notice that the surface representation in Geometry (which is based on the mesh of the simulation and is therefore much faster than the STL) is not saved either. So after doing load on a geometry you need to call build_surface(). I think the best solution would be to implement an alternative method inside Geometry::surface_normal(), which would use surface representation built by build_surface() and return the normal of the closest triangle. Half of this exists already. There is a routine Geometry::surface_triangle_normal(a), where a points to the index of the triangle. The only part missing really is finding the right triangle. Plan: 1. The user gives the coordinates to surface_normal(x). 2. Find mesh cell (i,j,k) using x. 3. Using surface_triangle_ptr(i,j,k), surface_trianglec(i,j,k) and surface_triangle(a) get access to triangle coordinates inside the cell 4. Transform the point coordinates to natural coordinates (u,v,w) of each triangle, where u and v are distance in the direction of the edges 12 and 13 and w is the distance from the plane of the triangle. 5. If u and v are normalized one can check if the point is within the triangle 0<u<1 and 0<v<1 and u+v<1. Some robustness factor added to these (1e-6). Normalize w to h and require |w|<1e-6 6. If a good triangle is found, return the normal of the triangle. I would say that is about 2 hours of programming, corrected by factor of pi, giving 6.3 hours. I might have some time tonight. When do you need it? Taneli -- Taneli Kalvas Ph.D., Senior researcher Department of Physics, room FL114 P.O. Box 35 (YFL) 40014 University of Jyväskylä, Finland Mobile: +358-44-314-1602 Fax: +358-14-617-411 Email: tan...@jy... ________________________________________ From: Scott Lawrie - UKRI STFC <sco...@st...> Sent: Tuesday, April 23, 2019 2:28:15 PM To: ibs...@li... Subject: [ibsimu-forum] Secondary emission off STL surfaces Dear Taneli, For years I have been using simple Boolean-defined solid geometries and using your excellent secondary electron emission code example. Part of that code calculates the surface normal at the particle collision location. I have now decided to bite the bullet and use STL imports and the ‘save/load geometry’ example, including set_surface_collision(true). The problem with STLs is that they are only surfaces, so there are no ‘solids’ really, meaning geom.surface_normal(loc) doesn’t work. Please can you let me know how to modify the secondary emission code to work for STL geometries? Thanks a lot, Scott. |