Monday, May 12, 2014

2D truss: Solution using Principle of Virtual Work with Matlab program


This Matlab program gives the solution to problem 11.3-12 of the
textbook "Mechanics of Materials", by Roy R. Craig, Jr., 2nd. edition, 2000.

Units are US customary system, Lb and inch.

Areas of elements:
Element (1):  1    in^2
Element (2):  1    in^2
Element (3):  1.5 in^2
Element (4):  1.5 in^2

NODES OF STRUCTURE (TRUSS):
Node A = Node 1. Coordinates: (0, 0, 0)
Node B = Node 2. Coordinates: (40, 0, 0)
Node C = Node 3. Coordinates: (0, -30, 0)
Node D = Node 4. Coordinates: (70, -30, 0)

All elements are straight links of steel, with modulus of elasticity E = 30E6 Lb/in^2.
The structure is a truss, with pins joining the elements at the nodes A, B, C and D.



ANSYS SOLUTION FOR LOAD STEP (LS) 1:


Matlab program:
______________




% craig_11_3_12.m
% Ricardo E. Avila Montoya / Luis Adan Villa Chaparro
% University of Ciudad Juarez, Mexico. 9 May 2014
% e-mail: ricardo_avila@hotmail.com
% Chihuahua, Mexico

% The method of virtual work is applied to solve a 2D
% structure, formed with elastic links pinned at their ends.

clc
clear

A = [1; 1; 1.5; 1.5];      % in^2, Area of link elements.
E = 30e6;                  % Lb/in^2, Elastic modulus of steel. 
L = [40; 42.426; 50; 70];  % Lengths of link elements.
K = A * E./L;              % Calculate element stiffness.

% Initialize the Stiffness Matrix
SM = zeros(4, 4);

% Build the Stiffness Matrix
SM(1, 1) =       K(1) + .5 * K(2) + .64 * K(3);
SM(1, 2) =            - .5 * K(2) + .48 * K(3);
SM(1, 3) =            - .5 * K(2);
SM(1, 4) =              .5 * K(2);
SM(2, 1) = SM(1, 2);
SM(2, 2) =              .5 * K(2) + .36 * K(3);
SM(2, 3) =              .5 * K(2);
SM(2, 4) =            - .5 * K(2);
SM(3, 1) = SM(1, 3);
SM(3, 2) = SM(2, 3);
SM(3, 3) =              .5 * K(2)              + K(4);
SM(3, 4) =            - .5 * K(2);
SM(4, 1) = SM(1, 4);
SM(4, 2) = SM(2, 4);
SM(4, 3) = SM(3, 4);
SM(4, 4) =              .5 * K(2);

% Forces applied on the structure
RHS = [0; 0; 0; -2000];

% Calculate and display displacements of nodes B and D 
disp('Displacement of nodes B and D, inch')
format long

% Solve the system of linear equations using Matlab algorithm
% (use the inverted backlash Matlab operator for matrix solution)
U = SM\RHS

% Calculation of forces
K2_sqrt_2 = K(2)/sqrt(2); % Auxiliary arithmetic operation

Force_Matrix = [ K(1)       0          0          0
                -K2_sqrt_2  K2_sqrt_2  K2_sqrt_2 -K2_sqrt_2
                 .8*K(3)    .6*K(3)    0          0
                 0          0          K(4)       0 ];
% Calculate and display vector of forces for the elements             
Force_vector = Force_Matrix * U

% Calculate stress in link elements of 2D structure:
Stress_in_elements = Force_vector ./ A

disp('________________________________')
disp('Successful run of Matlab program')

_______________________________________________________________
ANSYS ANIMATION OF DEFORMED RESULTS:


 
___________________________________________________________________
ANSYS results for displacements of the nodes:

 PRINT U    NODAL SOLUTION PER NODE

  ***** POST1 NODAL DEGREE OF FREEDOM LISTING *****                           

  LOAD STEP=     2  SUBSTEP=     1                                            
   TIME=    2.0000      LOAD CASE=   0                                        

  THE FOLLOWING DEGREE OF FREEDOM RESULTS ARE IN GLOBAL COORDINATES           

    NODE      UX          UY          UZ          USUM 
       1   0.0000      0.0000      0.0000      0.0000   
       2  0.62222E-02-0.14469E-01  0.0000     0.15750E-01
       3   0.0000      0.0000      0.0000      0.0000   
       4 -0.31111E-02-0.29459E-01  0.0000     0.29623E-01

 MAXIMUM ABSOLUTE VALUES
 NODE          2           4           0           4
 VALUE   0.62222E-02-0.29459E-01  0.0000     0.29623E-01
_________________________________________________________________

ANSYS results of forces and stresses in the elements of the truss:


 PRINT ELEMENT TABLE ITEMS PER ELEMENT

  ***** POST1 ELEMENT TABLE LISTING *****                                     

    STAT    CURRENT     CURRENT
    ELEM    FORCE       STRESS 
       1   4666.7      4666.7   
       2   2828.4      2828.4   
       3  -3333.3     -2222.2   
       4  -2000.0     -1333.3   

 MINIMUM VALUES
 ELEM          3           3
 VALUE   -3333.3     -2222.2   
 MAXIMUM VALUES
 ELEM          1           1
 VALUE    4666.7      4666.7