I would like to switch the sign on a Dirichlet boundary deep in the code after the BC is specified, after I have lost access to the original arguments of the Expression which specified the boundary value. When I do this I get a PETSc error
Error: Unable to successfully call PETSc function 'MatSetSizes'.
My FEniCS is the development version from mid September, so I am wondering if anyone
can reproduce this with other FEniCS versions. Also any suggestions to workarounds are welcome.
from dolfin import *
mesh = UnitCubeMesh(2, 2, 2)
V = VectorFunctionSpace(mesh, "CG", 2)
Q = FunctionSpace(mesh, "CG", 1)
W = V*Q
foo = Expression(["0.0", "t", "0.0"], t = 1.0)
foo2 = Expression(["0.0", "t", "0.0"], t = 1.0)
foo2 *= -1
#This one works
bc1 = DirichletBC(*[W.sub(0), foo, "near(x[0], 1.0)"])
#This one does not
bc2 = DirichletBC(*[W.sub(0), foo2, "near(x[0], 1.0)"])