|
[Sponsors] |
December 4, 2013, 21:06 |
Call foam solver from qt
|
#1 |
Member
Fatih Ertinaz
Join Date: Feb 2011
Location: Istanbul
Posts: 64
Rep Power: 15 |
Hi all. This is not directly a problem related with openfoam programming but might still be interesting for OF developers.
I am trying to develop a gui using qt that runs openfoam behind. tried to call simpleFoam using qprocess: Code:
solverProcess = new QProcess(this); solverBin = "/OF_APPBIN/simpleFoam"; testDir = "/fullPathTestDir"; args << "-case" << testDir; solverProcess->start(solverBin, args); if (solverProcess->waitForStarted()) // done simpleFoam: error while loading shared libraries: libincompressibleRASModels.so: cannot open shared object file: No such file or directory There is nothing wrong with the full path of the solver and test directory. I printed their values and could run manually on a terminal without any problems. The test case is pitzDaily. I am using (still) OF 1.6.x on an Ubuntu machine. Any help is appreciated. |
|
December 11, 2013, 17:06 |
|
#3 |
Member
Fatih Ertinaz
Join Date: Feb 2011
Location: Istanbul
Posts: 64
Rep Power: 15 |
I checked the links above. not much new to me, but they're quite useful. thanks.
I moved the installation of Openfoam from my home directory to /opt and changed the code a little bit. It seems to work now. However I don't want to do it this way. Here is the new code snippet: Code:
solverProcess->setStandardOutputFile("/myTestDir/test.out", QIODevice::Append); solverProcess->start("/bin/sh", QStringList() << "/myTestDir/test.sh"); if (solverProcess->waitForStarted()) { if (m_SolverProcess->state() == QProcess::Running) { QMessageBox::information(NULL, "runSolver", "Done"); } } Code:
#!/bin/bash echo "some messages" source openfoam echo "Check isSourced successfully: " echo $WM_PROJECT_DIR /FOAM_APPBIN/simpleFoam -case /myTestDir > /myTestDir/log However if I try to call simpleFoam directly using qprocess as in the very first post, I get the following err msg: Code:
qDebug() << "STDERR: " << m_SolverProcess->readAllStandardError(); STDERR: /FOAM_APPBIN/simpleFoam: error while loading shared libraries: libincompressibleTurbulenceModel.so: cannot open shared object file: No such file or directory Code:
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert("PATH", env.value("Path")+openfoamPath+"/platforms/"+openfoamArch+"/bin/"); solverProcess->setProcessEnvironment(env); solverProcess->start("simpleFoam -case /fullPathTestDir/"); Any ideas are very welcome. Note: OpenFoam is sourced by default in .bashrc |
|
December 12, 2013, 11:23 |
|
#4 |
New Member
Join Date: Nov 2013
Posts: 20
Rep Power: 12 |
Hey fertinaz,
can t help you with your specific problem, but do you know about PyFoam? Let s you handle Foaming in a Python environment. I used that to write a simple GUI (with wx, but you can just as well use qt) and some control/analysis functions. Works really nicely. |
|
December 15, 2013, 09:36 |
|
#5 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128 |
Greetings to all!
@Fatih: on Linux/POSIX systems, usually it's case-sensitive, where "PATH" and "Path" are not the thing. In addition, there are several environment variables that are modified and added when the OpenFOAM environment is sourced into the shell environment. Try this:
Bruno
__________________
|
|
June 15, 2018, 09:02 |
|
#6 |
New Member
JSousa
Join Date: Jun 2018
Posts: 2
Rep Power: 0 |
Hello,
Did you managed to solve that problem? I'm also facing the same type of problem. I want to run a solver through a pushbutton on qt and it doen's start. If I type the command on the commandline it works perfectly. Don't know how to solve this... If you managed to solve this please let me know how... regards, Jsousa |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
FEM solver in FOAM | Hrvoje Jasak (Hjasak) | OpenFOAM | 2 | March 31, 2013 12:52 |
Divergence problem | Smaras | FLUENT | 13 | February 21, 2013 05:03 |
[Other] cgnsToFoam problems with "QUAD_4" cells | lentschi | OpenFOAM Meshing & Mesh Conversion | 1 | March 9, 2011 04:49 |
Working directory via command line | Luiz | CFX | 4 | March 6, 2011 20:02 |
[Gmsh] Import problem | ARC | OpenFOAM Meshing & Mesh Conversion | 0 | February 27, 2010 10:56 |