Hermes, You probably don't need to use reinit() in your case. You want to use reinit() if the structure of the matrix changes with frequency. For example, if you change the degree of finite elements you need to call reinit(). If you want to change the values but the structure matrix is unchanged then you don't need to call reinit(). Instead, you can simply do matrix = 0; to clean the matrix.
Best, Bruno On Tuesday, September 14, 2021 at 10:18:19 AM UTC-4 [email protected] wrote: > Dear Bruno thank you very much for pointing step-17, I could solve the > problem. > > I would like to ask the last question. I am computing step-29 in parallel > for different frequencies. I have a loop for each of the frequencies as > follows: > > > make_grid(); > > setup_system(); > > assemble_system(sI[0]); > > > > > *for* ( *int* i = 0; i < Ns; ++i) > > { > > update_system(sI[i]); > > solve(); > > output_results(); > > } > > In orther to not setup the system and assemble in each iteration I created > update_system() to update the system matrix as it change due to the > frequency. I need to do system_matrix .reinit before the update to clean > the matrix which I realize is time comsuming. I would like to ask if there > is another efficient way to update the matrix. > > Thank you > Regards, > H > > > > El mar, 14 sept 2021 a las 14:11, Bruno Turcksin (<[email protected]>) > escribió: > >> Hermes, >> >> Le mar. 14 sept. 2021 à 05:19, Hermes Sampedro >> <[email protected]> a écrit : >> > >> > Should I use dealii::PETScWrappers::MPI::SparseMatrix system_matrix >> instead? If so could ou please help me to with the reinit() function? I do >> not fully understand how to call it. >> >> That's right, you need the matrix to be distributed too. Take a look >> at step-17 to see how to use PETScWrappers. >> >> Best, >> >> Bruno >> >> -- >> 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 a topic in the >> Google Groups "deal.II User Group" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/dealii/r3NGr6TnxXs/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/dealii/CAGVt9eNeuUqiA8-c0Zd%3DNn%2BTNx%2BVT3-xao0io8QT_D0rk0WjgQ%40mail.gmail.com >> . >> > -- 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/9f145b3a-044f-46f3-8adf-84a552c2a35en%40googlegroups.com.
