<div class="gmail_quote">Hi All, <br><div><br></div><div><div>I want to solve a system of equations which looks like </div><div><br></div><div> A x + Bu = f1</div><div> C x + Du = f2</div><div>
<br></div><div>A, B, C, and D as shell operators and {x , u, f1, and f2} are non-native </div>
<div>PETSc vectors.</div><div><br></div><div>This is how I am thinking of solving it in PETSc</div><div><br></div><div>1) Define shell operators which define Matrix-vector multiplication</div><div> routines {Ax,Bu, Cx, Du}. </div>
<div><br></div><div>2) Define a composite Matrix MAT_COMP as</div><div> Mat mat_array[ ] = {A,B,C,D};</div><div> Mat MAT_COMP;</div><div> MatCreateNest(PETSC_COMM_WORLD, 2, PETSC_NULL, 2, PETSC_NULL, mat_array, &MAT_COMP);</div>
<div><br></div><div>3) Define a composite Vector VEC_COMP as</div><div> Vec vec_array[ ] = {f1,f2};</div><div> Vec VEC_COMP;</div><div> VecCreateNest(PETSC_COMM_WORLD, 2, PETSC_NULL, vec_array, &VEC_COMP);</div>
<div><br></div><div>4) Create a shell matrix for composite matrix (MAT_COMP) which defines the action</div><div> f1 = Ax + Bu;</div><div> f2 = Cx + Du;</div><div><br></div><div> i.e MATOP_MULT, MATOP_MULT_ADD, and MATOP_GET_VECS to duplicate vectors</div>
<span class="HOEnZb"><font color="#888888">
<div> </div></font></span></div></div><div><br></div><div>Does this sound like a reasonable approach?</div><div><br></div>-- <br><div>Amneet <br><br></div><div><br></div><div><br></div>