|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "id": "c2ec2fd3", |
| 6 | + "metadata": {}, |
| 7 | + "source": [ |
| 8 | + "# BladeX" |
| 9 | + ] |
| 10 | + }, |
| 11 | + { |
| 12 | + "cell_type": "markdown", |
| 13 | + "id": "ad979fa2", |
| 14 | + "metadata": {}, |
| 15 | + "source": [ |
| 16 | + "## Tutorial 7: Retrieve blade's parameters from iges file using reversepropeller class" |
| 17 | + ] |
| 18 | + }, |
| 19 | + { |
| 20 | + "cell_type": "markdown", |
| 21 | + "id": "c0ab2647", |
| 22 | + "metadata": {}, |
| 23 | + "source": [ |
| 24 | + "The goal of this tutorial is to show how to start from an iges file containing a blade to obtain its parameters, both for the sections (camber, thickness) and for the whole blade (chord lengths, pitch, rake, skew angles)." |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "markdown", |
| 29 | + "id": "5f21ab8e", |
| 30 | + "metadata": {}, |
| 31 | + "source": [ |
| 32 | + "We start from some useful imports, as usual." |
| 33 | + ] |
| 34 | + }, |
| 35 | + { |
| 36 | + "cell_type": "code", |
| 37 | + "execution_count": 5, |
| 38 | + "id": "4362678f", |
| 39 | + "metadata": {}, |
| 40 | + "outputs": [], |
| 41 | + "source": [ |
| 42 | + "import numpy as np\n", |
| 43 | + "from bladex import Blade, NacaProfile, ReversePropellerBladeX, ReversePropeller" |
| 44 | + ] |
| 45 | + }, |
| 46 | + { |
| 47 | + "cell_type": "markdown", |
| 48 | + "id": "45d4e8f4", |
| 49 | + "metadata": {}, |
| 50 | + "source": [ |
| 51 | + "Then, we create the same blade as for Tutorial 6 and store it as iges file." |
| 52 | + ] |
| 53 | + }, |
| 54 | + { |
| 55 | + "cell_type": "code", |
| 56 | + "execution_count": null, |
| 57 | + "id": "aa8f973f", |
| 58 | + "metadata": {}, |
| 59 | + "outputs": [], |
| 60 | + "source": [ |
| 61 | + "# Create sections with NACAProfile\n", |
| 62 | + "n_sections = 10\n", |
| 63 | + "sections = np.asarray([NacaProfile(digits='4412', n_points=50) for i in range(n_sections)])\n", |
| 64 | + "\n", |
| 65 | + "# Define blade parameters\n", |
| 66 | + "radii = np.arange(1.0, 11.0, 1.0)\n", |
| 67 | + "chord_lengths = np.array([0.05, 2.5, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7])\n", |
| 68 | + "pitch = np.arange(1., 11.)\n", |
| 69 | + "rake = np.arange(0.1, 1.1, 0.1)\n", |
| 70 | + "skew_angles = np.arange(1., 21, 2.)\n", |
| 71 | + "\n", |
| 72 | + "# Create the Blade\n", |
| 73 | + "blade = Blade(sections=sections,\n", |
| 74 | + " radii=radii,\n", |
| 75 | + " chord_lengths=chord_lengths,\n", |
| 76 | + " pitch=pitch,\n", |
| 77 | + " rake=rake,\n", |
| 78 | + " skew_angles=skew_angles)\n", |
| 79 | + "\n", |
| 80 | + "# We build the blade to be able to store its iges version\n", |
| 81 | + "# The method build() internally calls apply_transformations()\n", |
| 82 | + "blade.build()\n", |
| 83 | + "\n", |
| 84 | + "# Storing the blade in iges format\n", |
| 85 | + "iges_filename='data/blade_reversepropeller.igs'\n", |
| 86 | + "blade.export_iges(iges_filename)" |
| 87 | + ] |
| 88 | + }, |
| 89 | + { |
| 90 | + "cell_type": "markdown", |
| 91 | + "id": "61aabd42", |
| 92 | + "metadata": {}, |
| 93 | + "source": [ |
| 94 | + "Now that we have our starting iges file, we can retrieve the blades parameters. In BladeX you can either use the `ReversePropellerBladeX`, if the blade has been generated using BladeX, or `ReversePropeller` otherwise. The former is robust and more accurate for BladeX blades because it exploits known structure of the iges file." |
| 95 | + ] |
| 96 | + }, |
| 97 | + { |
| 98 | + "cell_type": "code", |
| 99 | + "execution_count": null, |
| 100 | + "id": "78b71d18", |
| 101 | + "metadata": {}, |
| 102 | + "outputs": [], |
| 103 | + "source": [ |
| 104 | + "# We need to specify: \n", |
| 105 | + "# i) the name of the iges file; \n", |
| 106 | + "# ii) values of the radii in mm at which the parameters are to be extracted;\n", |
| 107 | + "# iii) how many points to use to reconstruct the sections for each radius value\n", |
| 108 | + "# In this case we use the same radii values (extrema excluded) of the blade's generation for a better comparison\n", |
| 109 | + "radii_reverse = np.arange(2.0, 10., 1.)\n", |
| 110 | + "# This operation may take few minutes\n", |
| 111 | + "reverse = ReversePropellerBladeX(iges_filename, 1000*radii_reverse, num_points_top_bottom=100)\n", |
| 112 | + "\n", |
| 113 | + "# Now we can retrieve the blade's parameters\n", |
| 114 | + "print(reverse.chord_length_list)\n", |
| 115 | + "print(reverse.pitch_list)\n", |
| 116 | + "print(reverse.rake_list)\n", |
| 117 | + "print(reverse.skew_angles_list)\n", |
| 118 | + "\n", |
| 119 | + "# Finally, we can store the parameters to a csv file\n", |
| 120 | + "reverse.save_global_parameters('data/blade_parameters.csv')" |
| 121 | + ] |
| 122 | + } |
| 123 | + ], |
| 124 | + "metadata": { |
| 125 | + "kernelspec": { |
| 126 | + "display_name": "marinai", |
| 127 | + "language": "python", |
| 128 | + "name": "python3" |
| 129 | + }, |
| 130 | + "language_info": { |
| 131 | + "codemirror_mode": { |
| 132 | + "name": "ipython", |
| 133 | + "version": 3 |
| 134 | + }, |
| 135 | + "file_extension": ".py", |
| 136 | + "mimetype": "text/x-python", |
| 137 | + "name": "python", |
| 138 | + "nbconvert_exporter": "python", |
| 139 | + "pygments_lexer": "ipython3", |
| 140 | + "version": "3.10.13" |
| 141 | + } |
| 142 | + }, |
| 143 | + "nbformat": 4, |
| 144 | + "nbformat_minor": 5 |
| 145 | +} |
0 commit comments