(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.1' 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[ 6914, 235]*) (*NotebookOutlinePosition[ 7625, 260]*) (* CellTagsIndexPosition[ 7581, 256]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["Comparing results of harmonic pre-stressed simulation", "Title"], Cell[TextData[{ StyleBox["Laura Del Tin, 2006, email: ", FontFamily->"Geneva"], StyleBox["ldeltin@deis.unibo.it", FontFamily->"Geneva", FontColor->RGBColor[0, 0, 0.501961]] }], "Text"], Cell[CellGroupData[{ Cell["Loading functions", "Subtitle"], Cell["You need to change the path to the right one", "Text"], Cell[BoxData[ \(<< path/Post4MOR.m\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Setting directory", "Subtitle"], Cell["You may need this to your current directory", "Text"], Cell[BoxData[ \(SetDirectory["\<.\>"]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Making output matrix from EMAT file", "Subtitle"], Cell[BoxData[ \(ComputeCurrentOutput[matE_, matC_, nvolt_Integer] := Module[{mask1, \ mask2, outVec, output1, maskDirichlet, maskDelete, out, output}, \[IndentingNewLine]mask1 = Table[1, {Length[matC]}]; \[IndentingNewLine]mask2 = Table[1, {nvolt}]; \[IndentingNewLine]outVec = mask2 . Take[matC, nvolt]; \[IndentingNewLine]output1 = outVec . matE; \[IndentingNewLine]maskDirichlet = mask1 . matC; \[IndentingNewLine]maskDelete = \((i = 0; out = {}; Scan[\((\(++i\); If[# == 1, AppendTo[out, {i}]])\) &, maskDirichlet]; \ out)\); \[IndentingNewLine]output = Delete[output1, maskDelete]; \[IndentingNewLine]{SparseArray[{output}], outVec . output1}\[IndentingNewLine]]\)], "Input"], Cell[BoxData[{ \(matE = Import["\", "\"]\), "\[IndentingNewLine]", \(matC = Import["\", "\"]\)}], "Input"], Cell["\<\ We assume that useful voltages are at at the beginning Number of voltages is equal to numberr of trans element created by emtgen \ macro, which can be read in the _emtgen.out file\ \>", "Text"], Cell[BoxData[ \(nvolt = 55\)], "Input"], Cell["\<\ Compute C matrix for current output and displacement current due to \ applied alternate voltage (negleting the multiplying factor \[ImaginaryI]2\ \[Pi]\[Omega]):\ \>", "Text"], Cell[BoxData[ \({matCadd, voltcontrib} = ComputeCurrentOutput[matE, matC, nvolt]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Making system matrices from FULL file after harmonic \ simulation\ \>", "Subtitle"], Cell["\<\ omega=0 => Re[tangent stiffness matrix]=K\ \>", "Text"], Cell[BoxData[ \(matK = Import["\", "\"]\)], "Input"], Cell["omega=1e13", "Text"], Cell[BoxData[ \(mat1e13re = Import["\", "\"]\)], "Input"], Cell[TextData[{ "Compute M:\nmat1e13=K-", Cell[BoxData[ \(TraditionalForm\`\[Omega]\^2\)]], "M" }], "Text"], Cell[BoxData[ \(matM = \((matK - mat1e13re)\)/\((1*^26)\)\)], "Input"], Cell["\<\ Create the complete full system and add current d.o.f. to \ mechanical d.o.f.\ \>", "Text"], Cell[BoxData[{ \(matB = Import["\", "\"]\), "\[IndentingNewLine]", \(matC = Import["\", "\"]\), "\[IndentingNewLine]", \(matCnames = Import["\", "\"]\)}], "Input"], Cell[BoxData[ \(\(\(sysfull = MakeDynamicSystem[matM, Null, matK, matB, matC, matCnames, Null]\)\(\[IndentingNewLine]\) \)\)], "Input"], Cell[BoxData[ \(sys2out = AddOutputs[sysfull, matCadd, {"\"}]\)], "Input"], Cell[BoxData[ \(WriteSystem[sys2out, "\"]\)], "Input"] }, Open ]], Cell[CellGroupData[{ Cell["Testing reduced system ", "Subtitle"], Cell["Loading the reduced system:", "Text"], Cell[BoxData[ \(sys = ReadSystem["\"]\)], "Input"], Cell["Loading ANSYS results:", "Text"], Cell[BoxData[ \(ansys = ReadResult["\"]\)], "Input"], Cell["Make harmonic simulation of reduced system:", "Text"], Cell[BoxData[ \(res = HarmonicSolution[XSeries[ansys], sys]\)], "Input"], Cell["Compare results:", "Text"], Cell[BoxData[ \(\(PlotResult[{ansys, res}, FunctionY \[Rule] \((Log10[Abs[#]] &)\), PlotStyle\ \[Rule] {RGBColor\ [1, 0, 0], RGBColor[0, 1, 0]}];\)\)], "Input"], Cell["\<\ It can be seen that current result is not correct. The computed \ values needs in fact still to be summed with the dispacement current \ previously computed, and \[ImaginaryI]2\[Pi]\[Omega]. This is done by the \ following function:\ \>", "Text"], Cell[BoxData[ \(resNew = TransformResult[res, YNames[res], TransformFunction \[Rule] {"\", Function[{y, freq}, 2*Pi*freq*\((y + voltcontrib)\)]}]\)], "Input"], Cell[BoxData[ \(\(PlotResult[{ansys, resNew}, FunctionY \[Rule] \((Log10[Abs[#]] &)\), PlotStyle\ \[Rule] {RGBColor\ [1, 0, 0], RGBColor[0, 1, 0]}];\)\)], "Input"], Cell["Relative percentage error:", "Text"], Cell[BoxData[ \(\(PlotResult[ Difference[ansys, resNew, ErrorFunction \[Rule] \((\((Abs[#1] - Abs[#2])\)/Abs[#1] &)\)], FunctionX \[Rule] Log10, PlotStyle\ \[Rule] {RGBColor[0, 1, 0]}];\)\)], "Input"] }, Open ]] }, Open ]] }, FrontEndVersion->"5.1 for Macintosh", ScreenRectangle->{{0, 1024}, {0, 702}}, WindowSize->{1024, 680}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{1, Automatic}, ShowSelection->True ] (******************************************************************* 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, 70, 0, 168, "Title"], Cell[1849, 55, 200, 6, 40, "Text"], Cell[CellGroupData[{ Cell[2074, 65, 37, 0, 59, "Subtitle"], Cell[2114, 67, 60, 0, 36, "Text"], Cell[2177, 69, 51, 1, 33, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[2265, 75, 37, 0, 59, "Subtitle"], Cell[2305, 77, 59, 0, 36, "Text"], Cell[2367, 79, 54, 1, 33, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[2458, 85, 55, 0, 59, "Subtitle"], Cell[2516, 87, 820, 13, 223, "Input"], Cell[3339, 102, 145, 2, 52, "Input"], Cell[3487, 106, 203, 5, 74, "Text"], Cell[3693, 113, 43, 1, 33, "Input"], Cell[3739, 116, 185, 4, 36, "Text"], Cell[3927, 122, 104, 2, 33, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[4068, 129, 93, 3, 59, "Subtitle"], Cell[4164, 134, 66, 3, 55, "Text"], Cell[4233, 139, 71, 1, 33, "Input"], Cell[4307, 142, 26, 0, 36, "Text"], Cell[4336, 144, 79, 1, 33, "Input"], Cell[4418, 147, 119, 5, 56, "Text"], Cell[4540, 154, 74, 1, 33, "Input"], Cell[4617, 157, 101, 3, 36, "Text"], Cell[4721, 162, 229, 3, 71, "Input"], Cell[4953, 167, 159, 4, 52, "Input"], Cell[5115, 173, 88, 1, 33, "Input"], Cell[5206, 176, 65, 1, 33, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5308, 182, 43, 0, 59, "Subtitle"], Cell[5354, 184, 43, 0, 36, "Text"], Cell[5400, 186, 60, 1, 33, "Input"], Cell[5463, 189, 38, 0, 36, "Text"], Cell[5504, 191, 70, 1, 33, "Input"], Cell[5577, 194, 59, 0, 36, "Text"], Cell[5639, 196, 76, 1, 33, "Input"], Cell[5718, 199, 32, 0, 36, "Text"], Cell[5753, 201, 187, 3, 52, "Input"], Cell[5943, 206, 256, 5, 55, "Text"], Cell[6202, 213, 201, 4, 52, "Input"], Cell[6406, 219, 190, 3, 52, "Input"], Cell[6599, 224, 42, 0, 36, "Text"], Cell[6644, 226, 242, 5, 52, "Input"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)