Esempio n. 1
0
def str_el6(coord, ul):
    """Compute the strains at each element integration point

    This one is used for 6-noded triangular elements.

    Parameters
    ----------
    coord : ndarray
      Coordinates of the nodes of the element (6, 2).
    ul : ndarray
      Array with displacements for the element.

    Returns
    -------
    epsGT : ndarray
      Strain components for the Gauss points.
    xl : ndarray
      Configuration of the Gauss points after deformation.

    """
    epsl = np.zeros([3])
    epsG = np.zeros([3, 7])
    xl = np.zeros([7, 2])
    XW, XP = gau.gpoints7()
    for i in range(7):
        ri = XP[i, 0]
        si = XP[i, 1]
        ddet, B = stdm6NT(ri, si, coord)
        epsl = np.dot(B, ul)
        epsG[:, i] = epsl[:]
        N = sha6(ri, si)
        xl[i, 0] = sum(N[0, 2*i]*coord[i, 0] for i in range(6))
        xl[i, 1] = sum(N[0, 2*i]*coord[i, 1] for i in range(6))
    return epsG.T, xl
Esempio n. 2
0
def uel6ntrian(coord, enu, Emod):
    """Triangular element with 6 nodes

    Parameters
    ----------
    coord : ndarray
      Coordinates for the nodes of the element (6, 2).
    enu : float
      Poisson coefficient (-1, 0.5).
    Emod : float
      Young modulus (>0).

    Returns
    -------
    kl : ndarray
      Local stiffness matrix for the element (12, 12).
 
    Examples
    --------
    
    >>> coord = Matrix([
    ...         [0, 0],
    ...         [1, 0],
    ...         [0, 1],
    ...         [0.5, 0],
    ...         [0.5, 0.5],
    ...         [0, 0.5]])
    >>> stiff = uel6ntrian(coord, S(1)/3, S(8)/3)
    >>> stiff_ex = 1/6 * Matrix([
    ...            [12, 6, 3, 1, 1, 1, -12, -4, 0, 0, -4, -4],
    ...            [6, 12, 1, 1, 1, 3, -4, -4, 0, 0, -4, -12],
    ...            [3, 1, 9, 0, 0, -1, -12, -4, 0, 4, 0, 0],
    ...            [1, 1, 0, 3, -1, 0, -4, -4, 4, 0, 0, 0],
    ...            [1, 1, 0, -1, 3, 0, 0, 0, 0, 4, -4, -4],
    ...            [1, 3, -1, 0, 0, 9, 0, 0, 4, 0, -4, -12],
    ...            [-12, -4, -12, -4, 0, 0, 32, 8, -8, -8, 0, 8],
    ...            [-4, -4, -4, -4, 0, 0, 8, 32, -8, -24, 8, 0],
    ...            [0, 0, 0, 4, 0, 4, -8, -8, 32, 8, -24, -8],
    ...            [0, 0, 4, 0, 4, 0, -8, -24, 8, 32, -8, -8],
    ...            [-4, -4, 0, 0, -4, -4, 0, 8, -24, -8, 32, 8],
    ...            [-4, -12, 0, 0, -4, -12, 8, 0, -8, -8, 8, 32]])
    >>> (stiff - stiff_ex).norm()/stiff_ex.norm() < 1e-6
    True
    
    """
    kl = np.zeros([12, 12])
    C = fem.umat(enu, Emod)
    XW, XP = gau.gpoints7()
    ngpts = 7
    for i in range(ngpts):
        ri = XP[i, 0]
        si = XP[i, 1]
        alf = XW[i]
        ddet, B = fem.stdm6NT(ri, si, coord)
        kl = kl + 0.5*B.T*C*B*alf*ddet
    return kl
