Dear list, I would like to use PETSc's linear solver for matrix free methods, but I think that I need to create a custom vector type in order to write an efficient matrix-vector multiplication. First, this is my problem:
I would like to solve a system of linear equations ? /?? A? |? B?? \??? /? x? \?? /? a? \ ? | -----+----- | *? | --- | = | --- | ? \?? C? |? D?? /??? \? y? /?? \? b? / The problem is that only A is a PETSc matrix. For the other matrices, an external library provides a matrix-vector multiplication for PETSc vectors. I would like to use GMRES to solve this system. If I would like to use GMRES, I have to provide a matrix-vector multiplication for the whole matrix, right?. A, B, C, D and all vectors involved are distributed across the same set of processes. This is why I think it would be inefficient to use PETSc's MPIVec vector class. Is it? Or can I obtain the required parts of the vector efficiently, i.e. with little communication operations involved? I think, it would be the best solution, to write a vector class myself, that contains an array of PETSc vector. I took a look at the PETSc source code and it does not look too hard, but first: 1.) I wanted to get some feedback, because I am a beginner with PETSc and there might be a way to do this in PETSc more easily. 2.) I do not know which functions I have to implement in order to get GMRES to work. Is there a comprehensive list or something? Or does PETSc return meaningful error messages about missing functions? 3.) If you do not mind, could you give a short example how new vector classes are created once the vector operations struct is created? I could not find this yet. Thanks for your help! Best regards, Markus Mayr
