(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 75054, 1963] NotebookOptionsPosition[ 70592, 1829] NotebookOutlinePosition[ 71006, 1847] CellTagsIndexPosition[ 70963, 1844] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) 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[GraphicsData["PDF", "\<\ 9E14ARda;S@:9LO/Sj8:=B0`86mRJPXl?2m?mGLEM`d]E;:jQaE@eZ0@6l c0CnB21APmYndH`DBIehlG21NcjSMnYLSAU5ommo_YobilbjjO@;m4hOohjooilkonn_klmknn WcKf7?g?ooa[W;ioC_]CIRloHl]]aC9nVU`eIo_IlllhkO^IAO1^?nL8o^[?M?R? _lKNL/:94oIHNX>eOfXAGn_WT4F?;gi[`6Sok j1EV6NeW=[UWZClK^1AmYRBf1?j7IVcF>>?/bC_67gCh3TMXl;bT7Ah5B57DDY@5:o17oCBXbi^QRWco7ClaV[ JM[:n/V`cYnjN<6e=9J6i?WnUSBFYH3W5MKgTPM/:HH]1M]`N2;7goYID`4:Y4WA U7]/h8kB`=[m;NgPj7V3]Kl11LbOcMZGEX7V`d^dOB6Uo`>IjcmMCQVeX/7]>[A^ :m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vb=g6ihgUOF[l3NZG?g7NHJa_7USZVhM[ N5O>MM0@3_EM50D:2cG9ODaJS>SSkfm?/Kc9O0aFiQ3=M2Rm@HG9UKW@PB0`858:?Sh:IFiTKf9Z2SLP<21_ HVX:?3`_E7U`IBm5N7A7DgAQM6D:;dm@CB0a?SiUKVA_HVX:>20`86mRJPXl?2mB =`Xg830PDShn2VE^I6mRJPXi830PKf9Z2S`l;eAiL6D_CFEdHFAQM64:;e=eHWAi L6D_F4e<;daUKVMdJ20aF@W?ch:?3mQI6mRIBehHG0]IVU/ M6EbLb1ULfU94AR1hKFa^LcYbI6Hm9fQdM70j;bmgMgL^Mc<^Kg9W;c4i>CT_ <38_VUH?BMXM7A`>Rl_KW<^HFA_HVD^ Hfm];fUH;c4^<2lW?PXlLVAV>TAULf=bJG1dJFm^879TISYQHVmeM3dW=f<`IC0c Bd`<30`;F8i=CAR<6ISHVIQ>BLPN6e/KWRl_KW<^HFA_HVD^Hfm];gQQL2la;S0_9b1hHG0jCFmTJFIiA65dICdWBda <2daCXe=3Xc=2d`=3X`<2LPN65`>T=bIF5dIDAQM6Dm9c8`<3T]T=bIF5dKg9DKfm/?S`_LVAV>TAULf=bJG1d JFm^?PXlLVAV>TAULf=bJG1dJFm^879TISYQHVmeM3dW=f<`IC0cV5RKgEd?BLgHc1U<3CDdHS1VHf9VHCTW 87Q]K6ic>VAS?BMXM7A`>Rl_L7EbK2i_LVL_I6<_IFaUKFE^M7<_T5/M3hlLVAV >VaY87Q]K3Y/HFiW?BMh;FAUIV5eK7@W?UE^M6UdK6ET?2mbI6HjK6Tn?2mbI6Hj @Fad?S`_I6U94ASh:?2mh >WQ]L6eUM64n2R0P820P820P820P820P820P820P820P820P820P820P820P820P 820P820P820P820P820P820P820P820P820P820P820P80XP820P820P820P820P 820P820P820P820P820P820P820P820P820P820P820P820P820P820P820P820P 820P820P820P820:?3mhL65SJfEd86E^I3dWMbLo?PYUKVAcM79UHFd:IFiTKf9Z 2S8P<21_HVX:?3`_D79_I7ESIG8XAe1<84MXKg=dLf=bJG1d83P^=SC4`CDd3Hc 85`XL7=gLVUdIE`Y:ChnIFiTKf9Z2VmRJPXl?0X_AFiSKfAYKVLP;deQHe9_KF5^ AFiSKfAYKVL:;e1bIF5]HVaU82Q5Df5^KVm`AE=cK65cJ6A_HgE]IFidHfaQLg=K 2DeA2Dg@VU^L7EdIFiS9CM49C8`9C8e MG=UIWE/9C8`M6lU"], "Graphics", ImageSize->{389, 76}], Cell[BoxData[ RowBox[{ RowBox[{"Off", "[", RowBox[{"General", "::", "spell1"}], "]"}], ";"}]], "Input", CellLabel->"In[1]:="], Cell["Define Laplace's Equation\[Ellipsis]", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"eqn", "[", RowBox[{"i_", ",", "j_"}], "]"}], " ", ":=", RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", " ", RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{ RowBox[{"i", "+", "1"}], ",", "j"}], "]"}], " ", "-", " ", RowBox[{"2", " ", RowBox[{"\[Psi]", "[", RowBox[{"i", ",", "j"}], "]"}]}], " ", "+", " ", RowBox[{"\[Psi]", "[", RowBox[{ RowBox[{"i", "-", "1"}], ",", "j"}], "]"}]}], ")"}], "/", RowBox[{"\[Delta]x", "^", "2"}]}], " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"i", ",", RowBox[{"j", "+", "1"}]}], "]"}], " ", "-", " ", RowBox[{"2", " ", RowBox[{"\[Psi]", "[", RowBox[{"i", ",", "j"}], "]"}]}], " ", "+", " ", RowBox[{"\[Psi]", "[", RowBox[{"i", ",", RowBox[{"j", "-", "1"}]}], "]"}]}], ")"}], "/", RowBox[{"\[Delta]y", "^", "2"}]}]}], " ", "\[Equal]", " ", "0"}]}]], "Input", CellLabel->"In[2]:="], Cell[BoxData[ RowBox[{"eqn", "[", RowBox[{"i", ",", "j"}], "]"}]], "Input", CellLabel->"In[3]:="] }, Closed]], Cell[CellGroupData[{ Cell["Define a Grid", "Section"], Cell[BoxData[{ RowBox[{ RowBox[{"height", " ", "=", " ", "1.0"}], " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"length", " ", "=", " ", "5.0"}], " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"wallHeight", " ", "=", " ", "0.5"}], " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{ 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[{ RowBox[{ RowBox[{"numX", " ", "=", " ", "80"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"numY", " ", "=", " ", "60"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Print", "[", RowBox[{"\"\\"", ",", " ", RowBox[{"numX", " ", "numY"}]}], "]"}], ";"}]}], "Input", CellLabel->"In[8]:="], Cell[BoxData[{ RowBox[{ RowBox[{"dx", " ", "=", " ", RowBox[{"length", "/", RowBox[{"(", RowBox[{"numX", "-", "1"}], ")"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"dy", " ", "=", " ", RowBox[{"height", "/", RowBox[{"(", RowBox[{"numY", " ", "-", "1"}], ")"}]}]}], ";"}]}], "Input", CellLabel->"In[11]:="], Cell[BoxData[ RowBox[{"wallLength", "/", "dx"}]], "Input", CellLabel->"In[13]:="], Cell[BoxData[ RowBox[{"wallHeight", "/", "dy"}]], "Input", CellLabel->"In[14]:="], Cell[BoxData[ RowBox[{ RowBox[{"flow", " ", "=", " ", "5.0"}], " ", RowBox[{"(*", " ", StyleBox[ RowBox[{"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[ RowBox[{ RowBox[{ RowBox[{"length", "/", "2"}], "-", RowBox[{"wallLength", "/", "2"}]}], "\[LessEqual]", " ", RowBox[{ RowBox[{"(", RowBox[{"ix", "-", "1"}], ")"}], " ", "dx"}], " ", "\[LessEqual]", " ", RowBox[{ RowBox[{"length", "/", "2"}], " ", "+", RowBox[{"wallLength", "/", "2"}]}]}], FontColor->RGBColor[1, 0, 1]], StyleBox[" ", FontColor->RGBColor[1, 0, 1]], StyleBox["&&", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"iy", "-", "1"}], ")"}], " ", "dy"}], "\[LessEqual]", " ", "wallHeight"}], FontColor->GrayLevel[0]]}], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["||", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[ RowBox[{"ix", " ", "\[Equal]", " ", "1"}], FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["||", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[ RowBox[{"ix", " ", "==", " ", "numX"}], FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["||", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[ RowBox[{"iy", " ", "\[Equal]", " ", "1"}], FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox["||", FontColor->GrayLevel[0]], StyleBox[" ", FontColor->GrayLevel[0]], StyleBox[ RowBox[{"iy", " ", "==", " ", "numY"}], FontColor->GrayLevel[0]]}], ",", " ", "1", ",", " ", "0"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"ix", ",", " ", "1", ",", " ", "numX"}], "}"}], ",", RowBox[{"{", RowBox[{"iy", ",", " ", "1", ",", " ", "numY"}], "}"}]}], "]"}]}], ";"}]], "Input", CellLabel->"In[16]:="], Cell[BoxData[ RowBox[{"Dimensions", "[", "grid", "]"}]], "Input", CellLabel->"In[17]:="], Cell[BoxData[ RowBox[{ RowBox[{"Count", "[", RowBox[{ RowBox[{"Flatten", "[", "grid", "]"}], ",", RowBox[{"x_", "/;", RowBox[{"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[{ RowBox[{"Count", "[", RowBox[{ RowBox[{"Flatten", "[", "grid", "]"}], ",", RowBox[{"x_", "/;", RowBox[{"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[ RowBox[{"Length", "[", RowBox[{"Flatten", "[", "grid", "]"}], "]"}]], "Input", CellLabel->"In[20]:="], Cell[BoxData[ RowBox[{"ArrayPlot", "[", RowBox[{ RowBox[{"Transpose", "[", "grid", "]"}], ",", RowBox[{"Mesh", "\[Rule]", "True"}]}], "]"}]], "Input", CellLabel->"In[21]:="], Cell[BoxData[ RowBox[{ RowBox[{"wallBound", "[", "ix_", "]"}], " ", ":=", " ", RowBox[{"If", "[", RowBox[{ StyleBox[ RowBox[{ RowBox[{ RowBox[{"length", "/", "2"}], "-", RowBox[{"wallLength", "/", "2"}]}], "\[LessEqual]", " ", RowBox[{ RowBox[{"(", RowBox[{"ix", "-", "1"}], ")"}], " ", "dx"}], " ", "\[LessEqual]", " ", RowBox[{ RowBox[{"length", "/", "2"}], " ", "+", RowBox[{"wallLength", "/", "2"}]}]}], FontColor->RGBColor[1, 0, 1]], ",", " ", RowBox[{ RowBox[{"Floor", "[", RowBox[{"wallHeight", "/", "dy"}], "]"}], "+", "1"}], ",", " ", "1"}], "]"}]}]], "Input", CellLabel->"In[22]:="], Cell[BoxData[ RowBox[{"ListPlot", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"wallBound", "[", "ix", "]"}], ",", RowBox[{"{", RowBox[{"ix", ",", RowBox[{"Floor", "[", FractionBox["numX", "4"], "]"}], ",", RowBox[{"Floor", "[", FractionBox[ RowBox[{"3", " ", "numX"}], "4"], "]"}]}], "}"}]}], "]"}], ",", RowBox[{"Frame", "\[Rule]", "True"}], ",", RowBox[{"PlotStyle", "\[Rule]", RowBox[{"PointSize", "[", "0.02`", "]"}]}], ",", RowBox[{"Axes", "\[Rule]", "False"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\<\>\""}], "}"}]}]}], "]"}]], "Input", CellLabel->"In[23]:="] }, Closed]], Cell[CellGroupData[{ Cell["Define Boundary Conditions", "Section"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"Clear", "[", "\[Psi]", "]"}], ";"}], " ", RowBox[{"(*", " ", StyleBox[ RowBox[{ "\[Psi]", " ", "is", " ", "the", " ", "variable", " ", "used", " ", "to", " ", "store", " ", "the", " ", RowBox[{"streamfunction", "."}]}], FontColor->RGBColor[0, 1, 0]], " ", "*)"}]}]], "Input", CellLabel->"In[24]:="], Cell["Top and bottom\[Ellipsis]", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"ix_", ",", "numY"}], "]"}], " ", "=", " ", RowBox[{"flow", " ", "height"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"ix_", ",", "1"}], "]"}], " ", "=", " ", "0"}], ";"}]}], "Input", CellLabel->"In[25]:="], Cell["Left and right sides\[Ellipsis]", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"1", ",", "iy_"}], "]"}], " ", "=", " ", RowBox[{"flow", " ", RowBox[{"(", RowBox[{"iy", "-", "1"}], ")"}], " ", "dy"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"numX", ",", "iy_"}], "]"}], " ", "=", " ", RowBox[{"flow", " ", RowBox[{"(", RowBox[{"iy", "-", "1"}], ")"}], " ", "dy"}]}], ";"}]}], "Input", CellLabel->"In[27]:="], Cell["The wall\[Ellipsis]", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"ix", ",", "iy"}], "]"}], " ", "=", " ", "0"}], ",", " ", RowBox[{"{", RowBox[{"iy", ",", " ", "1", ",", " ", RowBox[{"wallBound", "[", "ix", "]"}]}], "}"}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{"ix", ",", " ", "1", ",", " ", "numX"}], "}"}]}], "]"}], ";"}]], "Input", CellLabel->"In[29]:="] }, Closed]], Cell[CellGroupData[{ Cell["Define the Equations", "Section"], Cell[BoxData[ RowBox[{ RowBox[{"eqns", " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"eqn", "[", RowBox[{"ix", ",", "iy"}], "]"}], ",", RowBox[{"{", RowBox[{"iy", ",", " ", RowBox[{ RowBox[{"wallBound", "[", "ix", "]"}], "+", "1"}], ",", " ", RowBox[{"numY", "-", "1"}]}], "}"}]}], "]"}], " ", ",", RowBox[{"{", RowBox[{"ix", ",", " ", "2", ",", " ", RowBox[{"numX", "-", "1"}]}], "}"}]}], "]"}], "]"}], " ", "/.", " ", RowBox[{"\[Delta]x", " ", "\[Rule]", " ", "dx"}]}], " ", "/.", " ", RowBox[{"\[Delta]y", " ", "\[Rule]", " ", "dy"}]}]}], ";"}]], "Input", CellLabel->"In[30]:="], Cell[BoxData[ RowBox[{ RowBox[{"eqns", " ", "=", " ", RowBox[{"Simplify", "[", "eqns", "]"}]}], ";"}]], "Input", CellLabel->"In[31]:="], Cell[BoxData[ RowBox[{"Dimensions", "[", "eqns", "]"}]], "Input", CellLabel->"In[32]:="], Cell[BoxData[ RowBox[{"eqns", "\[LeftDoubleBracket]", RowBox[{"{", RowBox[{"1", ",", "2", ",", "3"}], "}"}], "\[RightDoubleBracket]"}]], "Input", CellLabel->"In[33]:="], Cell[BoxData[ RowBox[{ RowBox[{"unknowns", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"ix", ",", "iy"}], "]"}], ",", RowBox[{"{", RowBox[{"iy", ",", " ", RowBox[{ RowBox[{"wallBound", "[", "ix", "]"}], "+", "1"}], ",", " ", RowBox[{"numY", "-", "1"}]}], "}"}]}], "]"}], " ", ",", RowBox[{"{", RowBox[{"ix", ",", " ", "2", ",", " ", RowBox[{"numX", "-", "1"}]}], "}"}]}], "]"}], "]"}]}], ";"}]], "Input",\ CellLabel->"In[34]:="], Cell[BoxData[ RowBox[{"unknowns", "\[LeftDoubleBracket]", RowBox[{"{", RowBox[{"1", ",", "2", ",", "3"}], "}"}], "\[RightDoubleBracket]"}]], "Input", CellLabel->"In[35]:="], Cell[BoxData[ RowBox[{"Dimensions", "[", "unknowns", "]"}]], "Input", CellLabel->"In[36]:="] }, Closed]], Cell[CellGroupData[{ Cell["Finding the Solution", "Section"], Cell[BoxData[ RowBox[{"Timing", "[", RowBox[{ RowBox[{"sol", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{"Solve", "[", RowBox[{"eqns", ",", "unknowns"}], "]"}], "]"}]}], ";"}], "]"}]], "Input", CellLabel->"In[37]:="], Cell[BoxData[ RowBox[{ RowBox[{"\[Psi]Sol", " ", "=", " ", RowBox[{"Interpolation", "[", RowBox[{"Flatten", "[", RowBox[{ RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"ix", "-", "1"}], ")"}], " ", "dx"}], ",", " ", RowBox[{ RowBox[{"(", RowBox[{"iy", "-", "1"}], ")"}], " ", "dy"}], ",", " ", RowBox[{"\[Psi]", "[", RowBox[{"ix", ",", "iy"}], "]"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"ix", ",", " ", "1", ",", " ", "numX"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"iy", ",", " ", "1", ",", " ", "numY"}], "}"}]}], "]"}], " ", "/.", " ", "sol"}], ",", "1"}], "]"}], "]"}]}], ";"}]], "Input", CellLabel->"In[38]:="], Cell[BoxData[ RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"\[Psi]Sol", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "length"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"ContourShading", "\[Rule]", "False"}], ",", RowBox[{"Contours", "\[Rule]", "18"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"PerformanceGoal", " ", "\[Rule]", " ", "\"\\""}], ",", " ", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellChangeTimes->{{3.432286002259787*^9, 3.4322860161594954`*^9}}, CellLabel->"In[39]:="], Cell[BoxData[ RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"\[Psi]Sol", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", RowBox[{ FractionBox["length", "2"], "+", FractionBox["height", "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"ContourShading", "\[Rule]", "False"}], ",", RowBox[{"Contours", "\[Rule]", "18"}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"PerformanceGoal", " ", "\[Rule]", " ", "\"\\""}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellChangeTimes->{3.4322860358686333`*^9}, CellLabel->"In[40]:="] }, Closed]], Cell[CellGroupData[{ Cell["Computing the Velocity", "Section"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"uX", "[", RowBox[{"xx_", ",", "yy_"}], "]"}], " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"D", "[", RowBox[{ RowBox[{"\[Psi]Sol", "[", RowBox[{"x", ",", "y"}], "]"}], ",", "y"}], "]"}], " ", "/.", " ", RowBox[{"x", " ", "\[Rule]", " ", "xx"}]}], " ", "/.", " ", RowBox[{"y", " ", "\[Rule]", " ", "yy"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"uY", "[", RowBox[{"xx_", ",", "yy_"}], "]"}], " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"D", "[", RowBox[{ RowBox[{"\[Psi]Sol", "[", RowBox[{"x", ",", "y"}], "]"}], ",", "x"}], "]"}]}], "/.", " ", RowBox[{"x", " ", "\[Rule]", " ", "xx"}]}], " ", "/.", " ", RowBox[{"y", " ", "\[Rule]", " ", "yy"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"u2", "[", RowBox[{"x_", ",", "y_"}], "]"}], " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"uX", "[", RowBox[{"x", ",", "y"}], "]"}], "^", "2"}], " ", "+", " ", RowBox[{ RowBox[{"uY", "[", RowBox[{"x", ",", "y"}], "]"}], "^", "2"}]}]}], ";"}]}], "Input", CellLabel->"In[41]:="], Cell[BoxData[ RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{ FractionBox["1", "2"], " ", RowBox[{"u2", "[", RowBox[{"x", ",", "y"}], "]"}]}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", RowBox[{ FractionBox["length", "2"], "+", FractionBox["height", "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"ContourShading", "\[Rule]", "False"}], ",", RowBox[{"Contours", "\[Rule]", "18"}], ",", RowBox[{"PerformanceGoal", " ", "\[Rule]", " ", "\"\\""}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellChangeTimes->{3.432286041621207*^9}, CellLabel->"In[44]:="], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"Cp", "[", RowBox[{"x_", ",", "y_"}], "]"}], " ", "=", " ", RowBox[{"1", " ", "-", " ", RowBox[{ RowBox[{"u2", "[", RowBox[{"x", ",", "y"}], "]"}], "/", RowBox[{"flow", "^", "2"}]}]}]}], ";"}]], "Input", CellLabel->"In[45]:="], Cell[BoxData[ RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"Cp", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", RowBox[{ FractionBox["length", "2"], "+", FractionBox["height", "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"ContourShading", "\[Rule]", "False"}], ",", RowBox[{"Contours", "\[Rule]", "18"}], ",", RowBox[{"PerformanceGoal", " ", "\[Rule]", " ", "\"\\""}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellChangeTimes->{3.432286045613276*^9}, CellLabel->"In[46]:="], Cell[BoxData[ RowBox[{"Plot3D", "[", RowBox[{ RowBox[{"Cp", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", RowBox[{ FractionBox["length", "2"], "+", FractionBox["height", "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellLabel->"In[47]:="], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"%", ",", RowBox[{"ViewPoint", "\[Rule]", RowBox[{"{", RowBox[{"1.2`", ",", "1.2`", ",", "1.2`"}], "}"}]}]}], "]"}]], "Input", CellLabel->"In[48]:="], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"Cp", "[", RowBox[{ RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{ "PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellLabel->"In[49]:="], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"Cp", "[", RowBox[{"x", ",", "wallHeight"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "length"}], "}"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellLabel->"In[50]:="] }, Closed]], Cell[CellGroupData[{ Cell["Flow Past a Cylinder", "Section"], Cell[BoxData[ RowBox[{ RowBox[{"Clear", "[", RowBox[{"\[Psi]", ",", "uX", ",", "uY", ",", "u2"}], "]"}], ";"}]], "Input",\ CellLabel->"In[51]:="], Cell[BoxData[{ RowBox[{ RowBox[{"radius", " ", "=", " ", "0.2"}], " ", RowBox[{"(*", " ", StyleBox["meter", FontColor->RGBColor[0, 1, 0]], " ", "*)"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"centerY", " ", "=", " ", RowBox[{"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[{ RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"ix_", ",", "numY"}], "]"}], " ", "=", " ", RowBox[{"flow", " ", "height"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"ix_", ",", "1"}], "]"}], " ", "=", " ", "0"}], ";"}]}], "Input", CellLabel->"In[54]:="], Cell["Left and right sides\[Ellipsis]", "Text"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"1", ",", "iy_"}], "]"}], " ", "=", " ", RowBox[{"flow", " ", RowBox[{"(", RowBox[{"iy", "-", "1"}], ")"}], " ", "dy"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"numX", ",", "iy_"}], "]"}], " ", "=", " ", RowBox[{"flow", " ", RowBox[{"(", RowBox[{"iy", "-", "1"}], ")"}], " ", "dy"}]}], ";"}]}], "Input", CellLabel->"In[56]:="], Cell["The cylinder", "Text"], Cell[BoxData[ RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ StyleBox[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"ix", "-", "1"}], ")"}], " ", "dx"}], " ", "-", " ", RowBox[{"length", "/", "2"}]}], ")"}], "^", "2"}], " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"iy", " ", "-", "1"}], ")"}], "dy"}], " ", "-", " ", "centerY"}], ")"}], "^", "2"}]}], " ", "\[LessEqual]", " ", RowBox[{"radius", "^", "2"}]}], FontColor->RGBColor[1, 0, 1]], ",", " ", RowBox[{ RowBox[{"\[Psi]", "[", RowBox[{"ix", ",", "iy"}], "]"}], " ", "=", " ", RowBox[{"flow", " ", "centerY"}]}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{"iy", ",", " ", "1", ",", "numY"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"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[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"ix", "-", "1"}], ")"}], " ", "dx"}], " ", "-", " ", RowBox[{"length", "/", "2"}]}], ")"}], "^", "2"}], " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"iy", " ", "-", "1"}], ")"}], "dy"}], " ", "-", " ", "centerY"}], ")"}], "^", "2"}]}], " ", "\[LessEqual]", " ", RowBox[{"radius", "^", "2"}]}], FontColor->RGBColor[1, 0, 1]], ",", RowBox[{"-", "1"}], ",", RowBox[{"eqn", "[", RowBox[{"ix", ",", "iy"}], "]"}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{"iy", ",", " ", "2", ",", RowBox[{"numY", "-", "1"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"ix", ",", " ", "2", ",", " ", RowBox[{"numX", "-", "1"}]}], "}"}]}], "]"}], "]"}], " ", "/.", " ", RowBox[{"\[Delta]x", " ", "\[Rule]", " ", "dx"}]}], " ", "/.", " ", RowBox[{"\[Delta]y", " ", "\[Rule]", " ", "dy"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"eqns", " ", "=", " ", RowBox[{"DeleteCases", "[", RowBox[{"eqns", ",", " ", RowBox[{"_", "?", "Negative"}]}], "]"}]}], ";"}]}], "Input", CellLabel->"In[59]:="], Cell[BoxData[ RowBox[{"Dimensions", "[", "eqns", "]"}]], "Input", CellLabel->"In[61]:="], Cell[BoxData[ RowBox[{ RowBox[{"eqns", " ", "=", " ", RowBox[{"Simplify", "[", "eqns", "]"}]}], ";"}]], "Input", CellLabel->"In[62]:="], Cell[BoxData[ RowBox[{"eqns", "\[LeftDoubleBracket]", RowBox[{"{", RowBox[{"1", ",", "2", ",", "3"}], "}"}], "\[RightDoubleBracket]"}]], "Input", CellLabel->"In[63]:="], Cell[BoxData[{ RowBox[{ RowBox[{"unknowns", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{"Table", "[", RowBox[{ RowBox[{"If", "[", RowBox[{ StyleBox[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"ix", "-", "1"}], ")"}], " ", "dx"}], " ", "-", " ", RowBox[{"length", "/", "2"}]}], ")"}], "^", "2"}], " ", "+", " ", RowBox[{ RowBox[{"(", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"iy", " ", "-", "1"}], ")"}], "dy"}], " ", "-", " ", "centerY"}], ")"}], "^", "2"}]}], " ", "\[LessEqual]", " ", RowBox[{"radius", "^", "2"}]}], FontColor->RGBColor[1, 0, 1]], ",", RowBox[{"-", "1"}], ",", RowBox[{"\[Psi]", "[", RowBox[{"ix", ",", "iy"}], "]"}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{"iy", ",", " ", "2", ",", RowBox[{"numY", "-", "1"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"ix", ",", " ", "2", ",", " ", RowBox[{"numX", "-", "1"}]}], "}"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"unknowns", " ", "=", " ", RowBox[{"DeleteCases", "[", RowBox[{"unknowns", ",", " ", RowBox[{"_", "?", "Negative"}]}], "]"}]}], ";"}]}], "Input", CellLabel->"In[64]:="], Cell[BoxData[ RowBox[{"unknowns", "\[LeftDoubleBracket]", RowBox[{"{", RowBox[{"1", ",", "2", ",", "3"}], "}"}], "\[RightDoubleBracket]"}]], "Input", CellLabel->"In[66]:="], Cell[BoxData[ RowBox[{"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[ RowBox[{"Timing", "[", RowBox[{ RowBox[{"sol", " ", "=", " ", RowBox[{"Flatten", "[", RowBox[{"Solve", "[", RowBox[{"eqns", ",", "unknowns"}], "]"}], "]"}]}], ";"}], "]"}]], "Input", CellLabel->"In[68]:="], Cell[BoxData[ RowBox[{ RowBox[{"\[Psi]Sol", " ", "=", " ", RowBox[{"Interpolation", "[", RowBox[{"Flatten", "[", RowBox[{ RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"ix", "-", "1"}], ")"}], " ", "dx"}], ",", " ", RowBox[{ RowBox[{"(", RowBox[{"iy", "-", "1"}], ")"}], " ", "dy"}], ",", " ", RowBox[{"\[Psi]", "[", RowBox[{"ix", ",", "iy"}], "]"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{"ix", ",", " ", "1", ",", " ", "numX"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"iy", ",", " ", "1", ",", " ", "numY"}], "}"}]}], "]"}], " ", "/.", " ", "sol"}], ",", "1"}], "]"}], "]"}]}], ";"}]], "Input", CellLabel->"In[69]:="], Cell[BoxData[ RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"\[Psi]Sol", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", "0", ",", "length"}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"ContourShading", "\[Rule]", "False"}], ",", RowBox[{"Contours", "\[Rule]", "24"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"PerformanceGoal", " ", "\[Rule]", " ", "\"\\""}], ",", RowBox[{ "PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellChangeTimes->{3.4322860537699738`*^9}, CellLabel->"In[70]:="], Cell[BoxData[ RowBox[{"plt", "=", RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"\[Psi]Sol", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", RowBox[{ FractionBox["length", "2"], "+", FractionBox["height", "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"ContourShading", "\[Rule]", "False"}], ",", RowBox[{"PerformanceGoal", " ", "\[Rule]", " ", "\"\\""}], ",", RowBox[{"Contours", "\[Rule]", "24"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{ "PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]}]], "Input", CellChangeTimes->{3.432286057117145*^9}, CellLabel->"In[71]:="], Cell[BoxData[ RowBox[{"cylinder", "=", RowBox[{"Graphics", "[", RowBox[{"{", RowBox[{ RowBox[{"Thickness", "[", "0.02`", "]"}], ",", RowBox[{"Circle", "[", RowBox[{ RowBox[{"{", RowBox[{ FractionBox["length", "2"], ",", "centerY"}], "}"}], ",", "radius"}], "]"}]}], "}"}], "]"}]}]], "Input", CellLabel->"In[72]:="], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"plt", ",", "cylinder"}], "]"}]], "Input", CellLabel->"In[73]:="] }, Closed]], Cell[CellGroupData[{ Cell["Computing the Velocity", "Subsection"], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"uX", "[", RowBox[{"xx_", ",", "yy_"}], "]"}], " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"D", "[", RowBox[{ RowBox[{"\[Psi]Sol", "[", RowBox[{"x", ",", "y"}], "]"}], ",", "y"}], "]"}], " ", "/.", " ", RowBox[{"x", " ", "\[Rule]", " ", "xx"}]}], " ", "/.", " ", RowBox[{"y", " ", "\[Rule]", " ", "yy"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"uY", "[", RowBox[{"xx_", ",", "yy_"}], "]"}], " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"-", RowBox[{"D", "[", RowBox[{ RowBox[{"\[Psi]Sol", "[", RowBox[{"x", ",", "y"}], "]"}], ",", "x"}], "]"}]}], "/.", " ", RowBox[{"x", " ", "\[Rule]", " ", "xx"}]}], " ", "/.", " ", RowBox[{"y", " ", "\[Rule]", " ", "yy"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"u2", "[", RowBox[{"x_", ",", "y_"}], "]"}], " ", "=", " ", RowBox[{ RowBox[{ RowBox[{"uX", "[", RowBox[{"x", ",", "y"}], "]"}], "^", "2"}], " ", "+", " ", RowBox[{ RowBox[{"uY", "[", RowBox[{"x", ",", "y"}], "]"}], "^", "2"}]}]}], ";"}]}], "Input", CellLabel->"In[74]:="], Cell[BoxData[ RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{ FractionBox["1", "2"], " ", RowBox[{"u2", "[", RowBox[{"x", ",", "y"}], "]"}]}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", RowBox[{ FractionBox["length", "2"], "+", FractionBox["height", "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"ContourShading", "\[Rule]", "False"}], ",", RowBox[{"Contours", "\[Rule]", "18"}], ",", RowBox[{"PerformanceGoal", " ", "\[Rule]", " ", "\"\\""}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellChangeTimes->{3.432286063149158*^9}, CellLabel->"In[77]:="], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{"Cp", "[", RowBox[{"x_", ",", "y_"}], "]"}], " ", "=", " ", RowBox[{"1", " ", "-", " ", RowBox[{ RowBox[{"u2", "[", RowBox[{"x", ",", "y"}], "]"}], "/", RowBox[{"flow", "^", "2"}]}]}]}], ";"}]], "Input", CellLabel->"In[78]:="], Cell[BoxData[ RowBox[{"ContourPlot", "[", RowBox[{ RowBox[{"Cp", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", RowBox[{ FractionBox["length", "2"], "+", FractionBox["height", "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"ContourShading", "\[Rule]", "False"}], ",", RowBox[{"Contours", "\[Rule]", "18"}], ",", RowBox[{"PerformanceGoal", " ", "\[Rule]", " ", "\"\\""}], ",", RowBox[{"AspectRatio", "\[Rule]", "Automatic"}], ",", RowBox[{"FrameLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellChangeTimes->{3.432286067540759*^9}, CellLabel->"In[79]:="], Cell[BoxData[ RowBox[{"Plot3D", "[", RowBox[{ RowBox[{"Cp", "[", RowBox[{"x", ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"x", ",", RowBox[{ FractionBox["length", "2"], "-", FractionBox["height", "2"]}], ",", RowBox[{ FractionBox["length", "2"], "+", FractionBox["height", "2"]}]}], "}"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"PlotPoints", "\[Rule]", "80"}], ",", RowBox[{"PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellLabel->"In[80]:="], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"%", ",", RowBox[{"ViewPoint", "\[Rule]", RowBox[{"{", RowBox[{"1.2`", ",", "1.2`", ",", "1.2`"}], "}"}]}]}], "]"}]], "Input", CellLabel->"In[81]:="], Cell[BoxData[ RowBox[{"Show", "[", RowBox[{"%%", ",", RowBox[{"PlotRange", "\[Rule]", "All"}]}], "]"}]], "Input", CellLabel->"In[82]:="], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"Cp", "[", RowBox[{ FractionBox["length", "2"], ",", "y"}], "]"}], ",", RowBox[{"{", RowBox[{"y", ",", "0", ",", "height"}], "}"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{ "PlotLabel", "\[Rule]", "\"\\""}]}], "]"}]], "Input", CellLabel->"In[83]:="], Cell[BoxData[ RowBox[{"Plot", "[", RowBox[{ RowBox[{"Cp", "[", RowBox[{ RowBox[{ FractionBox["length", "2"], "+", RowBox[{"1.1`", " ", "radius", " ", RowBox[{"Cos", "[", "\[Theta]", "]"}]}]}], ",", RowBox[{"centerY", "+", RowBox[{"1.1`", " ", "radius", " ", RowBox[{"Sin", "[", "\[Theta]", "]"}]}]}]}], "]"}], ",", RowBox[{"{", RowBox[{"\[Theta]", ",", "0", ",", RowBox[{"2", " ", "\[Pi]"}]}], "}"}], ",", RowBox[{"AxesLabel", "\[Rule]", RowBox[{"{", RowBox[{"\"\<\[Theta]\>\"", ",", "\"\\""}], "}"}]}], ",", RowBox[{"Ticks", "\[Rule]", RowBox[{"{", RowBox[{ RowBox[{"Range", "[", RowBox[{"0", ",", RowBox[{"2", " ", "\[Pi]"}], ",", FractionBox["\[Pi]", "2"]}], "]"}], ",", "Automatic"}], "}"}]}], ",", RowBox[{ "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 ]] }, WindowSize->{653, 828}, WindowMargins->{{19, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowSelection->True, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (May 21, 2008)", StyleDefinitions->"TutorialBook.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[590, 23, 62, 0, 103, "Title"], Cell[655, 25, 78, 3, 43, "Subsubtitle"], Cell[736, 30, 511, 11, 74, "Text"], Cell[CellGroupData[{ Cell[1272, 45, 54, 0, 87, "Section"], Cell[1329, 47, 30110, 464, 84, "Graphics"], Cell[31442, 513, 133, 4, 27, "Input"], Cell[31578, 519, 52, 0, 23, "Text"], Cell[31633, 521, 1083, 33, 68, "Input"], Cell[32719, 556, 102, 3, 27, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[32858, 564, 32, 0, 55, "Section"], Cell[32893, 566, 769, 24, 88, "Input"], Cell[33665, 592, 164, 8, 22, "Text"], Cell[33832, 602, 356, 9, 68, "Input"], Cell[34191, 613, 354, 11, 48, "Input"], Cell[34548, 626, 83, 2, 27, "Input"], Cell[34634, 630, 83, 2, 27, "Input"], Cell[34720, 634, 224, 7, 27, "Input"], Cell[34947, 643, 2470, 77, 168, "Input"], Cell[37420, 722, 90, 2, 27, "Input"], Cell[37513, 726, 785, 27, 48, "Input"], Cell[38301, 755, 787, 27, 48, "Input"], Cell[39091, 784, 120, 3, 27, "Input"], Cell[39214, 789, 185, 5, 27, "Input"], Cell[39402, 796, 711, 22, 68, "Input"], Cell[40116, 820, 790, 22, 142, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[40943, 847, 45, 0, 55, "Section"], Cell[40991, 849, 377, 11, 48, "Input"], Cell[41371, 862, 41, 0, 23, "Text"], Cell[41415, 864, 339, 10, 48, "Input"], Cell[41757, 876, 47, 0, 23, "Text"], Cell[41807, 878, 489, 16, 48, "Input"], Cell[42299, 896, 35, 0, 22, "Text"], Cell[42337, 898, 497, 15, 48, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[42871, 918, 39, 0, 55, "Section"], Cell[42913, 920, 843, 23, 108, "Input"], Cell[43759, 945, 143, 4, 27, "Input"], Cell[43905, 951, 90, 2, 27, "Input"], Cell[43998, 955, 180, 5, 27, "Input"], Cell[44181, 962, 644, 19, 108, "Input"], Cell[44828, 983, 184, 5, 27, "Input"], Cell[45015, 990, 94, 2, 27, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[45146, 997, 39, 0, 55, "Section"], Cell[45188, 999, 248, 8, 27, "Input"], Cell[45439, 1009, 876, 24, 88, "Input"], Cell[46318, 1035, 819, 20, 88, "Input"], Cell[47140, 1057, 1011, 26, 183, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[48188, 1088, 41, 0, 55, "Section"], Cell[48232, 1090, 1230, 39, 68, "Input"], Cell[49465, 1131, 1042, 28, 171, "Input"], Cell[50510, 1161, 305, 10, 27, "Input"], Cell[50818, 1173, 995, 26, 183, "Input"], Cell[51816, 1201, 593, 18, 107, "Input"], Cell[52412, 1221, 212, 6, 27, "Input"], Cell[52627, 1229, 519, 16, 107, "Input"], Cell[53149, 1247, 432, 12, 68, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[53618, 1264, 39, 0, 55, "Section"], Cell[53660, 1266, 154, 5, 27, "Input"], Cell[53817, 1273, 421, 13, 48, "Input"], Cell[CellGroupData[{ Cell[54263, 1290, 48, 0, 35, "Subsection"], Cell[54314, 1292, 41, 0, 23, "Text"], Cell[54358, 1294, 339, 10, 48, "Input"], Cell[54700, 1306, 47, 0, 23, "Text"], Cell[54750, 1308, 489, 16, 48, "Input"], Cell[55242, 1326, 28, 0, 22, "Text"], Cell[55273, 1328, 1155, 35, 108, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[56465, 1368, 42, 0, 35, "Subsection"], Cell[56510, 1370, 1745, 49, 168, "Input"], Cell[58258, 1421, 90, 2, 27, "Input"], Cell[58351, 1425, 143, 4, 27, "Input"], Cell[58497, 1431, 180, 5, 27, "Input"], Cell[58680, 1438, 1512, 44, 148, "Input"], Cell[60195, 1484, 184, 5, 27, "Input"], Cell[60382, 1491, 94, 2, 27, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[60513, 1498, 30, 0, 35, "Subsection"], Cell[60546, 1500, 191, 8, 22, "Text"], Cell[60740, 1510, 248, 8, 27, "Input"], Cell[60991, 1520, 876, 24, 88, "Input"], Cell[61870, 1546, 794, 20, 88, "Input"], Cell[62667, 1568, 1007, 27, 183, "Input"], Cell[63677, 1597, 378, 12, 106, "Input"], Cell[64058, 1611, 113, 3, 27, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[64208, 1619, 44, 0, 35, "Subsection"], Cell[64255, 1621, 1230, 39, 68, "Input"], Cell[65488, 1662, 1046, 28, 191, "Input"], Cell[66537, 1692, 305, 10, 27, "Input"], Cell[66845, 1704, 995, 26, 183, "Input"], Cell[67843, 1732, 593, 18, 107, "Input"], Cell[68439, 1752, 212, 6, 27, "Input"], Cell[68654, 1760, 145, 4, 27, "Input"], Cell[68802, 1766, 463, 14, 107, "Input"], Cell[69268, 1782, 979, 29, 181, "Input"] }, Closed]] }, Closed]], Cell[CellGroupData[{ Cell[70296, 1817, 26, 0, 55, "Section"], Cell[70325, 1819, 239, 6, 39, "Text"] }, Closed]] }, Open ]] } ] *) (* End of internal cache information *)