[petsc-users] Parallel TS for ODE

Barry Smith bsmith at petsc.dev
Thu Apr 1 21:45:32 CDT 2021



> On Apr 1, 2021, at 9:17 PM, Zhang, Hong via petsc-users <petsc-users at mcs.anl.gov> wrote:
> 
> 
> 
>> On Mar 31, 2021, at 2:53 AM, Francesco Brarda <brardafrancesco at gmail.com> wrote:
>> 
>> Hi everyone!
>> 
>> I am trying to solve a system of 3 ODEs (a basic SIR model) with TS. Sequentially works pretty well, but I need to switch it into a parallel version. 
>> I started working with TS not very long time ago, there are few questions I’d like to share with you and if you have any advices I’d be happy to hear.
>> First of all, do I need to use a DM object even if the model is only time dependent? All the examples I found were using that object for the other variable when solving PDEs.
> 
> Are you considering SIR on a spatial domain? If so, you can parallelize your model in the spatial domain using DM. Splitting the three variables in the ODE among processors would not scale.

  Even though it will not scale and will deliver slower performance it is completely possible for you to solve the 3 variable problem using 3 MPI ranks. Or 10 mpi ranks. You would just create vectors/matrices with 1 degree of freedom for the first three ranks and no degrees of freedom for the later ranks. During your function evaluation (and Jacobian evaluation) for TS you will need to set up the appropriate communication to get the values you need on each rank to evaluate the parts of the function evaluation needed by that rank. This is true for parallelizing any computation.

  Barry




> 
> Hong (Mr.)  
> 
>> When I preallocate the space for the Jacobian matrix, is it better to decide the local or global space?
>> 
>> Best,
>> Francesco
> 



More information about the petsc-users mailing list