|
[Sponsors] |
April 27, 2009, 11:47 |
OpenFOAM command from inside MATLAB
|
#1 |
Senior Member
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20 |
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') s = 1 w = sample: /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by sample) sample: /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/gatzka/OpenFOAM/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libfiniteVolume.so) sample: /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/gatzka/OpenFOAM/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libmeshTools.so) sample: /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/gatzka/OpenFOAM/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libsampling.so) sample: /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/gatzka/OpenFOAM/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libtriSurface.so) sample: /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/gatzka/OpenFOAM/OpenFOAM-1.5.x/lib/linux64GccDPOpt/liblagrangian.so) sample: /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/gatzka/OpenFOAM/OpenFOAM-1.5.x/lib/linux64GccDPOpt/libOpenFOAM.so) sample: /usr/local/matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /home/gatzka/OpenFOAM/OpenFOAM-1.5.x/lib/linux64GccDPOpt/openmpi-1.2.6/libPstream.so)
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!" |
|
April 29, 2009, 13:31 |
Location of GLIC
|
#2 |
Senior Member
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20 |
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?
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!" |
|
April 30, 2009, 03:24 |
|
#3 |
Senior Member
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,903
Rep Power: 37 |
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 |
|
June 30, 2010, 11:55 |
|
#4 |
Senior Member
Daniele
Join Date: Feb 2010
Posts: 134
Rep Power: 16 |
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 |
|
December 29, 2010, 11:15 |
|
#5 |
Member
angel
Join Date: May 2009
Location: Spain
Posts: 46
Rep Power: 17 |
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 |
|
December 30, 2010, 11:16 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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) result=unix(['export LD_LIBRARY_PATH=""; . $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc; ' command]) Then simply use: Code:
goGoOpenFOAM('foamInfoExec') Bruno
__________________
|
|
December 30, 2010, 15:46 |
|
#7 |
Member
angel
Join Date: May 2009
Location: Spain
Posts: 46
Rep Power: 17 |
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 |
|
April 13, 2011, 12:39 |
|
#8 | |||
Member
The True
Join Date: Dec 2010
Posts: 80
Rep Power: 16 |
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:
|
||||
April 13, 2011, 12:46 |
|
#9 | |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
Quote:
__________________
Laurence R. McGlashan :: Website |
||
April 13, 2011, 13:06 |
|
#10 | |
Member
The True
Join Date: Dec 2010
Posts: 80
Rep Power: 16 |
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. |
||
April 13, 2011, 19:04 |
|
#11 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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
__________________
|
|
April 14, 2011, 05:28 |
|
#12 | |
Senior Member
Laurence R. McGlashan
Join Date: Mar 2009
Posts: 370
Rep Power: 23 |
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?
__________________
Laurence R. McGlashan :: Website |
||
April 14, 2011, 07:22 |
|
#13 |
Member
The True
Join Date: Dec 2010
Posts: 80
Rep Power: 16 |
Thank you very much Bruno . Indeed, the flame-thrower did the job .
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. |
|
October 3, 2011, 07:20 |
|
#14 | |
Member
Claudio
Join Date: Mar 2010
Posts: 57
Rep Power: 16 |
Quote:
Dear Daniele, have you solved your problem? I have the same your problem and I cannot succeed in solving it. Your sincerely, Claudio |
||
October 3, 2011, 11:59 |
|
#15 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
Greetings Claudio,
Quote:
If none of them work, then what errors occur after each possible solution? Best regards, Bruno
__________________
|
||
September 20, 2012, 15:42 |
|
#16 |
Member
Join Date: Mar 2009
Posts: 90
Rep Power: 17 |
I tried writing Bruno's "flame thrower" command, with the following result
Code:
unix('env -i HOME=/opt/openfoam211/bin/foamExec foamInfoExec') fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by fluent3DMeshToFoam) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by fluent3DMeshToFoam) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libmeshTools.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libmeshTools.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libdynamicMesh.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libdynamicMesh.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libtriSurface.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libtriSurface.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libfiniteVolume.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libfiniteVolume.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libfileFormats.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libfileFormats.so) |
|
September 22, 2012, 18:04 |
|
#17 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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? 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
__________________
|
|
September 24, 2012, 14:58 |
|
#18 |
Member
Join Date: Mar 2009
Posts: 90
Rep Power: 17 |
Having corrected the error I am still not having success:
Code:
>> unix('env -i HOME=~ /opt/openfoam211/bin/foamExec foamInfoExec') ans = 0 >> unix('fluent3DMeshToFoam') fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by fluent3DMeshToFoam) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by fluent3DMeshToFoam) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libmeshTools.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libmeshTools.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libdynamicMesh.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libdynamicMesh.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libOpenFOAM.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libtriSurface.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libtriSurface.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libfiniteVolume.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libfiniteVolume.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libfileFormats.so) fluent3DMeshToFoam: /usr/local/Matlab/sys/os/glnxa64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by /opt/openfoam211/platforms/linux64GccDPOpt/lib/libfileFormats.so) ans = 1 |
|
September 25, 2012, 08:35 |
|
#19 | |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,981
Blog Entries: 45
Rep Power: 128 |
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
__________________
|
||
Tags |
matlab, sample, unix |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Superlinear speedup in OpenFOAM 13 | msrinath80 | OpenFOAM Running, Solving & CFD | 18 | March 3, 2015 06:36 |
64bitrhel5 OF installation instructions | mirko | OpenFOAM Installation | 2 | August 12, 2008 19:07 |
Adventure of fisrst openfoam installation on Ubuntu 710 | jussi | OpenFOAM Installation | 0 | April 24, 2008 15:25 |
OpenFOAM Debian packaging current status problems and TODOs | oseen | OpenFOAM Installation | 9 | August 26, 2007 14:50 |
meshing F1 front wing | Steve | FLUENT | 0 | April 17, 2003 13:37 |