This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Assigning dirichlet boundary conditions directly to a function

+1 vote

I have a vector of DirichletBCs,

std::vector<const DirichletBC*>

which work just fine when used with a solver. I would like to be able to update the Function with the DirichletBCs directly, without going through a solver. I have been trying to find a way to interpolate the Expression within each of the DirichletBCs, within its respective SubDomain, onto my Function.

How might I go about this?

I was hoping to find something like

u->interpolate(Expression, SubDomain);

Thanks!

asked Jan 14, 2014 by Charles FEniCS User (4,220 points)

1 Answer

+2 votes
 
Best answer

Try

bc->apply(u.vector())
answered Jan 14, 2014 by Marie E. Rognes FEniCS User (5,380 points)
selected Jan 14, 2014 by Charles

Very nice, thank you!

...