Fork me on GitHub

scikit-FEM

from skfem import *

m = MeshTri()
m.refine(4)

e = ElementTriP1()
basis = InteriorBasis(m, e)

@bilinear_form
def laplace(u, du, v, dv, w):
    return du[0]*dv[0] + du[1]*dv[1]

@linear_form
def load(v, dv, w):
    return 1.0*v

A = asm(laplace, basis)
b = asm(load, basis)

I = m.interior_nodes()

x = 0*b
x[I] = solve(*condense(A, b, I=I))

m.plot3(x)
m.show()

  

Please see the directory examples for more instructions.

Contributors

posted @ 2018-08-07 15:36  小奔奔  阅读(224)  评论(0编辑  收藏  举报