On Sun, Apr 30, 2023 at 1:12 PM Matthew Young < myoung.space.scie...@gmail.com> wrote:
> Hi all, > > I am developing a particle-in-cell code that models ions as particles and > electrons as an inertialess fluid. I use a PIC DMSWARM for the ions, which > I gather into density and flux before solving a linear system for the > electrostatic potential (phi). I currently have one DMDA with 5 degrees of > freedom -- one each for density, 3 flux components, and phi. > > When setting up the linear system to solve for phi, I've been following > examples like KSP ex34.c and ex42.c when writing the KSP operator and RHS > functions but I'm not sure I have the right approach, since 4 of the DOFs > are known and 1 is unknown. > > I saw this thread > <https://lists.mcs.anl.gov/pipermail/petsc-users/2016-November/031031.html> > that recommended using DMDAGetReducedDMDA, which I gather has been > deprecated in favor of DMDACreateCompatibleDMDA. Is that a good approach > for managing a regular grid with known and unknown quantities on each node? > Could a composite DM be useful? Has anyone else worked on a problem like > this? > I recommend making a different DM for each kind of solve you want. DMDACreateCompatibleDMDA() should be the implementation of DMClone(), but we have yet to harmonize all things for all DMs. I would create one DM for your Vlasov components and one for the Poisson. We follow this strategy in our Vlasov-Poisson test for Landau damping: https://gitlab.com/petsc/petsc/-/blob/main/src/dm/impls/swarm/tests/ex9.c Thanks, Matt > --Matt > ========================== > Matthew Young, PhD (he/him) > Research Scientist II > Space Science Center > University of New Hampshire > matthew.yo...@unh.edu > ========================== > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>