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

bash files: starting test simulation automatically after another test in OpenFOAM

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

Like Tree2Likes
  • 1 Post By fresty
  • 1 Post By raumpolizei

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 4, 2019, 09:13
Default bash files: starting test simulation automatically after another test in OpenFOAM
  #1
C.C
Member
 
CC
Join Date: Jun 2011
Posts: 73
Rep Power: 12
C.C is on a distinguished road
Hi all!

I want to simulate one case in OpenFOAM and after it finish and want to simulate another case but I want that it will start automatically. For example, if I have a CFD in-house code developed in fortran I can have a batch file and run a few cases since I have the .exe file. In Ansys Fluent I can create a journal file... It is possible to do something similar in OpenFOAM?

It is possible to not start the simulation manually but instead start it automatically? It would be very useful to start a new simulation automatically mainly for cases which can be finished during the night...


I have been trying with bash files and also phyton, but not successfully unitl now... The bash files that I have start all the simulations at almost the same time and not one after the previous one have finished, my bash file looks like this



#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory

# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

nameCases="case_3_15_4 case_3_15_5"


for caseName in $nameCases
do

( cd $caseName && bash simulation.sh )

done




Please anyone can help? Thank you.
BR,

CC
C.C is offline   Reply With Quote

Old   November 4, 2019, 10:52
Default
  #2
Senior Member
 
Join Date: Aug 2014
Location: UK
Posts: 213
Rep Power: 10
fresty is on a distinguished road
Have you tried the 'wait' command?

Certainly not the best solution but could you not try doing something like this in the main bash file:

Code:
filename_prefix='case_3_15_'
num=0
for num in {0..5};
        cd $filename_prefix$num/
	do 
		{solver executable commands}
		cd $main_dir
	done
...and run the pre-processing script(s)/routine bash simulation.sh separately. It may be a good idea to separate the processes.
C.C likes this.

Last edited by fresty; November 5, 2019 at 04:03.
fresty is offline   Reply With Quote

Old   November 5, 2019, 02:31
Default
  #3
Member
 
Join Date: Dec 2018
Location: Darmstadt, Germany
Posts: 87
Rep Power: 4
raumpolizei is on a distinguished road
Hey, you could separate your commands with semicolons:
Code:
cd dir;
bash executableScript;
Cheers RP
C.C likes this.
raumpolizei is offline   Reply With Quote

Old   November 5, 2019, 06:36
Default
  #4
C.C
Member
 
CC
Join Date: Jun 2011
Posts: 73
Rep Power: 12
C.C is on a distinguished road
To say the truth with some shame, I am quite new working on linux and OpenFOAM. I did not know about the 'wait' command . But now I know this good command and I can put to run batch mode simulations.
Thank you!
C.C is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
critical error during installation of openfoam Fabio88 OpenFOAM Installation 21 June 2, 2010 03:01
OF 1.6 | Ubuntu 9.10 (64bit) | GLIBCXX_3.4.11 not found piprus OpenFOAM Installation 22 February 25, 2010 13:43
Problems in compiling paraview in Suse 10.3 platform chiven OpenFOAM Installation 3 December 1, 2009 07:21
OpenFOAM15 paraFoam bug koen OpenFOAM Bugs 19 June 30, 2009 10:46
64bitrhel5 OF installation instructions mirko OpenFOAM Installation 2 August 12, 2008 18:07


All times are GMT -4. The time now is 01:33.