(* Content-type: application/vnd.wolfram.mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 11.1' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 158, 7] NotebookDataLength[ 10019, 318] NotebookOptionsPosition[ 9715, 304] NotebookOutlinePosition[ 10058, 319] CellTagsIndexPosition[ 10015, 316] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[BoxData[{ RowBox[{ RowBox[{"wing", " ", "=", " ", RowBox[{"Polygon", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "18"}], ",", RowBox[{"-", "2.2"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "14"}], ",", RowBox[{"-", "3"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "9"}], ",", RowBox[{"-", "2.5"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"12", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"18", ",", "1.5"}], "}"}], ",", RowBox[{"{", RowBox[{"11", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"6", ",", "2.2"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "2"}], ",", "2.2"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "11"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "17"}], ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "18"}], ",", RowBox[{"-", "2.2"}]}], "}"}]}], "}"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"rectangle", " ", "=", " ", RowBox[{"Rectangle", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "30"}], ",", RowBox[{"-", "15"}]}], "}"}], ",", RowBox[{"{", RowBox[{"30", ",", "15"}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"reg", " ", "=", " ", RowBox[{"RegionDifference", "[", RowBox[{"rectangle", ",", "wing"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Needs", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"mesh", "=", RowBox[{"ToElementMesh", "[", RowBox[{ RowBox[{"DiscretizeRegion", "[", "reg", "]"}], ",", RowBox[{"MaxCellMeasure", "\[Rule]", "3"}], ",", RowBox[{"\"\\"", "\[Rule]", " ", "1"}]}], "]"}]}], ";"}], "\n", RowBox[{ RowBox[{"mesh", "[", "\"\\"", "]"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Remove", " ", "semicolon", " ", "for", " ", "more", " ", "detailed", " ", "mesh"}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Show", "[", RowBox[{ RowBox[{"mesh", "[", RowBox[{"\"\\"", "[", RowBox[{"\"\\"", "\[Rule]", "Red"}], "]"}], "]"}], ",", RowBox[{"mesh", "[", RowBox[{"\"\\"", "[", RowBox[{ RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", RowBox[{"\"\\"", "\[Rule]", "Blue"}]}], "]"}], "]"}]}], "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"nodes", " ", "=", " ", RowBox[{"mesh", "[", "\"\\"", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"elements", " ", "=", " ", RowBox[{ RowBox[{"mesh", "[", "\"\\"", "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"boundary", " ", "=", RowBox[{"Flatten", "[", RowBox[{ RowBox[{"mesh", "[", "\"\\"", "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"boundary", "=", RowBox[{"DeleteDuplicates", "[", "boundary", "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ SubscriptBox["\[CapitalGamma]", "els"], "=", RowBox[{"N", "[", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"-", "18"}], ",", RowBox[{"-", "2.2"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "14"}], ",", RowBox[{"-", "3"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "9"}], ",", RowBox[{"-", "2.5"}]}], "}"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{"12", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"18", ",", "1.5"}], "}"}], ",", RowBox[{"{", RowBox[{"11", ",", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"6", ",", "2.2"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "2"}], ",", "2.2"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "11"}], ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "17"}], ",", RowBox[{"-", "1"}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{"-", "18"}], ",", RowBox[{"-", "2.2"}]}], "}"}]}], "}"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"upp", " ", "=", " ", RowBox[{"Cases", "[", RowBox[{ RowBox[{"nodes", "[", RowBox[{"[", "boundary", "]"}], "]"}], ",", RowBox[{ RowBox[{"{", RowBox[{"_", ",", "y_"}], "}"}], "/;", RowBox[{"y", "\[Equal]", " ", "15."}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"low", " ", "=", " ", RowBox[{"Cases", "[", RowBox[{ RowBox[{"nodes", "[", RowBox[{"[", "boundary", "]"}], "]"}], ",", RowBox[{ RowBox[{"{", RowBox[{"_", ",", "y_"}], "}"}], "/;", RowBox[{"y", "\[Equal]", " ", RowBox[{"-", "15."}]}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", " ", RowBox[{"Length", "[", "low", "]"}]}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ SubscriptBox["\[CapitalGamma]", "els"], " ", "=", " ", RowBox[{"Append", "[", RowBox[{ SubscriptBox["\[CapitalGamma]", "els"], ",", RowBox[{"low", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}], ";"}]}], " ", "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", " ", RowBox[{"Length", "[", "upp", "]"}]}], ",", RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{ SubscriptBox["\[CapitalGamma]", "els"], " ", "=", " ", RowBox[{"Append", "[", RowBox[{ SubscriptBox["\[CapitalGamma]", "els"], ",", RowBox[{"upp", "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}], ";"}]}], " ", "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ SubscriptBox["\[CapitalGamma]", "in"], "=", RowBox[{"Cases", "[", RowBox[{ RowBox[{"nodes", "[", RowBox[{"[", "boundary", "]"}], "]"}], ",", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", "_"}], "}"}], "/;", RowBox[{"x", "\[Equal]", " ", RowBox[{"-", "30."}]}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ SubscriptBox["\[CapitalGamma]", "out"], "=", RowBox[{"Cases", "[", RowBox[{ RowBox[{"nodes", "[", RowBox[{"[", "boundary", "]"}], "]"}], ",", RowBox[{ RowBox[{"{", RowBox[{"x_", ",", "_"}], "}"}], "/;", RowBox[{"x", "\[Equal]", " ", "30."}]}]}], "]"}]}], ";", RowBox[{"inElems", "=", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"11", ",", " ", "10"}], "}"}], ",", RowBox[{"{", RowBox[{"10", ",", " ", "402"}], "}"}], ",", RowBox[{"{", RowBox[{"402", ",", " ", "9"}], "}"}], ",", RowBox[{"{", RowBox[{"9", ",", " ", "8"}], "}"}], ",", RowBox[{"{", RowBox[{"8", ",", " ", "463"}], "}"}], ",", RowBox[{"{", RowBox[{"463", ",", " ", "7"}], "}"}], ",", RowBox[{"{", RowBox[{"7", ",", " ", "6"}], "}"}], ",", RowBox[{"{", RowBox[{"6", ",", " ", "453"}], "}"}], ",", RowBox[{"{", RowBox[{"453", ",", " ", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"5", ",", " ", "4"}], "}"}], ",", RowBox[{"{", RowBox[{"4", ",", " ", "3"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", " ", "451"}], "}"}], ",", RowBox[{"{", RowBox[{"451", ",", " ", "2"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", " ", "1"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"outNodes", " ", "=", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{ RowBox[{"Position", "[", RowBox[{"nodes", ",", " ", RowBox[{ SubscriptBox["\[CapitalGamma]", "out"], "[", RowBox[{"[", "i", "]"}], "]"}]}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", SubscriptBox["\[CapitalGamma]", "out"], "]"}]}], "}"}]}], "]"}]}], ";"}]}], "Input", CellChangeTimes->{{3.7524882286290936`*^9, 3.7524882335040703`*^9}},ExpressionUUID->"faf02619-938a-47c8-af8c-\ e4216e0273d5"] }, WindowSize->{958, 988}, WindowMargins->{{25, Automatic}, {Automatic, 31}}, FrontEndVersion->"11.1 for Microsoft Windows (64-bit) (March 13, 2017)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[558, 20, 9153, 282, 563, "Input", "ExpressionUUID" -> \ "faf02619-938a-47c8-af8c-e4216e0273d5"] } ] *)