Example #1
0
 def testL2Prod(self):
     N = 20
     k = 10
     qxw = puq.squarequadrature(N)
     D = 1
     g = pcb.PlaneWaves(pcb.circleDirections(40)[15], k)
     t1 = prp.findpw(prp.L2Prod(g.values, qxw, k), D, maxtheta = 1)
     self.assertAlmostEqual(t1, (2 * math.pi * 15) / 40)
Example #2
0
    def testEdge(self):
        N = 10
        k = 10
        D = 1
        x,w = puq.legendrequadrature(3*N)
        x = np.hstack((x, np.zeros_like(x)))
        
        g = pcb.PlaneWaves(pcb.circleDirections(40)[15], k)
        bc = pcbd.generic_boundary_data([1j*k,1],[1j*k,1],g)
#        t1 = prp.findpw(prp.ImpedanceProd(bc, (x,w), [0,1], k), D, maxtheta = 1)

        t1 = prp.findpw(prp.L2Prod(bc.values, (x,w), k), D, maxtheta = 1)
        self.assertAlmostEqual(t1, (2 * math.pi * 15) / 40)
Example #3
0
#    
#    mesh = tum.regularsquaremesh()
#    e = 0
#    mqs = pmmu.MeshQuadratures(mesh, puq.legendrequadrature(N))
#    qx = np.vstack([mqs.quadpoints(f) for f in mesh.etof[e]])
#    qw = np.concatenate([mqs.quadweights(f) for f in mesh.etof[e]])
#    qxw = (qx,qw)
    
    qrp(qxw, pcb.circleDirections(4), k)
    
    g = pcb.PlaneWaves(pcb.circleDirections(40)[15], k)
    g = pcb.FourierHankel([-1,-0.5], [10], k)
    g = pcb.BasisReduce(pcb.PlaneWaves(pcb.circleDirections(20)[[5,8]], k), [3,1])
    g = pcb.BasisReduce(pcb.BasisCombine([pcb.FourierHankel([-1,-0.5], [0], k), pcb.FourierHankel([-0.2,0.5], [0], k)]), [1,1])
#    g = pcb.FourierBessel([0.25,0.25],[20], k)

    t1 = pap.findpw(pap.L2Prod(g.values, qxw, k), D, maxtheta = 1)
    g1 = project(g, qxw, k, t1)
    t2 = pap.findpw(pap.L2Prod(g1.values, qxw, k), D, maxtheta = 1)
    g2 = project(g1, qxw, k, t2)
    print t1
    print t2

    theta, proj, projd, projdd = pwproduniform(g.values, qxw, k, 500)
#    print errs[0]
    mp.plot(theta, proj[0])
#    mp.plot(theta, projd[0])
#    mp.plot(theta, projdd[0])
#    mp.plot(theta, (np.roll(projd[0],-1) - projd[0]) / (np.roll(theta,-1) - theta))
#    mp.plot(theta, D**2 * k * np.sqrt(proj[0] / 3))
    mp.show()