[petsc-users] PETSc within a larger simulation

Young, Matthew, Adam may at bu.edu
Sat Mar 21 11:55:07 CDT 2015


Barry, 

The PIC and fluid codes are both running on MPI_COMM_WORLD, so it looks like we're doing the initialization correctly. Since my first email, I've identified some other parts in my PETSc solver that could be causing my communicator problems. I'll work on fixing those and come back with specific questions if I have them.

Thanks!
--------------------------------------------------------------
Matthew Young
Graduate Student
Boston University Dept. of Astronomy
--------------------------------------------------------------


________________________________________
From: Barry Smith [bsmith at mcs.anl.gov]
Sent: Friday, March 20, 2015 2:11 PM
To: Young, Matthew, Adam
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] PETSc within a larger simulation

> On Mar 20, 2015, at 1:02 PM, Young, Matthew, Adam <may at bu.edu> wrote:
>
> I have a PETSc routine that I am trying to use as an electric-field solver within a particle-in-cell code. The existing PIC code is parallelized with MPI. The pure PIC code (written many years ago by my advisor) is well-tested and I am trying to add an option for it to operate as a hybrid fluid/PIC code. This requires solving Ax=b at every time step but I don't think I understand how to manage communication between the existing code and my PETSc solver. Since we may not always run the hybrid version, the code calls MPI_Init() before PetscInitialize(). Section 14.1 of the manual suggests that I use PetscSetCommWorld between MPI_Init() and PetscInitialize(), but that routine appears to not be supported anymore. Is that correct? Can you point me to examples of simulations that use PETSc within a larger code?

   Matt,

    In the standard case where the PIC and fluid code are both running on the same communicator (MPI_COMM_WORLD) you don't need to do anything special, just call the MPI_Init() and then the PetscInitialize(). If the PETSc code runs on a smaller communicator then BEFORE the call to PetscInitialize() you just need to set PETSC_COMM_WORLD = comm (where comm is that smaller communicator). (This replaces the use of the function call PetscSetCommWorld() that once existed.)

  Barry

>
> --Matt
>
> --------------------------------------------------------------
> Matthew Young
> Graduate Student
> Boston University Dept. of Astronomy
> --------------------------------------------------------------



More information about the petsc-users mailing list