On 8/23/24 10:04, Mark Simmons wrote:
>
> I have implemented a new method that is supposedly allow us to assemble
> the system matrix only once at the beginning saving comp time. Our
> variables are solved sequentially and implicitly and I have a boolean
> that indicates whether we use this new method or not. in one of the
> variables, I have added stability term that, mathematically speaking,
> should make our method for solving one of the variables explicit rather
> than implicit. From what I know currently, dealii is assembling the
> matrix at every time step regardless if I say I am using the new method
> or not. Should I have to modifiy how the assemble_system_matrix function
> is called in the run function or should I modify the header file that
> actually computes the assembly of the matrix? Not sure on how to proceed.
Mark:
deal.II is not assembling your matrix. If your run() function calls
assemble_matrix(), then the matrix is assembled. That is, if your run()
function looks like this:
void run() {
...
for (time_step=1...N) {
assemble_system()
solve()
postprocess()
}
}
then you are assembling the matrix in every step, not because *deal.II*
does it for you, but *because you have said that that's what is supposed
to happen in your code*.
On the contrary, if your run() function does not call assemble_matrix(),
then the matrix is not assembled. So, if the run() function looks like this,
void run() {
...
assemble_system()
for (time_step=1...N) {
solve()
postprocess()
}
}
then the matrix is assembled only once *because you have said that it
should only happen once before you start your loop over time steps*.
Of course, which it is we cannot know without seeing your code.
Best
W.