[petsc-users] DMSwarm with periodic B.C.
Joauma Marichal
joauma.marichal at uclouvain.be
Wed Apr 12 03:02:21 CDT 2023
Hello,
I am using petsc DMSwarm library for some Lagrangian particle tracking. Until now, I was working in a closed box and was therefore initializing my swarm object as:
// Create a DMDA staggered and without ghost cells (for DMSwarm to work)
DMDACreate3d(PETSC_COMM_WORLD,DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE,DMDA_STENCIL_BOX,M,N,P,m,n,p,1,1,lx,ly,lz,da_swarm);
DMSetFromOptions(*da_swarm);
DMSetUp(*da_swarm);
PetscScalar xmin, xmax, ymin, ymax, zmin, zmax;
xmin = ymin = zmin = 0.;
xmax = ymax = zmax = 1.;
DMDASetUniformCoordinates(*da_swarm,xmin, xmax, ymin, ymax, zmin, zmax);
//SetNonUniform3DCoordinates(*da_swarm, cornp, gridp, rank);
/* Create a DMShell for point location purposes */
DMShellCreate(PETSC_COMM_WORLD,dmcell);
DMSetApplicationContext(*dmcell,*da_swarm);
(*dmcell)->ops->locatepoints = DMLocatePoints_DMDARegular;
(*dmcell)->ops->getneighbors = DMGetNeighbors_DMDARegular;
// Create a Swarm DMDA
DMCreate(PETSC_COMM_WORLD,swarm);
DMSetType(*swarm,DMSWARM);
DMSetDimension(*swarm,3);
DMSwarmSetType(*swarm,DMSWARM_PIC);
DMSwarmSetCellDM(*swarm,*dmcell);
I am now trying to work with periodic boundary conditions. I tried replacing DM_BOUNDARY_NONE by DM_BOUNDARY_PERIODIC but it does not work… I checked for examples using periodic B.C. but have not found any. Is it possible? And if yes, how can I make it work?
Thanks a lot for your answer.
Best regards,
Joauma
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230412/ca45512d/attachment.html>
More information about the petsc-users
mailing list