|
[Sponsors] |
November 30, 2016, 04:14 |
Allrun in background
|
#1 |
New Member
Hagen
Join Date: Nov 2016
Posts: 16
Rep Power: 10 |
Hi everyone,
I have a question concerning the Allrun script in background mode. Running Allrun redirects the output to log files, but still the command window is blocked for new commands. I tried running the script in background by Code:
./Allrun & Thank you for your help. |
|
November 30, 2016, 17:41 |
|
#2 |
Member
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16 |
simplest way: edit the script Allrun, so that it uses foamJob utility.
Replace the line where the solver call appears (i.e. runApplication $yourSolverName)by: foamJob $yourSolverName in case of working in parallel you shall rather use foamJob -parallel $yourSolverName (no need to specify the number of processes, that is read automatically from system/decomposeParDict) other (less recommended) possibilities: a. stop process and send it to background manually ./Allrun & Ctrl+Z bg b. use nohup utility: nohup ./Allrun & |
|
January 9, 2017, 05:53 |
|
#3 |
New Member
Hagen
Join Date: Nov 2016
Posts: 16
Rep Power: 10 |
Thank you very much for your reply.
foamJob works, but then I get another problem when using several commands that should be executed one after another, like in the following example: Code:
foamJob snappyHexMesh foamJob simpleFoam I tried Code:
foamJob snappyHexMesh wait foamJob simpleFoam Has someone an idea on that? Thank you very much. |
|
January 9, 2017, 06:07 |
|
#4 | |
Member
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16 |
Quote:
that is because foamJob executes the process in the background, so the next command does not have yo wait for it to finish before being executed. Try out to call snappyHexMesh using "runApplication" instead of "foamJob" . |
||
January 9, 2017, 06:10 |
|
#5 |
Senior Member
Kevin van As
Join Date: Sep 2014
Location: TU Delft, The Netherlands
Posts: 252
Rep Power: 21 |
What exactly does your script look like?
If I have a prepareCase script like: Code:
##### Prepare Case ##### echo "> Preparing case." if [ ! -d "./logs" ]; then mkdir "./logs" fi [ -d 0 ] && 'rm' -rf 0 cp -r 0.org 0 # Mesh echo "----> blockMesh" blockMesh > ./logs/blockMesh.log || exit 1 # setFields echo "----> setFields" mv "0/alpha.water.org" "0/alpha.water" setFields > ./logs/setFields.log || exit 1 Code:
./prepareCase.sh & Code:
./prepareCase.sh > log & If this is not the case for you, I presume that you have inserted some background "&"s inside the script? |
|
January 9, 2017, 06:27 |
|
#6 |
New Member
Hagen
Join Date: Nov 2016
Posts: 16
Rep Power: 10 |
Thank you again for your very quick answers!
My original ./Allrun file was: Code:
#!/bin/sh cd ${0%/*} || exit 1 # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions runApplication blockMesh runApplication surfaceFeatureExtract runApplication snappyHexMesh -overwrite runApplication simpleFoam runApplication foamToVTK Code:
#!/bin/sh cd ${0%/*} || exit 1 # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions foamJob blockMesh foamJob surfaceFeatureExtract foamJob snappyHexMesh -overwrite foamJob simpleFoam foamJob foamToVTK Code:
#!/bin/sh cd ${0%/*} || exit 1 # Source tutorial run functions . $WM_PROJECT_DIR/bin/tools/RunFunctions runApplication blockMesh runApplication surfaceFeatureExtract runApplication snappyHexMesh -overwrite foamJob simpleFoam runApplication foamToVTK Cheers. |
|
January 9, 2017, 07:26 |
|
#7 |
Member
Rodrigo
Join Date: Mar 2010
Posts: 98
Rep Power: 16 |
Hi,
You original Allrun file was OK. You can just call it by using one of my previously called "less-recommended" options "a" or "b" (post #2): Personally, I would use option "a" because I don't like the logfile written by nohup. Your second version of the Allrun file is definitetly not a good idea. Short (and surely oversimplified) hint: use foamJob only for calling the solver and ensure that it is the last action in your Allrun file. There would be more possibilities of having it done, but I think there is no point on getting more into deep on this in this forum, provided the given options shall just work and have the additional advantage of being simple... Last edited by guin; January 9, 2017 at 07:29. Reason: added link to previous post |
|
January 9, 2017, 09:28 |
|
#8 |
New Member
Hagen
Join Date: Nov 2016
Posts: 16
Rep Power: 10 |
Yes, thanks guin.
Version a is exactly what I needed. |
|
November 26, 2019, 05:09 |
|
#9 | |
New Member
Arne
Join Date: Dec 2018
Posts: 19
Rep Power: 8 |
Quote:
Hello Foamers! I am currently trying to work on a local cluster via ssh. I was just wondering about the advantage of using the standard 'Allrun' script which has a header and uses 'runApplication', as compared to the script I quote from floquation? Thanks in advance. Best regards Arne Simons |
||
Tags |
allrun background |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
A few questions about Gmsh: Background Mesh and Tutorial 7 | SeanQuallen | Main CFD Forum | 2 | November 27, 2017 04:28 |
Overset: refine background mesh without resetting the mesh | JohnAB | STAR-CCM+ | 6 | May 19, 2014 14:48 |
[Gmsh] background mesh in gmsh | Nick_J | OpenFOAM Meshing & Mesh Conversion | 1 | March 20, 2013 05:20 |
Background Image in Post | ellevset | CFX | 4 | April 1, 2009 12:01 |
Change Background Color | Anindya | Siemens | 3 | February 26, 2001 12:40 |