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

Automate execution of command line

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 7, 2012, 08:16
Default
  #21
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,975
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
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: 4,225
Rep Power: 51
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


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Execution problems in dsmcFOAM turanc OpenFOAM Running, Solving & CFD 3 April 10, 2017 12:58
Execution termination vidhya CFX 2 April 6, 2011 07:40
How to automate geometry, mesh and case setup using starccm+ jwillie2000 STAR-CCM+ 3 January 26, 2011 11: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 10:53


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