[petsc-users] [petsc-maint] DMSwarm with periodic B.C.

Matthew Knepley knepley at gmail.com
Wed Apr 19 08:13:41 CDT 2023


If this is a problem, let's make an example and I can debug it because I
thought that this worked.
I might have only tested with Plex.

  Thanks,

     Matt

On Wed, Apr 12, 2023 at 11:32 AM Mark Adams <mfadams at lbl.gov> wrote:

> First, you don't want a DMShell. Just use da_swarm.
> See src/dm/tutorials/ex20.c
>
> You can run this test with
> > cd src/dm/tutorials
> > make ex20
> > ./ex20
> or
> > ./ex20 -mode 1
> See the end of ex20.c for these (lack of) arguments
>
> Now change that code to one periodic direction and test.
>
> This could be a bug. This code is not well tested.
>
> Thanks,
> Mark
>
>
>
>
> On Wed, Apr 12, 2023 at 4:02 AM Joauma Marichal <
> joauma.marichal at uclouvain.be> wrote:
>
>> 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
>>
>

-- 
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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230419/71721c12/attachment-0001.html>


More information about the petsc-users mailing list