### The use of general passion is success but the use of adaptive error

191
views
0
7 months ago by
Hello everyone:
I am studying auto-adaptive solution, unluckly, In the process i encountered a problem;

the code is following:

from dolfin import *
# Create mesh and define function space
mesh = UnitSquareMesh(8, 8)
V = FunctionSpace(mesh, "CG", 1)
# Define Dirichlet boundary (x = 0 or x = 1)
def boundary(x):
return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS

# Define boundary condition
u0 = Constant(1.0)
bc = DirichletBC(V, u0, boundary)

# Define variational problem
u = TrialFunction(V)
v = TestFunction(V)

g = Expression("sin(5*x[0])",degree=2)
A = lhs(F)
L = rhs(F)

tol=1e-3
# Compute solution
u = Function(V)
M=u*dx
problem = LinearVariationalProblem(A,L,u,bc)
solver.solve(tol)

# Plot solution
plot(u.leaf_node())

interactive()

An error occurs when  using adaptation. However not using adaption is runnable, how do i solve?
Best wishes!
Thank you!

The tip of error is forrowing:
Generating forms required for error control, this may take some time...
Traceback (most recent call last):
File "demo_poisson.py", line 29, in <module>
File "/usr/lib/python2.7/dist-packages/dolfin/fem/adaptivesolving.py", line 59, in __init__
ec = generate_error_control(self.problem, goal)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/adaptivesolving.py", line 146, in generate_error_control
(ufl_forms, is_linear) = generate_error_control_forms(problem, goal)
File "/usr/lib/python2.7/dist-packages/dolfin/fem/adaptivesolving.py", line 194, in generate_error_control_forms
assert len(form.ufl_domains()) > 0, "Error control got as input a form with no domain!"
AssertionError: Error control got as input a form with no domain!
[1] 5740 abort python demo_poisson.py
Community: FEniCS Project