How to get assembled matricies from NonlinearVariationalSolver?

Asked by minak

Hello Everyone,

I am solving nonlinear system of PDEs and everything works fine
problem = NonlinearVariationalProblem(F, w, bcs=bcs, J=J, form_compiler_parameters=ffc_options)
solver = NonlinearVariationalSolver(problem)

The problem is that I would like look at the assembled matrices. The only solution I found already is to set parameters
solver.parameters["print_rhs"] = True
solver.parameters['print_matrix'] = True

Then we obtain <Matrix wrapper of <uBLASMatrix of size ... x ...> to std output, but this is not very convenient.

How can I assign this matrix to the variable (in particular in each Newton iteration) it will allow me to make some operations on the matrix.

Thank you,
minak

Question information

Language:
English Edit question
Status:
Answered
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Jan Blechta (blechta) said :
#1

You can do this sort of things by subclassing NonlinearProblem and overloading its F(), J() or form() method like in Cahn-Hilliard demo. I think more comprehensive examples of this sort of things is in another demo..

Jan

Can you help with this problem?

Provide an answer of your own, or ask minak for more information if necessary.

To post a message you must log in.