CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

Running O-FOAM on a server

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Linse

Reply
 
LinkBack Thread Tools Display Modes
Old   January 14, 2013, 05:59
Default Running O-FOAM on a server
  #1
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
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
samiam1000 is offline   Reply With Quote

Old   January 14, 2013, 06:19
Default
  #2
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
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.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   January 14, 2013, 06:34
Default
  #3
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
That's probably what I have missed.

I simply run sh launch.sh.

What should I do, then?
samiam1000 is offline   Reply With Quote

Old   January 14, 2013, 06:55
Default
  #4
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
See:

Run FOAM on a remote machine

keep process running
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   January 14, 2013, 06:57
Default
  #5
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Ironically, I also found an old post of yours with the question and later the answer:
Automate execution of command line
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   January 14, 2013, 07:04
Default
  #6
Senior Member
 
Samuele Z
Join Date: Oct 2009
Location: Mozzate - Co - Italy
Posts: 490
Rep Power: 9
samiam1000 is on a distinguished road
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.
samiam1000 is offline   Reply With Quote

Old   January 14, 2013, 17:36
Default
  #7
Senior Member
 
akidess's Avatar
 
Anton Kidess
Join Date: May 2009
Location: Delft, Netherlands
Posts: 919
Rep Power: 17
akidess will become famous soon enough
Code:
nohup launch.sh > out.log &
Disclaimer: This is not a great idea if you are sharing the server with others.
__________________
*On twitter @akidTwit
*Spend as much time formulating your questions as you expect people to spend on their answer.
*Help define the OpenFOAM stackexchange Q&A site: http://area51.stackexchange.com/prop...oam-technology
akidess is offline   Reply With Quote

Old   January 16, 2013, 06:09
Default
  #8
Senior Member
 
Bernhard Linseisen
Join Date: May 2010
Location: Magdeburg/Geneva
Posts: 176
Blog Entries: 1
Rep Power: 7
Linse is on a distinguished road
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. ;-)
samiam1000 likes this.
Linse is offline   Reply With Quote

Old   January 16, 2013, 09:02
Default
  #9
Senior Member
 
sail's Avatar
 
Vieri Abolaffio
Join Date: Jul 2010
Location: Always on the move.
Posts: 308
Rep Power: 7
sail is on a distinguished road
+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...
__________________
http://www.leadingedge.it/
Naval architecture and CFD consultancy
sail is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Case running in serial, but Parallel run gives error atmcfd OpenFOAM Running, Solving & CFD 10 November 24, 2013 07:35
Running Fluent on remote Unix server msth FLUENT 2 April 13, 2010 16:26
gmsh2ToFoam sarajags_89 OpenFOAM 0 November 24, 2009 23:50
Statically Compiling OpenFOAM Issues herzfeldd OpenFOAM Installation 21 January 6, 2009 10:38
CFD Online Server Load Jonas Larsson Main CFD Forum 0 March 13, 2001 15:29


All times are GMT -4. The time now is 14:47.