[FEM-7]杆单元分析的MATLAB程序


1 1D杆单元的有限元分析程序(Bar1D2Node)

最简单的线性杆单元程序应包括单元刚度矩阵、单元组装、单元应力等几个基本计算程序。

1.1 单元刚度矩阵

Element_K_Array = Bar1D2Node_Stiffness(Mat_E, Geo_A, Geo_L)

  • ToDo:计算单元的刚度矩阵
  • Input:弹性模量Mat_E、横截面积Geo_A、长度Geo_L
  • Output:单元刚度矩阵Element_K
function Element_K_Array = Bar1D2Node_Stiffness(Mat_E, Geo_A, Geo_L)
    Element_K_Array = [Mat_E * Geo_A / Geo_L, -Mat_E * Geo_A / Geo_L; ...
     -Mat_E * Geo_A / Geo_L, Mat_E * Geo_A / Geo_L];
end
图1 一维三连杆结构

图1 一维三连杆结构

上图为一维三连杆结构,通过程序得到每个杆件的单元刚度方程分别为

K ( 1 ) = [ K 11 ( 1 ) K 12 ( 1 ) K 21 ( 1 ) K 22 ( 1 ) ] \begin{equation} \begin{aligned} \mathbf{K}^{(1)} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} \\ K_{21}^{(1)} & K_{22}^{(1)} \end{bmatrix} \end{aligned} \end{equation} K(1)=[K11(1)K21(1)K12(1)K22(1)]

K ( 2 ) = [ K 22 ( 2 ) K 23 ( 2 ) K 32 ( 2 ) K 33 ( 2 ) ] \begin{equation} \begin{aligned} \mathbf{K}^{(2)} = \begin{bmatrix} K_{22}^{(2)} & K_{23}^{(2)} \\ K_{32}^{(2)} & K_{33}^{(2)} \end{bmatrix} \end{aligned} \end{equation} K(2)=[K22(2)K32(2)K23(2)K33(2)]

K ( 3 ) = [ K 33 ( 3 ) K 34 ( 3 ) K 43 ( 3 ) K 44 ( 3 ) ] \begin{equation} \begin{aligned} \mathbf{K}^{(3)} = \begin{bmatrix} K_{33}^{(3)} & K_{34}^{(3)} \\ K_{43}^{(3)} & K_{44}^{(3)} \end{bmatrix} \end{aligned} \end{equation} K(3)=[K33(3)K43(3)K34(3)K44(3)]

1.2 整体刚度矩阵

Total_K_Array = Bar1D2Node_Assembly(Total_K_Array, Element_K_Array, ElementNode_1, ElementNode_2)

  • ToDo:计算整体刚度矩阵
  • Input:单元刚度矩阵Element_K_Array、单元两端节点编号ElementNode_1ElementNode_2
  • Output:单元刚度矩阵Total_K_Array
function Total_K_Array = Bar1D2Node_Assembly(Total_K_Array, Element_K, ElementNode_1, ElementNode_2)
    Element_DOF_Array(1) = ElementNode_1;
    Element_DOF_Array(2) = ElementNode_2;
    for ii = 1 : 2
        for jj = 1 : 2
            Total_K_Array(Element_DOF_Array(ii), Element_DOF_Array(jj)) = Total_K_Array(Element_DOF_Array(ii), Element_DOF_Array(jj)) + Element_K_Array(ii, jj);
        end
    end
    Total_K_Array = Total_K_Array;
end

1.2.1 组装第1根杆件

通过程序,初始时Total_K_Array 4 × 4 4 \times 4 4×4的空矩阵,当组装第一根杆件时,有

Total_K_Array = Bar1D2Node_Assembly(Total_K_Array, Element_K_Array_1, 1, 2);

此时,

Element_DOF_Array(1) = 1;
Element_DOF_Array(2) = 2;

循环有,

ii = 1, jj = 1
Total_K_Array(1, 1) = Total_K_Array(1, 1) + Element_K_Array_1(1, 1);

K A l l = [ K 11 ( 1 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)000000000000000

ii = 1, jj = 2
Total_K_Array(1, 2) = Total_K_Array(1, 2) + Element_K_Array_1(1, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)000K12(1)00000000000

ii = 2, jj = 1
Total_K_Array(2, 1) = Total_K_Array(2, 1) + Element_K_Array_1(2, 1);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)00000000000

ii = 2, jj = 2
Total_K_Array(2, 2) = Total_K_Array(2, 2) + Element_K_Array_1(2, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)0000000000

1.2.2 组装第2根杆件

Total_K_Array = Bar1D2Node_Assembly(Total_K_Array, Element_K_Array_2, 2, 3);

此时,

Element_DOF_Array(1) = 2;
Element_DOF_Array(2) = 3;

循环有,

