Query regarding solution of linear system in deal.ii using linear solver

32 views
Skip to first unread message

Krish

unread,
Jul 29, 2023, 10:36:19 AM7/29/23
to deal.II User Group
Hello,

I am solving a problem that has 30 degrees of freedom. The newton update solution obtained from deal.ii (using both Direct and CG solver) seems to be less accurate (differs after 4 significant digits)  from the newton update solution obtained from Matlab using the same tangent_matrix and system_rhs. I am getting the two following solutions from the same tangent_matrix and system_rhs (data files containing the tangent_matrix and system_rhs attached).

    Matlab solution                 deal.ii solution

                                     0                   0
  -0.003033422503555  -0.003033560000000
                                     0                   0
  -0.002439900952733  -0.002439990000000
                                      0                   0
  -0.002737307578376  -0.002737430000000
   0.001007226333711   0.001007240000000
  -0.001069740617723  -0.001069780000000
   0.001663965890031   0.001663970000000
  -0.002605547185476  -0.002605610000000
   0.001113032138953   0.001113040000000
  -0.001469379092482  -0.001469430000000
   0.000916401048149   0.000916380000000
                                      0                   0
   0.001674445763014   0.001674440000000
                                      0                   0
   0.001041269520982   0.001041260000000
  -0.000000000000000  -0.000000000000000
                                      0                   0
   0.003033422503555   0.003033560000000
                                     0                   0
   0.002439900952733   0.002439990000000
                                     0                   0
   0.002737307578376   0.002737430000000
   0.001007226333711   0.001007240000000
   0.001069740617723   0.001069780000000
   0.001663965890031   0.001663970000000
   0.002605547185476   0.002605610000000
   0.001113032138953   0.001113040000000
   0.001469379092482   0.001469430000000

I am trying to figure out what could be the reason behind it and how to get a more accurate solution.

Thank you in advance.

Krish
rhs_global.txt
global_tangent_matrix.txt

Simon Sticko

unread,
Jul 29, 2023, 10:43:48 AM7/29/23
to dea...@googlegroups.com
Hi.

From your attached files it looks like you have saved the matrix and rhs with quite few digits. Do you get the same result if you increase the number of digits you write to your std::ofstream object?

Compare:
https://en.cppreference.com/w/cpp/io/manip/setprecision

Best,
Simon
> --
> The deal.II project is located at http://www.dealii.org/ <http://www.dealii.org/>
> For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en <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 dealii+un...@googlegroups.com <mailto:dealii+un...@googlegroups.com>.
> To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/ac75c294-7b25-4351-82e5-dd7ad3fd410bn%40googlegroups.com <https://groups.google.com/d/msgid/dealii/ac75c294-7b25-4351-82e5-dd7ad3fd410bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Krish

unread,
Jul 29, 2023, 11:38:24 AM7/29/23
to deal.II User Group
Hello Simon,

Thank you very much for the suggestion. The Matlab and deal.ii solutions matched with each other after increasing the number of digits written to the std::ofstream object.

Thanks,
Krish
Reply all
Reply to author
Forward
0 new messages