Optimal heat problem yields zero control and crashes
Hi
Using the following reference (https:/
I am using Fenics 1.2 on Ubuntu 12.04 with the latest dolfin-adjoint (1.2.0-
My question is if dolfin-adjoint is developed with an earlier version of Fenics in mind, or what other reason might there be for this behavior? (several similar crashes occur during other examples as well)
Thanks!
-------
#2D heat optimal control problem
from dolfin import *
from dolfin_adjoint import *
mesh = RectangleMesh(-1, -1, 1, 1, 20, 20)
V = FunctionSpace(mesh, "CG", 1)
u = Function(V, name="State")
m = Function(V, name="Control")
v = TestFunction(V)
F = (inner(grad(u), grad(v)) - m*v)*dx
bc = DirichletBC(V, 0.0, "on_boundary")
solve(F == 0, u, bc)
u_desired = Expression(
J = Functional(
reduced_functional = ReducedFunction
m_opt = minimize(
options = {"gtol": 1e-12,"ftol": 1e-12,"disp": True})
proj_error = project(
save_file = File("optim_
# desire solution
proj_udes = project(
plot(u_desired, mesh, interactive=True, title="Desired")
# Actual solution
solve(F == 0, u, bc)
plot(u, interactive=True, title="Actual")
# L1 error
proj_error = project(
plot(proj_error, interactive=True, title="L1-Error")
# Optimal forcing
plot(m_opt, interactive=True, title="Control")
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Simon Funke
- Solved:
- Last query:
- Last reply: