Commit 11e0cdd1 authored by Jorge Pérez Zerpa's avatar Jorge Pérez Zerpa
Browse files

agrego ejemplo MF

parent b10b8b88
......@@ -17,7 +17,8 @@ clear all, close all
% Applied loads and fixed degrees of freedom (supports)
%%
FMTrusSInput_ej1UT2
%FMTrusSInput_ej1UT2
FMTrusSInput_ej1Examen202112
%% 2- Previous calculations and stiffness matrix assembly
% Assembles the global stiffness matrix KG and computes the matrix for each element.
......
......@@ -9,7 +9,8 @@ addpath( [ pwd '/sources'] );
%% 1- Input data
% Input parameters for geometry and material definition of all the trusses.
% Applied loads and fixed degrees of freedom (supports) are also set here.
FMTrusSInput_ej1UT2
#FMTrusSInput_ej1UT2
FMTrusSInput_ej1Examen202112
%% 2- Pre-process
% Computation and storage of length, angle, E and A of all truss elements.
......
octave/deformed.png

22.8 KB | W: | H:

octave/deformed.png

42.1 KB | W: | H:

octave/deformed.png
octave/deformed.png
octave/deformed.png
octave/deformed.png
  • 2-up
  • Swipe
  • Onion skin
octave/normalforces.png

18.6 KB | W: | H:

octave/normalforces.png

33.8 KB | W: | H:

octave/normalforces.png
octave/normalforces.png
octave/normalforces.png
octave/normalforces.png
  • 2-up
  • Swipe
  • Onion skin
% section properties: vector with the cross-section areas
As = 2e-4 ;
% material properties: vector with young moduli values
Es = [ 200e9 ] ;
NodsCoord = [ ...
0 1 ;
1/sqrt(3) 0 ;
1/sqrt(3)+1 1 ;
1 0 ] ;
% inode jnode material section
ElemConec = [ ...
1 2 1 1 ;
1 4 1 1 ; ...
2 3 1 1 ; ...
2 4 1 1 ; ...
4 3 1 1 ...
] ;
fixeddofs = [ 1 2 5 6 ] ;
NodalLoads = [ 2 0 -10e3 ; ...
4 0 -10e3 ];
# Deformed scale factor
scalefactor = 1e3;
# row vector with the dofs related to supports which are replaced by virtual forces
virtualforcessupports = [ ] ;
# row vector with the truss elements which are replaced by virtual forces
virtualforceselements = [ 4 ] ;
# degree of freedom whose displacement must be determined (leave empty if none)
unkndispdof = 4 ;
% -----------------------------
% --- compute lengths and inclination of undeformed elements ---
Lengths = sqrt ( sum( ( NodsCoord( ElemConec(:,2),:) - ...
NodsCoord( ElemConec(:,1),:) ).^2 , 2 ) ) ;
NodsCoord( ElemConec(:,1),:) ).^2 , 2 ) )
Angles = atan2( ( NodsCoord( ElemConec(:,2),2) - NodsCoord( ElemConec(:,1),2) ) , ...
( NodsCoord( ElemConec(:,2),1) - NodsCoord( ElemConec(:,1),1) ) ) ;
( NodsCoord( ElemConec(:,2),1) - NodsCoord( ElemConec(:,1),1) ) )
Areas = As( ElemConec(:,4) ) ;
Youngs = Es( ElemConec(:,3) ) ;
......@@ -24,16 +24,16 @@ nforceunknowns = nfixeddofs + nelems ;
# assembles the vector of virtual force states, first the fixed dofs and after the truss elements normal forces.
if length(virtualforcessupports)>0
virtualforces = [ find( fixeddofs == virtualforcessupports) ...
virtualforceselements+nfixeddofs ] ;
virtualforceselements+nfixeddofs ] ;
else
virtualforces = [ virtualforceselements+nfixeddofs ] ;
virtualforces = [ virtualforceselements+nfixeddofs ] ;
end
# row vector with the indexes of the dofs of the supports left in the isostatic structure
isostaticsupports = 1:nfixeddofs ;
if length(virtualforcessupports)>0
# deletes the entries corresponding to the supports which are replaced by virtual forces
# deletes the entries corresponding to the supports which are replaced by virtual forces
isostaticsupports( find( fixeddofs == virtualforcessupports) ) = [] ;
end
......@@ -60,14 +60,14 @@ for i=1:nelems
l = Lengths(i) ;
ang = Angles(i);
nodi = ElemConec(i,1);
nodj = ElemConec(i,2);
nodi = ElemConec(i,1);
nodj = ElemConec(i,2);
elemdofs = nodes2dofs ( [ nodi nodj ]' ,2) ;
ca = cos(ang); sa = sin(ang);
auxproj = [ -ca; -sa; ca; sa] ;
Meq( elemdofs , i+nfixeddofs ) = - auxproj ;
end
......
......@@ -12,11 +12,11 @@ for j=1:hiperdegree
end
ForceIndepTerm
x = Meqred \ ForceIndepTerm
x = Meqred \ ForceIndepTerm
supportreactions = zeros(nfixeddofs, hiperdegree+1) ;
supportreactions( isostaticsupports , : ) = x( 1:length(isostaticsupports) ,:)
supportreactions( isostaticsupports , : ) = x( 1:length(isostaticsupports) ,:)
if length(virtualforcessupports)>0
aux = find( fixeddofs == virtualforcessupports) ;
for j=1:hiperdegree
......@@ -29,8 +29,8 @@ supportreactions
Ns = zeros(nelems,hiperdegree+1) ;
%~ Ns( isostaticforceselem-length(isostaticsupports) , : ) = x( isostaticforceselem, : ) ;
Ns( isostaticforceselem- nfixeddofs , : ) = x( (length(isostaticsupports)+1):end, : ) ;
%~ Ns( isostaticforceselem-length(isostaticsupports) , : ) = x( isostaticforceselem, : ) ;
Ns( isostaticforceselem- nfixeddofs , : ) = x( (length(isostaticsupports)+1):end, : ) ;
if length( virtualforceselements ) > 0
for i=1:length(virtualforceselements)
Ns(virtualforceselements,i+1) = 1 ;
......@@ -43,6 +43,7 @@ Ns
Kf = zeros( hiperdegree, hiperdegree) ;
Ff = zeros( hiperdegree, 1) ;
hiperdegree
for i=1:hiperdegree
for j = 1:hiperdegree
Kf(i,j) = sum( Ns(:,1+i).*Ns(:,1+j) ./ ( Youngs .* Areas ) .* Lengths ) ;
......@@ -51,11 +52,14 @@ for i=1:hiperdegree
Ff(i) = - sum( Ns(:,1) .* Ns(:,1+i) ./ ( Youngs .* Areas ) .* Lengths ) ;
end
X = Kf \ Ff
Kf
Ff
X = Kf \ Ff
ResultReactions = supportreactions * [ 1; X]
ResultNormalForces = Ns * [ 1 ; X ]
ResultNormalForces = Ns * [ 1 ; X ]
Rext = zeros( 2*nnodes,1) ;
Rext(fixeddofs) = ResultReactions ;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment