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

Saving a large OpenFOAM object

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 4, 2021, 04:26
Default Saving a large OpenFOAM object
  #1
Member
 
David GISEN
Join Date: Jul 2009
Location: Germany
Posts: 68
Rep Power: 17
David* is on a distinguished road
Dear FOAMers,

I use an object of type Foam::meshSearch [1] to perform many (efficient) searches on a constant mesh in my program. However, it is based on an indexed octree, which takes some minutes to create for my mesh. Tree generation is currently performed on every start of my program, which wastes a lot of time. I need to modify and recompile my program quite often (doing research). I'm looking for a way to save time. My ideas are

1. Save and load the meshSearch object from disk:
- Use a serialization library like cereal [2] or boost::serialization [3]
- Use OpenFOAM ITstream [4]

However, serialization or writing seems to require a suitable new method in EVERY class/for EVERY non-standard type used to construct the meshSearch object, which are a lot (e.g. indexedOctree, treeDataFace, treeDataCell, treeBoundBox, diverse enums...). Most of them have private access to their data members, so I would have to create a complete redundant structure of C++ files in order to access them and build my own "meshSearchSerializable" object.

2. Create and access in memory:
- A server/client concept with shared memory using boost.interprocess [5]
The "server" would create the meshSearch object and continue to run, while the "client" (my program") would access it in shared memory. Could there be a bottleneck when like 100 instances of my program try to access the shared memory at once?

Could somebody comment on whether these approaches make sense or if there is an easier way, e.g. using other existing OF functions?

Thanks a lot,
David

---
[1] https://cpp.openfoam.org/v4/classFoa...eshSearch.html (I'm currently using OF4.1, but there is basically no change in this class towards OF9 or v2012)
[2] https://uscilab.github.io/cereal/
[3] https://www.boost.org/doc/libs/1_76_...doc/index.html
[4] https://l-infinity.de/posts/openfoam-oop-library/
[5] https://www.boost.org/doc/libs/1_77_...rprocess.intro
David* is offline   Reply With Quote

Old   November 4, 2021, 05:32
Default
  #2
Member
 
s1291's Avatar
 
Join Date: Aug 2017
Location: Algeria
Posts: 98
Rep Power: 9
s1291 is on a distinguished road
Hello,
Have you considered using PCL (Point Cloud Library)? or more specifically, pcl_octree module which has also functions for serialization and deserialization to encode the octree structure into a binary format [1].

References:

[1]: https://pointclouds.org/documentatio...p__octree.html

Last edited by s1291; November 4, 2021 at 05:34. Reason: edit to fix a typo
s1291 is offline   Reply With Quote

Old   November 8, 2021, 05:22
Default
  #3
Member
 
David GISEN
Join Date: Jul 2009
Location: Germany
Posts: 68
Rep Power: 17
David* is on a distinguished road
This is interesting. However, if I understand correctly, it would solve my problem of storing an indexed octree, but would require some form of conversion of my OpenFOAM mesh to a point cloud. This seems to be more effort than my ideas because I also need the mesh to access field variables and interpolate them. Other opinions?



Thanks,
David
David* is offline   Reply With Quote

Reply


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
Map of the OpenFOAM Forum - Understanding where to post your questions! wyldckat OpenFOAM 10 September 2, 2021 05:29
OpenFOAM Training Jan-Apr 2017, Virtual, London, Houston, Berlin cfd.direct OpenFOAM Announcements from Other Sources 0 September 21, 2016 11:50
OpenFOAM Training, London, Chicago, Munich, Houston 2016-2017 cfd.direct OpenFOAM Announcements from Other Sources 0 September 14, 2016 03:19
[foam-extend.org] Error compiling OpenFOAM-1.6-ext Canesin OpenFOAM Installation 137 January 20, 2016 14:56
Cross-compiling OpenFOAM 1.7.0 on Linux for Windows 32 and 64bits with Mingw-w64 wyldckat OpenFOAM Announcements from Other Sources 3 September 8, 2010 06:25


All times are GMT -4. The time now is 01:45.