|
[Sponsors] |
April 4, 2022, 17:52 |
Launching OpenFOAM from Matlab standlaone
|
#1 |
Member
Jairo A. Gutiérrez S
Join Date: Nov 2014
Posts: 57
Rep Power: 11 |
Hello, I have compiled a standalone Matlab executable that calls OpenFOAM commands using system (ej: system('blockMesh'). When run from Matlab (as a script) it works fine. However, as a standalone app, an error message appears in the terminal (for example for blockMesh: "error while loading shared libraries: libblockMesh.so: cannot open shared object file: No such file or directory"
I have opened a forum post in Matlab but none of the solutions posted so far worked. The link is: https://www.mathworks.com/matlabcentral/answers/1678994-system-commands-requiring-libraries-non-matlab-related-do-not-work-when-executed-from-a-standalone?s_tid=srchtitle I suppose the error is related to the libraries loaded in the .sh file used to launch the standalone file. It reads: Code:
echo --- LD_LIBRARY_PATH=.:${MCRROOT}/runtime/glnxa64 ; LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/bin/glnxa64 ; LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/sys/os/glnxa64; LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${MCRROOT}/sys/opengl/lib/glnxa64; Code:
LD_LIBRARY_PATH=$"/usr/lib/openfoam/openfoam2012/platforms/linux64GccDPInt32Opt/lib/sys-openmpi" "libmwlaunchermain.so not found". This is a Matlab library. Any ideas to launch OpenFOAM libraries along with the standalone app of Matlab? |
|
April 5, 2022, 11:00 |
|
#2 |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
Try using the wrapper script, this is one of the use cases.
For example, assuming that you have the openfoam meta-package active: Code:
$ openfoam blockMesh or... $ openfoam -- blockMesh or... $ openfoam / blockMesh or... $ openfoam - blockMesh or .. $ openfoam2112 blockMesh etc.. |
|
April 6, 2022, 19:42 |
|
#3 |
Member
Jairo A. Gutiérrez S
Join Date: Nov 2014
Posts: 57
Rep Power: 11 |
Thank you so much. I did not know what the wrapper script was. I executed the system command as "openfoam2012 blockMesh" and worked well. I suppose it should also be the case for any OpenFOAM executable.
Regards, Jairo |
|
April 7, 2022, 11:30 |
|
#4 | |
Senior Member
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,686
Rep Power: 40 |
Quote:
Yup, try with "openfoam2012 -help" and you will see that you can use it for an interactive shell session, non-interactively to run an OpenFOAM application, can even use the '-c' option and provide it with a shell command to run. If you want something without specifying a long installation path, you will also notice that there is a template as "bin/tools/openfoam.in" that you can use sed to replace the @PROJECT_DIR@ token and make your own launcher. For the precompiled packages this is what ends up under /usr/bin/openfoam or /usr/bin/openfoam2012 etc. |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] how to convert a mesh drawn in matlab to a format which can be used in OpenFOAM | jali | OpenFOAM Meshing & Mesh Conversion | 3 | July 19, 2017 20:16 |
OpenFOAM Training Beijing 22-26 Aug 2016 | cfd.direct | OpenFOAM Announcements from Other Sources | 0 | May 3, 2016 04:57 |
OpenFOAM command from inside MATLAB | sega | OpenFOAM Post-Processing | 18 | September 25, 2012 07:35 |
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 |
Modified OpenFOAM Forum Structure and New Mailing-List | pete | Site News & Announcements | 0 | June 29, 2009 05:56 |