Пример #1
0
def Gaussian_1D_rat(t, ng):
    """
    Gaussian quadrature points and weights for rational function 1/|x-t|
    integration
    """
    x,w = Idat.Gaussian1D(ng)
    w1 = np.zeros(ng)
    for i in range(ng):
        for j in range(ng):
            w1[i] += (2.0*j+1.0)*poly_Legendre(x[i],j)*Legendre_Qn(t,j)
        w1[i] *= w[i]
        
    return x, w1
Пример #2
0
def Gaussian_1D_log(t, ng):
    """
    Gaussian quadrature points and weights for logarithmic function log|x-t|
    integration
    """
    x,w = Idat.Gaussian1D(ng)
    w1 = np.zeros(ng)
    for i in range(ng):
        for j in range(1,ng-1):
            w1[i] += (poly_Legendre(x[i],j-1)-poly_Legendre(x[i],j+1))*\
            R_function(t,j)
            
        w1[i] += (poly_Legendre(x[i],0)-poly_Legendre(x[i],1))*R_function(t,0)
        w1[i] += poly_Legendre(x[i],ng-2)*R_function(t,ng-1)
        w1[i] += poly_Legendre(x[i],ng-1)*R_function(t,ng)
        w1[i] *= w[i]
    return x, w1
Пример #3
0
def Gaussian_1D_Pn_Log_Rat(t, ng, m = -1):
    if m <= 0:
        m = math.ceil(ng/3)
    x,_ = Idat.Gaussian1D(ng)
    xi = np.empty((3*m,ng))
    mi = np.zeros(3*m)
    mi[0] = 2.0
    
    for i in range(m):
        for j in range(ng):
            pol = poly_Legendre(x[j],i)
            xi[i,j] = pol
            xi[i+m,j] = pol*math.log(math.fabs(x[j]-t))
            xi[i+2*m,j] = pol/(t-x[j])
        mi[i+m] = integration_PnLog(t,i)
        mi[i+2*m] = integration_PnRat(t,i)
        
    w1,_,_,_ = np.linalg.lstsq(xi, mi)
    return x, w1
Пример #4
0
def Gaussian_1D_Pn_Log(t, ng, m = -1):
    """
    Gaussian quadrature points and weights for function Pn(x)*log|x-t|
    """
    if m <= 0:
        m = math.ceil(ng/3)
    x,_ = Idat.Gaussian1D(ng)
    xi = np.empty((2*m,ng))
    mi = np.zeros(2*m)
    mi[0] = 2.0
    
    for i in range(m):
        for j in range(ng):
            pol = poly_Legendre(x[j],i)
            xi[i,j] = pol
            xi[i+m,j] = pol*math.log(math.fabs(x[j]-t))
        mi[i+m] = integration_PnLog(t,i)
        
    w1,_,_,_ = np.linalg.lstsq(xi, mi)
    
    return x, w1
Пример #5
0
def Gaussian_1D_rat2(t, ng):
    """
    Gaussian quadrature points and weights for rational function 1/|x-t|
    integration
    """
    x,w = Idat.Gaussian1D(ng)
    w1 = np.zeros(ng)
    for i in range(ng):
#        for j in range(ng-1):
#            for k in range(j,math.trunc((ng+j-3)/2)+1):
#                w1[i] -= (2*j+1)*(4*k+3-2*i)*Legendre_Qn(t,j)*\
#                poly_Legendre(x[i],2*k+1-(i+1))
        for j in range(1,ng):
            for k in range(math.trunc((j-1)/2)+1):
                w1[i] -= (2*j-4*k-1)*poly_Legendre(x[i],j)*(2*j+1)*\
                Legendre_Qn(t,j-2*k-1)
        for j in range(ng):
            w1[i] += (2.0*j+1.0)/2*poly_Legendre(x[i],j)*\
            (1.0/(t-1.0) - ((-1.0)**j)/(t+1))
        w1[i] *= w[i]
        
    return x, w1
Пример #6
0
#        r0 *= self.getFactor()*2.0*np.pi*self.x_[0]/self.material.mu0
#        r1 = -self.N_[i]*self.u_[0]*0.5
#        r1 *= self.getFactor()
#        R[0] += r0
#        R[1] += r1

Ndof = 2
tOrder = 1
Ng = [3, 3]
totalTime = 1.0e-3
numberTimeSteps = 100
rho_inf = 0.9
tol = 1.0e-8
load = 355.0 / 0.015 / 0.01

intDat = idat.GaussianQuadrature(Ng, 2, idat.Gaussian1D)

intDatB = idat.GaussianQuadrature(3, 1, idat.Gaussian1D)
#intSingDat = idat.GaussianQuadrature(3, 1, idat.Gaussian1D)

# converged solution only with special Gaussian quadrature
intSingDat = SI.SingularGaussian1D(12, intDatB.xg,\
SI.Gaussian_1D_Pn_Log, SI.Gaussian_1D_Pn_Log_Rat)
#intSingDat = None


def readInput(filename, nodeOrder, timeOrder, intData, Ndof=1):
    mesh = FM.MeshWithBoundaryElement()
    file = open(filename, 'r')
    int(file.readline().split()[1])
    nnode = int(file.readline().split()[1])
Пример #7
0
            elements[-1].append(nodes[ie])

    if bnd != 0:
        belms = []
        for e in belm:
            belms.append([])
            for ie in e:
                belms[-1].append(nodes[ie])
        return elements, belms

    return elements, None


nodeOrder = [[0, 1, 2, 0, 1, 2, 0, 1, 2], [0, 0, 0, 1, 1, 1, 2, 2, 2]]

intDat = idat.GaussianQuadrature(Ng, 2, idat.Gaussian1D)


def loadfuncA(x, t):
    return load * math.cos(60.0 * 2 * np.pi * t)


#    return load
def loadfuncAm(x, t):
    return -load * math.cos(60.0 * 2 * np.pi * t)


#    return -load


def loadfuncB(x, t):