[firedrake] matrix entries

Tomasz Salwa [RPG] mmtjs at leeds.ac.uk
Mon Nov 23 17:08:09 GMT 2015


Dear Firedrakers,


I have a problem similar to Anna's previous one.

How can and I access and modify matrices assembled for a given form, so that they can be used later in solvers?


For reference, my code is in:

https://github.com/mmtjs/lin_coupled_fd_2d_oop

with description of the scheme that I would like to implement in "FSI_scheme.pdf" (black terms clear - no coupling; blue - UFL suffices to define;  red - I need to build the matrices directly).


e.g. I have the following code:


...

    def initialize_solvers(self):
....
        a_phi = fd.dot( self.n_vec, fd.grad(self.trial) ) * self.v * fd.ds_t - fd.dot( fd.grad(self.trial), fd.grad(self.v) ) * fd.dx
        L_phi = self.Pw * self.v * fd.ds_v(2)

        a_eta = self.trial * self.v * fd.ds_t
        L_eta = ( self.eta + self.dt * fd.dot( self.n_vec, fd.grad(self.phi) ) ) * self.v * fd.ds_t
...


I would like to access the PETSc matices corresponding to the forms, modify the entries and solve the system with the updated matrices. How can I find out to which nodes the given entries correspond? I need to map between two domains, which I did for functions, but in case of matrices it may be different.


Thank you,

Tomasz
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list