Optimize vent hole(outlet) pattern for reducing the cooling drag of UAV's motor efficiency.
- Extract arbitrary outlet data from CFD simulation(ANSYS Fluent)
- Upscale the input data for high-dimensional surrogate modeling
- PCA(Principal Component Analysis) for dimension reduction(for train quality)
- Train the surrogate model with the input data and output data
Input data: Vent-hole matrixOutput data1: DragOutput data2: Motor surface temperature(avg)Output data3: Motor surface temperature(max)
Note:
Drag(Cd)andsurface temperature(Tavg, mean)are conflicting objectives. So, we decided to optimize this multi-objective problem using Genetic-algorithm.
- Pattern type selection - defined by transformation group
GridCircularCorn
- Shape definition - define by closed area function(user-defined)
F(x, y) <= 0 - Chromosome(pattern) generation - generate vent hole pattern sets
- Generate pattern matrix - Model's input data
Example of generated patterns:

- Initialize population - can be customized
Shapegene distributionPatterngene distribution- population size, ...etc
- Evaluate fitness - can be customized
Fitness1: DragFitness2: Motor surface temperature(avg)Fitness3: Motor surface temperature(max)
- Selection - can be customized
Tournament selectionRoulette wheel selectionStochastic universal samplingElitism
- Crossover - can be customized
Single-point crossoverTwo-point crossoverUniform crossover
- Mutation - can be customized
Gaussian mutation(stochastic approach)- Random mutation(probabilistic approach)
- Termination - can be customized
Max generationPopulation diversityExtraordinary fitness value...etc
-
Clone this repository
git clone [repo link]
-
Install virtual environment
vscode based(recommended):
ctrl + shift + p->Python: Create environment.- select
./venvdirectory. - select python interpreter version,
3.11.0or higher recommended.
-
Install required packages
pip3 install -r packages.txt
-
Run the main script
-
goto
experimental_template.ipynbfile(make sure you have installed jupyter notebook) -
adjust genetic algorithm hyperparameters
-
run the script
suite = GAPipeline[VentHole]( suite_name="exp/tournament/config", # 🔼 Name of experiment, and also the directory name store/{suite_name} suite_max_count=50, # 🔼 Maximum generation suite_min_population=20, # 🔼 Minimum population size suite_min_chromosome=40, # 🔼 Minimum unique chromosome size crossover_behavior=UniformCrossover(), # 🔼 Crossover behavior selector_behavior=TournamentSelectionFilter(tournament_size=4), # 🔼 Selection behavior fitness_calculator=VentFitnessCalculator( # 🔼 Fitness model model_trainer_tuple=( gpr_model_trainer, gpr_model_trainer, gpr_model_trainer, ), criteria_weight_list=CRITERIA_WEIGHT, drag_criterion=DRAG_CRITERION, drag_std_criterion=DRAG_STD_CRITERION, avg_temp_criterion=AVG_TEMP_CRITERION, avg_temp_std_criterion=AVG_TEMP_STD_CRITERION, max_temp_criterion=MAX_TEMP_CRITERION, max_temp_std_criterion=MAX_TEMP_STD_CRITERION, ), immediate_exit_condition=lambda x: x[0] >= 0.725 and x[1] >= 0.725, # 🔼 Exit condition, extra ordinary fitness value mutation_probability=0.01, # 1% # 🔼 Mutation probability population_initializer=VentInitializer( population_size=150, # 🔼 Initial population size grid_scale=GRID_SCALE, grid_resolution=GRID_RESOLUTION, pattern_bound=GRID_BOUND, pattern_gene_pool=[ # 🔼 Pattern gene pool, you can adjust the gene pool circular_params, corn_params, grid_params, ], shape_gene_pool=[ # 🔼 Shape gene pool, you can adjust the gene pool circle_params, ], ), )
-
Check the results
- Gene, fitness data: check
store/{suite_name}directoryNote:
All the results are recorded at
storedirectory byjsonformat data. You can visualize or analyze the results.
-




