CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

surfMesh, surfaceMesh, meshedSurface?

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By HPE
  • 2 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 13, 2020, 07:43
Default surfMesh, surfaceMesh, meshedSurface?
  #1
Member
 
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 10
frobaux is on a distinguished road
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
frobaux is offline   Reply With Quote

Old   February 13, 2020, 17:32
Default
  #2
HPE
Senior Member
 
HPE's Avatar
 
Herpes Free Engineer
Join Date: Sep 2019
Location: The Home Under The Ground with the Lost Boys
Posts: 931
Rep Power: 13
HPE is on a distinguished road
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.
frobaux likes this.
HPE is offline   Reply With Quote

Old   February 14, 2020, 04:13
Default
  #3
Member
 
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 10
frobaux is on a distinguished road
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)
frobaux is offline   Reply With Quote

Old   February 23, 2020, 06:42
Default
  #4
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,714
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by frobaux View Post
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

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
granzer and frobaux like this.
olesen is offline   Reply With Quote

Old   February 24, 2020, 07:15
Default
  #5
Member
 
Fabien Robaux
Join Date: Oct 2016
Posts: 51
Rep Power: 10
frobaux is on a distinguished road
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?
frobaux is offline   Reply With Quote

Reply

Tags
meshedsurface, surface, surfacemesh, surfmesh


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM] surfMesh not support with paraview? su_junwei ParaView 1 April 6, 2010 12:08


All times are GMT -4. The time now is 03:36.