In the release notes of 1.4.1,
In the release notes of 1.4.1, there is a note about foamUser being replaced,
"foamUser and foamUtil libraries replaced by the more general dlopen method in which any libraries may be included at run-time using the optional 'libs' entry in the case controlDict, e.g. to replicate previous automatic inclusion of the foamUser and foamUtil libraries include libs ("libfoamUser.so" "libfoamUtil.so"); in controlDict."
This is a bit too cryptic for me, and unfortunately, section 3.2.6 of the 1.4.1 userGuide (dated 1 Aug 2007) has not been updated to reflect this change.
As such, does anyone have an example of how to use dlopen to link in a user library? I looked on the wiki, and no luck. A nice example of a new boundary condition, or something similar, would be cool.
Hello Eric, There are two e
There are two examples in the tutorials directory that explicitly use the dlopen mechanism in the controlDict file:
I am still exploring this part of OF 1.4.1, so I cannot help you a whole lot more than this for now.
But since we are still using the foamUser trick for loading and using our own development with OF, I guess we will have to adjust as well .. http://www.cfd-online.com/OpenFOAM_D...part/happy.gif
Hi Martin, I don't see the
I don't see the dlopen mechanism being used in either of these cases. For the simpleFoam/pitzDaily example, it looks unchanged from earlier versions. For oodles/pitzDaily, controlDict has been modified to use the probe interface of 1.4.1.
Am I missing something? I was expecting to see a "libs" entry in controlDict with options.
What happens if you add li
What happens if you add
to your controlDict?
where libXXXX.so is your library. When it loads the libraries it (dlopen) will call any static constructors. This is the mechanism used in the OpenFOAM libraries for most user settings (turbulence models, discretisation schemes etc.) so if you stick to that framework it should work.
But then this all is no different from linking in libraries during link time.
Hi Eric! For a vanilla case
For a vanilla case, the libs-mechanism shouldn't make any difference (using only stock-turbulence-models etc).
Havn't any experience with this implementation, but it seems to me, that libs obsoletes
(in earlier versions of OF, if you wanted to introduce your own boundary conditions/turbulence models/etc to a unmodified solver you had to include them all in the sources of the foamUser-library, now you can mix and match theCrazyTurbulenceModelHugoSentMe.so with myPersonalBoundaryConditionsForSinkingShips.so in earlier versions you had to include myPersonalBoundaryConditionsForSinkingShips.C and theCrazyTurbulenceModelHugoSentMe.C into the sources for foamUser.so and if they contradicted sigournysBoundaryConditionsForSinkingShips.C you were in deep trouble)
Anyway. This is mostly of interest for those who program (or use) run-time-selectable models (turbulence, boundary conditions) that are not part of the OF-distribution.
Hi Eric, Sorry, my mistake
Sorry, my mistake about the simpleFoam/pitzDaily example, you are quite right.
But in $FOAM_TUTORIALS/oodles/pitzDaily/system/controlDict, there is an entry that looks like this in the probe interface:
I would think that this is the way to dynamically load the library libsampling.so at runtime with your simulation.
Now, what would be the proper syntax for simply loading your libfoamUser_version_xyz.so library instead, I don't know yet. Maybe someone from this forum could quickly provide you with a simple example?
As a side note, I sure hope that the usage of libfoamUser.so will remain as a default mechanism for loading libraries in OpenFOAM because otherwise, we will have to modify a lot of controlDict files in our different simulations in order to plug our code back in.
Perhaps there might be a means
Perhaps there might be a means of tapping into the Debug mechanism with something like the following hand-waving:
dlLibraryTable::readDlLibrary foo(*controlDictPtr_, "libs");
|All times are GMT -4. The time now is 17:52.|