# ================================================================== # === Optimization ================================================= # ================================================================== """ This script is an example of how to setup wing twist optimization with pyLAVA. See the documentation for more details. you can run the script like this: mpirun -np 2 mbind.x -t 14 python run_opt.py """ # === Import ======================================================= from mpi4py import MPI import yaml # imports-start from pylava.pyLAVA_optimization import optLAVA # imports-end # ================================================================== # === Run ========================================================== # loadyamls-start # Read the YAML file name for lava options with open("lava.yaml", "r") as f: lava_options = yaml.safe_load(f) # Read in the YAML file for optimization options with open("opt.yaml", "r") as f: opt_options = yaml.safe_load(f) # loadyamls-end # init-start # Instantiate the class solver = optLAVA(lava_options, opt_options, comm=MPI.COMM_WORLD) # Initialize the optimization problem solver.initOptimization(opt_options) # init-end # opt-start # Optimize sol = solver() # Write the solution if (solver.comm.rank == 0) : print(sol) # opt-end # ==================================================================