Ejemplo n.º 1
0
f=f.squeeze()
(X,error)=solve(S,f)


#X = print_timing(spsolve)(S.tocsr(), f.tocsr())

#print X


print "Residual: %e: " % numpy.linalg.norm(S*X-f) 



EvalError=EvalElementError(mesh,elttobasis,quad, bnddata, lv, bndvs)
(ed,en,eb)=EvalError.evaluate(X)
print numpy.linalg.norm(ed),numpy.linalg.norm(en),numpy.linalg.norm(eb)

vtkgrid=VTKGrid(mesh,scalars=ed)
vtkgrid.write('test.vtu')


eval_fun=lambda points: numpy.real(Evaluator(mesh,elttobasis,points).evaluate(X))
bounds=numpy.array([[-2,2],[-2,2],[-2,2]],dtype='d')
npoints=numpy.array([50,50,50])
vtk_structure=VTKStructuredPoints(eval_fun)
vtk_structure.create_vtk_structured_points(bounds,npoints)
vtk_structure.write_to_file('test.vti')
t.split("output")
t.show()

Ejemplo n.º 2
0
f=numpy.array(f.todense())
f=f.squeeze()
(X,error)=solve(S,f)


#S=S.tocsr()
#f=f.tocsr()
#X = print_timing(spsolve)(S, f)

print "Residual: %e: " % numpy.linalg.norm(S*X-f) 

#print X


EvalError=EvalElementError(mesh,elttobasis,quad, bnddata, lv, bndvs)
(ed,en,eb)=EvalError.evaluate(X)
print numpy.linalg.norm(ed),numpy.linalg.norm(en),numpy.linalg.norm(eb)

vtkgrid=VTKGrid(mesh,scalars=ed)
vtkgrid.write('soundsoft.vtu')


print "Evaluating solution"

eval_fun=lambda points: numpy.real(Evaluator(mesh,elttobasis,points[:,:2]).evaluate(X))
bounds=numpy.array([[-2,2],[-2,2],[0,0]],dtype='d')
npoints=numpy.array([200,200,1])
vtk_structure=VTKStructuredPoints(eval_fun)
vtk_structure.create_vtk_structured_points(bounds,npoints)
vtk_structure.write_to_file('soundsoft.vti')