OpenFOAM not recognize custom library (decomp method)
Hi all,
I am struggling with adding a custom decomp method to OpenFOAM. This library successfully complies to a .o object, and further to a .so object. However, it does not show up as an option when using DecomposePar. Perhaps its relevant that I am using foam-extend4.1. For simplicity, I was just trying to get a new decomp method called metisDecomp2, which is just the same as metisDecomp, but I just want to show that something new can be added. So I copied the metisDecomp/ folder, renamed it to metisDecomp2/, and renamed all the files, and moved it to the $FOAM_USER_LIBBIN I crtl+F metisDecomp and replaced it with metisDecomp2 in the C and H file, to make the new class. I updated the Make/files, Make/options, and CMakeLists.txt as shown below. Make/files: Code:
metisDecomp2.C Make/options: Code:
EXE_INC = \ and the CMakeLists.txt Code:
list(APPEND SOURCES After I do all this, and put the option metis2, it says: Code:
Unknown decompositionMethod metis2 I assume that I am missing something small and simple. I have never added my own custom lib. Thanks for your time looking over my question. If you need any more clarification, please let me know. Best, Erik |
I had a look at the decomposePar.C... sources and Make files, according to that "EXE = $(FOAM_APPBIN)/decomposePar" it's meant to be an application, not a library.
The best way to start developing new things in OpenFOAM is to copy the most similar application or library, change the name compile and run it under the new name, if that works, make your changes and compile your new application or library. For applications use wmake and wclean, for libraries use wmake libso and wclean libso. Custom libraries need to be added to the control dictionary as follows: Code:
/*--------------------------------*- C++ -*----------------------------------*\ |
Quote:
It is indeed relatively simple. You have compiled a new library (libmetisDecomp2) and presumably also included the addToRunTimeSelectionTable interface in the code (otherwise none of this will work). The missing piece of the puzzle is that this library actually needs to be loaded when the application runs. You don't see this most of the time, since the library dependencies are usually defined when compiling the application (see decomposePar/Make/options). In your case, you need to specify the library loading. You can either quickly add a "libs" entry into your case controlDict, but it is usually easier just to use the '-lib' option, which is available for all OpenFOAM applications (eg, blockMesh -help-full for usage). To check that your library can actually load OK, without missing other dependencies, use the foamhasLibrary utility. |
All times are GMT -4. The time now is 12:06. |