Solving 2 eqns at the same time in PETSc

Barry Smith bsmith at
Fri May 30 21:48:13 CDT 2008

On May 30, 2008, at 5:33 PM, Ben Tay wrote:

> Hi,
> (I sent this email a while ago but I use a different email address.  
> Not sure if it got through since it's not registered in the server  
> list. Sorry if it was resent.)
> I obtain 2 linear eqns (u and v velocity) from the momentum eqn in  
> my CFD code. Instead of solving eqn 1 in parallel, and then  
> subsequently eqn 2 in parallel, I am thinking of solving the 2 eqns  
> at the same time, using half the number of processors on each eqn.  
> In other words, when using 4 processors, I use 2 processors for eqn  
> 1 and 2 processors for eqn 2. Will that be possible?

    You simply use the MPI_Group and MP_Comm commands to make MPI  
communicators for the subsets of processes and then
construct the Vec, Mat, and KSP based on those new communicators.


> I thought that in MPI, if an equation is divided among too many  
> processors, its scaling factor will decrease. So by dividing into  
> less processors and solving them simultaneously, it will give better  
> performance. Is that true?
> I've also successfully coded 1 eqn to be solved in parallel in  
> PETSc. What changes do I have to made now?
> Thank you very much.
> Regards.

More information about the petsc-users mailing list