CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Programming & Development

Automate execution of command line

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

Reply
 
LinkBack Thread Tools Display Modes
Old   August 7, 2012, 08:16
Default
  #21
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 8,301
Blog Entries: 34
Rep Power: 84
wyldckat is just really nicewyldckat is just really nicewyldckat is just really nicewyldckat is just really nice
Greetings to all!

@samiam1000: The first line shouldn't have quotes:
Code:
#!/bin/bash
There is a major flaw in your current script: "foamJob -p" will launch and run in the background automatically, leading the rest of the script to executed immediately after foamJob is executed. A quick fix would be to run with "foamJob -s -p".

By what I can understand, it's not foamJob that needs nohup, it's the call to this script that needs this! For example, if you call this script "runcase.sh", you'll need to:
  1. The script should be something like this:
    Code:
    #!/bin/bash
    
    foamJob -s -p buoyantPimpleFoam
    
    reconstructPar
    
    cd ../1DegNew/
    
    mapFields -consistent ../1DegStartNew -sourceTime 100
    
    decomposePar
    
    buoyantPimpleDyMFoam_MS
    
    sed -i 's/1/2/' system/controlDict
    
    buoyantPimpleDyMFoam_MS
    
    sed -i 's/2/3/' system/controlDict
    
    buoyantPimpleDyMFoam_MS
    
    sed -i 's/3/4/' system/controlDict
    
    buoyantPimpleDyMFoam_MS
    
    sed -i 's/4/5/' system/controlDict
    
    buoyantPimpleDyMFoam_MS
    
    sed -i 's/5/6/' system/controlDict
  2. After you edit and save the script for the first time, make sure it is an executable script:
    Code:
    chmod a+x runcase.sh
  3. Then for running the script:
    Code:
    nohup ./runcase.sh
Last but not least, why aren't you following the examples shown in the tutorials? For example, see "incompressible/simpleFoam/turbineSiting/Allrun". The downside of this example is that it will only run in the machine where it is launched...


Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   August 7, 2012, 08:21
Default
  #22
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,914
Rep Power: 40
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by samiam1000 View Post
If I understood well, I can write a launch.sh file like this:

Code:
'#!/bin/bash'

nohup foamJob -p buoyantPimpleFoam;

reconstructPar;

cd ../1DegNew/;

mapFields -consistent ../1DegStartNew -sourceTime 100;

decomposePar;

buoyantPimpleDyMFoam_MS;

sed -i 's/1/2/' system/controlDict;

buoyantPimpleDyMFoam_MS;

sed -i 's/2/3/' system/controlDict;

buoyantPimpleDyMFoam_MS;

sed -i 's/3/4/' system/controlDict;

buoyantPimpleDyMFoam_MS;

sed -i 's/4/5/' system/controlDict;

buoyantPimpleDyMFoam_MS;

sed -i 's/5/6/' system/controlDict;
Is that correct?

Thanks a lot,
Samuele
No. I was answering the mpirun-issue. I don't use foamJob so I can't comment on your script
gschaider 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
Execution termination vidhya CFX 2 April 6, 2011 07:40
Execution problems in dsmcFOAM turanc OpenFOAM Running, Solving & CFD 2 March 10, 2011 11:04
How to automate geometry, mesh and case setup using starccm+ jwillie2000 STAR-CCM+ 3 January 26, 2011 12:13
Measuring an Execution Time - f90 su Main CFD Forum 11 July 4, 2008 07:21
Background execution on UNIX systems law FLUENT 1 January 3, 2006 11:53


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