我在windows子系统上安装了fenics,以便linux完成我的工作,我正在尝试测试fenics。因此,我在教程中使用了ft01_possion.py。
from fenics import *
# Create mesh and define function space
mesh = UnitSquareMesh(8, 8)
V = FunctionSpace(mesh, 'P', 1)
# Define boundary conditions
u_D = Expression('1 + x[0]*x[0] + 2*x[1]*x[1]', degree = 2)
def boundary(x, on_boundary):
return on_boundary
bc = DirichletBC(V, u_D, boundary)
# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)
f = Constant(-6.0)
a = dot(grad(u), grad(v))*dx
L = f*v*dx
# Compute solution
u = Function(V)
solve(a == L, u, bc)
# Plot solution and mesh
plot(u)
plot(mesh)
interactive()它没有显示这个数字。我得到的错误是:
Solving linear variational problem.
Traceback (most recent call last):
File "ft01_poisson.py", line 29, in <module>
interactive()
NameError: name 'interactive' is not defined我试图重新安装fenics的最新版本,但没有成功。
当输出错误值时,NameError会阻止图形显示。
发布于 2019-08-07 09:02:51
发布于 2019-01-08 19:31:22
错误显示如下: error_L2 = 0.008235098073354827 error_max = 1.3322676295501878e-15,但是没有定义名称‘交互式’,这个错误可能不会影响结果。
https://stackoverflow.com/questions/53730427
复制相似问题