Hi Junho,

In Firedrake we assume that the reason you want to use PETSc is to solve finite element problems. In that context, you have weak forms which can be used to define the matrices and vectors in the linear system (e.g. in the link that you shared). If you want to build your linear systems manually, you can use petsc4py directly. If you take a look at these demos then they should help with the toy problem you describe.

Assuming that your Firedrake installation knows which MPI you are using, parallelising a script can be as simple as calling `mpiexec -n X python3 demo.py`, where X is the number of processors. You may also want to look at this demo.

Kind regards,
Joe


From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Junho Choi <J.Choi@leeds.ac.uk>
Sent: 12 August 2020 19:05
To: firedrake <firedrake@imperial.ac.uk>
Subject: [firedrake] Questions about Firedrake PETSc.
 

Dear the development team, 

 

I am Junho, a researcher at University of Leeds. 


Using Firedrake PETSc, I am trying to solving a linear system. To do this, I refer to your instruction about Interfacing directly with PETSc(https://www.firedrakeproject.org/petsc-interface.html), but it is hard to follow the instruction for me because of no example.  

So would you let me know how to apply the instruction if simply setting a system Bx=b where B=[1, 2, 3; 3, 4,5; 4, 5,6], b=[2; 3; 5]? 


In addition, if I solve a linear system with PETSc like your instruction, can I use parallel computing to shorten computing time? If yes, how can I use the parallel computing? 

 

Thank you. 

 

Junho