ii = 1, jj = 1
Total_K_Array(2, 2) = Total_K_Array(2, 2) + Element_K_Array_2(1, 1);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) + K 22 ( 2 ) 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} + K_{22}^{(2)} & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)+K22(2)0000000000

ii = 1, jj = 2
Total_K_Array(2, 3) = Total_K_Array(2, 3) + Element_K_Array_2(1, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) + K 22 ( 2 ) K 23 ( 2 ) 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} + K_{22}^{(2)} & K_{23}^{(2)} & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)+K22(2)000K23(2)000000

ii = 2, jj = 1
Total_K_Array(3, 2) = Total_K_Array(3, 2) + Element_K_Array_2(2, 1);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) + K 22 ( 2 ) K 23 ( 2 ) 0 0 K 32 ( 2 ) 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} + K_{22}^{(2)} & K_{23}^{(2)} & 0 \\ 0 & K_{32}^{(2)} & 0 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)+K22(2)K32(2)00K23(2)000000

ii = 2, jj = 2
Total_K_Array(3, 3) = Total_K_Array(3, 3) + Element_K_Array_2(2, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) + K 22 ( 2 ) K 23 ( 2 ) 0 0 K 32 ( 2 ) K 33 ( 2 ) 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} + K_{22}^{(2)} & K_{23}^{(2)} & 0 \\ 0 & K_{32}^{(2)} & K_{33}^{(2)} & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)+K22(2)K32(2)00K23(2)K33(2)00000

1.2.3 组装第3根杆件

Total_K_Array = Bar1D2Node_Assembly(Total_K_Array, Element_K_Array_3, 3, 4);

此时,

Element_DOF_Array(1) = 3;
Element_DOF_Array(2) = 4;

循环有,

ii = 1, jj = 1
Total_K_Array(3, 3) = Total_K_Array(3, 3) + Element_K_Array_3(1, 1);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) + K 22 ( 2 ) K 23 ( 2 ) 0 0 K 32 ( 2 ) K 33 ( 2 ) + K 33 ( 3 ) 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} + K_{22}^{(2)} & K_{23}^{(2)} & 0 \\ 0 & K_{32}^{(2)} & K_{33}^{(2)} + K_{33}^{(3)} & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)+K22(2)K32(2)00K23(2)K33(2)+K33(3)00000

ii = 1, jj = 2
Total_K_Array(3, 4) = Total_K_Array(3, 4) + Element_K_Array_3(1, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) + K 22 ( 2 ) K 23 ( 2 ) 0 0 K 32 ( 2 ) K 33 ( 2 ) + K 33 ( 3 ) K 34 ( 3 ) 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} + K_{22}^{(2)} & K_{23}^{(2)} & 0 \\ 0 & K_{32}^{(2)} & K_{33}^{(2)} + K_{33}^{(3)} & K_{34}^{(3)} \\ 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)+K22(2)K32(2)00K23(2)K33(2)+K33(3)000K34(3)0

ii = 2, jj = 1
Total_K_Array(4, 3) = Total_K_Array(4, 3) + Element_K_Array_3(2, 1);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) + K 22 ( 2 ) K 23 ( 2 ) 0 0 K 32 ( 2 ) K 33 ( 2 ) + K 33 ( 3 ) K 34 ( 3 ) 0 0 K 43 ( 3 ) 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} + K_{22}^{(2)} & K_{23}^{(2)} & 0 \\ 0 & K_{32}^{(2)} & K_{33}^{(2)} + K_{33}^{(3)} & K_{34}^{(3)} \\ 0 & 0 & K_{43}^{(3)} & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)+K22(2)K32(2)00K23(2)K33(2)+K33(3)K43(3)00K34(3)0

ii = 2, jj = 2
Total_K_Array(4, 4) = Total_K_Array(4, 4) + Element_K_Array_3(2, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 K 21 ( 1 ) K 22 ( 1 ) + K 22 ( 2 ) K 23 ( 2 ) 0 0 K 32 ( 2 ) K 33 ( 2 ) + K 33 ( 3 ) K 34 ( 3 ) 0 0 K 43 ( 3 ) K 44 ( 3 ) ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} + K_{22}^{(2)} & K_{23}^{(2)} & 0 \\ 0 & K_{32}^{(2)} & K_{33}^{(2)} + K_{33}^{(3)} & K_{34}^{(3)} \\ 0 & 0 & K_{43}^{(3)} & K_{44}^{(3)} \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)00K12(1)K22(1)+K22(2)K32(2)00K23(2)K33(2)+K33(3)K43(3)00K34(3)K44(3)

最终得到整体刚度矩阵如上。组合方式如下图所示

图2 一维多连杆结构整体刚度矩阵组装方式

图2 一维多连杆结构整体刚度矩阵组装方式

1.3 单元应力

