Le ven. 14 janv. 2022 à 15:52, Matthew Knepley <knep...@gmail.com> a écrit :
> On Fri, Jan 14, 2022 at 9:48 AM Lawrence Mitchell <wen...@gmail.com> > wrote: > >> > On 14 Jan 2022, at 14:12, Matthew Knepley <knep...@gmail.com> wrote: >> > >> > On Fri, Jan 14, 2022 at 9:07 AM Thibault Bridel-Bertomeu < >> thibault.bridelberto...@gmail.com> wrote: >> > Also, if we still consider my example with Solid and Fluid, let's image >> we call DMPlexFilter twice. We then get two new DMs with Solid in one and >> Fluid in the other one. >> > >> > The labels will be communicated, so fluidDM will still know Wall, >> Inlet, Freestream and Outlet and on the other hand, solidDM will still know >> Wall and Insulation : those two domain share the Wall stratum of the Face >> Sets. >> > >> > Can I extract data at the Wall label from the solidDM and transfer it >> to the Wall label of the fluidDM ? >> > >> > Yes, conceptually here is how that would work. You iterate over the >> label, extracting the values you want. You map those points >> > to points in the original mesh using the subpointMap, and then map them >> again using the subpointMap from the fluidDM down to it. >> > Now you can insert the values using the section in the fluidDM. I think >> the easiest way to do this is to setup a VecScatter (or PetscSF) >> > from one boundary to the other. Then you would just stick in the two >> vectors and call VecScatterBegin/End() >> > >> > If this turns out to be useful, this construction is something we could >> easily automate in the library. >> >> I've needed this too, I think I have some code lying around, let me see >> if I can port it into DMPlexFilter.. > > Hi Lawrence, Thank you so much, that would be great ! Would you mind sending the original snippet of code, maybe I can figure it out ? > > I did the initial implementation for the label filtering. It is here > > https://gitlab.com/petsc/petsc/-/merge_requests/4717 > > Thibault, can you try it on your example? I will not have time to code up > a nice test until I get home from this conference. > Hi Matt, Thank you for the quick mod. It works well, the labels are passed down to the filtered DMPlex as we can see in the example below : // Overall plex : DM Object: CoupledPhysics_Plex 1 MPI processes type: plex CoupledPhysics_Plex in 2 dimensions: Number of 0-cells per rank: 1409 Number of 1-cells per rank: 4084 Number of 2-cells per rank: 2676 Labels: celltype: 3 strata with value/size (0 (1409), 3 (2676), 1 (4084)) depth: 3 strata with value/size (0 (1409), 1 (4084), 2 (2676)) Cell Sets: 2 strata with value/size (1 (924), 2 (1752)) Solid: 1 strata with value/size (1 (924)) Fluid: 1 strata with value/size (2 (1752)) Face Sets: 5 strata with value/size (4 (60), 3 (40), 7 (20), 5 (40), 6 (20)) Insulation: 1 strata with value/size (4 (60)) Wall: 1 strata with value/size (3 (40)) Outlet: 1 strata with value/size (7 (20)) Freestream: 1 strata with value/size (5 (40)) Inlet: 1 strata with value/size (6 (20)) // Fluid plex : DM Object: 1 MPI processes type: plex DM_0x12471c2f0_1 in 2 dimensions: Number of 0-cells per rank: 937 Number of 1-cells per rank: 2688 Number of 2-cells per rank: 1752 Labels: celltype: 3 strata with value/size (0 (937), 1 (2688), 3 (1752)) depth: 3 strata with value/size (0 (937), 1 (2688), 2 (1752)) Cell Sets: 1 strata with value/size (2 (1752)) Solid: 0 strata with value/size () Fluid: 1 strata with value/size (2 (1752)) Face Sets: 4 strata with value/size (3 (40), 7 (20), 5 (40), 6 (20)) Insulation: 0 strata with value/size () Wall: 1 strata with value/size (3 (40)) Outlet: 1 strata with value/size (7 (20)) Freestream: 1 strata with value/size (5 (40)) Inlet: 1 strata with value/size (6 (20)) // Solid plex : DM Object: 1 MPI processes type: plex DM_0x12471c2f0_2 in 2 dimensions: Number of 0-cells per rank: 513 Number of 1-cells per rank: 1436 Number of 2-cells per rank: 924 Labels: celltype: 3 strata with value/size (0 (513), 1 (1436), 3 (924)) depth: 3 strata with value/size (0 (513), 1 (1436), 2 (924)) Cell Sets: 1 strata with value/size (1 (924)) Solid: 1 strata with value/size (1 (924)) Fluid: 0 strata with value/size () Face Sets: 2 strata with value/size (4 (60), 3 (40)) Insulation: 1 strata with value/size (4 (60)) Wall: 1 strata with value/size (3 (40)) Outlet: 0 strata with value/size () Freestream: 0 strata with value/size () Inlet: 0 strata with value/size () I think it would be perfect if the 0-sized labels were also completely filtered out. Is that something that you could add to the DMPlexFliterLabels_Internal function ? By the way, I believe there is a typo in the name of the function, it should read "F*il*ter". Thanks again !! Thibault Thanks, > > Matt > > >> Lawrence > > > > -- > 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/> >