|
[Sponsors] |
August 18, 2020, 23:46 |
How to automatically run computations?
|
#1 |
New Member
Harry Kim
Join Date: Sep 2015
Posts: 6
Rep Power: 10 |
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. Thanks! |
|
August 19, 2020, 05:43 |
|
#2 |
Senior Member
bigfoot
Join Date: Dec 2011
Location: Netherlands
Posts: 504
Rep Power: 17 |
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. Code:
# 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: tmpfile=open(tmpfilename,'w') for line in f: if line.strip().startswith('MACH_NUMBER'): line = "MACH_NUMBER = " + str(m) + "\n" #print(line) tmpfile.write(line) f.close() tmpfile.close() # copy the tmp file to the original file shutil.copy(tmpfilename,configfilename) # ### END ### # the new config file has been created. now we can start su2 # communicate waits until job is completed subprocess.Popen(["mpirun","-n","8","SU2_CFD","config.cfg"]).communicate() |
|
April 6, 2021, 22:57 |
|
#3 |
New Member
Harry Kim
Join Date: Sep 2015
Posts: 6
Rep Power: 10 |
That was really helpful! Thank you so much!
|
|
|
|
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 |