Element_Stress = Bar1D2Node_Stress(Element_Dis_Vec, Geo_L)

  • ToDo:计算单元的应力
  • Input:单元位移列阵Element_Dis_Vec、长度Geo_L
  • Output:单元应力标量Element_Stress
function Element_Stress = Bar1D2Node_Stress(Element_Dis_Vec, Geo_L)
    Element_Stress = [-1/Geo_L, 1/Geo_L] * Element_Dis_Vec
end

求取第1根杆件上的单元应力为

Element_Stress = Bar1D2Node_Stress(Element_Dis_Vec, Geo_L)

σ ( 1 ) = [ − 1 / l 1 / l ] ∗ q ( 1 ) = [ − 1 / l 1 / l ] ∗ [ u 1 ( 1 ) u 2 ( 1 ) ] = σ ( 1 ) \begin{equation} \begin{aligned} \mathbf{\sigma}^{(1)} &= \begin{bmatrix} - 1 / l & 1 / l \end{bmatrix} * \mathbf{q}^{(1)} \\ &= \begin{bmatrix} - 1 / l & 1 / l \end{bmatrix} * \begin{bmatrix} u_{1}^{(1)} \\ u_{2}^{(1)} \\ \end{bmatrix} \\ &= \sigma^{(1)} \end{aligned} \end{equation} σ(1)=[1/l1/l]q(1)=[1/l1/l][u1(1)u2(1)]=σ(1)

1.4 单元节点力矢量

Element_Force_Array = Bar1D2Node_Force(Element_K_Array, Element_Dis_Vec)

  • ToDo:计算单元的节点力矢量
  • Input:单元刚度矩阵Element_K_Array、单元位移列阵Element_Dis_Vec
  • Output:单元节点力矢量Element_Force_Array
function Element_Force_Array = Bar1D2Node_Force(Element_K_Array, Element_Dis_Vec)
    Element_Force_Array = Element_K_Array * Element_Dis_Vec
end

求取第1根杆件上的节点力为

Element_Force_Array = Bar1D2Node_Force(Element_K_Array_1, Element_Dis_Vec)

P ( 1 ) = K ( 1 ) ∗ q ( 1 ) = [ K 11 ( 1 ) K 12 ( 1 ) K 21 ( 1 ) K 22 ( 1 ) ] ∗ [ u 1 ( 1 ) u 2 ( 1 ) ] = [ P 1 ( 1 ) P 2 ( 1 ) ] \begin{equation} \begin{aligned} \mathbf{P}^{(1)} &= \mathbf{K}^{(1)} * \mathbf{q}^{(1)} \\ &= \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} \\ K_{21}^{(1)} & K_{22}^{(1)} \\ \end{bmatrix} * \begin{bmatrix} u_{1}^{(1)} \\ u_{2}^{(1)} \\ \end{bmatrix} \\ &= \begin{bmatrix} P_{1}^{(1)} \\ P_{2}^{(1)} \\ \end{bmatrix} \end{aligned} \end{equation} P(1)=K(1)q(1)=[K11(1)K21(1)K12(1)K22(1)][u1(1)u2(1)]=[P1(1)P2(1)]

求得分别为第1根杆件上2个节点的节点力。

2 平面(2D)杆单元的有限元分析程序(Bar2D2Node)

2.1 单元刚度矩阵

Element_K_Array = Bar2D2Node_Stiffness(Mat_E, Geo_A, Node1_X, Node1_Y, Node2_X, Node2_Y)

  • ToDo:计算单元的刚度矩阵
  • Input:弹性模量Mat_E、横截面积Geo_A、节点1坐标(Node1_X, Node1_Y)、节点2坐标(Node2_X, Node2_Y)
  • Output:单元刚度矩阵Element_K
function Element_K_Array = Bar2D2Node_Stiffness(Mat_E, Geo_A, Node1_X, Node1_Y, Node2_X, Node2_Y)
    % 杆件长度
    Geo_L = sqrt((Node2_X - Node1_X)^2 + (Node2_Y - Node1_Y)^2);
    % 杆件方向向量与整体坐标系X轴的夹角
    Alpha_Rad = atan2(Node2_Y - Node1_Y, Node2_X - Node1_X);
    Cos_Alpha = cos(Alpha_Rad);
    Sin_Alpha = sin(Alpha_Rad);
    Element_K_Array = Mat_E * Geo_A / Geo_L * ...
    [Cos_Alpha^2, Cos_Alpha * Sin_Alpha, -Cos_Alpha^2, -Cos_Alpha * Sin_Alpha; ...
    Cos_Alpha * Sin_Alpha, Sin_Alpha^2, -Cos_Alpha * Sin_Alpha, -Sin_Alpha^2; ...
    -Cos_Alpha^2, -Cos_Alpha * Sin_Alpha, Cos_Alpha^2, Cos_Alpha * Sin_Alpha; ...
    -Cos_Alpha * Sin_Alpha, -Sin_Alpha^2, Cos_Alpha * Sin_Alpha, Sin_Alpha^2];
