On Mon, May 2, 2022 at 12:23 PM Matteo Semplice < [email protected]> wrote:
> Thanks! > > On 02/05/2022 18:07, Matthew Knepley wrote: > > On Mon, May 2, 2022 at 11:25 AM Matteo Semplice < > [email protected]> wrote: > >> Hi. >> >> I am facing a PDE with 2 dofs per node in which one dof has periodic >> b.c. in the x direction and the other one periodic b.c. in the y >> direction. Is there a (possibly quick-and-dirty) solution to represent >> this in a DM (not necessarily a DMDA)? >> > > I am trying to understand what this means. > > It comes from a toy model for more complicated quantum field theory model > that's hard for me to understand. > > Usually we think of periodicity as arising from the domain, not the field. > > I think it would be easiest to: > > a) Use two different DMDA for the fields that "match up" where needed > > This is kind of what I was thinking at. So I would create two DMDA, then a > DMComposite with the two and finally create Vecs and Matrices from the > DMComposite? > > Yes. The drawback here is that DMDA will not help you make the proper Jacobian. I'm not sure how important this is to you. > If so, then how do I assemble matrices for linear systems? If I extract > submatrices, I could use MatSetValuesStencil on diagonal blocks, but how > about the off-diagonal ones? These latter would have rows/cols indexed by > different DMDAs. > > Yes, you would need to manage it. Here is an example doing this: https://petsc.org/main/src/snes/tutorials/ex28.c.html I have never loved it, but sometimes it makes the most sense. As a third option, you could manually construct the local to global map. Periodicity is encoded here. However, this is pretty intrusive. Thanks, Matt > Matteo > > > or > > b) Use a DMStag since it sounds like these should live on horizontal and > vertical edges > > Thanks, > > Matt > > >> I understand the request it's strange, but I should add that we are >> experimenting numerically with this toy model, so in fact the b.c. may >> change in the future... just to stress once more that I am not after a >> perfect solution, but anything that would at least allow parallel runs >> with few processors would do for now. >> >> Thanks in advance >> >> Matteo >> >> > > -- > 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/ > <https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cse.buffalo.edu%2F~knepley%2F&data=05%7C01%7Cmatteo.semplice%40uninsubria.it%7Cba6f4499929f45d75a5f08da2c55e259%7C9252ed8bdffc401c86ca6237da9991fa%7C0%7C0%7C637871044633599928%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DRvIjjr1cjHWdoSpQJr9UkIWVxlopKbKt%2BW5sQBvQE4%3D&reserved=0> > > -- > Prof. Matteo Semplice > Università degli Studi dell’Insubria > Dipartimento di Scienza e Alta Tecnologia – DiSAT > Professore Associato > Via Valleggio, 11 – 22100 Como (CO) – Italia > tel.: +39 031 2386316 > > -- 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/>
