Ejemplo n.º 1
0
def geterr(problem, basisrule):
    computation = psc.Computation(problem, basisrule, pcp.HelmholtzSystem, 15)
    solution = computation.solution(psc.DirectSolver().solve, dovolumes=True)
#    mp.close()
#    pom.output2dsoln(bounds, solution, npoints)
#    pos.standardoutput(computation, solution, 20, bounds, npoints, None)
    return pos.comparetrue(bounds, npoints, g, solution)
Ejemplo n.º 2
0
#average = (mesh.connectivity + mesh.internal)/2
#jump = mesh.internal - mesh.connectivity
#AD = average
#AN = jump / 2
#JD = jump
#JN = average * 2
#I = mesh.facepartition
#
#print mesh.connectivity.nnz, mesh.internal.nnz, AD.nnz, AN.nnz, JD.nnz, JN.nnz, I.nnz

npw = 12
quadpoints = 10

# Original basis:
pw = pcbv.PlaneWaveVariableN(pcb.uniformdirs(2,npw))
# Polynomials only:
#basisrule = pcbr.ReferenceBasisRule(pcbr.Dubiner(3))
# Product basis:
#basisrule = pcb.ProductBasisRule(pcb.planeWaveBases(2,k,npw), pcbr.ReferenceBasisRule(pcbr.Dubiner(1)))

#basisrule=pcb.ProductBasisRule(pw,pcbr.ReferenceBasisRule(pcbr.Dubiner(0)))
basisrule = pw
#basisrule = pcbred.SVDBasisReduceRule(puq.trianglequadrature(quadpoints), basisrule)

problem = psp.Problem(mesh, k, bnddata)
computation = psc.DirectComputation(problem, basisrule, quadpoints, pcp.HelmholtzSystem)
solution = computation.solution(dovolumes=True)

pos.comparetrue(bounds, npoints, g, solution)
pos.standardoutput(solution, quadpoints, bounds, npoints, 'square', mploutput = True)
Ejemplo n.º 3
0
 def process(self, n, solution):
     err = pos.comparetrue(self.bounds, self.npoints, self.g, solution)
     print n, err
     if self.docomma: self.ftxt.write(', ')
     self.docomma = True
     self.ftxt.write(str(err))