How can you assemble matrix once, and apply for different boundary conditions to have an efficent ensemble simulation

Hi guys,

Could you please help me with this? I have a shared coefficient matrix and p different boundary conditions, which are slightly different. I am trying to assemble the matrix once, and then apply different boundary conditions.

However, when I assemble the matrix, I specify the boundary conditions.
Is there a way to separate them?


  1. Please use the search button before posting, otherwise we may end up closing your post due to violation of the discourse rules. Assuming that you are using dolfinx, there was a recent message by @federicobetti with the same question. Search for it, and then post the resulting link in an answer.
  2. Again, according to the discourse rules this post is too vague: you do not specificy if you are using dolfin or dolfinx, you do not give an attempt of what you tried. I’ll give you one answer to rectify this. Failure to do so will result in me closing down the post.

No answer in the last 4 days, even though the user was seen only more recently than that. Closing.

1 Like