Hi everyone,

Attached is a code in which I am attempting to do optimization.

For the dffusion operator, I want to enforce this:

min 1/2*x^T*H*x - x^T*f
s.t. 0 < x < 1

Starting at line 197 is where I have set up TAO through petsc4py. I have done this problem previously purely through PETSc (Matt's FEM w/DMPlex), and directly translated my C code into what I currently have, but the issue I am running into is enforcing non-homogeneous boundary conditions. I am still a little confused on how to enforce these in the context of firedrake/petsc4py, so I was wondering if you guys could help me "fix" what I have.

The attached code runs, but I do not think the boundary conditions for the optimization problem are not enforced correctly.

Thanks,
Justin