Пример #1
0
def lowerOrderAMORE(coordTri,Dmat,coord1,rho1,coord2=None,rho2=None):
    if coord2 is None: 
        coord2=coord1
        rho2=rho1

    if coord1.shape[0]+coord2.shape[0]==6: nInt=3
    elif coord1.shape[0]+coord2.shape[0]==7: nInt=4
    else: nInt=6 

    pos,wei=numericalIntegration.gaussTri(nInt)
    LCmat1=getLC(coordTri,rho1)

    if rho2 is rho1: LCmat2=LCmat1
    else: LCmat2=getLC(coordTri,rho2)

    Kloc=np.zeros((2*coord1.shape[0],2*coord2.shape[0]))

    for i in range(nInt):
        Nmat,_,Jacobian=shapeFunction.shapeTriFE2(coordTri,pos[i,0],pos[i,1])
        rho1Value=(Nmat@rho1)[0]
        xy=(Nmat@coordTri).reshape(-1)
        Bmat1=getStrainMatrix(LCmat1,coord1,xy,rho1Value)

        if rho2 is rho1: Bmat2=Bmat1
        else: 
            rho2Value=(Nmat@rho2)[0]
            Bmat2=getStrainMatrix(LCmat2,coord2,xy,rho2Value)

        Kloc+=0.5*np.matmul(Bmat1.transpose(),np.matmul(Dmat,Bmat2))*Jacobian*wei[i]
    
    return Kloc
Пример #2
0
def quadraticAMORE(coordTri,Dmat,coord1,rho1,coord2=None,rho2=None):
    """For a straight-edge triangle. It can be curved only at the boundary."""
    if coord2 is None: 
        coord2=coord1
        rho2=rho1

    if coord1.shape[0]+coord2.shape[0]==6: nInt=3 # 3+3
    elif coord1.shape[0]+coord2.shape[0]==7: nInt=4 # 3+4
    elif coord1.shape[0]+coord2.shape[0]==8: nInt=6 # 4+4
    elif coord1.shape[0]+coord2.shape[0]==9: nInt=4 # 3+6
    elif coord1.shape[0]+coord2.shape[0]==10: nInt=6 # 4+6
    elif coord1.shape[0]+coord2.shape[0]==12: nInt=9 # 3+9
    elif coord1.shape[0]+coord2.shape[0]==13: nInt=12 # 4+9
    else: nInt=16 # 9+9

    pos,wei=numericalIntegration.gaussTri(nInt)

    Kloc=np.zeros((2*coord1.shape[0],2*coord2.shape[0]))

    if len(coordTri)==3:
        LCmat1=getLC(coordTri,rho1) # A constant matrix

        if rho2 is rho1: LCmat2=LCmat1
        else: LCmat2=getLC(coordTri,rho2)

        for i in range(nInt):
            Nmat,_,Jacobian=shapeFunction.shapeTriFE2(coordTri,pos[i,0],pos[i,1])
            rho1Value=(Nmat@rho1)[0]
            xy=(Nmat@coordTri).reshape(-1)
            Bmat1=getStrainMatrix(LCmat1,coord1,xy,rho1Value)
    
            if rho2 is rho1: Bmat2=Bmat1
            else: 
                rho2Value=(Nmat@rho2)[0]
                Bmat2=getStrainMatrix(LCmat2,coord2,xy,rho2Value)
    
            Kloc+=0.5*np.matmul(Bmat1.transpose(),np.matmul(Dmat,Bmat2))*Jacobian*wei[i]   

    elif len(coordTri)==6:
        for i in range(nInt):
            LCmat1=getLC(coordTri,rho1,pos[i,0],pos[i,1]) # No longer constant
            if rho2 is rho1: LCmat2=LCmat1
            else: LCmat2=getLC(coordTri,rho2,pos[i,0],pos[i,1])

            Nmat,_,Jacobian=shapeFunction.shapeTriQuadFE2(coordTri,pos[i,0],pos[i,1])
            rho1Value=pos[i,0]*rho1[0]+pos[i,1]*rho1[1]+pos[i,2]*rho1[2]

            xy=(Nmat@coordTri).reshape(-1)
            Bmat1=getStrainMatrix(LCmat1,coord1,xy,rho1Value)

            if rho2 is rho1: Bmat2=Bmat1
            else: 
                rho2Value=pos[i,0]*rho2[0]+pos[i,1]*rho2[1]+pos[i,2]*rho2[2]
                Bmat2=getStrainMatrix(LCmat2,coord2,xy,rho2Value)

            Kloc+=0.5*np.matmul(Bmat1.transpose(),np.matmul(Dmat,Bmat2))*Jacobian*wei[i]

    else: raise ValueError
    
    return Kloc
Пример #3
0
def triFE(coord,Dmat):
    nInt=1

    (pos,wei)=numericalIntegration.gaussTri(nInt)

    Kloc=np.zeros((2*len(coord),2*len(coord)))

    for i in range(nInt):
        (Bmat,Jacobian)=shapeFunction.shapeTriFE(coord,pos[i,0],pos[i,1])[1:3]
        Kloc+=0.5*np.matmul(Bmat.transpose(),np.matmul(Dmat,Bmat))*Jacobian*wei[i]
    
    return Kloc