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

Create an script for a Local Application of OpenFOAM

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 2 Post By Bernhard
  • 1 Post By naval

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 5, 2013, 00:11
Default Create an script for a Local Application of OpenFOAM
  #1
New Member
 
Tom
Join Date: Jun 2013
Posts: 26
Rep Power: 13
RTom is on a distinguished road
Dear All,
I'm looking for how to create an script (OpenFOAM 2.2.2 local application) which can run the following applications:
blockMesh
simpleFoam
paraFoam

My goal is to create an script for any solver so I can use it in CAESES software for the case directory. CAESES just executes the executable files.

Also I was wondering if is possible to make an srcipt which can run the "blockMesh", the solver (any solver) and generate or transform the results in VTK format or FLUENT format or .foam format

Any help is wellcome. Thanks!
RTom is offline   Reply With Quote

Old   November 5, 2013, 04:17
Default
  #2
Senior Member
 
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22
Bernhard is on a distinguished road
Yes, this is easy

Call your script "run"
Code:
#!/bin/bash
blockMesh
$1
foamToVTK
paraFoam
Which you can run with "run simpleFoam"

Is this what you need?
RTom and the_ichthyologist like this.
Bernhard is offline   Reply With Quote

Old   November 7, 2013, 10:54
Default
  #3
New Member
 
Ben Zeitz
Join Date: Nov 2013
Posts: 1
Rep Power: 0
BenZ is on a distinguished road
Hi Tom,

Actually you can combine different Software Connectors in CAESES to set up such a chain of tools. If you do so you wouldn't need a script.

Create a Software Connector for each tool.
Add a result file in the first Software Connector. The result file is here the output of the application, e.g. a produced mesh file.
Then add an input file for this very same file in the Software Connector of the next application in line.
Now you have to replace the file name of the input file with the following command:
computationName.getResults().getResultFileName("nameOfTheInputFile")
-> see attached image

So, what you basically do is setting the output file of the first application as input for the second application.

I guess that is what you are trying to achieve?

Cheers
Ben
Attached Images
File Type: jpg processChainInCAESES.jpg (43.4 KB, 107 views)
BenZ is offline   Reply With Quote

Old   November 11, 2013, 06:36
Default
  #4
New Member
 
Sebastian W
Join Date: Nov 2009
Location: Germany
Posts: 16
Rep Power: 17
naval is on a distinguished road
Hi RTom,

there are two nice ways of doing this:

a) a script which takes the solver as an argument (or you may use the getapplication command to extract that information from the control.dict). Use the one Bernhard gave you (except for parafoam, much of the post-processing can also be done in CAESES)

b) the way I prefer: a script that executes one of your CAESES template files, i.e. a file named Allrun. Pretty much the way it is done in the CAESES sample for the ahmed body.
Solver and specific settings can be managed from within CAESES, the executable runOpenFOAM.sh basically just runs this script.
This is not completely ready for any case, but since you can make all the changes within CAESES, it's quite efficient.

runOpenFOAM.sh
Code:
#!/bin/bash
chmod +x Allrun
./Allrun
The template file within CAESES (Allrun):
Code:
#!/bin/bash
touch case.foam
blockmesh
simpleFoam
foamToVTK
Of course you can use the solver as an argument somewhere in the process chain.


Cheers,
naval

edit:
To clarify this: runOpenFOAM can be used for any case, this should be the executable for your Local Application for all OpenFOAM projects. Only Allrun should be unique for every case. With this method you can also easily open and run the OF tutorials, since they use such an Allrun file.
RTom likes this.
naval is offline   Reply With Quote

Reply

Tags
application, caeses, local, openfoam 2.2.x, scripting


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
[Salome] Script for converting a mesh from Salome-Platform to OpenFOAM nsf OpenFOAM Meshing & Mesh Conversion 86 February 8, 2023 11:30
Transient simulation not converging skabilan OpenFOAM Running, Solving & CFD 14 December 17, 2019 00:12
dynamic Mesh is faster than MRF???? sharonyue OpenFOAM Running, Solving & CFD 14 August 26, 2013 08:47
how to create the sediment transport using openfoam hxxxmu OpenFOAM 0 April 2, 2013 23:49
fluent add additional zones for the mesh file SSL FLUENT 2 January 26, 2008 12:55


All times are GMT -4. The time now is 10:53.