%**********************************************************************
edit tr2dL.m

%======================================================================
% Tensile test; linear elastic; one truss element
%----------------------------------------------------------------------
clear all; 
crd0 = [ 0 0; 100 0 ]; lok = [ 9 1 1 2 ]; 
elda = [ 0 11 10 0 0 100000 0.3 ];
pp0 = [1 1 0; 1 2 0; 2 2 0]; 
pp = [pp0; 2 1 1];
%pp = pp0;pf = [2 1 2e4];
tr2dL; 
Mp, Mfe, Mfi, Ge, Gs
%======================================================================

%======================================================================
% Two truss elements
%----------------------------------------------------------------------
clear all; 
crd0 = [0 0; 100 0; 0 100/sqrt(3)]; lok = [9 1 1 2; 9 2 2 3];
elda = [ 0 11 10 0 0 200000 0.3; 0 11 20 0 0 150000 0.3 ];
pp = [ 1 1 0; 1 2 0; 3 1 0; 3 2 0 ]; pf = [ 2 2 -100 ];
tr2dL;
figure; plotmesh([1000 1 1 0 0 0 0 0 0],lok,crd0,crd,eldaC,1); 
%======================================================================

%======================================================================
% local nodal coordinate system  
%----------------------------------------------------------------------
clear all; 
crd0 = [0 0; 100 0; 100 50]; lok = [9 1 1 2; 9 1 2 3]; 
elda = [1 11 1 0 0 100000 0.25 ]; tr = [ 2 45 ];
pp = [ 1 1 0; 1 2 0; 2 2 0; 3 1 0 ]; pf = [ 3 2 100 ];
tr2dL;
figure; plotmesh([250 1 1 0 0 0 0 0 0],lok,crd0,crd,eldaC,1);
        axis([-10 140 0 80]); 
%======================================================================

%======================================================================
% Truss frame; the use of links
%----------------------------------------------------------------------
clear all; 
crd0 = [0 0; 1 0; 1 1; 0 1; 0.5 0; 1 0.5; 0.5 1; 0 0.5; 0.5 0.5];
lok = [...
9 1 1 5; 9 1 5 2; 9 1 1 8; 9 1 5 9; 9 1 2 6; 9 1 8 9; ...
9 1 9 6; 9 1 8 4; 9 1 9 7; 9 1 6 3; 9 1 4 7; 9 1 7 3   
];
elda = [1 11 1 0 0 1000 0.25 0 0 0 0 0 0 0 0];
pp   = [1 2 0; 5 2 0; 2 2 0; 1 1 0; 8 1 0; 4 1 0 ; 2 1 0.01];
pl   = [6 1; 3 1; 4 2; 7 2];
pr   = [2 1; 3 2];
lim  = [1 0; 1 0; 0 1; 0 1];
tr2dL;
figure; plotmesh([10 1 1 0 0 0 0 0 0],lok,crd0,crd,eldaC,1);
%======================================================================

%======================================================================
% use of links with applied force
%----------------------------------------------------------------------
clear all; 
crd0 = [0 0; 0 -100; 100 0; 100 -100; 200 0; 200 -100 ];
lok = [9 1 1 2; 9 1 3 4; 9 1 5 6 ];
elda = [1 11 10 0 0  1000 0.0 0   0   0   0   0   0   0   0 ];
pp = [1 1 0; 1 2 0; 3 1 0; 3 2 0; 5 1 0; 5 2 0; 2 1 0 ];
pf = [6 2 -10000 ];
pl = [4 2; 4 1; 6 1];
pr = [2 2; 6 2; 2 1];
lim = [1/2 1/2 0; 0 0 1; 0 0 1];
tr2dL;
figure; plotmesh([1 1 1 0 0 0 0 0 0],lok,crd0,crd,eldaC,1);
        axis([ -10 250 -200 30]); 
%======================================================================

%======================================================================
% Truss structure: 10 trusses in 10 element groups
%----------------------------------------------------------------------
clear all;
x0 = [ 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 ]; % [cm^2]
AA = x0./10000; E = 100e9; Gn = 0; Gsy = 70e6; Gr = 7500;
crd0 = [ 0.5 0.0; 0.0 0.0; 0.5 0.5; 0.0 0.5; 1.0 0.0; 1.0 0.5 ];
lok = [
9 1  1 2; 9 2  1 3; 9 3  3 4; 9 4  2 3; 9 5  4 1; 9 6  1 5; 
9 7  3 6; 9 8  5 6; 9 9  3 5; 9 10 1 6;
];
elda = [ 
0 11 AA(1)  0 0 E Gn; 0 11 AA(2)  0 0 E Gn; 0 11 AA(3)  0 0 E Gn; 
0 11 AA(4)  0 0 E Gn; 0 11 AA(5)  0 0 E Gn; 0 11 AA(6)  0 0 E Gn; 
0 11 AA(7)  0 0 E Gn; 0 11 AA(8)  0 0 E Gn; 0 11 AA(9)  0 0 E Gn; 
0 11 AA(10) 0 0 E Gn ];
pp   = [ 2 1 0; 2 2 0; 4 1 0; 4 2 0 ];
pf   = [ 1 2 50e1; 5 2 100e1 ];
tr2dL;
figure; plotmesh([100 1 1 0 0 0 0 0 0],lok,crd0,crd,eldaC,1);
%======================================================================

