On 10/28/23 12:46, Simon wrote:

After assembling and solving the linear system, I need the uncondensed system matrix and right hand side to perform a sensitivity analysis. In particular, I need the rows and entries of the system matrix and RHS corresponding to constrained dofs. However, the constraints.distribute_local_to_global() function sets these entries all to zero (except the diagonal value of the system matrix).
My solution to deal with this is to basically copy my assembly function and,
instead of distributing the constraints with the constraints object --
constraints.distribute_local_to_global() --
I distributed them with the cell iterator --
cell-> distribute_local_to_global(),
which does not care about the constraints.

This solution is of course very inefficient as for efficiency and code re-use.
As I said, it is basically a copy of my assembly function,
although most of the system matrix "is already there".

So is there a more efficient way to recover the full system matrix based on the condensed system matrix?

No. If I tell you that a number x is a sum of two contributions a+b, there is no way for you to recover a and b from x. You have to store it somewhere.

In your case, though, you don't actually need to compute the contributions twice -- you can just compute it once and then both save the contributions locally *and* distribute them to the global matrix. In fact, you only need to store contributions for constrained degrees of freedom, rather than for all.

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           www: http://www.math.colostate.edu/~bangerth/


--
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- You received this message because you are subscribed to the Google Groups "deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/ad4901fe-d57c-39b6-50f6-1bea81683fea%40colostate.edu.

Reply via email to