-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 19 October 2015 12:28 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Modifying diagonal entries of Jacobian (preconditioning)
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Dear Henrik,
On 09/10/15 14:16, Buesing, Henrik wrote:
Dear Firedrakers,
if I wanted to modify the diagonal entries of my Jacobian in a Newton step during a time step... How would I do this? Do I have to define my own preconditioner here?
Do you actually want to modify the Jacobian, or do you only want to precondition the Newton step with an operator that is different from the true Jacobian?
[Buesing, Henrik] Well, in certain problems my formulation has zero entries in the diagonal of the Jacobian. What I did in my Fortran Code was just adding a small value to these diagonal entries, and then solve for a different update as you say. This solved problems with LU decomposition. I understand that I can just provide a different J for the solve: NonlinearVariationalProblem(F, u, J= bilinear_form, ...) But how would I get the modified J? I can calculate J and assemble it, then change the values in the assembled matrix J = derivative(F,u) M = assemble(J).M for i in range(0,2) : for j in range(0,2) : print "Block: ", i,j print M[i,j].values # change M[i,j].values[l,k] If I then just do solver.solve() in every timestep ... is the modified J used? Or do I have to call NonlinearVariationalProblem in every timestep? At the moment I only change constants t and dt via assign. But I also want to be able to change coefficients, e.g. changing density with pressure/temperature... And sometimes during a phase change, even a coefficient turns into a primary unknown... The former I can realize with Constant() and assign, I guess. But for the latter, do I have to reassemble the form? Thank you! Henrik
Lawrence -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux)
iQEcBAEBAgAGBQJWJMWhAAoJECOc1kQ8PEYvMGoH/iSoNwXTlgZL1BmPj5jr9QYB BWG8JsUn+v0yO/CHHx7MY1HRFELjtzUCyfmLHzOQcJYb7pYJIiE9UtKtMKYktR1g lo9O/GKuw8oIEED9usx+jFtw5tZvV9KB45JyXtOHrPY9jroRubXC6o5ZTNtlCRyG G85/zKFmnRZB+sF7PFkFUjxewr95WpQ+E/O4uvyuII4FfUYMwVTmxNc7mg6iXJnd 0LKwf7etueG1VnCkTnNA8vPjPzhRbltpXFoZJy3tLzhRRkjFjdKBhDGUz7ZjWXrj 35ozjxfC1jSG8VgH8IkaN0BDy4NhCw4o85eZLMCsAQwXSWbJIcTRVVDSLYKBikw= =w1/i -----END PGP SIGNATURE-----
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake