Example #1
0
 def output(self, i, solution):
     print "Adaptive step ",i
     standardoutput(self.computation, solution, self.quadpoints, self.bounds,self.npoints, "%s%s"%(self.fileroot,i))
     pob.vtkbasis(self.computation.problem.mesh, self.computation.etob, "%s%s%s%s"%(self.fileroot,"dirs", i,".vtu"), solution.x)
     if self.g: comparetrue(self.bounds, self.npoints, self.g, solution)
Example #2
0
beta=p**2*h*k
alpha=k*p**2*1./h
delta=.5

alpha=.5
beta=.5
delta=.5

entityton ={6:nfun}
problem=psp.VariableNProblem(entityton, mesh,k, bnddata)
etods = prc.tracemesh(problem, {8:lambda x:direction})


etob = [[pcb.PlaneWaves(ds, k)] if len(ds) else [] for ds in etods]
pob.vtkbasis(mesh,etob,'waveguide_rays.vtu',None)

b0=pcbv.PlaneWaveVariableN(pcb.circleDirections(10))
b=pcb.PlaneWaveFromDirectionsRule(etods)

b1=pcb.ProductBasisRule(b,pcbr.ReferenceBasisRule(pcbr.Dubiner(p)))
b2=pcbr.ReferenceBasisRule(pcbr.Dubiner(p))

origins=np.array([[0,0],[0,5],[5,1],[0,1]])
h=pcb.FourierHankelBasisRule(origins,[0])
h2=pcb.ProductBasisRule(h,pcbr.ReferenceBasisRule(pcbr.Dubiner(p)))
bh=pcb.UnionBasisRule([h2,b1])
b3=pcb.ProductBasisRule(b0,b2)


basisrule = b3 #cbred.SVDBasisReduceRule(puq.trianglequadrature(quadpoints), bh, threshold=1E-5)
Example #3
0
         12:pcbd.generic_boundary_data([-1j*k,1],[-1j*k,1],g=g)}

bounds=array([[-2,2],[-2,2]],dtype='d')
npoints=array([200,200])

mesh = pmm.gmshMesh('circscatt.msh',dim=2)

quadpoints = 20
p=2

entityton ={11:1}
problem=psp.VariableNProblem(entityton, mesh,k, bnddata)
etods = prc.tracemesh(problem, {12:lambda x:direction})

etob = [[pcb.PlaneWaves(ds, k)] if len(ds) else [] for ds in etods]
pob.vtkbasis(mesh,etob,'circsoundsoftrays.vtu',None)

b0=pcbv.PlaneWaveVariableN(pcb.circleDirections(20))
b=pcb.PlaneWaveFromDirectionsRule(etods)
b1=pcb.ProductBasisRule(b,pcbr.ReferenceBasisRule(pcbr.Dubiner(p)))
b2=pcbr.ReferenceBasisRule(pcbr.Dubiner(p))

computation = psc.Computation(problem, b1, pcp.HelmholtzSystem, quadpoints)

solution = computation.solution(psc.DirectSolver().solve, dovolumes=True)
pos.standardoutput(computation, solution, quadpoints, bounds, npoints, 'circsoundsoft_pol')
print solution.getError('Dirichlet')
print solution.getError('Neumann')
print solution.getError('Boundary')