CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Running O-FOAM on a server (https://www.cfd-online.com/Forums/openfoam-solving/111722-running-o-foam-server.html)

samiam1000 January 14, 2013 04:59

Running O-FOAM on a server
 
Dear All,

I am running O-FOAM on a server and I need to launch a series of commands. Hence I created a file called launch.sh which should have allowed me to run all the commands. The file looks like this:

Code:

#!/bin/bash
te about the ad-hoc solver and workaround

cd 55Deg/
mapFields  -consistent -sourceTime 2 ../60Deg/
buoyantPimpleFoam

cd ../50Deg
mapFields  -consistent -sourceTime 0.08 ../55Deg/
buoyantPimpleFoam

cd ../45Deg
mapFields  -consistent -sourceTime 0.08 ../50Deg/
buoyantPimpleFoam

cd ../40Deg
mapFields  -consistent -sourceTime 0.08 ../45Deg/
buoyantPimpleFoam

cd ../35Deg
mapFields  -consistent -sourceTime 0.08 ../40Deg/
buoyantPimpleFoam

cd ../30Deg
mapFields  -consistent -sourceTime 0.08 ../35Deg/
buoyantPimpleFoam

cd 25Deg
mapFields  -consistent -sourceTime 0.08 ../30Deg/
buoyantPimpleFoam

cd ../20Deg
mapFields  -consistent -sourceTime 0.08 ../25Deg/
buoyantPimpleFoam

cd ../15Deg
mapFields  -consistent -sourceTime 0.08 ../20Deg/
buoyantPimpleFoam

cd ../10Deg
mapFields  -consistent -sourceTime 0.08 ../15Deg/
buoyantPimpleFoam

cd ../5Deg
mapFields  -consistent -sourceTime 0.08 ../10Deg/
buoyantPimpleFoam

cd ../0Deg
mapFields  -consistent -sourceTime 0.08 ../5Deg/
buoyantPimpleFoam

The point is that - after the weekend - I discovered the the simulation stopped after these lines:

Code:

cd 55Deg/
mapFields  -consistent -sourceTime 2 ../60Deg/
buoyantPimpleFoam

Why this happened? I am not sure if this happened either because I have switched my laptop off (but I thought that the launch.sh file would have run in background. Am I wrong?) or because I write cd ../50Deg instead of cd 50Deg since the launch.sh is in the directory case which contains all the other folders (e.g.50Deg, 45Deg and so on..), at the same level of 55Deg folder.

Thanks for help,

Samuele

akidess January 14, 2013 05:19

How did you run the script? If you didn't explicitly set it to run in the background without hang-up, it will terminate when you disconnect.

samiam1000 January 14, 2013 05:34

That's probably what I have missed.

I simply run sh launch.sh.

What should I do, then?

akidess January 14, 2013 05:55

See:

http://www.cfd-online.com/Forums/ope...e-machine.html

http://www.cfd-online.com/Forums/mai...s-running.html

akidess January 14, 2013 05:57

Ironically, I also found an old post of yours with the question and later the answer:
http://www.cfd-online.com/Forums/ope...tml#post375590

samiam1000 January 14, 2013 06:04

Yeah, you're right.

But that thread didn't offer me the solution. I can't und what I am missing.

Probabily it's better to start from the / folder, when I give the cd command in the launch.sh file.

akidess January 14, 2013 16:36

Code:

nohup launch.sh > out.log &
Disclaimer: This is not a great idea if you are sharing the server with others.

Linse January 16, 2013 05:09

You could try running via the "screen" command. If you are on the server, just execute "screen". This will open a new session on the server. After starting the job, you can "detach" the screen with a command to be looked up ;-) and afterwards reattach via "screen -r".

After having detached from the screen you can logout from the server without shutting down that run. When returning to the server, reattach as described.

Important: If the server has several nodes, most probably you will have to login to the same node again for "screen -r" to work properly! So note down the server number (and the screen number) before leaving for the night/lunch/coffee/etc. ;-)

sail January 16, 2013 08:02

+1 to screen.

Or you can set up a scheduler like SGE and launch different jobs, one for each case.

this will avoid the need to create a custom script every time and will automatically set lauch the job when the previous one is completed.

but on a single machine i'm not shure how much it is worth the hassle, it is usually used on clusers...


All times are GMT -4. The time now is 11:24.