Question about distribute_local_to_global

23 views
Skip to first unread message

Joss G.

unread,
Nov 16, 2021, 11:34:10 AM11/16/21
to deal.II User Group
Dear all, 

I am having an issue that I would like to share and hopefullyI can get some feedback.
In my code, I first do an assemble and  I store the operators in the corresponding variables. Then, I have an update() function, where I use the pre-anssambled operators and change some values to compute different frequencies to build the system_matrix. Until here everything works.

I need to export the operators to perform some computations in a different environment. I used SparseMatrix::print_formatted() and verified that the exported values are the same as the ones in my dealii code.
 I did a sanity check, where I take the exported operators and solve the same system in in another environment (which is also validated). However, I get wrong results when using the exported operators.

The single function in my dealii code that I am calling in the end of my update() function is 
constraints.distribute_local_to_global(cell_matrix,
cell_rhs,
local_dof_indices,
system_matrix,
system_rhs);

My question is, if thee distribute_local_to_global function is performing something
that I am missing, which can be changing the system_matrix so that I need to do something
else with the exported operators when I create the system_matrix in the sanity check
at the other environment.

Thank you very much


Wolfgang Bangerth

unread,
Nov 16, 2021, 11:47:46 AM11/16/21
to dea...@googlegroups.com
On 11/16/21 9:34 AM, Joss G. wrote:
> /
> /
> /*My question is, */if thee /distribute_local_to_global function / is
> performing something
> that I am missing, which can be changing the system_matrix so that I
> need to do something
> else with the exported operators when I create the /system_matrix /in
> the sanity check
> at the other environment.

I *think* that your question is whether a sparse matrix is characterized
only by its entries (which you can write out) or whether there is some
additional hidden state that also affects the solution of a linear
system. The answer is the former. If you output the entries of a matrix
and a right hand side and solve the linear system in a different
environment, then you better get the same result.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/
Reply all
Reply to author
Forward
0 new messages