solución armadura 2d viamatlab
Post on 01-Jun-2018
217 Views
Preview:
TRANSCRIPT
-
8/9/2019 Solución Armadura 2D ViaMatlab
1/18
2D Truss Solution via Matlab
(Draft 2 April 24, 2006)
IntroductionA two bay symmetrical truss with cross diagonals in each bay is loaded at
the center bottom node with a vwertical force !" is pinned at the leftbottom node and supported by a hori#ontal roller (no vertical displacement)at the lower right node Determine the deflections, reactions, and memberforces if it is assumed (unrealistically) that all the members have thesame area (A) and elastic modulus ($) $ach bay has a width and height of%0 ft
Validation problem&& 'odular2D"russ(%)ead 6 nodes*ode, +-lag, oordinates% %% 0 0 0
2 0 0 %0 0. 0 %0 0 04 0 %0 %0 0/ 0 20 %0 06 % 20 0 0
ead %% elements$lem, "ype, onnectivityist% % % .2 % . 6. % % 24 % 2 .
/ % % 46 % . 41 % 4 6 % . /3 % / 6%0 % 2 4%% % 4 /'aimum element type number 5 %
ead . essential boundary condition sets*ode D- 7alue$+% % 0
% 2 06 2 0
ead % point sources*ode D- 8ourcevalue. 2 9%0
Application properties are:$lastity modulus 5 .0000ross9sectional area 5 %ine oad 5 ; 0 0 <
=age % of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
2/18
*ode, D-, esultant input sources. 2 9%02 D- "otals 5 0 9%0
omputed nodal displacements at 6 nodes*ode D-% D-2 D-. D-4 D-/ D-6% 0 0
2 000%66661 900003%%/.. 00001//%.6 9000440%264 00001//%.6 90002303/ 90000%/6.34 900003%%/.6 000%/%021 0
ecovered . eactions*ode, D-, 7alue of reaction% % %116.6e9%/% 2 /6 2 /2 D- "otals 5 00000 %00000
>> mesh_shrink_plot
=age 2 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
3/18
>> bc_flags_plot
>> quiver_resultant_load_mesh(0.25)@sing a scale of 02/ and vector increment of %
=age . of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
4/18
>> deformed_mesh_plot(250)8uggested scale 5 22120
>> quiver_disp_vec_mesh(0.5)@sing a scale of 0/ and vector increment of %
=age 4 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
5/18
>> quiver_reaction_vec_mesh(0.25)@sing a scale of 02/ and vector increment of %
>> truss_el_force_value
=age / of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
6/18
Modular source on Matlab script
The planar truss script is listed first. It is followed by all the current supporting functions for generalFEA, listed in alphebetical order
function Modular_2_!russ (load_pt) lassic planar truss for point loads (B line load soon) C D!*A"$8 8$D -' !*"$EA8 pree 5 F of dummy items before eltype B connectivity prep 5 F of dummy items before +flag coordinatespree 5 0 G prep 5 0 G default, consistent with plotsif ( nargin 55 0 ) G chec? for optional data loadpt 5 0 G no point source dataend if from argument count
Application and element dependent controlsng 5 2 G number of D- per node (aiald, transversed)nH 5 0 G number of Huadrature points reHuired
nr 5 % G number of rows in +e matri
ead mesh input data files;nm, ns, =, , y, #< 5 getmeshnodes (prep) G;ne, nn, nt, eltype, nodes< 5 getmeshelements (pree) Gnd 5 ngInm G system degrees of freedom (D-)ni 5 ngInn G number of D- per element8 5 #eros (nd, nd) G 5 #eros (nd, %) G initali#e sums' 5 #eros (nd, nd) G G initali#e sums
$tract $+ flags from pac?ed integer flag =
;$+flag< 5 getebcflags (ng, nm, =) G unpac? flags$+count 5 sum( sum ( $+flag & 0 ) ) G F of $+ ead $+ values, if anyif ( $+count & 0 ) G need $+ data ;$+value< 5 getebcvalues (ng, nm, $+flag) G read dataend if any $+ data epected
ead point loads or moments, if any, and insert in if ( loadpt & 0 ) G need point loads data ;< 5 getandaddpointsources (ng, nm, )G add point loadsend if any point source epected
55555555555555 A88@'!*E J'E$*@8 ==$"!$8 55555555555555555
E$*$A"$ $$'$*" 'A"!$8 A*D A88'+$ !*" 88"$' Assemble nd by nd sHuare matri terms from ne by ne
for K 5 %:ne G loop over elements 5555&& 5555&& 5555&& 5555&& 8e 5 #eros (ni, ni) G 'e 5 #eros (ni, ni) G sys arrays p 5 #eros (ni, %) G e 5 #eros (ni, %) G sys arrays s 5 #eros (ni, ni) G m 5 #eros (ni, ni) G loc arrays t 5 #eros (ni, ni) G c 5 #eros (ni, %) G loc arrays
=age 6 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
7/18
enodes 5 nodes (K, %:nn) G connectivity 8$" $$'$*" ==$"!$8 B E$'$" ption 5 % G select analysis case ;A, $, inee, ho< 5 set2Dtrussproperties (nn, ption) G99& find member length and direction cosines d 5 (enodes(2)) 9 (enodes(%)) G length dy 5 y(enodes(2)) 9 y(enodes(%)) G y length
e 5 sHrt (d I d L dy I dy) G total length c 5 d M e G cy 5 dy M e G direction cosines
$$'$*" *D@"!* A*D !*"$*A 8@$ 'A"!$8 for H 5 %:nH G oop over Huadrature points 9999& 9999&
inear aial bar and cubic bending D- 5 u, v, u, v -orm arrays in local aes, transform % 2 . 4
stiffness s 5 ; %, 0, 9%, 0 G
0, 0, 0, 0 G9%, 0, %, 0 G0, 0, 0, 0 < I $ I A M e G
'ap line load to node forces * if ( any (inee) ) G then form forcing vector
fprintf (NOA*!*E: line loads not yet active PnN)end if for set up line load nodal resultants
ptional local mass matri if ( ho & 0 ) m 5 ;%40, 0, 10, 0 G
0, 0, 0, 0 G10, 0, %40, 0 G
0, 0, 0, 0 < I ho I A I e G end if mass reHuested end for loop over nH element Huadrature points Q9999 Q9999
Define local to system D- transformation matri t 5 ; c cy 0 0 G (inverse t 5 transpose t) 9cy c 0 0 G 0 0 c cy G Koint 2 0 0 9cy c < G
"ransform from local to system 8e 5 tN I s I t G 'e 5 tN I m I t G
e 5 tN I c G
8A""$ " (A88$'+$ !*") 88"$' AA8 !nsert completed element matrices into system matrices ;rows< 5 getelementinde (ng, nn, enodes)G eH numbers 8 (rows, rows) 5 8 (rows, rows) L 8e G add to system sH (rows) 5 (rows) L e G add to sys columnend for each K element in mesh QQ5555 QQ5555 QQ5555 QQ5555
AA"$ 8"AE$ - ="!*A $A"!* $7$if ( $+count & 0 ) G reactions occur
=age 1 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
8/18
;$+row, $+col< 5 savereactionmatrices ($+flag, 8, )Gend if essential + eist (almost always true)
$J ==$"!$8 (add ho)fprintf (NApplication properties are: PnN)fprintf (N$lastity modulus 5 g PnN, $)fprintf (Nross9sectional area 5 g PnN, A)fprintf (Nine oad 5 ; g g < PnN, inee(%), inee(2))
$*-$ $88$*"!A +@*DA *D!"!*8saveresultantloadvectors (ng, )if ( all ( 55 0 ) ) then null solution fprintf (NOA*!*E: *o loads or support movement applied PnN)end if null solution;8, < 5 enforceessential+ ($+flag, $+value, 8, )G
'=@"$ 8@"!* B 8A7$" 5 8 P G ompute displacements B rotationslistsavedisplacementsresults (ng, nm, ")
="!*A $A"!* $7$ B 8A7$if ( $+count & 0 ) G reactions eist R ;$+react< 5 recoverreactionsprintsave (ng, nd, $+flag, $+row, $+col, ")G reaction to $+end if $+ eist =8"9=$88 $$'$*" $A"!*8 ('$'+$ -$8) output2Dtrusselreactions (ne, ng, nn, nH, nodes, , y, ")
$nd finite element calculations 8ee MhomeMmech/%1MpublichtmlM'atlab=lots for graphic options http:MMwwwowlnetriceeduMSmech/%1Mhelpplothtml for help end of Modular_2_!russ
LLLLLLLLLLLLL functions in alphabetical order LLLLLLLLLLLLLLLLL
function ;8, < 5 enforceessential+ ($+flag, $+value, 8, ) modify system linear eHs for essential boundary conditions (by tric? to avoid matri partitions, loses reaction data) nd 5 si#e (, %) G number of D- eHsif ( si#e ($+flag, 2) & % ) G change to vector copy flag$+ 5 reshape ( $+flagN, %, nd) G value$+ 5 reshape ( $+valueN, %, nd) Gelse flag$+ 5 $+flag G value$+ 5 $+value G
end if for K 5 %:nd chec? all D- for essential +
if ( flag$+ (K) ) then $+ here arry ?nown columnsI$+ to J8 Tero that column and row !nsert $+ identity, %I$+dof 5 $+value $+ 5 value$+ (K) G recover $+ value (:) 5 (:) 9 $+ I 8 (:, K) G carry ?nown column to J8 8 (:, K) 5 0 G 8 (K, :) 5 0 G clear, restore symmetry 8 (K, K) 5 % G (K) 5 $+ G insert identity into row end if $+ for this D- end for over all K9th D-
=age of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
9/18
end enforceessential+ ($+flag, $+value, 8, )
function ;a, b, c, center, twoA< 5 form".geomconstants (, y, enodes) =lanar . node triangle geometry: Ji (,y) 5 (ai L biI L ciIy)Mtwoa define nodal coordinates, ccw: i, K, ? e 5 (enodes) G ye 5 y(enodes) G coord at el nodes i 5 e(%) G K 5 e(2) G ? 5 e(.) G change notation yi 5 ye(%) G yK 5 ye(2) G y? 5 ye(.) G change notation
define centroid coordinates (Huadrature point) center (%) 5 (i L K L ?)M. Gcenter (2) 5 (yi L yK L y?)M. G
geometric parameters: Ji (,y) 5 (ai L biI L ciIy)Mtwoa ai 5 K I y? 9 ? I yK G bi 5 yK 9 y? G ci 5 ? 9 K G aK 5 ? I yi 9 i I y? G bK 5 y? 9 yi G cK 5 i 9 ? G a? 5 i I yK 9 K I yi G b? 5 yi 9 yK G c? 5 K 9 i G
a (%:.) 5 ;ai, aK, a?< G b (%:.) 5 ;bi, bK, b?< G c (%:.) 5 ;ci, cK, c?< G
calculate twice element area twoA 5 ai L aK L a? G 5 bKIc? 9 b?IcK also end form".geomconstants (, y, enodes)
function ;< 5 getandaddpointsources (ng, nm, ) load mshloadpttmp G node, D-, value (eH number) nu 5 si#e(mshloadpt, %) G number of point sources if ( nu Q % ) G missing data error (N*o loadpt data in mshloadpttmpN) end if user error fprintf (Nead g point sources PnN, nu)
fprintf (N*ode D- 8ourcevalue PnN) for K 5 %:nu G non9#ero *eumann pts node 5 mshloadpt (K, %) G global node number D- 5 mshloadpt (K, 2) G local D- number value 5 mshloadpt (K, .) G point source value fprintf (Ng g g PnN, node, D-, value) $H 5 ng I (node 9 %) L D- G row in system matri ($H) 5 ($H) L value G add to system column matri end for each $+ fprintf (NPnN) end getandaddpointsources (ng, nm, )
function ;$+flag< 5 getebcflags (ng, nm, =) $+flag 5 #eros(nm, ng) G initiali#e for ? 5 %:nm G loop over all nodes if ( =(?) & 0 ) G at least one $+ here ;flags< 5 unpac?ptflags (ng, ?, =(?)) G unpac?ing $+flag (?, %:ng) 5 flags (%:ng) G populate array end if $+ at node ? end for loop over all nodes end getebcflags
function ;$+value< 5 getebcvalues (ng, nm, $+flag)
=age 3 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
10/18
$+count 5 sum( sum ( $+flag & 0 ) ) G F of $+ $+value 5 #eros(nm, ng) G initiali#e to #ero load mshebctmp G node, D-, value (eH number) nc 5 si#e(mshebc, %) G number of constraints fprintf (Nead g essential boundary condition sets PnN, nc) fprintf (Nead g essential boundary condition sets PnN, nc) if ( nc S5 $+count ) then probable user error fprintf (NOA*!*E, epected g $+ sets PnN, $+count)
end if error epected fprintf (N*ode D- 7alue$+ PnN)
for K 5 %:nc G loop over ebc inputs node 5 round (mshebc (K, %)) G node in mesh D- 5 round (mshebc (K, 2)) G D- F at node value 5 mshebc (K, .) G $+ value
$H 5 ng I (node 9 %) L D- G row in system matri $+value (node, D-) 5 value G insert value in array fprintf (Ng g g PnN, node, D-, value) if ( $+flag (node, D-) 55 0 ) chec? data consistency fprintf (NOA*!*E: $+ but no flag at node g B D- g PnN, node, D-) $+flag (node, D-) 5 %G try to recover from data error end if common user error end for each $+
$+count 5 sum (sum ( $+flag & 0 )) G chec? input data if ( $+count S5 nc ) G probable user error fprintf (NOA*!*E: mismatch in bcflag count B mshebctmp PnN) end if user error fprintf (NPnN) end getebcvalues
function ;rows< 5 getelementinde (ng, nn, enodes)
calculate system D- numbers of element, for gather, scatterrows 5 #eros (%, ngInn) G allow for node 5 0for ? 5 %:nn G loop over element nodes globalnode 5 round (enodes (?)) G corresponding sys node for i 5 %:ng G loop over D- at node eHglobal 5 i L ng I (globalnode 9 %) G sys D-, if any eHelement 5 i L ng I (? 9 %) G el D- number if ( eHglobal & 0 ) G chec? node50 tric? rows (%, eHelement) 5 eHglobal G valid D- & 0 end if allow for omitted nodes end for D- i end local D- loopend for each element node end local node loop
end getelementinde
function ;ne, nn, nt, eltype, nodes< 5 getmeshelements (pree) G 'D$ input file controls (for various data generators)if (nargin 55 0) G default to no proceeding items in data pree 5 0 G Dummy items before eltype B connectivityend if
load mshtypnodestmp G eltype, connectivity list (.)ne 5 si#e (mshtypnodes,%) G number of elementsif ( ne 55 0 ) G data file missing
=age %0 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
11/18
error (N$rror missing file mshtypnodestmpN)end if errornn 5 si#e (mshtypnodes,2) 9 pree 9 % G nodes per elementeltype 5 round (mshtypnodes(:, preeL%))G el type number &5 %nt 5 ma(eltype) G number of element typesnodes (%:ne, %:nn) 5 mshtypnodes (%:ne, (preeL2:preeL%Lnn))Gfprintf (Nead g elements PnN, ne)fprintf (N$lem, "ype, onnectivityist PnN)
for K 5 %:ne if ( nn 55 % ) fprintf (Ng g g PnN, K, eltype(K), nodes(K,:))G elseif ( nn 55 2 ) fprintf (Ng g g g PnN, K, eltype(K), nodes(K,:))G elseif ( nn 55 . ) fprintf (Ng g g g g PnN, K, eltype(K), nodes(K,:))G elseif ( nn 55 4 ) fprintf (Ng g g g g g PnN, K, eltype(K), nodes(K,:))G elseif ( nn 55 / ) fprintf (Ng g g g g g g PnN, K, eltype(K), nodes(K,:))G elseif ( nn 55 6 ) fprintf (Ng g g g g g g g PnN, K, eltype(K), nodes(K,:))G else
fprintf (Ng g PnN, K, eltype(K))G dips( nodes(K,:))G end ifend for each elementfprintf (N'aimum element type number 5 g Pn PnN, nt) end getmeshelements
function ;nm, ns, =, , y, #< 5 getmeshnodes (prep) G 'D$ input file controls (for various data generators)if (nargin 55 0) set usual defaultprep 5 0 G Dummy items before +flag coordinates
end if
$AD '$8J A*D $+-AE !*=@" DA"A specific problem data from 'D$ data files (seHuential)load mshbcy#tmp G bcflag, 9, y9, #9coordsnm 5 si#e (mshbcy#,%) G number of nodal points in meshif ( nm 55 0 ) G data missing Uerror (N$rror missing file mshbcy#tmpN)
end if errorns 5 si#e (mshbcy#,2) 9 prep 9 % G number of space dimensionsmshbcy# (:, (prepL%))5 round (mshbcy# (:, (prepL%)))G= 5 mshbcy# (%:nm, (prepL%)) G integer =ac?ed + flag 5 mshbcy# (%:nm, (prepL2)) G etract column
y (%:nm, %) 5 00 G # (%:nm, %) 5 00 G default to #ero if (ns & % ) G chec? 2D or .D y 5 mshbcy# (%:nm, (prepL.)) G etract y columnend if 2D or .Dif ( ns 55 . ) G chec? .D # 5 mshbcy# (%:nm, (prepL4)) G etract # columnend if .Db if ( prep S5 % ) not given node number, seHuential datafprintf (Nead g nodes PnN, nm)fprintf (N*ode, +-lag, oordinates PnN)
=age %% of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
12/18
for K 5 %:nm G list nodes fprintf (Ng g g g g PnN, K, =(K), (K), y(K), #(K)) G end for K D- fprintf (NPnN) end getmeshnodes
function listsavebeamdisplacements (ng, nm, ")fprintf (NPnN) G
fprintf(N*ode displacement Trotation at g nodes PnN, nm) "matri 5 reshape (", ng, nm)N G pretty shape save results (displacements) to 'D$ file: noderesultstmp fid 5 fopen(NnoderesultstmpN, NwN) G open for writing for K 5 %:nm G node loop, save displ fprintf (fid, Ng g PnN, "matri (K, %:ng)) G to file fprintf (Ng g g PnN, K, "matri (K, %:ng)) G to screen end for K D- end listsavebeamdisplacements (ng, nm, ")
function listsavedisplacementsresults (ng, nm, ") fprintf(Nomputed nodal displacements at g nodes PnN, nm) fprintf(N*ode D-% D-2 D-. D-4 D-/ D-6 PnN) "matri 5 reshape (", ng, nm)N G pretty shape save results (displacements) to 'D$ file: noderesultstmp
fid 5 fopen(NnoderesultstmpN, NwN) G open for writing for K 5 %:nm G save displacements if ( ng 55 % ) fprintf (fid, Ng PnN, "matri (K, %:ng)) G fprintf (Ng g PnN, K, "matri (K, %:ng)) G elseif ( ng 55 2 ) fprintf (fid, Ng g PnN, "matri (K, %:ng)) G fprintf (Ng g g PnN, K, "matri (K, %:ng)) G elseif ( ng 55 . ) fprintf (fid, Ng g g PnN, "matri (K, %:ng)) G
fprintf (Ng g g g PnN, K, "matri (K, %:ng)) G elseif ( ng 55 4 ) fprintf (fid, Ng g g g PnN, "matri (K, %:ng)) G fprintf (Ng g g g g PnN, K, "matri (K, %:ng)) G elseif ( ng 55 / ) fprintf (fid, Ng g g g g PnN, "matri (K, %:ng)) G fprintf (Ng g g g g g PnN, K, "matri (K, %:ng)) G elseif ( ng 55 6 ) fprintf (fid, Ng g g g g g PnN, "matri (K, %:ng)) G fprintf (Ng g g g g g g PnN, K, "matri (K, %:ng)) G else
error(Nreformat listsavedisplacementsresults for ng & 6N)
end ifend for K D-
fprintf (NPnN) G end listsavedisplacementsresults (")
function listsavetemperatureresults (") nm 5 si#e (", %) G get si#e fprintf(N"emperature at g nodes PnN, nm) G header
save results (temperature) to 'D$ file: noderesultstmp fid 5 fopen(NnoderesultstmpN, NwN) G open for writing
=age %2 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
13/18
for K 5 %:nm G save temperaturefprintf ( fid, Ng PnN, " (K)) G print
fprintf (N g g PnN, K, " (K)) G seHuential save end for K D- end listsavetemperatureresults (")
function output=lane8tressstresses(ne, ng, nn, nH, nodes, ,y,") =8"9=$88 $$'$*" 8"$88 $7$ B 8A7$
fid 5 fopen(NelHpy#fluestmpN, NwN) G open for writingfprintf (NPnN) G blan? linefprintf(N$lem, V=, CHp, Hp PnN) G headerfprintf(N$lem, V=, 8tressHp: yy y PnN)G header for K 5 %:ne G loop over elements 5555&& enodes 5 nodes (K, %:nn) G connectivity ;a, b, c, center, twoA< 5 form".geomconstants (, y, enodes)G ;te, +odye, $e< 5 setconstantplanestresspropG properties
get D- numbers for this element, gather solution ;rows< 5 getelementinde (ng, nn, enodes) G eH numbers "e 5 " (rows) G gather element D-
for H 5 %:nH G oop over element Huadrature points 9999&
Ji (,y) 5 (ai L biI L ciIy)MtwoA interpolations +e (%, %:2:/) 5 b (%:.)MtwoA G +e (2, 2:2:6) 5 c (%:.)MtwoA G +e (., %:2:/) 5 c (%:.)MtwoA G +e (., 2:2:6) 5 b (%:.)MtwoA G
'=@"$ EAD!$*" B J$A" -@C, 8A7$ A"!* A*D 7A@$8 8trains 5 +e I "e G mechanical strain 8tress 5 $e I 8trains G mechanical stress fprintf (fid,Ng g g g g PnN, center(%), center(2), 8tress(%), 8tress(2), 8tress(.))G save
fprintf (Ng g g g PnN, K, H, center(%:2))G prt fprintf (Ng g g g g PnN, K, H, 8tress(%:.))G prt fprintf (NPnN) G prt end for loop over nH element Huadrature points Q9999end for each K element in mesh end output=lane8tressstresses (ne, ng, nn, nH, nodes, , y, ")
function output".heatflu (ne, ng, nn, nH, nodes, , y, ") =8"9=$88 $$'$*" J$A" -@C $7$ B 8A7$fid 5 fopen(NelHpy#fluestmpN, NwN) G open for writingfprintf (NPnN) G blan? linefprintf(N$lem, CHp, Hp, Jeat-lu, Jeat-luy PnN)G header
for K 5 %:ne G loop over elements 5555&& enodes 5 nodes (K, %:nn) G connectivity ;a, b, c, center, twoA< 5 form".geomconstants (, y, enodes)G ;te, +odye, $e< 5 setconstantplanestresspropG properties
get D- numbers for this element, gather solution ;rows< 5 getelementinde (ng, nn, enodes) G eH numbers "e 5 " (rows) G gather element D- for H 5 %:nH G oop over element Huadrature points 9999&
=age %. of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
14/18
Ji (,y) 5 (ai L biI L ciIy)MtwoA interpolations +e (%, %:.) 5 b(%:.) M twoA G dJMd +e (2, %:.) 5 c(%:.) M twoA G dJMdy
'=@"$ EAD!$*" B J$A" -@C, 8A7$ A"!* A*D 7A@$8 Eradient 5 +e I "e G gradient vector Jeat-lu 5 $e I Eradient G heat flu vector
fprintf (fid, Ng g g g PnN, center(%:2), Jeat-lu(%:2))G save fprintf (Ng g g g g PnN, K, center(%:2), Jeat-lu(%:2))G prt end for loop over nH element Huadrature points Q9999end for each K element in mesh QQ5555 end output".heatflu (ne, ng, nn, nH, nodes, , y, ")
function ;$+react< 5 recoverreactionsprintsave (ng, nd, $+flag, $+row, $+col, ") get $+ reaction values by using rows of 8 B (before $+) nd 5 si#e (", %) G number of system D- nc % 5 nc nd I nd % L nc % $+react 5 $+row I " 9 $+col G matri reactions (L9) save reactions (forces) to 'D$ file: nodereactiontmp fprintf (Necovered g eactions PnN, sum (sum ($+flag & 0))) G header fprintf (N*ode, D-, 7alue of reaction PnN) fid 5 fopen(NnodereactiontmpN, NwN) G open for writing if ( si#e ($+flag, 2) & % ) G change to vector copy flag$+ 5 reshape ( $+flagN, %, nd) G changed else flag$+ 5 $+flag G original vector end if "otals 5 #eros (%, ng) G #ero input totals ?ount 5 0 G initiali#e counter for K 5 %:nd G etract all $+ reactions
if ( flag$+(K) ) G then $+ here utput nodenumber, componentnumber, value, eHuationnumber
?ount 5 ?ount L % G copy counter node 5 ceil(KMng) G node at D- K Kg 5 K 9 (node 9 %)Ing G % Q5 Kg Q5 ng eact 5 $+react (?ount, %) G reaction value fprintf ( fid, Ng g g PnN, node, Kg, eact)G save fprintf (Ng g g PnN, node, Kg, eact)G print "otals (Kg) 5 "otals (Kg) L eact G sum all components end if $+ for this D- end for over all K9th D- fprintf (Ng D- "otals 5 N, ng) G disp("otals) G echo totals
fprintf (NPnN) G 8?ip a line end recoverreactionsprintsave ($+row, $+col, ")
function ;$+row, $+col< 5 savereactionmatrices ($+flag, 8, ) nd 5 si#e (, %) G number of system D- $+count 5 sum (sum ($+flag)) G count $+ B reactions $+row 5 #eros($+count, nd) G reaction data $+col 5 #eros($+count, %) G reaction data if ( si#e ($+flag, 2) & % ) G change to vector copy flag$+ 5 reshape ( $+flagN, %, nd) G changed else
=age %4 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
15/18
flag$+ 5 $+flag G original vector end if ?ount 5 0 G initiali#e counter for K 5 %:nd 8ystem D- loop, chec? for displacement + if ( flag$+ (K) ) G then $+ here 8ave reaction data to be destroyed by $+ solver tric? ?ount 5 ?ount L % G copy counter $+row(?ount, %:nd) 5 8 (K, %:nd) G copy reaction data
$+col(?ount, %) 5 (K) G copy reaction data end if $+ for this D- end for over all K9th D- end sys D- loop end savereactionmatrices (8, , $+flag)
function saveresultantloadvectors (ng, ) save resultant forces to 'D$ file: noderesultantstmp nd 5 si#e (, %) G number of system D- fprintf (NPnN) G 8?ip a line fprintf (N*ode, D-, esultant -orce (%) or 'oment (2) PnN) fprintf (N*ode, D-, esultant input sources PnN) fid 5 fopen(NnoderesultanttmpN, NwN)G open for writing "otals 5 #eros (%, ng) G #ero input totals for K 5 %:nd G etract resultants if ( (K) S5 0 ) G then source here utput nodenumber, componentnumber, value node 5 ceil(KMng) G node at D- K Kg 5 K 9 (node 9 %)Ing G % Q5 Kg Q5 ng value 5 (K) G resultant value fprintf ( fid, Ng g g g PnN, node,Kg,value,K)G save fprintf (Ng g g PnN, node, Kg, value)G print "otals (Kg) 5 "otals (Kg) L value G sum all inputs end if non9#ero for this D- end for over all K9th D- fprintf (Ng D- "otals 5 N, ng) G disp("otals) G echo totals
end saveresultantloadvectors (ng, nm, )
function ;!, $, ho, inee
-
8/9/2019 Solución Armadura 2D ViaMatlab
16/18
function ;te, +odye, $e< 5 setconstantplanestressprop G te 5 % G +odye (%:2) 5 0 G defaults case % te 5 /e9. G thic?ness +odye (%:2) 5 ;/e/, 0< G components $ 5 %/e3 G $lastic modulus nu 5 02/ G =oissonNs ratio
plane stress$v 5 $M(% 9 nuW2) G constant $e (%, %) 5 $v G $e (%, 2) 5 $v I nu G non9#ero term $e (2, %) 5 $v I nu G $e (2, 2) 5 $v G non9#ero term $e (., .) 5 $v I (% 9 nu) M 2 G non9#ero termend setconstantplanestressprop
function ;te, Ve, $e< 5 setconstant2Dconductionprop 'anually set constant element properties (-ig %%3 tet) He 5 0 G te 5 % G defaults case % Y 5 G Yy 5 G Yy 5 0 G thermal conductivity case 2 ? 5 % G Yy 5 % G Yy 5 0 G insert $e 5 #eros (2, 2) G constitutive matri $e (%, %) 5 Y G $e (%, 2) 5 Yy G non9#ero term $e (2, %) 5 Yy G $e (2, 2) 5 Yy G non9#ero term end setconstant2Dconductionprop
function ;A, $, !, inee, ho< 5 set2Dframeproperties (nn, ption) if ( nargin 55 % ) ption 5 % G elseif ( nargin 55 0 ) nn 5 2 G ption 5 % G
end if problem ption number inee 5 #eros (nn, %) G default line load at nodes switch ption case % Oeaver plane frame eample C99999999P -y59.2 Y, $5%0000?si, A5%0 in sH 2 (%) % P '#59%0/0 in9Y, !5%000 inW4, %5%00 in (2)P at node % 25%00 in, 2y591/ in P ;no line load< *ode % disp: 9002026 in, 90033.6 in, C and 9000%13 radians . eactions, node 2: 2026% Y, %%.1 Y, 2.66/ in Y node .:92026% Y, .062 Y, 96.3/2 in9Y
A5%0G !5%e.G $5%e4G ho50G inee 5 ;00G 00< G case 2 cantilever with uniform load, A 5 % G ! 5 % G $ 5 % G ho 5 0 G inee 5 ;%0G %0< G otherwise A 5 % G ! 5 % G $ 5 % G ho 5 0G default shape B material end switch end set2Dframeproperties (nn, ption)
function ;A, $, inee, ho< 5 set2Dtrussproperties (nn, ption) if ( nargin 55 % ) ption 5 % G
=age %6 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
17/18
elseif ( nargin 55 0 ) nn 5 2 G ption 5 % G end if problem ption number inee 5 #eros (nn, %) G default line load at nodes switch ption case % 2 4 / 'ee?Ns $ample 12 truss I99(%0)9I99(%%)9I $ 5 .0,000 ?si, A 5 % inW2
ZP(4) MZP(1) MZ "wo %0 inch bays Z P M Z P M Z 'a vertical deflection X . (.) C (6) C (3) is 9440%.$90. inches Z M P Z M P Z ZM(/) PZM() PZ eactions are /Y each at %, 6 % F99(%)99I99(2)99o 6 =in .Z oller v =5%0Y A5%G $5.0e. G ho50G inee 5 ;00G 00< G otherwise A 5 % G $ 5 % G ho 5 0G default shape B material end switch end set2Dtrussproperties (nn, ption)
function ;flags< 5 unpac?ptflags (ng, *, flag) unpac? ng integer flags from the ng digit flag at node * integer flag contains (left to right) f% f2 fng full 5 flag G copy integer chec? 5 0 G validate inputb si#e(flag)b si#e(full) for eft2ight 5 %:ng G loop over local D- at ? ight2eft 5 ng L % 9 eft2ight G reverse direction wor? 5 floor (full M %0) G wor? item ?eep 5 full 9 wor? I %0 G wor? item
flags (ight2eft) 5 ?eep G insert into array full 5 wor? G wor? item chec? 5 chec? L ?eep I %0W(eft2ight 9 %) G validate end for each local D- if ( flag & chec? ) G chec? for li?ely error fprintf (NOA*!*E: bc flag li?ely reversed at node g PnN, *) end if li?ely user error end unpac?ptflags
References> 'ee?, 'atri 8tructural Analysis, 'cEraw9Jill, %31%
Appendix – Checking with MOD! f"#
III !*=@" 8@$ $8@"A*"8 III!"$' 8@' =8!"!7$ *$EA"!7$ % 00000$L00 00000$L00 00000$L00 2 9%0000$L0% 00000$L00 9%0000$L0% III $A"!* $7$ III*D$, =AA'$"$, $A"!*, $V@A"!*
=age %1 of % opyright >$ A?in All rights reserved
-
8/9/2019 Solución Armadura 2D ViaMatlab
18/18
%, D-%, 44403$9%6 % %, D-2, /0000$L00 2 6, D-2, /0000$L00 %2
$A"!* $8@"A*"8=AA'$"$, 8@' =8!"!7$ *$EA"!7$ D-%, 44403$9%6 44403$9%6 00000$L00 D-2, %0000$L0% %0000$L0% 00000$L00
III $C"$'$ 7A@$8 - "J$ *DA =AA'$"$8 III=AA'$"$ 'AC!'@', *D$ '!*!'@', *D$ D-%, %6661$90., 2 9%/6.3$904, / D-2, 00000$L00, % 9440%.$90., .
III @"=@" - $8@"8 !* *DA D$ III*D$, C9oord, 9oord, D-%, D-2,
% 00000$L00 00000$L00 00000$L00 00000$L002 00000$L00 %0000$L0% %6661$90. 93%%/.$904. %0000$L0% 00000$L00 1//%4$904 9440%.$90.4 %0000$L0% %0000$L0% 1//%4$904 923%0$90./ 20000$L0% %0000$L0% 9%/6.3$904 93%%/.$9046 20000$L0% 00000$L00 %/%0.$90. 00000$L00
II +$E!* $$'$*" A==!A"!* =8" =$88!*E II $ $ ' $ * " 8 " $ 8 8 $ 8 $$'$*" '!D 8$"!* 8"$88 A": *@'+$ !EJ" $-" % 0226/403$L0% 0226/403$L0% 2 0226/403$L0% 0226/403$L0% . 9021.4/3%$L0% 9021.4/3%$L0% 4 0.6123/$L0% 0.6123/$L0% / 90.20.112$L0% 90.20.112$L0% 6 04/.0%$L0% 04/.0%$L0%
1 90.20.112$L0% 90.20.112$L0% 0.6123/$L0% 0.6123/$L0% 3 9021.4/3%$L0% 9021.4/3%$L0% %0 9021.4/3%$L0% 9021.4/3%$L0% %% 9021.4/3%$L0% 9021.4/3%$L0% *'A $*D - 'D$-30, O!"J 2 OA*!*E8
=age % of % opyright > $ A?in All rights reserved
top related