end
图3 平面三连杆结构

图3 平面三连杆结构

上图为平面三连杆结构,通过程序得到每个杆件的单元刚度方程分别为

K ( 1 ) = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) K 34 ( 1 ) K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) K 44 ( 1 ) ] \begin{equation} \begin{aligned} \mathbf{K}^{(1)} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} & K_{34}^{(1)} \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} & K_{44}^{(1)} \end{bmatrix} \end{aligned} \end{equation} K(1)= K11(1)K21(1)K31(1)K41(1)K12(1)K22(1)K32(1)K42(1)K13(1)K23(1)K33(1)K43(1)K14(1)K24(1)K34(1)K44(1)

K ( 2 ) = [ K 33 ( 2 ) K 34 ( 2 ) K 35 ( 2 ) K 36 ( 2 ) K 43 ( 2 ) K 44 ( 2 ) K 45 ( 2 ) K 46 ( 2 ) K 53 ( 2 ) K 54 ( 2 ) K 55 ( 2 ) K 56 ( 2 ) K 63 ( 2 ) K 64 ( 2 ) K 65 ( 2 ) K 66 ( 2 ) ] \begin{equation} \begin{aligned} \mathbf{K}^{(2)} = \begin{bmatrix} K_{33}^{(2)} & K_{34}^{(2)} & K_{35}^{(2)} & K_{36}^{(2)} \\ K_{43}^{(2)} & K_{44}^{(2)} & K_{45}^{(2)} & K_{46}^{(2)} \\ K_{53}^{(2)} & K_{54}^{(2)} & K_{55}^{(2)} & K_{56}^{(2)} \\ K_{63}^{(2)} & K_{64}^{(2)} & K_{65}^{(2)} & K_{66}^{(2)} \end{bmatrix} \end{aligned} \end{equation} K(2)= K33(2)K43(2)K53(2)K63(2)K34(2)K44(2)K54(2)K64(2)K35(2)K45(2)K55(2)K65(2)K36(2)K46(2)K56(2)K66(2)

K ( 3 ) = [ K 55 ( 3 ) K 56 ( 3 ) K 57 ( 3 ) K 58 ( 3 ) K 65 ( 3 ) K 66 ( 3 ) K 67 ( 3 ) K 68 ( 3 ) K 75 ( 3 ) K 76 ( 3 ) K 77 ( 3 ) K 78 ( 3 ) K 85 ( 3 ) K 86 ( 3 ) K 87 ( 3 ) K 88 ( 3 ) ] \begin{equation} \begin{aligned} \mathbf{K}^{(3)} = \begin{bmatrix} K_{55}^{(3)} & K_{56}^{(3)} & K_{57}^{(3)} & K_{58}^{(3)} \\ K_{65}^{(3)} & K_{66}^{(3)} & K_{67}^{(3)} & K_{68}^{(3)} \\ K_{75}^{(3)} & K_{76}^{(3)} & K_{77}^{(3)} & K_{78}^{(3)} \\ K_{85}^{(3)} & K_{86}^{(3)} & K_{87}^{(3)} & K_{88}^{(3)} \end{bmatrix} \end{aligned} \end{equation} K(3)= K55(3)K65(3)K75(3)K85(3)K56(3)K66(3)K76(3)K86(3)K57(3)K67(3)K77(3)K87(3)K58(3)K68(3)K78(3)K88(3)

2.2 整体刚度矩阵

Total_K_Array = Bar2D2Node_Assembly(Total_K_Array, Element_K_Array, ElementNode_1, ElementNode_2)

  • ToDo:计算整体刚度矩阵
  • Input:单元刚度矩阵Element_K_Array、单元两端节点编号ElementNode_1ElementNode_2
  • Output:单元刚度矩阵Total_K_Array
function Total_K_Array = Bar2D2Node_Assembly(Total_K_Array, Element_K_Array, ElementNode_1, ElementNode_2)
    Element_DOF_Array(1) = 2 * ElementNode_1 - 1;
    Element_DOF_Array(2) = 2 * ElementNode_1;
    Element_DOF_Array(3) = 2 * ElementNode_2 - 1;
    Element_DOF_Array(4) = 2 * ElementNode_2;
    for ii = 1 : 4
        for jj = 1 : 4
            Total_K_Array(Element_DOF_Array(ii), Element_DOF_Array(jj)) = Total_K_Array(Element_DOF_Array(ii), Element_DOF_Array(jj)) + Element_K_Array(ii, jj);
        end
    end
    Total_K_Array = Total_K_Array;
end

2.2.1 组装第1根杆件

通过程序,初始时Total_K_Array 8 × 8 8 \times 8 8×8的空矩阵,当组装第一根杆件时,有

Total_K_Array = Bar2D2Node_Assembly(Total_K_Array, Element_K_Array_1, 1, 2);

此时,

Element_DOF_Array(1) = 1;
Element_DOF_Array(2) = 2;
Element_DOF_Array(3) = 3;
Element_DOF_Array(4) = 4;

循环有,

ii = 1, jj = 1
Total_K_Array(1, 1) = Total_K_Array(1, 1) + Element_K_Array_1(1, 1);

K A l l = [ K 11 ( 1 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)000000000000000000000000000000000000000000000000000000000000000

ii = 1, jj = 2
Total_K_Array(1, 2) = Total_K_Array(1, 2) + Element_K_Array_1(1, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)0000000K12(1)0000000000000000000000000000000000000000000000000000000

组装完第1根杆后得到

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) 0 0 0 0 K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) 0 0 0 0 K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) K 34 ( 1 ) 0 0 0 0 K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) K 44 ( 1 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} & 0 & 0 & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} & 0 & 0 & 0 & 0 \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} & K_{34}^{(1)} & 0 & 0 & 0 & 0 \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} & K_{44}^{(1)} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)K31(1)K41(1)0000K12(1)K22(1)K32(1)K42(1)0000K13(1)K23(1)K33(1)K43(1)0000K14(1)K24(1)K34(1)K44(1)000000000000000000000000000000000000

2.2.2 组装第2根杆件

当组装第2根杆件时,有

Total_K_Array = Bar2D2Node_Assembly(Total_K_Array, Element_K_Array_2, 2, 3);

此时,

Element_DOF_Array(1) = 3;
Element_DOF_Array(2) = 4;
Element_DOF_Array(3) = 5;
Element_DOF_Array(4) = 6;

循环有,

ii = 1, jj = 1
Total_K_Array(3, 3) = Total_K_Array(3, 3) + Element_K_Array_2(1, 1);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) 0 0 0 0 K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) 0 0 0 0 K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) + K 33 ( 2 ) K 34 ( 1 ) 0 0 0 0 K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) K 44 ( 1 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} & 0 & 0 & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} & 0 & 0 & 0 & 0 \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} + K_{33}^{(2)} & K_{34}^{(1)} & 0 & 0 & 0 & 0 \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} & K_{44}^{(1)} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)K31(1)K41(1)0000K12(1)K22(1)K32(1)K42(1)0000K13(1)K23(1)K33(1)+K33(2)K43(1)0000K14(1)K24(1)K34(1)K44(1)000000000000000000000000000000000000

ii = 1, jj = 2
Total_K_Array(3, 4) = Total_K_Array(3, 4) + Element_K_Array_2(1, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) 0 0 0 0 K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) 0 0 0 0 K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) + K 33 ( 2 ) K 34 ( 1 ) + K 34 ( 2 ) 0 0 0 0 K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) K 44 ( 1 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} & 0 & 0 & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} & 0 & 0 & 0 & 0 \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} + K_{33}^{(2)} & K_{34}^{(1)} + K_{34}^{(2)} & 0 & 0 & 0 & 0 \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} & K_{44}^{(1)} & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)K31(1)K41(1)0000K12(1)K22(1)K32(1)K42(1)0000K13(1)K23(1)K33(1)+K33(2)K43(1)0000K14(1)K24(1)K34(1)+K34(2)K44(1)000000000000000000000000000000000000

组装完第2根杆后得到

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) 0 0 0 0 K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) 0 0 0 0 K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) + K 33 ( 2 ) K 34 ( 1 ) + K 34 ( 2 ) K 35 ( 2 ) K 36 ( 2 ) 0 0 K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) + K 43 ( 2 ) K 44 ( 1 ) + K 44 ( 2 ) K 45 ( 2 ) K 46 ( 2 ) 0 0 0 0 K 53 ( 2 ) K 54 ( 2 ) K 55 ( 2 ) K 56 ( 2 ) 0 0 0 0 K 63 ( 2 ) K 64 ( 2 ) K 65 ( 2 ) K 66 ( 2 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} & 0 & 0 & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} & 0 & 0 & 0 & 0 \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} + K_{33}^{(2)} & K_{34}^{(1)} + K_{34}^{(2)} & K_{35}^{(2)} & K_{36}^{(2)} & 0 & 0 \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} + K_{43}^{(2)} & K_{44}^{(1)} + K_{44}^{(2)} & K_{45}^{(2)} & K_{46}^{(2)} & 0 & 0 \\ 0 & 0 & K_{53}^{(2)} & K_{54}^{(2)} & K_{55}^{(2)} & K_{56}^{(2)} & 0 & 0 \\ 0 & 0 & K_{63}^{(2)} & K_{64}^{(2)} & K_{65}^{(2)} & K_{66}^{(2)} & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)K31(1)K41(1)0000K12(1)K22(1)K32(1)K42(1)0000K13(1)K23(1)K33(1)+K33(2)K43(1)+K43(2)K53(2)K63(2)00K14(1)K24(1)K34(1)+K34(2)K44(1)+K44(2)K54(2)K64(2)0000K35(2)K45(2)K55(2)K65(2)0000K36(2)K46(2)K56(2)K66(2)000000000000000000

2.2.3 组装第3根杆件

当组装第3根杆件时,有

Total_K_Array = Bar2D2Node_Assembly(Total_K_Array, Element_K_Array_3, 3, 4);

此时,

Element_DOF_Array(1) = 5;
Element_DOF_Array(2) = 6;
Element_DOF_Array(3) = 7;
Element_DOF_Array(4) = 8;

循环有,

ii = 1, jj = 1
Total_K_Array(5, 5) = Total_K_Array(5, 5) + Element_K_Array_2(1, 1);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) 0 0 0 0 K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) 0 0 0 0 K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) + K 33 ( 2 ) K 34 ( 1 ) + K 34 ( 2 ) K 35 ( 2 ) K 36 ( 2 ) 0 0 K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) + K 43 ( 2 ) K 44 ( 1 ) + K 44 ( 2 ) K 45 ( 2 ) K 46 ( 2 ) 0 0 0 0 K 53 ( 2 ) K 54 ( 2 ) K 55 ( 2 ) + K 55 ( 3 ) K 56 ( 2 ) 0 0 0 0 K 63 ( 2 ) K 64 ( 2 ) K 65 ( 2 ) K 66 ( 2 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} & 0 & 0 & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} & 0 & 0 & 0 & 0 \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} + K_{33}^{(2)} & K_{34}^{(1)} + K_{34}^{(2)} & K_{35}^{(2)} & K_{36}^{(2)} & 0 & 0 \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} + K_{43}^{(2)} & K_{44}^{(1)} + K_{44}^{(2)} & K_{45}^{(2)} & K_{46}^{(2)} & 0 & 0 \\ 0 & 0 & K_{53}^{(2)} & K_{54}^{(2)} & K_{55}^{(2)} + K_{55}^{(3)} & K_{56}^{(2)} & 0 & 0 \\ 0 & 0 & K_{63}^{(2)} & K_{64}^{(2)} & K_{65}^{(2)} & K_{66}^{(2)} & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)K31(1)K41(1)0000K12(1)K22(1)K32(1)K42(1)0000K13(1)K23(1)K33(1)+K33(2)K43(1)+K43(2)K53(2)K63(2)00K14(1)K24(1)K34(1)+K34(2)K44(1)+K44(2)K54(2)K64(2)0000K35(2)K45(2)K55(2)+K55(3)K65(2)0000K36(2)K46(2)K56(2)K66(2)000000000000000000

ii = 1, jj = 2
Total_K_Array(5, 6) = Total_K_Array(5, 6) + Element_K_Array_2(1, 2);

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) 0 0 0 0 K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) 0 0 0 0 K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) + K 33 ( 2 ) K 34 ( 1 ) + K 34 ( 2 ) K 35 ( 2 ) K 36 ( 2 ) 0 0 K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) + K 43 ( 2 ) K 44 ( 1 ) + K 44 ( 2 ) K 45 ( 2 ) K 46 ( 2 ) 0 0 0 0 K 53 ( 2 ) K 54 ( 2 ) K 55 ( 2 ) + K 55 ( 3 ) K 56 ( 2 ) + K 56 ( 3 ) 0 0 0 0 K 63 ( 2 ) K 64 ( 2 ) K 65 ( 2 ) K 66 ( 2 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} & 0 & 0 & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} & 0 & 0 & 0 & 0 \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} + K_{33}^{(2)} & K_{34}^{(1)} + K_{34}^{(2)} & K_{35}^{(2)} & K_{36}^{(2)} & 0 & 0 \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} + K_{43}^{(2)} & K_{44}^{(1)} + K_{44}^{(2)} & K_{45}^{(2)} & K_{46}^{(2)} & 0 & 0 \\ 0 & 0 & K_{53}^{(2)} & K_{54}^{(2)} & K_{55}^{(2)} + K_{55}^{(3)} & K_{56}^{(2)} + K_{56}^{(3)} & 0 & 0 \\ 0 & 0 & K_{63}^{(2)} & K_{64}^{(2)} & K_{65}^{(2)} & K_{66}^{(2)} & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)K31(1)K41(1)0000K12(1)K22(1)K32(1)K42(1)0000K13(1)K23(1)K33(1)+K33(2)K43(1)+K43(2)K53(2)K63(2)00K14(1)K24(1)K34(1)+K34(2)K44(1)+K44(2)K54(2)K64(2)0000K35(2)K45(2)K55(2)+K55(3)K65(2)0000K36(2)K46(2)K56(2)+K56(3)K66(2)000000000000000000