Esempio n. 3
0
def str_el6(coord, ul):
    """Compute the strains at each element integration point

    This one is used for 6-noded triangular elements.

    Parameters
    ----------
    coord : ndarray
      Coordinates of the nodes of the element (6, 2).
    ul : ndarray
      Array with displacements for the element.

    Returns
    -------
    epsGT : ndarray
      Strain components for the Gauss points.
    xl : ndarray
      Configuration of the Gauss points after deformation.

    """
    epsl = np.zeros([3])
    epsG = np.zeros([3, 7])
    epsGT = np.zeros([7, 3])
    xl = np.zeros([7, 2])
    x, y = symbols('x y')

    XW, XP = gau.gpoints7()
    for i in range(7):
        ri = XP[i, 0]
        si = XP[i, 1]
        ddet, B = stdm6NT(ri, si, coord)
        epsl = B*ul
        epsG[:, i] = epsl[:]
        N = sha6(ri, si)
        NN = N.subs([(x, ri), (y, si)])
        xl[i, 0] = sum(NN[0, 2*i]*coord[i, 0] for i in range(6))
        xl[i, 1] = sum(NN[0, 2*i]*coord[i, 1] for i in range(6))
    epsGT = epsG.T
    return epsGT, xl
Esempio n. 4
0
def uel6ntrian(coord, par):
    """Triangular element with 6 nodes

    Parameters
    ----------
    coord : ndarray
      Coordinates for the nodes of the element (6, 2).
    enu : float
      Poisson coefficient (-1, 0.5).
    Emod : float
      Young modulus (>0).

    Returns
    -------
    kl : ndarray
      Local stiffness matrix for the element (12, 12).
 
    Examples
    --------

    >>> coord = np.array([
    ...         [0, 0],
    ...         [1, 0],
    ...         [0, 1],
    ...         [0.5, 0],
    ...         [0.5, 0.5],
    ...         [0, 0.5]])
    >>> stiff = uel6ntrian(coord,1/3, 8/3)
    >>> stiff_ex = 1/6 * np.array([
    ...            [12, 6, 3, 1, 1, 1, -12, -4, 0, 0, -4, -4],
    ...            [6, 12, 1, 1, 1, 3, -4, -4, 0, 0, -4, -12],
    ...            [3, 1, 9, 0, 0, -1, -12, -4, 0, 4, 0, 0],
    ...            [1, 1, 0, 3, -1, 0, -4, -4, 4, 0, 0, 0],
    ...            [1, 1, 0, -1, 3, 0, 0, 0, 0, 4, -4, -4],
    ...            [1, 3, -1, 0, 0, 9, 0, 0, 4, 0, -4, -12],
    ...            [-12, -4, -12, -4, 0, 0, 32, 8, -8, -8, 0, 8],
    ...            [-4, -4, -4, -4, 0, 0, 8, 32, -8, -24, 8, 0],
    ...            [0, 0, 0, 4, 0, 4, -8, -8, 32, 8, -24, -8],
    ...            [0, 0, 4, 0, 4, 0, -8, -24, 8, 32, -8, -8],
    ...            [-4, -4, 0, 0, -4, -4, 0, 8, -24, -8, 32, 8],
    ...            [-4, -12, 0, 0, -4, -12, 8, 0, -8, -8, 8, 32]])
    >>> np.allclose(stiff, stiff_ex)
    True
    
    """
    Emod = par[0]
    enu = par[1]
    rho = par[2]
    calpha = par[3]
    cbeta = par[4]
    kl = np.zeros([12, 12])
    ml = np.zeros([12, 12])
    cl = np.zeros([12, 12])
    C = fem.umat(enu, Emod, rho)
    XW, XP = gau.gpoints7()
    ngpts = 7
    for i in range(ngpts):
        ri = XP[i, 0]
        si = XP[i, 1]
        alf = XW[i]
        ddet, B = fem.stdm6NT(ri, si, coord)
        N = fem.sha6(ri, si)
        kl = kl + 0.5 * np.dot(np.dot(B.T, C), B) * alf * ddet
        ml = ml + 0.5 * rho * np.dot(N.T, N) * alf * ddet
    cl = calpha * kl + cbeta * ml
    return kl, ml, cl