(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 24492, 749]*) (*NotebookOutlinePosition[ 25243, 775]*) (* CellTagsIndexPosition[ 25199, 771]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Numerical Solution of Plane Irrotational Flow", "Title"], Cell["\<\ APPH 4200 Physics of Fluids Columbia University\ \>", "Subsubtitle"], Cell[TextData[{ "Solve Laplace's equation for the streamfunction, \[Psi][", StyleBox["x,y", FontSlant->"Italic"], "], for two relatively simple examples. Since ", StyleBox["Mathematica", FontSlant->"Italic"], " can solve thousands of simultaneous equations quickly, the only challenge \ to this problem is defining the computational grid and the boundary \ conditions on the flow. Two dimensional solutions to elliptical PDE's can be \ easily and accurately solved using today's computers." }], "Text"], Cell[CellGroupData[{ Cell["Define Laplace's Equation on a Grid", "Section"], Cell[BoxData[ \(\(Off[General::spell1];\)\)], "Input", CellLabel->"In[1]:="], Cell["Define Laplace's Equation\[Ellipsis]", "Text"], Cell[BoxData[ \(eqn[i_, j_]\ := \((\ \[Psi][i + 1, j]\ - \ 2\ \[Psi][i, j]\ + \ \[Psi][i - 1, j])\)/\[Delta]x^2\ + \ \((\[Psi][i, j + 1]\ - \ 2\ \[Psi][i, j]\ + \ \[Psi][i, j - 1])\)/\[Delta]y^2\ \[Equal] \ 0\)], "Input", CellLabel->"In[2]:="], Cell[BoxData[ \(eqn[i, j]\)], "Input", CellLabel->"In[3]:="] }, Closed]], Cell[CellGroupData[{ Cell["Define a Grid", "Section"], Cell[BoxData[{ RowBox[{\(height\ = \ 1.0\), " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{\(length\ = \ 5.0\), " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{\(wallHeight\ = \ 0.5\), " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{\(wallLength\ = \ 0.5\), " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}]}], "Input", CellLabel->"In[4]:="], Cell[TextData[{ "Grid points go from 1 to ", StyleBox["numX", FontWeight->"Bold"], " and from 1 to ", StyleBox["numY", FontWeight->"Bold"], "." }], "Text"], Cell[BoxData[{ \(\(numX\ = \ 80;\)\), "\[IndentingNewLine]", \(\(numY\ = \ 60;\)\), "\[IndentingNewLine]", \(\(Print["\", \ numX\ numY];\)\)}], "Input", CellLabel->"In[8]:="], Cell[BoxData[{ \(\(dx\ = \ length/\((numX - 1)\);\)\), "\[IndentingNewLine]", \(\(dy\ = \ height/\((numY\ - 1)\);\)\)}], "Input", CellLabel->"In[11]:="], Cell[BoxData[ \(wallLength/dx\)], "Input", CellLabel->"In[13]:="], Cell[BoxData[ \(wallHeight/dy\)], "Input", CellLabel->"In[14]:="], Cell[BoxData[ RowBox[{\(flow\ = \ 5.0\), " ", RowBox[{"(*", " ", StyleBox[\(m/s\), FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}]], "Input", CellLabel->"In[15]:="], Cell[BoxData[ RowBox[{ RowBox[{"grid", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{ RowBox[{ StyleBox[\(length/2 - wallLength/ 2 \[LessEqual] \ \((ix - 1)\)\ dx\ \[LessEqual] \ length/2\ + wallLength/2\), FontColor->RGBColor[1, 0, 1]], StyleBox[" ", FontColor->RGBColor[1, 0, 1]], StyleBox["&&", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[\(\((iy - 1)\)\ dy \[LessEqual] \ wallHeight\), FontColor->GrayLevel[0]]}], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["||", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[\(ix\ \[Equal] \ 1\), FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["||", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[\(ix\ == \ numX\), FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["||", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[\(iy\ \[Equal] \ 1\), FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["||", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[\(iy\ == \ numY\), FontColor->GrayLevel[0]]}], ",", " ", "1", ",", " ", "0"}], "]"}], ",", " ", \({ix, \ 1, \ numX}\), ",", \({iy, \ 1, \ numY}\)}], "]"}]}], ";"}]], "Input", CellLabel->"In[16]:="], Cell[BoxData[ \(Dimensions[grid]\)], "Input", CellLabel->"In[17]:="], Cell[BoxData[ RowBox[{\(Count[Flatten[grid], x_ /; x \[Equal] 1]\), " ", RowBox[{"(*", " ", RowBox[{ StyleBox["number", FontColor->RGBColor[0, 1, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox["of", FontColor->RGBColor[0, 1, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox["known", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox["grid", FontColor->RGBColor[0, 1, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox["values", FontColor->RGBColor[0, 1, 0]]}], " ", "*)"}]}]], "Input", CellLabel->"In[18]:="], Cell[BoxData[ RowBox[{\(Count[Flatten[grid], x_ /; x \[Equal] 0]\), " ", RowBox[{"(*", " ", RowBox[{ StyleBox["number", FontColor->RGBColor[0, 1, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox["of", FontColor->RGBColor[0, 1, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox["unknown", FontColor->RGBColor[1, 0, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox["grid", FontColor->RGBColor[0, 1, 0]], StyleBox[" ", FontColor->RGBColor[0, 1, 0]], StyleBox["values", FontColor->RGBColor[0, 1, 0]]}], " ", "*)"}]}]], "Input", CellLabel->"In[19]:="], Cell[BoxData[ \(Length[Flatten[grid]]\)], "Input", CellLabel->"In[20]:="], Cell[BoxData[ \(\(ArrayPlot[Transpose[grid], \ Mesh\ \[Rule] \ True];\)\)], "Input", CellLabel->"In[21]:="], Cell[BoxData[ RowBox[{\(wallBound[ix_]\), " ", ":=", " ", RowBox[{"If", "[", RowBox[{ StyleBox[\(length/2 - wallLength/2 \[LessEqual] \ \((ix - 1)\)\ dx\ \[LessEqual] \ length/2\ + wallLength/2\), FontColor->RGBColor[1, 0, 1]], ",", " ", \(Floor[wallHeight/dy] + 1\), ",", " ", "1"}], "]"}]}]], "Input", CellLabel->"In[22]:="], Cell[BoxData[ \(\(ListPlot[ Table[wallBound[ix], \ {ix, \ Floor[numX/4], \ Floor[3\ numX/4]}], \ Frame\ \[Rule] \ True, \ PlotStyle\ \[Rule] \ PointSize[0.02], \ Axes\ \[Rule] \ False, \ FrameLabel\ \[Rule] \ {"\", "\", "\", \ "\<\>"}];\)\)], "Input", CellLabel->"In[23]:="] }, Closed]], Cell[CellGroupData[{ Cell["Define Boundary Conditions", "Section"], Cell[BoxData[ RowBox[{\(Clear[\[Psi]]\), ";", " ", RowBox[{"(*", " ", StyleBox[\(\[Psi]\ is\ the\ variable\ used\ to\ store\ the\ \ \(\(streamfunction\)\(.\)\)\), FontColor->RGBColor[0, 1, 0]], " ", "*)"}]}]], "Input", CellLabel->"In[24]:="], Cell["Top and bottom\[Ellipsis]", "Text"], Cell[BoxData[{ \(\(\[Psi][ix_, numY]\ = \ flow\ \ height;\)\), "\[IndentingNewLine]", \(\(\[Psi][ix_, 1]\ = \ 0;\)\)}], "Input", CellLabel->"In[25]:="], Cell["Left and right sides\[Ellipsis]", "Text"], Cell[BoxData[{ \(\(\[Psi][1, iy_]\ = \ flow\ \((iy - 1)\)\ dy;\)\), "\[IndentingNewLine]", \(\(\[Psi][numX, iy_]\ = \ flow\ \((iy - 1)\)\ dy;\)\)}], "Input", CellLabel->"In[27]:="], Cell["The wall\[Ellipsis]", "Text"], Cell[BoxData[ \(\(Table[ Table[\[Psi][ix, iy]\ = \ 0, \ {iy, \ 1, \ wallBound[ix]}], \ {ix, \ 1, \ numX}];\)\)], "Input", CellLabel->"In[29]:="] }, Closed]], Cell[CellGroupData[{ Cell["Define the Equations", "Section"], Cell[BoxData[ \(\(eqns\ = \ \(Flatten[ Table[Table[ eqn[ix, iy], {iy, \ wallBound[ix] + 1, \ numY - 1}]\ , {ix, \ 2, \ numX - 1}]]\ /. \ \[Delta]x\ \[Rule] \ dx\)\ /. \ \[Delta]y\ \[Rule] \ dy;\)\)], "Input", CellLabel->"In[30]:="], Cell[BoxData[ \(\(eqns\ = \ Simplify[eqns];\)\)], "Input", CellLabel->"In[31]:="], Cell[BoxData[ \(Dimensions[eqns]\)], "Input", CellLabel->"In[32]:="], Cell[BoxData[ \(eqns\[LeftDoubleBracket]{1, 2, 3}\[RightDoubleBracket]\)], "Input", CellLabel->"In[33]:="], Cell[BoxData[ \(\(unknowns\ = \ Flatten[Table[ Table[\[Psi][ix, iy], {iy, \ wallBound[ix] + 1, \ numY - 1}]\ , {ix, \ 2, \ numX - 1}]];\)\)], "Input", CellLabel->"In[34]:="], Cell[BoxData[ \(unknowns\[LeftDoubleBracket]{1, 2, 3}\[RightDoubleBracket]\)], "Input", CellLabel->"In[35]:="], Cell[BoxData[ \(Dimensions[unknowns]\)], "Input", CellLabel->"In[36]:="] }, Closed]], Cell[CellGroupData[{ Cell["Finding the Solution", "Section"], Cell[BoxData[ \(Timing[\(sol\ = \ Flatten[Solve[eqns, unknowns]];\)]\)], "Input", CellLabel->"In[37]:="], Cell[BoxData[ \(\(\[Psi]Sol\ = \ Interpolation[ Flatten[Table[{\((ix - 1)\)\ dx, \ \((iy - 1)\)\ dy, \ \[Psi][ix, iy]}, \ {ix, \ 1, \ numX}, \ {iy, \ 1, \ numY}]\ /. \ sol, 1]];\)\)], "Input", CellLabel->"In[38]:="], Cell[BoxData[ \(\(ContourPlot[\[Psi]Sol[x, y], \ {x, \ 0, \ length}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ ContourShading\ \[Rule] \ False, \ Contours\ \[Rule] \ 18, FrameLabel\ \[Rule] \ {"\", "\"}, \ PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[39]:="], Cell[BoxData[ \(\(ContourPlot[\[Psi]Sol[x, y], \ {x, \ length/2 - height/2, \ length/2 + height/2}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ ContourShading\ \[Rule] \ False, \ Contours\ \[Rule] \ 18, AspectRatio\ \[Rule] \ Automatic, FrameLabel\ \[Rule] \ {"\", "\"}, \ PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[40]:="] }, Closed]], Cell[CellGroupData[{ Cell["Computing the Velocity", "Section"], Cell[BoxData[{ \(\(uX[xx_, yy_]\ = \ \(D[\[Psi]Sol[x, y], y]\ /. \ x\ \[Rule] \ xx\)\ /. \ y\ \[Rule] \ yy;\)\), "\[IndentingNewLine]", \(\(uY[xx_, yy_]\ = \ \(\(-D[\[Psi]Sol[x, y], x]\) /. \ x\ \[Rule] \ xx\)\ /. \ y\ \[Rule] \ yy;\)\), "\[IndentingNewLine]", \(\(u2[x_, y_]\ = \ uX[x, y]^2\ + \ uY[x, y]^2;\)\)}], "Input", CellLabel->"In[41]:="], Cell[BoxData[ \(\(ContourPlot[ u2[x, y]/2, \ {x, \ length/2 - height/2, \ length/2 + height/2}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ ContourShading\ \[Rule] \ False, \ Contours\ \[Rule] \ 18, AspectRatio\ \[Rule] \ Automatic, FrameLabel\ \[Rule] \ {"\", "\"}, \ PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[44]:="], Cell[BoxData[ \(\(Cp[x_, y_]\ = \ 1\ - \ u2[x, y]/flow^2;\)\)], "Input", CellLabel->"In[45]:="], Cell[BoxData[ \(\(ContourPlot[ Cp[x, y], \ {x, \ length/2 - height/2, \ length/2 + height/2}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ ContourShading\ \[Rule] \ False, \ Contours\ \[Rule] \ 18, AspectRatio\ \[Rule] \ Automatic, FrameLabel\ \[Rule] \ {"\", "\"}, \ PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[46]:="], Cell[BoxData[ \(\(Plot3D[ Cp[x, y], \ {x, \ length/2 - height/2, \ length/2 + height/2}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[47]:="], Cell[BoxData[ \(\(Show[%, ViewPoint -> {1.2, 1.2, 1.2}];\)\)], "Input", CellLabel->"In[48]:="], Cell[BoxData[ \(\(Plot[Cp[length/2 - height/2, y], \ {y, 0, \ height}, AxesLabel\ \[Rule] \ {"\", "\"}, PlotLabel \[Rule] \ "\"];\)\)], \ "Input", CellLabel->"In[49]:="], Cell[BoxData[ \(\(Plot[Cp[x, wallHeight], \ {x, 0, \ length}, AxesLabel\ \[Rule] \ {"\", "\"}, PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[50]:="] }, Closed]], Cell[CellGroupData[{ Cell["Flow Past a Cylinder", "Section"], Cell[BoxData[ \(\(Clear[\[Psi], uX, uY, u2];\)\)], "Input", CellLabel->"In[51]:="], Cell[BoxData[{ RowBox[{\(radius\ = \ 0.2\), " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{\(centerY\ = \ height/2\), " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}]}], "Input", CellLabel->"In[52]:="], Cell[CellGroupData[{ Cell["Define Boundary Conditions", "Subsection"], Cell["Top and bottom\[Ellipsis]", "Text"], Cell[BoxData[{ \(\(\[Psi][ix_, numY]\ = \ flow\ \ height;\)\), "\[IndentingNewLine]", \(\(\[Psi][ix_, 1]\ = \ 0;\)\)}], "Input", CellLabel->"In[54]:="], Cell["Left and right sides\[Ellipsis]", "Text"], Cell[BoxData[{ \(\(\[Psi][1, iy_]\ = \ flow\ \((iy - 1)\)\ dy;\)\), "\[IndentingNewLine]", \(\(\[Psi][numX, iy_]\ = \ flow\ \((iy - 1)\)\ dy;\)\)}], "Input", CellLabel->"In[56]:="], Cell["The cylinder", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ StyleBox[\(\((\((ix - 1)\)\ dx\ \ - \ length/2)\)^2\ + \ \((\((iy\ - 1)\) dy\ - \ centerY)\)^2\ \[LessEqual] \ radius^2\), FontColor->RGBColor[1, 0, 1]], ",", " ", \(\[Psi][ix, iy]\ = \ flow\ centerY\)}], "]"}], ",", " ", \({iy, \ 1, numY}\), ",", " ", \({ix, \ 1, \ numX}\)}], "]"}], ";"}]], "Input", CellLabel->"In[58]:="] }, Closed]], Cell[CellGroupData[{ Cell["Define the Equations", "Subsection"], Cell[BoxData[{ RowBox[{ RowBox[{"eqns", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ StyleBox[\(\((\((ix - 1)\)\ dx\ \ - \ length/2)\)^2\ + \ \((\((iy\ - 1)\) dy\ - \ centerY)\)^2\ \[LessEqual] \ radius^2\), FontColor->RGBColor[1, 0, 1]], ",", \(-1\), ",", \(eqn[ix, iy]\)}], "]"}], ",", " ", \({iy, \ 2, numY - 1}\), ",", " ", \({ix, \ 2, \ numX - 1}\)}], "]"}], "]"}], " ", "/.", " ", \(\[Delta]x\ \[Rule] \ dx\)}], " ", "/.", " ", \(\[Delta]y\ \[Rule] \ dy\)}]}], ";"}], "\[IndentingNewLine]", \(eqns\ = \ DeleteCases[eqns, \ _?Negative];\)}], "Input", CellLabel->"In[59]:="], Cell[BoxData[ \(Dimensions[eqns]\)], "Input", CellLabel->"In[61]:="], Cell[BoxData[ \(\(eqns\ = \ Simplify[eqns];\)\)], "Input", CellLabel->"In[62]:="], Cell[BoxData[ \(eqns\[LeftDoubleBracket]{1, 2, 3}\[RightDoubleBracket]\)], "Input", CellLabel->"In[63]:="], Cell[BoxData[{ RowBox[{ RowBox[{"unknowns", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ StyleBox[\(\((\((ix - 1)\)\ dx\ \ - \ length/2)\)^2\ + \ \((\((iy\ - 1)\) dy\ - \ centerY)\)^2\ \[LessEqual] \ radius^2\), FontColor->RGBColor[1, 0, 1]], ",", \(-1\), ",", \(\[Psi][ix, iy]\)}], "]"}], ",", " ", \({iy, \ 2, numY - 1}\), ",", " ", \({ix, \ 2, \ numX - 1}\)}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", \(unknowns\ = \ DeleteCases[unknowns, \ _?Negative];\)}], "Input", CellLabel->"In[64]:="], Cell[BoxData[ \(unknowns\[LeftDoubleBracket]{1, 2, 3}\[RightDoubleBracket]\)], "Input", CellLabel->"In[66]:="], Cell[BoxData[ \(Dimensions[unknowns]\)], "Input", CellLabel->"In[67]:="] }, Closed]], Cell[CellGroupData[{ Cell["Solution", "Subsection"], Cell[TextData[{ "The solution is found quickly using ", StyleBox["Mathematica", FontSlant->"Italic"], "'s built-in ", StyleBox["Solve", FontWeight->"Bold"], " function." }], "Text"], Cell[BoxData[ \(Timing[\(sol\ = \ Flatten[Solve[eqns, unknowns]];\)]\)], "Input", CellLabel->"In[68]:="], Cell[BoxData[ \(\(\[Psi]Sol\ = \ Interpolation[ Flatten[Table[{\((ix - 1)\)\ dx, \ \((iy - 1)\)\ dy, \ \[Psi][ix, iy]}, \ {ix, \ 1, \ numX}, \ {iy, \ 1, \ numY}]\ /. \ sol, 1]];\)\)], "Input", CellLabel->"In[69]:="], Cell[BoxData[ \(\(ContourPlot[\[Psi]Sol[x, y], \ {x, \ 0, \ length}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ ContourShading\ \[Rule] \ False, \ Contours\ \[Rule] \ 24, FrameLabel\ \[Rule] \ {"\", "\"}, \ PlotLabel \[Rule] \ "\"];\)\)], \ "Input", CellLabel->"In[70]:="], Cell[BoxData[ \(\(plt\ = \ ContourPlot[\[Psi]Sol[x, y], {x, \ length/2 - height/2, \ length/2 + height/2}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ ContourShading\ \[Rule] \ False, \ Contours\ \[Rule] \ 24, FrameLabel\ \[Rule] \ {"\", "\"}, \ PlotLabel \[Rule] \ "\"];\)\)], \ "Input", CellLabel->"In[71]:="], Cell[BoxData[ \(\(cylinder\ = \ Graphics[{Thickness[0.02], Circle[{length/2, centerY}, radius]}];\)\)], "Input", CellLabel->"In[72]:="], Cell[BoxData[ \(\(Show[plt, cylinder];\)\)], "Input", CellLabel->"In[73]:="] }, Closed]], Cell[CellGroupData[{ Cell["Computing the Velocity", "Subsection"], Cell[BoxData[{ \(\(uX[xx_, yy_]\ = \ \(D[\[Psi]Sol[x, y], y]\ /. \ x\ \[Rule] \ xx\)\ /. \ y\ \[Rule] \ yy;\)\), "\[IndentingNewLine]", \(\(uY[xx_, yy_]\ = \ \(\(-D[\[Psi]Sol[x, y], x]\) /. \ x\ \[Rule] \ xx\)\ /. \ y\ \[Rule] \ yy;\)\), "\[IndentingNewLine]", \(\(u2[x_, y_]\ = \ uX[x, y]^2\ + \ uY[x, y]^2;\)\)}], "Input", CellLabel->"In[74]:="], Cell[BoxData[ \(\(ContourPlot[ u2[x, y]/2, \ {x, \ length/2 - height/2, \ length/2 + height/2}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ ContourShading\ \[Rule] \ False, \ Contours\ \[Rule] \ 18, AspectRatio\ \[Rule] \ Automatic, FrameLabel\ \[Rule] \ {"\", "\"}, \ PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[77]:="], Cell[BoxData[ \(\(Cp[x_, y_]\ = \ 1\ - \ u2[x, y]/flow^2;\)\)], "Input", CellLabel->"In[78]:="], Cell[BoxData[ \(\(ContourPlot[ Cp[x, y], \ {x, \ length/2 - height/2, \ length/2 + height/2}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ ContourShading\ \[Rule] \ False, \ Contours\ \[Rule] \ 18, AspectRatio\ \[Rule] \ Automatic, FrameLabel\ \[Rule] \ {"\", "\"}, \ PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[79]:="], Cell[BoxData[ \(\(Plot3D[ Cp[x, y], \ {x, \ length/2 - height/2, \ length/2 + height/2}, {y, 0, \ height}, \ PlotPoints\ \[Rule] \ 80, \ PlotLabel \[Rule] \ "\"];\)\)], "Input", CellLabel->"In[80]:="], Cell[BoxData[ \(\(Show[%, ViewPoint -> {1.2, 1.2, 1.2}];\)\)], "Input", CellLabel->"In[81]:="], Cell[BoxData[ \(\(Show[%%, \ PlotRange\ \[Rule] \ All];\)\)], "Input", CellLabel->"In[82]:="], Cell[BoxData[ \(\(Plot[Cp[length/2, y], \ {y, 0, \ height}, AxesLabel\ \[Rule] \ {"\", "\"}, PlotLabel \[Rule] \ "\"];\)\)], \ "Input", CellLabel->"In[83]:="], Cell[BoxData[ \(\(Plot[ Cp[length/2 + \ 1.1\ radius\ Cos[\[Theta]], centerY\ + \ 1.1\ radius\ Sin[\[Theta]]], \ {\[Theta], 0, \ 2\ \[Pi]}, AxesLabel\ \[Rule] \ {"\<\[Theta]\>", "\"}, Ticks\ \[Rule] \ {Range[0, 2 \[Pi], \[Pi]/2], Automatic}, PlotLabel \[Rule] \ "\"];\)\)], \ "Input", CellLabel->"In[84]:="] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell["Summary", "Section"], Cell[TextData[{ "Two dimensional potential flow requires the solution of an elliptic \ partial differential equation. These problems can be solved ", StyleBox["very easily ", FontSlant->"Italic"], "with today's computers." }], "Text"] }, Closed]] }, Open ]] }, FrontEndVersion->"5.2 for Macintosh", ScreenRectangle->{{0, 1600}, {0, 998}}, WindowSize->{653, 828}, WindowMargins->{{13, Automatic}, {Automatic, 33}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowSelection->True, StyleDefinitions -> "TutorialBook.nb" ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 62, 0, 118, "Title"], Cell[1841, 55, 78, 3, 50, "Subsubtitle"], Cell[1922, 60, 520, 11, 88, "Text"], Cell[CellGroupData[{ Cell[2467, 75, 54, 0, 92, "Section"], Cell[2524, 77, 82, 2, 29, "Input"], Cell[2609, 81, 52, 0, 28, "Text"], Cell[2664, 83, 337, 7, 69, "Input"], Cell[3004, 92, 66, 2, 29, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[3107, 99, 32, 0, 60, "Section"], Cell[3142, 101, 762, 20, 89, "Input"], Cell[3907, 123, 173, 8, 28, "Text"], Cell[4083, 133, 219, 4, 69, "Input"], Cell[4305, 139, 166, 3, 49, "Input"], Cell[4474, 144, 71, 2, 29, "Input"], Cell[4548, 148, 71, 2, 29, "Input"], Cell[4622, 152, 199, 5, 29, "Input"], Cell[4824, 159, 2443, 58, 169, "Input"], Cell[7270, 219, 74, 2, 29, "Input"], Cell[7347, 223, 801, 22, 49, "Input"], Cell[8151, 247, 803, 22, 49, "Input"], Cell[8957, 271, 79, 2, 29, "Input"], Cell[9039, 275, 114, 2, 29, "Input"], Cell[9156, 279, 435, 11, 89, "Input"], Cell[9594, 292, 349, 7, 109, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[9980, 304, 45, 0, 60, "Section"], Cell[10028, 306, 273, 6, 69, "Input"], Cell[10304, 314, 41, 0, 28, "Text"], Cell[10348, 316, 164, 3, 49, "Input"], Cell[10515, 321, 47, 0, 28, "Text"], Cell[10565, 323, 202, 4, 49, "Input"], Cell[10770, 329, 35, 0, 28, "Text"], Cell[10808, 331, 170, 4, 49, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[11015, 340, 39, 0, 60, "Section"], Cell[11057, 342, 329, 7, 89, "Input"], Cell[11389, 351, 88, 2, 29, "Input"], Cell[11480, 355, 74, 2, 29, "Input"], Cell[11557, 359, 112, 2, 29, "Input"], Cell[11672, 363, 218, 5, 109, "Input"], Cell[11893, 370, 116, 2, 29, "Input"], Cell[12012, 374, 78, 2, 29, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[12127, 381, 39, 0, 60, "Section"], Cell[12169, 383, 111, 2, 29, "Input"], Cell[12283, 387, 278, 6, 89, "Input"], Cell[12564, 395, 360, 6, 109, "Input"], Cell[12927, 403, 435, 7, 129, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[13399, 415, 41, 0, 60, "Section"], Cell[13443, 417, 431, 9, 69, "Input"], Cell[13877, 428, 430, 8, 129, "Input"], Cell[14310, 438, 103, 2, 29, "Input"], Cell[14416, 442, 430, 8, 129, "Input"], Cell[14849, 452, 257, 5, 69, "Input"], Cell[15109, 459, 100, 2, 29, "Input"], Cell[15212, 463, 238, 5, 69, "Input"], Cell[15453, 470, 221, 4, 69, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[15711, 479, 39, 0, 60, "Section"], Cell[15753, 481, 88, 2, 29, "Input"], Cell[15844, 485, 394, 10, 49, "Input"], Cell[CellGroupData[{ Cell[16263, 499, 48, 0, 41, "Subsection"], Cell[16314, 501, 41, 0, 28, "Text"], Cell[16358, 503, 164, 3, 49, "Input"], Cell[16525, 508, 47, 0, 28, "Text"], Cell[16575, 510, 202, 4, 49, "Input"], Cell[16780, 516, 28, 0, 28, "Text"], Cell[16811, 518, 588, 14, 109, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[17436, 537, 42, 0, 41, "Subsection"], Cell[17481, 539, 1040, 23, 169, "Input"], Cell[18524, 564, 74, 2, 29, "Input"], Cell[18601, 568, 88, 2, 29, "Input"], Cell[18692, 572, 112, 2, 29, "Input"], Cell[18807, 576, 818, 18, 149, "Input"], Cell[19628, 596, 116, 2, 29, "Input"], Cell[19747, 600, 78, 2, 29, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[19862, 607, 30, 0, 41, "Subsection"], Cell[19895, 609, 200, 8, 28, "Text"], Cell[20098, 619, 111, 2, 29, "Input"], Cell[20212, 623, 278, 6, 89, "Input"], Cell[20493, 631, 366, 7, 109, "Input"], Cell[20862, 640, 433, 9, 129, "Input"], Cell[21298, 651, 164, 4, 69, "Input"], Cell[21465, 657, 82, 2, 29, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[21584, 664, 44, 0, 41, "Subsection"], Cell[21631, 666, 431, 9, 69, "Input"], Cell[22065, 677, 434, 8, 129, "Input"], Cell[22502, 687, 103, 2, 29, "Input"], Cell[22608, 691, 430, 8, 129, "Input"], Cell[23041, 701, 257, 5, 69, "Input"], Cell[23301, 708, 100, 2, 29, "Input"], Cell[23404, 712, 100, 2, 29, "Input"], Cell[23507, 716, 228, 5, 69, "Input"], Cell[23738, 723, 404, 8, 109, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[24191, 737, 26, 0, 60, "Section"], Cell[24220, 739, 244, 6, 48, "Text"] }, Closed]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)