|
[Sponsors] |
openFoam run functions, runApplication, getApplication |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
February 22, 2015, 12:30 |
openFoam run functions, runApplication, getApplication
|
#1 |
Member
Hassan
Join Date: Oct 2012
Location: Iran
Posts: 63
Rep Power: 13 |
Hello all,
I want to use my own solver 'interPhaseChangeFoam_0' in a case by its tutorial 'Allrun' script. The script is shown below: Code:
#!/bin/sh cd ${0%/*} || exit 1 # run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions # copy bullet surface from resources folder cp $FOAM_TUTORIALS/resources/geometry/bullet.stl.gz constant/triSurface/ # Generate the base block mesh runApplication blockMesh # Generate the snappy mesh runApplication snappyHexMesh -overwrite # Run the solver runApplication `getApplication` But after this, the script can,t access to my own solver then can not run. How can I configure this script or file system/controlDict to right accessing the new solver by keeping its original key words 'runApplication' and 'getApplication'? Best regards, Hassan |
|
February 22, 2015, 13:00 |
|
#2 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Greetings Hassan,
No, no, no... don't call your solver that! For better or for worse, the shell function "getApplication" was not designed to allow names with numbers and characters in them. It was designed with the naming convention used by the solvers and utilities in OpenFOAM, namely to use normal names, like "simpleFoam" and "rhoPimpleFoam" (I know, not very normal, but spaces are prohibited in C/C++ names for variables). This to say that you should name your solver something like "interPhaseChangeFoamZero". Best regards, Bruno
__________________
|
|
February 22, 2015, 13:42 |
|
#3 |
Member
Hassan
Join Date: Oct 2012
Location: Iran
Posts: 63
Rep Power: 13 |
Hi
Thanks Bruno for your clear answer. Now, how can I discover openfoam conventions like this? |
|
February 22, 2015, 14:22 |
|
#4 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
A bit by trial an error, as well as getting a feeling by how the OpenFOAM source code is... uhm... coded.
Then there's this page: http://www.openfoam.org/contrib/code-style.php You can get there through this link path: ------ edit: The updated links are:
Last edited by wyldckat; April 16, 2018 at 19:34. Reason: see "edit:" |
|
October 19, 2015, 02:46 |
|
#5 |
Member
Join Date: Jul 2014
Posts: 39
Rep Power: 11 |
Hi Bruno
Thank you for your answer. Is there a way to obtain the 0 (zero) that the solver returns when it is done executing? For example (in the shell script): Code:
#!/bin/sh cd ${0%/*} || exit 1 # run from this directory # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions application=`getApplication` runApplication blockMesh runApplication setFields result = runApplication $application echo $result # ----------------------------------------------------------------- end-of-file Kind regards |
|
October 22, 2015, 17:29 |
|
#6 |
Retired Super Moderator
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,974
Blog Entries: 45
Rep Power: 128 |
Quick answer: Google:
Code:
bash script get error code Try this: Code:
runApplication $application result=$? echo $result |
|
October 22, 2015, 17:49 |
|
#7 |
Member
Join Date: Jul 2014
Posts: 39
Rep Power: 11 |
Hi Bruno
Thank you for your amswer. I found that solution this morning. Did not xpect it to be that simple. Will defintely improve my Google before I post a question. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Frequently Asked Questions about Installing OpenFOAM | wyldckat | OpenFOAM Installation | 3 | November 14, 2023 12:58 |
How to run OpenFoam using openMP. | bravikanth | OpenFOAM Running, Solving & CFD | 12 | June 20, 2016 11:11 |
Suggestion for a new sub-forum at OpenFOAM's Forum | wyldckat | Site Help, Feedback & Discussions | 20 | October 28, 2014 10:04 |
Unable to run a case with OpenFOAM 1.6-ext that works with OpenFOAM 2.3.0 | Jiricbeng | OpenFOAM Running, Solving & CFD | 15 | May 21, 2014 04:52 |
New OpenFOAM Forum Structure | jola | OpenFOAM | 2 | October 19, 2011 07:55 |