|
[Sponsors] |
![]() |
![]() |
#1 |
Member
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 9 ![]() |
Hello foamer,
I'm currently trying to implement an special immersed boundary method. - At a given time step a "surface mesh" is given by an external solver, with openFoam format: * point * face. - It is read and stored by a very simple class I've develloped for now, that is almost a copy of polyMesh.H, but with everything concerning cells removed. - I would like to further triangulate this surface to obtain a triSurfaceMesh_ to perform some already existing operation. Does anyone have any idea from which class I should inherit? There is a lot, like surfMesh, surfaceMesh, meshedSurface, From what I understand, MeshedSurface would be the best choice, but I do not see any IO capabilities. surfMesh does have some, but I don't see any triangulation method available. Thank you a lot for your help! Fabien |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 12 ![]() |
There are fair amount of experimental OF implementations for IBM. foam-extend has one as well. I would start to use and modify them instead of reinventing the wheel.
Apart from that, personally I have no idea on ur Qs, Im afraid. Wish u luck.
__________________
The OpenFOAM community is the biggest contributor to OpenFOAM: User guide/Wiki-1/Wiki-2/Code guide/Code Wiki/Journal Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak/Primer Governance Bugs/Features: OpenFOAM (ESI-OpenCFD-Trademark) Bugs/Features: FOAM-Extend (Wikki-FSB) Bugs: OpenFOAM.org How to create a MWE New: Forkable OpenFOAM mirror |
|
![]() |
![]() |
![]() |
![]() |
#3 |
Member
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 9 ![]() |
Well, actually, that is the idea, but most of the existing IBM I found were using:
1. A fixed IBM 2. A .str (or .ftr) file. So they have direct access to the triangulated surface. My goal is to use their function, but for that I need to convert my type of surface into a triangulated one. Currently what I found is: - I inherit from MeshedSurface. - Import my surface with MeshedSurfaceIOAllocator - Convert to triangulated - store the triangulated into triSf_ Not the best, because at the end I store twice the triangulated surface (one time as a listFace and one time as a triSurface) |
|
![]() |
![]() |
![]() |
![]() |
#4 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40 ![]() ![]() |
Quote:
As you can guess, there are far many options, not all of which are clear. First off, you should eliminate surfMesh from consideration. It is/was designed to as a registered IO object similar to a polyMesh or fvMesh, which means that it reads/writes from the OpenFOAM time directories in a native OpenFOAM format. If your mesh should be used in an untriangulated form, you then have the choice of a MeshedSurface and an UnsortedMeshedSurface. The regular MeshedSurface uses the assumption that your surface mesh has surface "regions" that are sorted - much the OpenFOAM boundaries idea (from start/size for each region). This of course also applies if you have zero or one region. The UnsortedMeshedSurface keeps an additional set of indices to track which region each face belongs to. Both MeshedSurface and UnsortedMeshedSurface are templated on a face type. If the templated face type is a triFace or labelledTri, the surfaces read will be automatically triangulated. However, even if you template on a face, you can force triangulation at a later stage with the triangulate() method. This method has two signatures. If you need to recover the faceMap to know what the original untriangulated faces where, use the method with the additional parameter. All of the triSurface, MeshedSurface, UnsortedMeshed surface format share a reasonable amount of common reading/writing routines that are run-time selectable. This is actually where you should be injecting your format. Take a look under the src/surfMesh/surfaceFormats directory. Perhaps the simplest one to look at is the obj/ code. The OBJsurfaceFormatRunTime.C includes the run-time selection, within the OBJsurfaceFormat.C you will find how the reading looks and where the decision is made to triangulate (eg, based on the faceTraits). To move this into a triSurfaceMesh will be a bit easier if you are using the openfoam.com version. There you will notice that runtime selection tables are also templated on a labelledTri, which means that these readers are automatically known to be good for a triSurface. If you are using the openfoam.org version, you will have more trouble since their triSurface reader extensions are hard-coded into triSurface. You will still be able to get the surfaces across, but will need to strip out a List of labelledTri and pass that into the triSurface constructor. Still doable, but more work and the reading will not happen automatically. Could be a good topic for a wiki entry? /mark |
||
![]() |
![]() |
![]() |
![]() |
#5 |
Member
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 9 ![]() |
Wow, Thank you a lot for your detailled answer. I have to admit that I didn't understood everything!
I've taken a look into the OBJ format. (which I already saw) it seems to be closed from my format but not exactly that. I just chose the format I currently use thinking that it would be simpler as it is the native OF format for meshes. As for my surface Mesh, I don't need it in an untriangulated form at all. It just happens that it is in such a form when reading. From what I've told in #3. , I'm not using the best way to do it for now, but it works, even if I know it's neither clean nor elegant, nor even memory efficient. I inherit my new class from the templated form of MeshedSurface on face, such that faces (untriangulated), points and zones are stored inside stored...(). The reading is done directly inside the new constructor of this class. Then I force the triangulation and save it into a triSurface member. For your last question so as for it to be a good wiki entry, I completely agree! Ps. When you talk about region, do you mean what is called in "zone" in the source code? I'm not using any and I works for now. Should I worry about that? |
|
![]() |
![]() |
![]() |
Tags |
meshedsurface, surface, surfacemesh, surfmesh |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[OpenFOAM] surfMesh not support with paraview? | su_junwei | ParaView | 1 | April 6, 2010 11:08 |