Loop update & assemble

20 views
Skip to first unread message

Hermes Sampedro

unread,
Aug 17, 2021, 5:47:34 AM8/17/21
to deal.II User Group
Hello, 

I am working with step-29 and I would like to compute the solution for different frequency values (omega). For now, I am implementing a loop that updates omega, do the assemble and solve it. However, the simulations are slow due to the assembling in every loop iteration. Is there any other way to update the value in a more efficient way? Is there any other step example that works with that?

Thank you very much
Regards, 
H

Wolfgang Bangerth

unread,
Aug 17, 2021, 3:05:31 PM8/17/21
to dea...@googlegroups.com
On 8/17/21 3:47 AM, Hermes Sampedro wrote:
>
> I am working with step-29 and I would like to compute the solution for
> different frequency values (omega). For now, I am implementing a loop that
> updates /omega/, do the assemble and solve it. However, the simulations are
> slow due to the assembling in every loop iteration. Is there any other way to
> update the value in a more efficient way? Is there any other step example that
> works with that?

The matrix depends on the frequency, so you somehow have to re-build it for
every frequency you consider. On the other hand, it is of the form
A = A1 + omega*A2
if I remember correctly, and so you could pre-compute A1 and A2 and then add
them together with the factor omega. This is how step-26 builds the system
matrix, for example. It avoids the repeated assembly of the matrix.

Best
W.

--
------------------------------------------------------------------------
Wolfgang Bangerth email: bang...@colostate.edu
www: http://www.math.colostate.edu/~bangerth/

Reply all
Reply to author
Forward
0 new messages