CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > SU2

How to automatically run computations?

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

Like Tree2Likes
  • 2 Post By bigfootedrockmidget

LinkBack Thread Tools Search this Thread Display Modes
Old   August 18, 2020, 23:46
Smile How to automatically run computations?
New Member
Harry Kim
Join Date: Sep 2015
Posts: 6
Rep Power: 10
hkim716 is on a distinguished road
I'm a new to this SU2 world.

I would like to run and get several results on Onera M6 wing.
I have successfully run a single simulation for a default condition from the Tutorial, but now I would like to get a lot of results automatically, let say, for two-hundred different conditions. e.g. Re = 1.5m, AoA = range (-8,8,1), Mach = range(0.7, 1.8, 0.1)

1. In this case, is it a sequential run or a parallel run?
2. Do I need to install MPI version of SU2?
3. How can I get these results automatically? (Is there a way to use a python script for that?)

FYI, I am trying to use Linux system for SU2 and Paraview.

Please help me if you have any experience.
hkim716 is offline   Reply With Quote

Old   August 19, 2020, 05:43
Senior Member
Join Date: Dec 2011
Location: Netherlands
Posts: 496
Rep Power: 17
bigfootedrockmidget is on a distinguished road
If you haven't compiled su2 for mpi, I highly recommend you do this. On most linux systems everything you need is already there or can be easily installed from your preferred package manager. You can then do what you describe either in parallel or sequentially, depending on the number of available cores that you have on your computer (I assume you run su2 on a local pc that has a certain number of cores).

Say you have 16 cores available and you want to run a single job on 16 cores. Then this single job is a parallel job, and you want the sequence of jobs over e.g. Mach number to be a sequential run. This is the easiest for local runs on a single pc in my opinion.

Since you talked about python, I have made a small example python script for you below. It loops over a list of mach numbers and modifies the config file. It then starts su2 using mpirun.
Hope this helps...
By the way, 200 runs is a lot. If you are interested in one result, e.g. lift as function of Mach, then you can for instance inspect the lift after each run and depending on its change, use larger steps in Mach number when the change is small to save time.

# python code that loops over a list of Mach numbers, 
# modifies the config file and runs su2
import shutil
import os
import subprocess

configfilename = "config.cfg"
tmpfilename = "tmpfile.txt"

Mach=[0.7, 0.8, 0.9]

for m in Mach:
        print("Current Mach number = ",m)
        # ### change the mach number in the config file ###  
        with open(configfilename,mode='r') as f:
          for line in f:
             if line.strip().startswith('MACH_NUMBER'):
               line = "MACH_NUMBER = " + str(m) + "\n"
        # copy the tmp file to the original file
        # ### END ### 

        # the new config file has been created. now we can start su2
        # communicate waits until job is completed   

sangeet and TKatt like this.
bigfootedrockmidget is online now   Reply With Quote

Old   April 6, 2021, 22:57
New Member
Harry Kim
Join Date: Sep 2015
Posts: 6
Rep Power: 10
hkim716 is on a distinguished road
That was really helpful! Thank you so much!
hkim716 is offline   Reply With Quote


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
Automatically starting a run Dora STAR-CCM+ 24 October 27, 2023 18:53
Problem with foam-extend 4.0 ggi parallel run Metikurke OpenFOAM Running, Solving & CFD 1 December 6, 2018 15:51
Automatically switched to run in parallel -t1 mode MsRuby Fluent UDF and Scheme Programming 6 June 16, 2018 06:37
how to automatically run multiple cases in batch mode breezeyu STAR-CCM+ 1 June 11, 2018 06:45
[mesh manipulation] Cannot get refineMesh to run in parallel smschnob OpenFOAM Meshing & Mesh Conversion 2 June 3, 2014 11:20

All times are GMT -4. The time now is 13:35.