|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "# Postprocessing for DU00-W-212: Coefficients of lift and drag\n", |
| 8 | + "## Angle of attack sweep" |
| 9 | + ] |
| 10 | + }, |
| 11 | + { |
| 12 | + "cell_type": "code", |
| 13 | + "execution_count": null, |
| 14 | + "metadata": {}, |
| 15 | + "outputs": [], |
| 16 | + "source": [ |
| 17 | + "import yaml\n", |
| 18 | + "import matplotlib.pyplot as plt\n", |
| 19 | + "import numpy as np" |
| 20 | + ] |
| 21 | + }, |
| 22 | + { |
| 23 | + "cell_type": "code", |
| 24 | + "execution_count": null, |
| 25 | + "metadata": {}, |
| 26 | + "outputs": [], |
| 27 | + "source": [ |
| 28 | + "size=14\n", |
| 29 | + "params = {'legend.fontsize': 'large',\n", |
| 30 | + " 'axes.labelsize': size,\n", |
| 31 | + " 'axes.titlesize': size,\n", |
| 32 | + " 'xtick.labelsize': size,\n", |
| 33 | + " 'ytick.labelsize': size}\n", |
| 34 | + "plt.rcParams.update(params)" |
| 35 | + ] |
| 36 | + }, |
| 37 | + { |
| 38 | + "cell_type": "code", |
| 39 | + "execution_count": null, |
| 40 | + "metadata": {}, |
| 41 | + "outputs": [], |
| 42 | + "source": [ |
| 43 | + "# For website workflow\n", |
| 44 | + "path_prefix = '../../nalu-wind/2D_airfoil_Transition/DU00-W-212/figures_and_scripts/'" |
| 45 | + ] |
| 46 | + }, |
| 47 | + { |
| 48 | + "cell_type": "code", |
| 49 | + "execution_count": null, |
| 50 | + "metadata": {}, |
| 51 | + "outputs": [], |
| 52 | + "source": [ |
| 53 | + "re_list=[3]\n", |
| 54 | + "\n", |
| 55 | + "n_re=len(re_list)\n", |
| 56 | + "\n", |
| 57 | + "for i in range(n_re):\n", |
| 58 | + " re = re_list[i]\n", |
| 59 | + " file =path_prefix+'../reference_data/exp_du00w212_re{:02d}M.yaml'.format(int(re))\n", |
| 60 | + " with open(file, \"r\") as data:\n", |
| 61 | + " clcd=yaml.safe_load(data)\n", |
| 62 | + "\n", |
| 63 | + " with open(path_prefix+'../performance/du00w212_F_rey{:08d}.yaml'.format(int(re*1e6)), \"r\") as data3:\n", |
| 64 | + " cfd_trans=yaml.safe_load(data3)\n", |
| 65 | + "\n", |
| 66 | + " with open(path_prefix+'../performance/du00w212_F_rey{:08d}_turb.yaml'.format(int(re*1e6)), \"r\") as data1:\n", |
| 67 | + " cfd_turb=yaml.safe_load(data1)\n", |
| 68 | + "\n", |
| 69 | + "\n", |
| 70 | + " plt.figure(figsize=(11,4))\n", |
| 71 | + " plt.subplot(1, 3, 1)\n", |
| 72 | + " plt.plot(clcd['DU00W212']['aoa'],clcd['DU00W212']['cl'],'ko')\n", |
| 73 | + " plt.plot(cfd_turb['du00w212_F']['aoa'],cfd_turb['du00w212_F']['cl'],'--')\n", |
| 74 | + " plt.plot(cfd_trans['du00w212_F']['aoa'],cfd_trans['du00w212_F']['cl'])\n", |
| 75 | + " plt.xlabel('Angle of Attack [deg]')\n", |
| 76 | + " plt.xlim([-10, 20])\n", |
| 77 | + " plt.ylim([-1, 2])\n", |
| 78 | + " plt.ylabel('Lift coefficient, $C_{l}$')\n", |
| 79 | + " plt.grid()\n", |
| 80 | + " plt.tight_layout() \n", |
| 81 | + " plt.legend(['Experiment','Turbulent','Transition'])\n", |
| 82 | + " \n", |
| 83 | + "\n", |
| 84 | + " plt.subplot(1, 3, 2)\n", |
| 85 | + " plt.plot(clcd['DU00W212']['cd'],clcd['DU00W212']['cl'],'ko')\n", |
| 86 | + " plt.plot(cfd_turb['du00w212_F']['cd'],cfd_turb['du00w212_F']['cl'],'--')\n", |
| 87 | + " plt.plot(cfd_trans['du00w212_F']['cd'],cfd_trans['du00w212_F']['cl'])\n", |
| 88 | + " plt.xlabel('Drag coefficient, $C_{d}$')\n", |
| 89 | + " plt.ylabel('Lift coefficient, $C_{l}$')\n", |
| 90 | + " plt.xlim([0.0,0.03])\n", |
| 91 | + " plt.ylim([-1, 2])\n", |
| 92 | + " plt.grid()\n", |
| 93 | + " plt.tight_layout() \n", |
| 94 | + "\n", |
| 95 | + "\n", |
| 96 | + " plt.subplot(1, 3, 3)\n", |
| 97 | + " plt.plot(clcd['DU00W212']['aoa'],clcd['DU00W212']['cm'],'ko')\n", |
| 98 | + " plt.plot(cfd_turb['du00w212_F']['aoa'],np.array(cfd_turb['du00w212_F']['cm'])*-1,'--')\n", |
| 99 | + " plt.plot(cfd_trans['du00w212_F']['aoa'],np.array(cfd_trans['du00w212_F']['cm'])*-1)\n", |
| 100 | + " plt.xlabel('Angle of Attack [deg]')\n", |
| 101 | + " plt.ylabel('Pitching moment coefficient, $C_{m}$')\n", |
| 102 | + " plt.xlim([-10, 20])\n", |
| 103 | + " plt.ylim([-0.12, -0.02])\n", |
| 104 | + " plt.grid()\n", |
| 105 | + " plt.tight_layout() \n", |
| 106 | + "\n", |
| 107 | + " # plt.savefig(\"du_rey_%dM.png\"%re,dpi=300)\n", |
| 108 | + "\n", |
| 109 | + "plt.show()" |
| 110 | + ] |
| 111 | + } |
| 112 | + ], |
| 113 | + "metadata": { |
| 114 | + "language_info": { |
| 115 | + "name": "python" |
| 116 | + } |
| 117 | + }, |
| 118 | + "nbformat": 4, |
| 119 | + "nbformat_minor": 2 |
| 120 | +} |
0 commit comments