def calcPoissonError (solname, outputdir, exactsol):

    # get aproximated solution at each node
    sol = Solution(solname, outdir=outputdir)
    uh = sol.getPhie()[0,:] 

    # compute exact solution at each node
    ue = np.zeros((np.shape(uh)[0]),dtype='float32') # exact u
    lM = sol.getLumpedMassMatrixE()                  # lumped Mass
    mesh = sol.getNodes()   
    X = mesh[:,0]
    Y = mesh[:,1]
    Z = mesh[:,2]
    ue = evalExactSolution(exactsol, X, Y, Z)   

    # compute nodal error
    err = ue - uh

    # compute the L2 norm of the error
    normeu = sol.calcL2NormError(err, lM)
    return normeu
def viewLaplaceSolution (solname):

    lasol = Solution(solname)
    lphie = lasol.getPhie()

    # no time steps
    lphie = lphie[0,:]
    
    peshp = np.shape(lphie)[0]

    # view structured square mesh only
    numNodesX = int( sqrt(peshp) )
    numNodesY = int( sqrt(peshp) )

    # reshape for visualization
    phie = np.reshape(lphie, (numNodesX,numNodesY))

    ax = subplot(111)
    im = imshow(phie,cmap=cm.jet)
    im.set_interpolation('bilinear')
    title('Solution of the Laplace problem')
    colorbar()
    show()