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