组装完第3根杆后得到

K A l l = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) 0 0 0 0 K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) 0 0 0 0 K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) + K 33 ( 2 ) K 34 ( 1 ) + K 34 ( 2 ) K 35 ( 2 ) K 36 ( 2 ) 0 0 K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) + K 43 ( 2 ) K 44 ( 1 ) + K 44 ( 2 ) K 45 ( 2 ) K 46 ( 2 ) 0 0 0 0 K 53 ( 2 ) K 54 ( 2 ) K 55 ( 2 ) + K 55 ( 3 ) K 56 ( 2 ) + K 56 ( 3 ) K 57 ( 3 ) K 58 ( 3 ) 0 0 K 63 ( 2 ) K 64 ( 2 ) K 65 ( 2 ) + K 65 ( 3 ) K 66 ( 2 ) + K 66 ( 3 ) K 67 ( 3 ) K 68 ( 3 ) 0 0 0 0 K 75 ( 3 ) K 76 ( 3 ) K 77 ( 3 ) K 78 ( 3 ) 0 0 0 0 K 85 ( 3 ) K 86 ( 3 ) K 87 ( 3 ) K 88 ( 3 ) ] \begin{equation} \begin{aligned} \mathbf{K}^{All} = \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} & 0 & 0 & 0 & 0 \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} & 0 & 0 & 0 & 0 \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} + K_{33}^{(2)} & K_{34}^{(1)} + K_{34}^{(2)} & K_{35}^{(2)} & K_{36}^{(2)} & 0 & 0 \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} + K_{43}^{(2)} & K_{44}^{(1)} + K_{44}^{(2)} & K_{45}^{(2)} & K_{46}^{(2)} & 0 & 0 \\ 0 & 0 & K_{53}^{(2)} & K_{54}^{(2)} & K_{55}^{(2)} + K_{55}^{(3)} & K_{56}^{(2)} + K_{56}^{(3)} & K_{57}^{(3)} & K_{58}^{(3)} \\ 0 & 0 & K_{63}^{(2)} & K_{64}^{(2)} & K_{65}^{(2)} + K_{65}^{(3)} & K_{66}^{(2)} + K_{66}^{(3)} & K_{67}^{(3)} & K_{68}^{(3)} \\ 0 & 0 & 0 & 0 & K_{75}^{(3)} & K_{76}^{(3)} & K_{77}^{(3)} & K_{78}^{(3)} \\ 0 & 0 & 0 & 0 & K_{85}^{(3)} & K_{86}^{(3)} & K_{87}^{(3)} & K_{88}^{(3)} \end{bmatrix} \end{aligned} \end{equation} KAll= K11(1)K21(1)K31(1)K41(1)0000K12(1)K22(1)K32(1)K42(1)0000K13(1)K23(1)K33(1)+K33(2)K43(1)+K43(2)K53(2)K63(2)00K14(1)K24(1)K34(1)+K34(2)K44(1)+K44(2)K54(2)K64(2)0000K35(2)K45(2)K55(2)+K55(3)K65(2)+K65(3)K75(3)K85(3)00K36(2)K46(2)K56(2)+K56(3)K66(2)+K66(3)K76(3)K86(3)0000K57(3)K67(3)K77(3)K87(3)0000K58(3)K68(3)K78(3)K88(3)

最终得到整体刚度矩阵如上。组合方式如下图所示

图4 平面多连杆结构整体刚度矩阵组装方式

图4 平面多连杆结构整体刚度矩阵组装方式

2.3 单元应力

Element_Stress = Bar2D2Node_Stress(Mat_E, Node1_X, Node1_Y, Node2_X, Node2_Y, Element_Dis_Vec)

  • ToDo:计算单元的应力
  • Input:结构弹性模量Mat_E、第1个节点坐标Node1_X, Node1_Y、第2个节点坐标Node2_X, Node2_Y、单元位移列阵Element_Dis_Vec
  • Output:单元应力标量Element_Stress
function Element_Stress = Bar2D2Node_Stress(Mat_E, Node1_X, Node1_Y, Node2_X, Node2_Y, Element_Dis_Vec)
    % 杆件长度
    Geo_L = sqrt((Node2_X - Node1_X)^2 + (Node2_Y - Node1_Y)^2);
    % 杆件方向向量与整体坐标系X轴的夹角
    Alpha_Rad = atan2(Node2_Y - Node1_Y, Node2_X - Node1_X);
    Cos_Alpha = cos(Alpha_Rad);
    Sin_Alpha = sin(Alpha_Rad);
    Trans_Array = [Cos_Alpha, Sin_Alpha, 0, 0; 0, 0, Cos_Alpha, Sin_Alpha];
    Element_Stress = [-1/Geo_L, 1/Geo_L] * Trans_Array * Element_Dis_Vec;
