def showdirs(): k = 10 #direction=array([[1.0,1.0]])/sqrt(2) direction=array([[1,1]])/sqrt(2) # direction = array([[1,0]]) mesh = pmm.gmshMesh('squarescatt.msh',dim=2) problem = psp.Problem(mesh, k, None) etods = prc.tracemesh(problem, {10:lambda x:direction}) pom.showdirections2(problem.mesh, etods) pom.showmesh(problem.mesh)
def examplepic(n, k=20): origin = np.array([-0.2,-0.2]) bounds=np.array([[0,1],[0,1]],dtype='d') npoints=np.array([k * 20,k * 20], dtype=int) g = pcb.FourierHankel(origin, [0], k) pom.output2dfn(bounds, g.values, npoints, alpha=1.0, cmap=mp.cm.get_cmap('binary')) rt = PlaneWaveFromSourceRule(origin) mesh = tum.regularsquaremesh(n) pom.showmesh(mesh) etob = {} psp.Problem(mesh,k, None).populateBasis(etob, rt) pom.showdirections(mesh, etob) mp.show()
def bubblematerial(c = 1, N = 20): # slowness, gradslowness = bubble(c) slowness, gradslowness = hump(c) x0 = np.vstack((np.linspace(0,1,N), np.zeros(N))).T p0 = np.vstack((np.zeros(N), np.ones(N))).T wfs, idxs = prw.wavefront(x0, p0, slowness, gradslowness, 0.1, 1.2/c, 0.1) mp.subplot(1,2,1) plotwavefront(wfs, idxs) mesh = ptum.regularsquaremesh(12, "BDY") etob = prb.getetob(wfs, idxs, mesh, "BDY") mp.subplot(1,2,2) pom.showmesh(mesh) pom.showdirections(mesh, etob,scale=20)