{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Postprocessing for DU00-W-212: Coefficients of lift and drag\n", "## Angle of attack sweep" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import yaml\n", "import matplotlib.pyplot as plt\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "size=14\n", "params = {'legend.fontsize': 'large',\n", " 'axes.labelsize': size,\n", " 'axes.titlesize': size,\n", " 'xtick.labelsize': size,\n", " 'ytick.labelsize': size}\n", "plt.rcParams.update(params)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# For website workflow\n", "path_prefix = '../../nalu-wind/2D_airfoil_Transition/DU00-W-212/figures_and_scripts/'" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "re_list=[3]\n", "\n", "n_re=len(re_list)\n", "\n", "for i in range(n_re):\n", " re = re_list[i]\n", " file =path_prefix+'../reference_data/exp_du00w212_re{:02d}M.yaml'.format(int(re))\n", " with open(file, \"r\") as data:\n", " clcd=yaml.safe_load(data)\n", "\n", " with open(path_prefix+'../performance/du00w212_F_rey{:08d}.yaml'.format(int(re*1e6)), \"r\") as data3:\n", " cfd_trans=yaml.safe_load(data3)\n", "\n", " with open(path_prefix+'../performance/du00w212_F_rey{:08d}_turb.yaml'.format(int(re*1e6)), \"r\") as data1:\n", " cfd_turb=yaml.safe_load(data1)\n", "\n", "\n", " plt.figure(figsize=(11,4))\n", " plt.subplot(1, 3, 1)\n", " plt.plot(clcd['DU00W212']['aoa'],clcd['DU00W212']['cl'],'ko')\n", " plt.plot(cfd_turb['du00w212_F']['aoa'],cfd_turb['du00w212_F']['cl'],'--')\n", " plt.plot(cfd_trans['du00w212_F']['aoa'],cfd_trans['du00w212_F']['cl'])\n", " plt.xlabel('Angle of Attack [deg]')\n", " plt.xlim([-10, 20])\n", " plt.ylim([-1, 2])\n", " plt.ylabel('Lift coefficient, $C_{l}$')\n", " plt.grid()\n", " plt.tight_layout() \n", " plt.legend(['Experiment','Turbulent','Transition'])\n", " \n", "\n", " plt.subplot(1, 3, 2)\n", " plt.plot(clcd['DU00W212']['cd'],clcd['DU00W212']['cl'],'ko')\n", " plt.plot(cfd_turb['du00w212_F']['cd'],cfd_turb['du00w212_F']['cl'],'--')\n", " plt.plot(cfd_trans['du00w212_F']['cd'],cfd_trans['du00w212_F']['cl'])\n", " plt.xlabel('Drag coefficient, $C_{d}$')\n", " plt.ylabel('Lift coefficient, $C_{l}$')\n", " plt.xlim([0.0,0.03])\n", " plt.ylim([-1, 2])\n", " plt.grid()\n", " plt.tight_layout() \n", "\n", "\n", " plt.subplot(1, 3, 3)\n", " plt.plot(clcd['DU00W212']['aoa'],clcd['DU00W212']['cm'],'ko')\n", " plt.plot(cfd_turb['du00w212_F']['aoa'],np.array(cfd_turb['du00w212_F']['cm'])*-1,'--')\n", " plt.plot(cfd_trans['du00w212_F']['aoa'],np.array(cfd_trans['du00w212_F']['cm'])*-1)\n", " plt.xlabel('Angle of Attack [deg]')\n", " plt.ylabel('Pitching moment coefficient, $C_{m}$')\n", " plt.xlim([-10, 20])\n", " plt.ylim([-0.12, -0.02])\n", " plt.grid()\n", " plt.tight_layout() \n", "\n", " # plt.savefig(\"du_rey_%dM.png\"%re,dpi=300)\n", "\n", "plt.show()" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 2 }