Dear Firedrakers [mostly Lawrence but asking here means it is archived and might be useful to someone], I'm using a matfree solver, for the same equation with changing coefficients, but always the same preconditioner. Is there are way to avoid rebuilding the preconditioner but updating the matrix entries? I'm hoping that this actually happens by default, because of the matfree setup, but am not sure. cheers --cjc -- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916
On 14 Jun 2017, at 17:43, Colin Cotter <colin.cotter@imperial.ac.uk> wrote:
I'm using a matfree solver, for the same equation with changing coefficients, but always the same preconditioner. Is there are way to avoid rebuilding the preconditioner but updating the matrix entries? I'm hoping that this actually happens by default, because of the matfree setup, but am not sure.
If your update method in your PC is empty, then the pc will not be rebuilt when the matrix changes. I think that is what you want. If course, there are no matrix entries, so you just need to ensure that you reassemble the matrix appropriately I think. Lawrence
On Wednesday, 14 June 2017, Lawrence Mitchell < lawrence.mitchell@imperial.ac.uk> wrote:
If your update method in your PC is empty, then the pc will not be rebuilt when the matrix changes. I think that is what you want. If course, there are no matrix entries, so you just need to ensure that you reassemble the matrix appropriately I think.
Ah, it's actually in a Linear Solver, so I pass in an 'assembled' matrix with matfree mat type. Does the generated code get the new coefficient values passed in? -- http://www.imperial.ac.uk/people/colin.cotter www.cambridge.org/9781107663916
On 14/06/17 19:42, Colin Cotter wrote:
On Wednesday, 14 June 2017, Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk <mailto:lawrence.mitchell@imperial.ac.uk>> wrote:
If your update method in your PC is empty, then the pc will not be rebuilt when the matrix changes. I think that is what you want. If course, there are no matrix entries, so you just need to ensure that you reassemble the matrix appropriately I think.
Ah, it's actually in a Linear Solver, so I pass in an 'assembled' matrix with matfree mat type. Does the generated code get the new coefficient values passed in?
You should do: A = assemble(a, mat_type="matfree") solver = LinearSolver(A) while ...: solver.solve(x, b) # This is basically a no-op, but updates the matrix state # So that PETSc is aware that the operator has changed. A = assemble(a, mat_type="matfree", tensor=A) Please note that there is currently a bug if you have boundary conditions and A changes. I keep meaning to fix it... Lawrence
participants (2)
- 
                
                Colin Cotter
- 
                
                Lawrence Mitchell