Quickstart
The 2D polar generator is defined within a python class, and can be instantiated by:
aero = e2dpolar()
Most grid, run parameters etc have reasonable default values and should work for your 2D polar, however you have great flexibility to change the settings. These all are defined as class attributes. Have a look at the full list here e2dpolar class.
In general you only need to specify very few things if you want a quick result:
Airfoil coordinates:
aero.pf_coords = np.loadtxt('naca63-418.dat')Reynolds number:
aero.Re = 5e6Boundary layer flow case:
aero.case = 'tu'Angles-of-attack:
aero.aoas = np.array([2.0, 5.25])
You could also choose which queue to use (depends on cluster):
aero.queue = 'windq'
Remember that this module may generate a considerable amount of simulations that will be queued to the specified cluster. Keep a track of the launched simulations, and try to respect other users. So don’t go crazy on those parametric sweeps.
Well that’s it, fire!
aero.run_all()
To get more familiar with all the different methods have a look at the example
my_first_polar.py
. This code will run you through a common polar generation
and will generate all the common output files. So try it out and have a look at
all the different PDFs, directories and other output files you will get to familiarize
yourself with the code. The code in the end wraps a lot of different tools together
and also keeps all intermediate files generated by those tools, so you can always
run your own tools as well and modify input files etc and rerun single operations in
the workflow chain.
Basic methods
update()
Use to update the run directory <obj>.run_dir
make_surface_mesh(rerun=True)
Make surface mesh with PGL inside folder sfgrid/, specify if you want to rerun the generation.
make_volume_mesh(rerun=True)
Make volume mesh with hypgrid inside folder grid/, specify if you want to rerun the generation.
run_polar(group_sims=True, dry_run=False, rerun=True)
Creates the folder for the run Re<Re>_<case>/ and inside launches the CFD simulations. It bundles all AoAs into a single job unless
group_sims=False
and creates folders for each a<AoA>/. You can also only create the input files and run folders to check whether all is setup correctly by settingdry_run=True
. Old simulations are deleted and rerun if you do not specifyrerun=False
.ext_polar(plot=True)
Extracts Cl etc and places them in Re<Re>_<case>/grid-<grid-level>.clcd. Furthermore the polar is plotted as Re<Re>_<case>/polars_gl<grid_level>.pdf, the profile data (Cf and Cp) in Re<Re>_<case>/profiles_gl<grid_level>.pdf and the transition position (if it is transitional) in Re<Re>_<case>/trans_gl<grid_level>.pdf. All data used in the plots is also saved in Re<Re>_<case>/polar.pkl. Refer to the detailed description of the method for what and how it is stored. Data is also stored in the object itself in
self.polar
.ext_flowfield(AoA)
Directly extract CFD flowfield variables from the restart files of the specified angle-of-attack. The variables to be extracted are plotted as Re<Re>_<case>/a<AoA>/ff_<variable>_gl<grid_level>_aoa<AoA>.pdf. Each variable is stored as numpy array inside the dictionary
self.flowfield
. The size of each array is (grid_ni, grid_nj). Data is also outputted as Re<Re>_<case>/a<AoA>/flowfield.pkl.ext_bl(xq)
Extract boundary layer profiles at chordwise location xq. Relies on the flowfield being extracted beforehand or passed to the method. Also plots profiles as bl_profiles.pdf and saves them bl_profiles.pkl. For a detailed description and all the different options have a look at the detailed description of the method.
Quick methods
make_mesh(rerun=False)
Makes the surface and volume mesh
run_extract_polar(rerun=False, plot=True)
As above, but waits for the simulations to finish and extracts the polars subsequently
run_all(rerun=False, plot=True)
Makes the mesh, runs CFD, waits for the simulations to finish and then extracts polar