OpenFOAM command from inside MATLAB
Hello World.
I'm doing some post-processing with MATLAB and need to run the OpenFOAM 'sample' command from within MATLAB. Unfortunately the MATLAB unix command used like Code:
unix('sample -time 8'); Code:
>> [s,w]=unix('sample') |
Location of GLIC
As I have found out through the MATLAB Newsgroup this is a problem due to a wrong pointer to GLIB.
I will have to change a setting so MATLAB will not use its own GLIB, but the one needed by OpenFOAM. To do this I will have to know, where OpenFOAM's GLIB is located! Can anybody tell me, so I can set the right path? |
Hi Sebastian
I believe that you should target the following file: ~/OpenFOAM/ThirdParty/gcc-4.3.1/platforms/linux/lib/libstdc++.so.6 Best regards, Niels |
Hi
I must use Openfoam in a matlab routine. OpenFoam run correcty but when I use this matlab command, unix('simpleFoam'), I have this error message: /bin/bash: simpleFoam: command not found. Why? Thanks |
Hello
Please, could you explain how i must change the settings so MATLAB will not use its own GLIB and use ~/OpenFOAM/ThirdParty/gcc-4.3.1/platforms/linux/lib/libstdc++.so.6 Because I would like to launch OF from matlab but i obtain the following error. interDyMFoam: /MATHWORKS_R2008A/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by interDyMFoam) Best regards |
Greetings to all!
Interesting, I thought this was something that was already solved and well documented... I guess not. Well, it's somewhat easy, but a bit annoying to use: Code:
unix('export LD_LIBRARY_PATH=""; $HOME/OpenFOAM/OpenFOAM-1.7.x/bin/foamExec foamInfoExec')
Code:
unix('export LD_LIBRARY_PATH=""; . $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc; foamInfoExec') Code:
function result=goGoOpenFOAM(command) Then simply use: Code:
goGoOpenFOAM('foamInfoExec') Bruno |
Many Thanks,
With your explanations it looks like easy, but without them I had not been able to solve. It works for me, Best regards and happy new year Best regards and happy new year |
Hi,
I want to use matlab to call openfoam and its solvers. I am using openfoam17x. I have done the mentioned things in this topic but it did not help. when I just type unix('pisoFoam'). I get messages like: Quote:
Quote:
Quote:
|
Quote:
|
Quote:
I do not know where the extra / came from. I have checked the path, that should be correct. but I see that program does not search on the directory where Openfoam is installed, but it searches on other directory where normally applications are installed. |
Greetings to all!
The extra slash (usually) doesn't hurt in Linux. The main concern is "/opt/apps/openfoam/" being picked up at "bashrc: line 90". The question is how did it get there, when you called the version installed at the "$HOME" folder? It seems to me that you have more than one version of OpenFOAM installed in your system. Somehow environment variables from another OpenFOAM installation have contaminated the environment used by MATLAB. Try the other possibility I listed on the other post, the one that uses bashrc directly. It should give you the exact same error. In case you don't see the elusive dot-space, here's another way to use it: Code:
unix('export LD_LIBRARY_PATH=""; source $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc; foamInfoExec') Code:
unix('env -i HOME=~ $HOME/OpenFOAM/OpenFOAM-1.7.x/bin/foamExec foamInfoExec')
Best regards, Bruno |
Quote:
On another note, interesting that people are running foam through matlab. Why not just do it with a shell script? Is there an advantage to doing it this way? |
Quote:
I will sequentially run openfoam and hereby with matlab I will change some input values for each run. I am not familiar with shell scripting, matlab looks easier for this kind of operations for me. |
Quote:
Dear Daniele, have you solved your problem? I have the same your problem and I cannot succeed in solving it. Your sincerely, Claudio |
Greetings Claudio,
Quote:
If none of them work, then what errors occur after each possible solution? Best regards, Bruno |
I tried writing Bruno's "flame thrower" command, with the following result
Code:
unix('env -i HOME=/opt/openfoam211/bin/foamExec foamInfoExec') |
Greetings Robert,
Apparently something got lost along the way... After all of the details I wrote down, you still didn't notice the discrepancy between the command you posted and the one I wrote months ago? :confused: Mine was: Code:
unix('env -i HOME=~ $HOME/OpenFOAM/OpenFOAM-1.7.x/bin/foamExec foamInfoExec') Code:
unix('env -i HOME=/opt/openfoam211/bin/foamExec foamInfoExec') Code:
unix('env -i HOME=~ /opt/openfoam211/bin/foamExec foamInfoExec') Bruno |
Having corrected the error I am still not having success:
Code:
>> unix('env -i HOME=~ /opt/openfoam211/bin/foamExec foamInfoExec') |
Hi Robert,
I guess you didn't read post #6 ;): Quote:
As a side note: foamInfoExec use to provide the standard run-time OpenFOAM header, including version number and so on. But since OpenFOAM 2.0, it changed and it will only show the header if the proper arguments are given... Have fun! Bruno |
All times are GMT -4. The time now is 10:43. |