|
[Sponsors] |
running OF on local machine with batch script / job scheduler |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
November 2, 2010, 11:14 |
running OF on local machine with batch script / job scheduler
|
#1 |
Member
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17 |
Hi,
I would like to run simpleFoam in batch mode on a local machine with 4 cores. Has anyone a simple script with I could use? (My c++ skills are very limited) Thanks in advance Best Regards, Toni |
|
November 2, 2010, 13:07 |
|
#2 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Do you want to run one case on each core? If that is the case then you can probably just use this (assuming you are in a bash environment):
Code:
#!/bin/bash CASE1=/location/of/1st/case CASE2=/location/of/2nd/case CASE3=/location/of/3rd/case CASE4=/location/of/4th/case cd $CASE1 foamJob simpleFoam cd $CASE2 foamJob simpleFoam cd $CASE3 foamJob simpleFoa cd $CASE4 foamJob simpleFoam http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html |
|
November 2, 2010, 13:13 |
|
#3 | |
Member
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17 |
Hi Marco,
thanks for your reply. Quote:
Regards, Toni |
||
November 2, 2010, 13:27 |
|
#4 |
Senior Member
Marco A. Turcios
Join Date: Mar 2009
Location: Vancouver, BC, Canada
Posts: 740
Rep Power: 28 |
Ah, then you'll need to use
1. decomposePar to split the simulation domain 2. mpirun to run the solver in parallel The dam-break tutorial shows you how to work with parallel cases. Once you figure that out, then you should have a clear idea of how to change the above script |
|
November 2, 2010, 14:05 |
|
#5 |
Member
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17 |
No,no! I know how to run a parallel case.
I need a script to start cases automatically. The script should always check if a case is running or if the cores are "occupied". If so than "wait", if not than "start another case". Hope you know what I mean. |
|
November 2, 2010, 14:39 |
|
#6 |
Member
Lars Kiewidt
Join Date: Sep 2009
Location: Germany
Posts: 54
Rep Power: 17 |
Just write a script, that executes all the OpenFOAM commands and then just write several commands divided by semicolons. The script may look like this! Take care of the paths (relative or absolute, it's your choice). The script below is for relative paths, e.g. your cases are in the OF-run folder.
Code:
/!bin/bash JOBNAME=$1 cd $JOBNAME blockMesh setFields decomposePar mpirun -np 4 simpleFoam -parallel > log.simpleFoam reconstructPar sample rm -r processor* cd .. Code:
user:~/OpenFOAM/username-1.x/run$ batchOF <JobName1>; batchOF <JobNameN>; Lars |
|
November 2, 2010, 16:58 |
OpenFoam Built-In run functions
|
#7 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
How about using OF built in run functions?
they are in Code:
$WM_PROJECT_DIR/bin/tools/RunFunctions Code:
#!/bin/sh # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions cd case1 runApplication decomposePar hostname > system/machines runParallel simpleFoam 4 system/machines runApplication reconstructPar cd .. This is assuming that you run it from above the case1 folder (or whatever case name you want), you have a correct decomposeParDict file, and there are no other files that have log.decomposePar, log.simpleFoam, or log.reconstructPar in the case folder or the run functions will detect them and not run. Each of the run functions will wait for the previous one to finish before being executed. Just copy the code to a text file, make the text file executable, and call it with ./(file name without parenthesis). Alternatively, you can use some of the handy scripts in pyFoam (http://openfoamwiki.net/index.php/Contrib_PyFoam) but that takes some time to set up. Although its really worth it in the end...or at least I like it for some. Hope this helps. Dan |
|
November 2, 2010, 17:49 |
|
#8 |
Senior Member
Philippose Rajan
Join Date: Mar 2009
Location: Germany
Posts: 552
Rep Power: 25 |
Hello,
A Good Evening to you! I would strongly suggest that you consider using a load-balancing system such as Condor or the SUN GridEngine. Even though you are talking about one local multi-core computer, a system such as Condor can help you quite a bit because you can submit multiple parallel jobs at the same time.... and the jobs go into a Queue which is automatically queried and handled by the software which runs as a service on your Linux system. Condor runs the first simulation, and once that has been completed, it automatically starts the next job in the queue, and so on. Later on in the future extending the setup to use more than one computer is trivial, because Condor is basically a "Cluster" tool, and has been designed to work with multiple systems over networks. Hope this helps. Philippose |
|
November 4, 2010, 04:47 |
|
#9 |
Member
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17 |
HAHA! Stupid me!
I know about the allrun scripts but somehow I wasn't aware of the fact that they can exactly do what I want. Thank you for the hint, Dan! I tried the following: Code:
runApplication snappyHexMesh -overwrite runApplication transformPoints -scale "(0.001 0.001 0.001)" runApplication potentialFoam -writep runApplication decomposePar -force hostname > system/machines runParallel simpleFoam 4 system/machines runApplication reconstructPar -latestTime Code:
Wrong number of arguments, expected 0 found 2 Code:
runtransformPoints() { if [ -f log.transformPoints ] then echo "transformPoints already run on $PWD: remove log file to run" else echo "transformPoints: converting mesh" transformPoints -scale "($1 $2 $3)" > log.transformPoints 2>&1 fi } runtransformPoints 0.001 0.001 0.001 Why is the transformPoints command not working in the script? I also tried ' instead of " but without success. Best Regards, Toni |
|
November 4, 2010, 10:57 |
did you try no quotation marks?
|
#10 |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Im not near a Linux computer right now...but try
Code:
runApplication transformPoints -scale (0.001 0.001 0.001) Code:
runApplication transformPoints -scale "(0.001 0.001 0.001)" Dan |
|
November 4, 2010, 11:17 |
|
#11 | |
Senior Member
Daniel P. Combest
Join Date: Mar 2009
Location: St. Louis, USA
Posts: 621
Rep Power: 0 |
Scratch that, try
Code:
vector=(0.001 0.001 0.001) runApplication transformPoints -scale $vector Dan Quote:
|
||
November 9, 2010, 05:20 |
|
#12 |
Member
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17 |
Hi Dan,
I tried what you suggested: Code:
vector=(0.001 0.001 0.001) runApplication transformPoints -scale $vector Code:
--> FOAM FATAL IO ERROR: Expected a '(' while reading VectorSpace<Form, Cmpt, nCmpt>, found on line 0 the doubleScalar 0.001 file: IStringStream.sourceFile at line 0. From function Istream::readBegin(const char*) in file db/IOstreams/IOstreams/Istream.C at line 86. Regards, Toni |
|
November 9, 2010, 10:24 |
|
#13 |
New Member
Join Date: Dec 2009
Location: UK
Posts: 2
Rep Power: 0 |
I believe the correct syntax is
Code:
transformPoints -scale '(0.001 0.001 0.001)' i.e. you need a single quotes '....' to wrap the vector |
|
November 10, 2010, 04:22 |
|
#14 |
Member
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 17 |
||
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Running icepak on a linux machine | Codemaster | FLUENT | 0 | November 20, 2008 01:50 |
How to specify the iterations of a batch job | Consol | Main CFD Forum | 0 | October 19, 2008 00:42 |
Batch job | M. Malik | Main CFD Forum | 6 | February 12, 2008 10:49 |
How to create Batch job for CFX-10 in Linux OS | siv | CFX | 2 | March 21, 2006 04:38 |
submit batch job using PBS | ali | CFX | 1 | October 27, 2005 14:11 |