end

求取第1根杆件上的单元应力为

Element_Stress = Bar2D2Node_Stress(Mat_E, Node1_X, Node1_Y, Node2_X, Node2_Y, Element_Dis_Vec)

σ ( 1 ) = [ − 1 / l 1 / l ] ∗ T ( 1 ) ∗ q ‾ ( 1 ) = [ − 1 / l 1 / l ] ∗ [ cos ⁡ α sin ⁡ α 0 0 0 0 cos ⁡ α sin ⁡ α ] ∗ [ u 1 ( 1 ) v 1 ( 1 ) u 2 ( 1 ) v 2 ( 1 ) ] = σ ( 1 ) \begin{equation} \begin{aligned} \mathbf{\sigma}^{(1)} &= \begin{bmatrix} - 1 / l & 1 / l \end{bmatrix} * \mathbf{T}^{(1)} * \overline{\mathbf{q}}^{(1)} \\ &= \begin{bmatrix} - 1 / l & 1 / l \end{bmatrix} * \begin{bmatrix} \cos \alpha & \sin \alpha & 0 & 0 \\ 0 & 0 & \cos \alpha & \sin \alpha \end{bmatrix} * \begin{bmatrix} u_{1}^{(1)} \\ v_{1}^{(1)} \\ u_{2}^{(1)} \\ v_{2}^{(1)} \\ \end{bmatrix} \\ &= \sigma^{(1)} \end{aligned} \end{equation} σ(1)=[1/l1/l]T(1)q(1)=[1/l1/l][cosα0sinα00cosα0sinα] u1(1)v1(1)u2(1)v2(1) =σ(1)

2.4 单元节点力矢量

Element_Force_Array = Bar2D2Node_Force(Element_K_Array, Element_Dis_Vec)

  • ToDo:计算单元的节点力矢量
  • Input:单元刚度矩阵Element_K_Array、单元位移列阵Element_Dis_Vec
  • Output:单元应力节点力矢量Element_Force_Array
function Element_Force_Array = Bar2D2Node_Force(Element_K_Array, Element_Dis_Vec)
    Element_Force_Array = Element_K_Array * Element_Dis_Vec
end

求取第1根杆件上的节点力为

Element_Force_Array = Bar2D2Node_Force(Element_K_Array_1, Element_Dis_Vec)

P ( 1 ) = K ( 1 ) ∗ q ( 1 ) = [ K 11 ( 1 ) K 12 ( 1 ) K 13 ( 1 ) K 14 ( 1 ) K 21 ( 1 ) K 22 ( 1 ) K 23 ( 1 ) K 24 ( 1 ) K 31 ( 1 ) K 32 ( 1 ) K 33 ( 1 ) K 34 ( 1 ) K 41 ( 1 ) K 42 ( 1 ) K 43 ( 1 ) K 44 ( 1 ) ] ∗ [ u 1 ( 1 ) v 1 ( 1 ) u 2 ( 1 ) v 2 ( 1 ) ] = [ P 1 x ( 1 ) P 1 y ( 1 ) P 2 x ( 1 ) P 2 y ( 1 ) ] \begin{equation} \begin{aligned} \mathbf{P}^{(1)} &= \mathbf{K}^{(1)} * \mathbf{q}^{(1)} \\ &= \begin{bmatrix} K_{11}^{(1)} & K_{12}^{(1)} & K_{13}^{(1)} & K_{14}^{(1)} \\ K_{21}^{(1)} & K_{22}^{(1)} & K_{23}^{(1)} & K_{24}^{(1)} \\ K_{31}^{(1)} & K_{32}^{(1)} & K_{33}^{(1)} & K_{34}^{(1)} \\ K_{41}^{(1)} & K_{42}^{(1)} & K_{43}^{(1)} & K_{44}^{(1)} \\ \end{bmatrix} * \begin{bmatrix} u_{1}^{(1)} \\ v_{1}^{(1)} \\ u_{2}^{(1)} \\ v_{2}^{(1)} \\ \end{bmatrix} \\ &= \begin{bmatrix} P_{1x}^{(1)} \\ P_{1y}^{(1)} \\ P_{2x}^{(1)} \\ P_{2y}^{(1)} \end{bmatrix} \end{aligned} \end{equation} P(1)=K(1)q(1)= K11(1)K21(1)K31(1)K41(1)K12(1)K22(1)K32(1)K42(1)K13(1)K23(1)K33(1)K43(1)K14(1)K24(1)K34(1)K44(1) u1(1)v1(1)u2(1)v2(1) = P1x(1)P1y(1)P2x(1)P2y(1)

求得分别为第1根杆件上2个节点的节点力。

参考

  1. 曾攀. 有限元分析基础教程[M]. 北京: 清华大学出版社, 2008.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值