Você está na página 1de 7

(************** Content-type: application/mathematica **************

CreatedBy='Mathematica 4.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[ 12752, 333]*)
(*NotebookOutlinePosition[ 13828, 367]*)
(* CellTagsIndexPosition[ 13784, 363]*)
(*WindowFrame->Normal*)

Notebook[{
Cell["\<\
To ASEN 5007 students: upon downloading this Notebook, check it out \

by following this procedure.


1. Initialize by picking Kernel -> Evaluation -> Evaluate Initialization. \
This will
execute Cells 1-6, which are marked as initialization cells. Verify \
that the output
of the cells (produced by the test statements in blue) agree with the \
Notes.
2. Pick Cell 7 by clicking mouse on interior of cell. Execute by pressing \
<Shift-Enter>
on a Windows PC, or <Enter> on Mac. Check answers agree with Notes \
(Chapter 5)
3. Repeat for Cell 8. Check answers agree with Notes (Chapter 5) \
\>", \
"Text",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
FontFamily->"Times New Roman",
FontSize->14,
Background->RGBColor[1, 0.719951, 0.200015]],

Cell["\<\
Cell 1: module to form element stiffness of two-dimensional \
two-node bar element in global coordinates.\
\>", "Text",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell[TextData[{
"ElemStiff2DTwoNodeBar[{{x1_,y1_},{x2_,y2_}},{Em_,A_}] := Module[\n \
{c,s,dx=x2-x1,dy=y2-y1,L,Ke}, \n L=Sqrt[dx^2+dy^2]; c=dx/L; s=dy/L;\n \
Ke=(Em*A/L)* {{ c^2, c*s,-c^2,-c*s},\n { c*s, \
s^2,-s*c,-s^2},\n {-c^2,-s*c, c^2, s*c},\n \
{-s*c,-s^2, s*c, s^2}}; \n Return[Ke]\n ];\n",
StyleBox["Ke= ElemStiff2DTwoNodeBar[{{0,0},{10,10}},{100,2*Sqrt[2]}];\n\
Print[\"Numerical Elem Stiff Matrix:\"]; Print[Ke//MatrixForm];\nKe= \
ElemStiff2DTwoNodeBar[{{0,0},{L,L}},{Em,A}];\nKe=Simplify[Ke,L>0];\n\
Print[\"Symbolic Elem Stiff Matrix:\"]; Print[Ke//MatrixForm];",
FontColor->RGBColor[0, 0, 1]]
}], "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
InitializationCell->True,
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]],

Cell["\<\
Cell 2: module to merge two-node bar element stiffness into the \
master stiffness matrix.\
\>", "Text",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell[TextData[{
"MergeElemIntoMasterStiff[Ke_,eftab_,Kin_]:=Module[ {i,j,ii,jj,K=Kin}, \n \
For [i=1, i<=4, i++, ii=eftab[[i]];\n For [j=i, j<=4, j++, \
jj=eftab[[j]];\n K[[jj,ii]]=K[[ii,jj]]+=Ke[[i,j]] \n ]\n ]; \
Return[K]\n]; \n",
StyleBox["K=Table[0,{6},{6}];\nPrint[\"Initialized master stiffness matrix:\
\"];\nPrint[K//MatrixForm]\n\
Ke=ElemStiff2DTwoNodeBar[{{0,0},{10,10}},{100,2*Sqrt[2]}];\nPrint[\"Member \
stiffness matrix:\"]; Print[Ke//MatrixForm];\n\
K=MergeElemIntoMasterStiff[Ke,{1,2,5,6},K]; \nPrint[\"Master stiffness after \
member merge:\"];\nPrint[K//MatrixForm];",
FontColor->RGBColor[0, 0, 1]]
}], "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
InitializationCell->True,
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]],

Cell["\<\
Cell 3: module to assemble master stiffness matrix of example \
truss.\
\>", "Text",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell[TextData[{
"AssembleMasterStiffOfExampleTruss[]:= Module[{Ke,K=Table[0,{6},{6}]},\n \
Ke=ElemStiff2DTwoNodeBar[{{0,0},{10,0}},{100,1}];\n K= \
MergeElemIntoMasterStiff[Ke,{1,2,3,4},K]; \n \
Ke=ElemStiff2DTwoNodeBar[{{10,0},{10,10}},{100,1/2}];\n K= \
MergeElemIntoMasterStiff[Ke,{3,4,5,6},K];\n \
Ke=ElemStiff2DTwoNodeBar[{{0,0},{10,10}},{100,2*Sqrt[2]}];\n K= \
MergeElemIntoMasterStiff[Ke,{1,2,5,6},K]; \n Return[K]\n ]; \n",
StyleBox["K=AssembleMasterStiffOfExampleTruss[];\nPrint[\"Master stiffness \
of example truss:\"]; Print[K//MatrixForm];",
FontColor->RGBColor[0, 0, 1]]
}], "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
InitializationCell->True,
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]],

Cell["\<\
Cell 4: modules to apply homogeneous, single-freedom displacement \
BCs on master stiffness and forces.\
\>", "Text",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell[TextData[{
"ModifiedMasterStiffForDBC[pdof_,K_] := Module[\n \
{i,j,k,nk=Length[K],np=Length[pdof],Kmod=K}, \n For [k=1,k<=np,k++, \
i=pdof[[k]]; \n For [j=1,j<=nk,j++, Kmod[[i,j]]=Kmod[[j,i]]=0];\n \
Kmod[[i,i]]=1];\n Return[Kmod]\n];\n\
ModifiedMasterForcesForDBC[pdof_,f_] := Module[\n \
{i,k,np=Length[pdof],fmod=f}, \n For [k=1,k<=np,k++, i=pdof[[k]]; \
fmod[[i]]=0];\n Return[fmod]\n]; \n",
StyleBox["K=Array[Kij,{6,6}]; Print[\"Assembled master stiffness:\"]; \n\
Print[K//MatrixForm];\nK=ModifiedMasterStiffForDBC[{1,2,4},K];\n\
Print[\"Master stiffness modified for displacement B.C.:\"];\n\
Print[K//MatrixForm];\nf=Array[fi,{6}]; Print[\"Force vector:\"]; Print[f];\n\
f=ModifiedMasterForcesForDBC[{1,2,4},f];\nPrint[\"Force vector modified for \
displacement B.C.:\"]; Print[f];",
FontColor->RGBColor[0, 0, 1]]
}], "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
InitializationCell->True,
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]],

Cell["\<\
Cell 5: module to compute the internal force in a two-dimensional \
two-node bar element.\
\>", "Text",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell[TextData[{
"IntForce2DTwoNodeBar[{{x1_,y1_},{x2_,y2_}},{Em_,A_},eftab_,u_]:= \n \
Module[ {c,s,dx=x2-x1,dy=y2-y1,L,ix,iy,jx,jy,ubar,e}, \n \
L=Sqrt[dx^2+dy^2]; c=dx/L; s=dy/L; {ix,iy,jx,jy}=eftab;\n \
ubar={c*u[[ix]]+s*u[[iy]],-s*u[[ix]]+c*u[[iy]],\n \
c*u[[jx]]+s*u[[jy]],-s*u[[jx]]+c*u[[jy]]};\n e=(ubar[[3]]-ubar[[1]])/L; \
Return[Em*A*e]\n];\n",
StyleBox["p=IntForce2DTwoNodeBar[{{0,0},{10,10}},{100,2*Sqrt[2]},\n \
{1,2,5,6},{0,0,0,0,0.4,-0.2}];\nPrint[\"Member int force (numerical):\"]; \
Print[N[p]];\np=IntForce2DTwoNodeBar[{{0,0},{L,L}},{Em,A},\n \
{1,2,5,6},{0,0,0,0,ux3,uy3}];\nPrint[\"Member int force (symbolic):\"]; \
Print[Simplify[p]];",
FontColor->RGBColor[0, 0, 1]]
}], "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
InitializationCell->True,
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]],

Cell["\<\
Cell 6: module to get internal forces in members of example truss.\
\
\>", "Text",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell[TextData[{
"IntForcesOfExampleTruss[u_]:= Module[{f=Table[0,{3}]},\n \
f[[1]]=IntForce2DTwoNodeBar[{{0,0},{10,0}},{100,1},{1,2,3,4},u];\n \
f[[2]]=IntForce2DTwoNodeBar[{{10,0},{10,10}},{100,1/2},{3,4,5,6},u];\n \
f[[3]]=IntForce2DTwoNodeBar[{{0,0},{10,10}},{100,2*Sqrt[2]},\n \
{1,2,5,6},u]; \n Return[f]\n]; \n",
StyleBox["f=IntForcesOfExampleTruss[{0,0,0,0,0.4,-0.2}];\nPrint[\"Internal \
member forces in example truss:\"];Print[N[f]",
FontColor->RGBColor[0, 0, 1]],
"];"
}], "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
InitializationCell->True,
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]],

Cell["Cell 7: driver program to analyze example truss numerically.", "Text",


CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell["\<\
f={0,0,0,0,2,1};
K=AssembleMasterStiffOfExampleTruss[];
Kmod=ModifiedMasterStiffForDBC[{1,2,4},K];
fmod=ModifiedMasterForcesForDBC[{1,2,4},f];
u=Simplify[Inverse[Kmod].fmod];
Print[\"Computed nodal displacements:\"]; Print[u];
f=Simplify[K.u];
Print[\"External node forces including reactions:\"]; Print[f];
p=Simplify[IntForcesOfExampleTruss[u]];
Print[\"Internal member forces:\"]; Print[p];\
\>", "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]],

Cell["\<\
Cell 8: driver program for analysis of example truss, leaving \
forces at node 3 symbolic.\
\>", "Text",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell["\<\
f={0,0,0,0,fx3,fy3};
K=AssembleMasterStiffOfExampleTruss[];
Kmod=ModifiedMasterStiffForDBC[{1,2,4},K];
fmod=ModifiedMasterForcesForDBC[{1,2,4},f];
u=Simplify[Inverse[Kmod].fmod];
Print[\"Computed nodal displacements:\"]; Print[u];
f=Simplify[K.u];
Print[\"External node forces including reactions:\"]; Print[f];
p=Simplify[IntForcesOfExampleTruss[u]];
Print[\"Internal member forces:\"]; Print[p];\
\>", "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]],

Cell["Cell 9: for Exercise 5.7.", "Text",


CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[1, 1, 0]],

Cell["\<\
xynode={{0,0},{10,0},{10,10}}; elenod={{1,2},{2,3},{3,1}};
unode={{0,0},{0,0},{2/5,-1/5}}; amp=5; p={};
For [t=0,t<=1,t=t+1/5,
For [e=1,e<=Length[elenod],e++, {i,j}=elenod[[e]];
xyi=xynode[[i]];ui=unode[[i]];xyj=xynode[[j]];uj=unode[[j]];
p=AppendTo[p,Graphics[Line[{xyi+amp*t*ui,xyj+amp*t*uj}]]];
];
];
Show[p,Axes->False,AspectRatio->Automatic];\
\>", "Input",
CellFrame->True,
CellMargins->{{11, 9}, {Inherited, Inherited}},
CellLabelMargins->{{7, Inherited}, {Inherited, Inherited}},
ImageRegion->{{-0, 1}, {0, 1}},
Background->RGBColor[0, 1, 0]]
},
FrontEndVersion->"4.2 for Macintosh",
ScreenRectangle->{{0, 1920}, {0, 1180}},
AutoGeneratedPackage->None,
WindowToolbars->{},
CellGrouping->Manual,
WindowSize->{1041, 771},
WindowMargins->{{1, Automatic}, {Automatic, 1}},
PrivateNotebookOptions->{"ColorPalette"->{RGBColor, -1}},
ShowCellLabel->True,
ShowCellTags->False,
RenderingOptions->{"ObjectDithering"->True,
"RasterDithering"->False},
MacintoshSystemPageSetup->"\<\
00<0001804P000000]P2:?oQon82n@960dL5:0?l0080001804P000000]P2:001
0000I00000400`<300000BL?00400@00000000000000060801T1T00000000000
00000000000000000000000000000000\>"
]

(*******************************************************************
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[1754, 51, 900, 23, 182, "Text"],
Cell[2657, 76, 327, 8, 46, "Text"],
Cell[2987, 86, 914, 17, 238, "Input",
InitializationCell->True],
Cell[3904, 105, 312, 8, 46, "Text"],
Cell[4219, 115, 903, 18, 253, "Input",
InitializationCell->True],
Cell[5125, 135, 292, 8, 46, "Text"],
Cell[5420, 145, 863, 17, 193, "Input",
InitializationCell->True],
Cell[6286, 164, 326, 8, 46, "Text"],
Cell[6615, 174, 1117, 21, 328, "Input",
InitializationCell->True],
Cell[7735, 197, 312, 8, 46, "Text"],
Cell[8050, 207, 971, 19, 223, "Input",
InitializationCell->True],
Cell[9024, 228, 291, 8, 46, "Text"],
Cell[9318, 238, 745, 16, 163, "Input",
InitializationCell->True],
Cell[10066, 256, 274, 5, 46, "Text"],
Cell[10343, 263, 617, 16, 178, "Input"],
Cell[10963, 281, 313, 8, 46, "Text"],
Cell[11279, 291, 621, 16, 178, "Input"],
Cell[11903, 309, 240, 5, 46, "Text"],
Cell[12146, 316, 602, 15, 163, "Input"]
}
]
*)

(*******************************************************************
End of Mathematica Notebook file.
*******************************************************************)

Você também pode gostar