Re: [firedrake] Periodic domain with imported mesh
Hi Floriane, The short version is “no” because the right smarts tying together the gmsh, dmplex and Firedrake concepts of periodicity have not been done. Could you give a little detail of what sort of domain and mesh you want, and we can give some thought to whether we can do that for you. Regards, David From: <firedrake-bounces@imperial.ac.uk> on behalf of "Floriane Gidel [RPG]" <mmfg@leeds.ac.uk> Date: Wednesday, 7 November 2018 at 10:40 To: firedrake <firedrake@imperial.ac.uk> Subject: [firedrake] Periodic domain with imported mesh Dear all, Is there a way to force an imported mesh (created with Gmsh) to be x- and y-periodic ? (maybe something similar to the option 'constrained_domain' when defining a FunctionSpace in FeniCs ?) Thank you, Floriane
Hi David, It would be again a disk centered in a square domain and I need the square boundaries to be periodic both in x and y. Now I'm solving a simple problem with a solution u_p in the plane and u_d in the disk that are only y-dependent and satisfy: Delta_y u_p = 0 in the plane grad_y u_p . n_y = n_y at the disk/plane interface. u_p periodic Delta_y u_d = 0 in the disk grad_y u_d . n_y = n_y at the disk/plane interface. int (u_d) dx(disk) = 0 Note that n_y at the disk/plane interface is equal to sin(theta), which will therefore be the source term in the weak formulations. So the two problems can be solved independently, but the domain must contain both the disk and the surrounding plane in both cases to apply the condition at the interface (or we need to make sure that the interface nodes are at the same location in both meshes). At the moment I use triangular mesh with CG1 basis functions, but that is quite flexible. Cheers, Floriane ________________________________ De : Ham, David A <david.ham@imperial.ac.uk> Envoyé : mercredi 7 novembre 2018 12:58 À : Floriane Gidel [RPG]; firedrake Objet : Re: [firedrake] Periodic domain with imported mesh Hi Floriane, The short version is “no” because the right smarts tying together the gmsh, dmplex and Firedrake concepts of periodicity have not been done. Could you give a little detail of what sort of domain and mesh you want, and we can give some thought to whether we can do that for you. Regards, David From: <firedrake-bounces@imperial.ac.uk> on behalf of "Floriane Gidel [RPG]" <mmfg@leeds.ac.uk> Date: Wednesday, 7 November 2018 at 10:40 To: firedrake <firedrake@imperial.ac.uk> Subject: [firedrake] Periodic domain with imported mesh Dear all, Is there a way to force an imported mesh (created with Gmsh) to be x- and y-periodic ? (maybe something similar to the option 'constrained_domain' when defining a FunctionSpace in FeniCs ?) Thank you, Floriane
On 7 Nov 2018, at 13:16, Floriane Gidel [RPG] <mmfg@leeds.ac.uk> wrote:
Hi David,
It would be again a disk centered in a square domain and I need the square boundaries to be periodic both in x and y. Now I'm solving a simple problem with a solution u_p in the plane and u_d in the disk that are only y-dependent and satisfy:
Delta_y u_p = 0 in the plane grad_y u_p . n_y = n_y at the disk/plane interface. u_p periodic
Delta_y u_d = 0 in the disk grad_y u_d . n_y = n_y at the disk/plane interface. int (u_d) dx(disk) = 0
Note that n_y at the disk/plane interface is equal to sin(theta), which will therefore be the source term in the weak formulations.
So the two problems can be solved independently, but the domain must contain both the disk and the surrounding plane in both cases to apply the condition at the interface (or we need to make sure that the interface nodes are at the same location in both meshes). At the moment I use triangular mesh with CG1 basis functions, but that is quite flexible.
You can make a topologically periodic square mesh with: PeriodicUnitSquareMesh(..., direction="both") I think that's what you want? Cheers, Lawrence
Hi Lawrence, I need a way to distinguish the two subdomains, that are 1) the disk, 2) the square with a hole instead of the disk (see black and blue meshes in the attached figure). Can I make the equivalent to the blue mesh (i.e., a square with a hole) using PeriodicUnitSquareMesh ? And if so, can I make sure that the nodes at the boundary of my disk mesh (black) match those of the plane mesh (blue) at the hole boundary? Cheers, Floriane ________________________________ De : Lawrence Mitchell <wencel@gmail.com> Envoyé : mercredi 7 novembre 2018 14:14 À : Floriane Gidel [RPG] Cc : David Ham; firedrake Objet : Re: [firedrake] Periodic domain with imported mesh
On 7 Nov 2018, at 13:16, Floriane Gidel [RPG] <mmfg@leeds.ac.uk> wrote:
Hi David,
It would be again a disk centered in a square domain and I need the square boundaries to be periodic both in x and y. Now I'm solving a simple problem with a solution u_p in the plane and u_d in the disk that are only y-dependent and satisfy:
Delta_y u_p = 0 in the plane grad_y u_p . n_y = n_y at the disk/plane interface. u_p periodic
Delta_y u_d = 0 in the disk grad_y u_d . n_y = n_y at the disk/plane interface. int (u_d) dx(disk) = 0
Note that n_y at the disk/plane interface is equal to sin(theta), which will therefore be the source term in the weak formulations.
So the two problems can be solved independently, but the domain must contain both the disk and the surrounding plane in both cases to apply the condition at the interface (or we need to make sure that the interface nodes are at the same location in both meshes). At the moment I use triangular mesh with CG1 basis functions, but that is quite flexible.
You can make a topologically periodic square mesh with: PeriodicUnitSquareMesh(..., direction="both") I think that's what you want? Cheers, Lawrence
On 7 Nov 2018, at 14:23, Floriane Gidel [RPG] <mmfg@leeds.ac.uk> wrote:
Hi Lawrence,
I need a way to distinguish the two subdomains, that are 1) the disk, 2) the square with a hole instead of the disk (see black and blue meshes in the attached figure). Can I make the equivalent to the blue mesh (i.e., a square with a hole) using PeriodicUnitSquareMesh ? And if so, can I make sure that the nodes at the boundary of my disk mesh (black) match those of the plane mesh (blue) at the hole boundary?
Ah, that's the bit I was missing. With periodic unit square mesh it is not possible. One could hack something that moved the mesh nodes around to capture the circle appropriately. But that's going to be fiddly too. Cheers, Lawrence
Ok so there's no other way to do it with Firedrake? Could I do it with FeniCs and import my mesh and corresponding function space to firedrake ? ________________________________ De : Lawrence Mitchell <wencel@gmail.com> Envoyé : mercredi 7 novembre 2018 14:24 À : Floriane Gidel [RPG] Cc : firedrake Objet : Re: [firedrake] Periodic domain with imported mesh
On 7 Nov 2018, at 14:23, Floriane Gidel [RPG] <mmfg@leeds.ac.uk> wrote:
Hi Lawrence,
I need a way to distinguish the two subdomains, that are 1) the disk, 2) the square with a hole instead of the disk (see black and blue meshes in the attached figure). Can I make the equivalent to the blue mesh (i.e., a square with a hole) using PeriodicUnitSquareMesh ? And if so, can I make sure that the nodes at the boundary of my disk mesh (black) match those of the plane mesh (blue) at the hole boundary?
Ah, that's the bit I was missing. With periodic unit square mesh it is not possible. One could hack something that moved the mesh nodes around to capture the circle appropriately. But that's going to be fiddly too. Cheers, Lawrence
Dear Floriane, Importing from FEniCS definitely won’t work as we have a completely different concept of periodicity from them. It might be possible to load the existing gmsh file, map the boundary vertices to each other and produce the corresponding DG coordinate field, but that will be quite a fiddly process. Regards, David From: <firedrake-bounces@imperial.ac.uk> on behalf of "Floriane Gidel [RPG]" <mmfg@leeds.ac.uk> Date: Wednesday, 7 November 2018 at 15:16 To: Lawrence Mitchell <wencel@gmail.com> Cc: firedrake <firedrake@imperial.ac.uk> Subject: Re: [firedrake] Periodic domain with imported mesh Ok so there's no other way to do it with Firedrake? Could I do it with FeniCs and import my mesh and corresponding function space to firedrake ? ________________________________ De : Lawrence Mitchell <wencel@gmail.com> Envoyé : mercredi 7 novembre 2018 14:24 À : Floriane Gidel [RPG] Cc : firedrake Objet : Re: [firedrake] Periodic domain with imported mesh
On 7 Nov 2018, at 14:23, Floriane Gidel [RPG] <mmfg@leeds.ac.uk> wrote:
Hi Lawrence,
I need a way to distinguish the two subdomains, that are 1) the disk, 2) the square with a hole instead of the disk (see black and blue meshes in the attached figure). Can I make the equivalent to the blue mesh (i.e., a square with a hole) using PeriodicUnitSquareMesh ? And if so, can I make sure that the nodes at the boundary of my disk mesh (black) match those of the plane mesh (blue) at the hole boundary?
Ah, that's the bit I was missing. With periodic unit square mesh it is not possible. One could hack something that moved the mesh nodes around to capture the circle appropriately. But that's going to be fiddly too. Cheers, Lawrence
On Thu, Nov 8, 2018 at 9:08 AM Ham, David A <david.ham@imperial.ac.uk> wrote:
Dear Floriane,
Importing from FEniCS definitely won’t work as we have a completely different concept of periodicity from them.
It might be possible to load the existing gmsh file, map the boundary vertices to each other and produce the corresponding DG coordinate field, but that will be quite a fiddly process.
Gmsh supports periodicity to some extent. We can read periodic GMsh files and do the right thing in Plex. Is this a periodic Gmsh? Thanks, Matt
Regards,
David
*From: *<firedrake-bounces@imperial.ac.uk> on behalf of "Floriane Gidel [RPG]" <mmfg@leeds.ac.uk> *Date: *Wednesday, 7 November 2018 at 15:16 *To: *Lawrence Mitchell <wencel@gmail.com> *Cc: *firedrake <firedrake@imperial.ac.uk> *Subject: *Re: [firedrake] Periodic domain with imported mesh
Ok so there's no other way to do it with Firedrake?
Could I do it with FeniCs and import my mesh and corresponding function space to firedrake ?
------------------------------
*De :* Lawrence Mitchell <wencel@gmail.com> *Envoyé :* mercredi 7 novembre 2018 14:24 *À :* Floriane Gidel [RPG] *Cc :* firedrake *Objet :* Re: [firedrake] Periodic domain with imported mesh
On 7 Nov 2018, at 14:23, Floriane Gidel [RPG] <mmfg@leeds.ac.uk> wrote:
Hi Lawrence,
I need a way to distinguish the two subdomains, that are 1) the disk, 2) the square with a hole instead of the disk (see black and blue meshes in the attached figure). Can I make the equivalent to the blue mesh (i.e., a square with a hole) using PeriodicUnitSquareMesh ? And if so, can I make sure that the nodes at the boundary of my disk mesh (black) match those of the plane mesh (blue) at the hole boundary?
Ah, that's the bit I was missing. With periodic unit square mesh it is not possible. One could hack something that moved the mesh nodes around to capture the circle appropriately. But that's going to be fiddly too.
Cheers, Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
-- 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/>
From: Matthew Knepley <knepley@gmail.com> Date: Thursday, 8 November 2018 at 14:13 To: "Ham, David A" <david.ham@imperial.ac.uk> Cc: "mmfg@leeds.ac.uk" <mmfg@leeds.ac.uk>, Lawrence Mitchell <wencel@gmail.com>, firedrake <firedrake@imperial.ac.uk> Subject: Re: [firedrake] Periodic domain with imported mesh On Thu, Nov 8, 2018 at 9:08 AM Ham, David A <david.ham@imperial.ac.uk<mailto:david.ham@imperial.ac.uk>> wrote: Dear Floriane, Importing from FEniCS definitely won’t work as we have a completely different concept of periodicity from them. It might be possible to load the existing gmsh file, map the boundary vertices to each other and produce the corresponding DG coordinate field, but that will be quite a fiddly process. Gmsh supports periodicity to some extent. We can read periodic GMsh files and do the right thing in Plex. Is this a periodic Gmsh? Thanks, Matt I think it can be a periodic GMSH if required. The problem occurs that Firedrake’s concept of periodic isn’t quite dmplex’s and so someone needs to sit down and do the renumbering legwork to get from one to the other. I believe Lawrence had a go once and gave up in a mess of renumberings. I.e. I believe this is a Firedrake inadequacy rather than a Plex one. Regards, David Regards, David From: <firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>> on behalf of "Floriane Gidel [RPG]" <mmfg@leeds.ac.uk<mailto:mmfg@leeds.ac.uk>> Date: Wednesday, 7 November 2018 at 15:16 To: Lawrence Mitchell <wencel@gmail.com<mailto:wencel@gmail.com>> Cc: firedrake <firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk>> Subject: Re: [firedrake] Periodic domain with imported mesh Ok so there's no other way to do it with Firedrake? Could I do it with FeniCs and import my mesh and corresponding function space to firedrake ? ________________________________ De : Lawrence Mitchell <wencel@gmail.com<mailto:wencel@gmail.com>> Envoyé : mercredi 7 novembre 2018 14:24 À : Floriane Gidel [RPG] Cc : firedrake Objet : Re: [firedrake] Periodic domain with imported mesh
On 7 Nov 2018, at 14:23, Floriane Gidel [RPG] <mmfg@leeds.ac.uk<mailto:mmfg@leeds.ac.uk>> wrote:
Hi Lawrence,
I need a way to distinguish the two subdomains, that are 1) the disk, 2) the square with a hole instead of the disk (see black and blue meshes in the attached figure). Can I make the equivalent to the blue mesh (i.e., a square with a hole) using PeriodicUnitSquareMesh ? And if so, can I make sure that the nodes at the boundary of my disk mesh (black) match those of the plane mesh (blue) at the hole boundary?
Ah, that's the bit I was missing. With periodic unit square mesh it is not possible. One could hack something that moved the mesh nodes around to capture the circle appropriately. But that's going to be fiddly too. Cheers, Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake -- 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/>
On Thu, Nov 8, 2018 at 9:18 AM Ham, David A <david.ham@imperial.ac.uk> wrote:
*From: *Matthew Knepley <knepley@gmail.com> *Date: *Thursday, 8 November 2018 at 14:13 *To: *"Ham, David A" <david.ham@imperial.ac.uk> *Cc: *"mmfg@leeds.ac.uk" <mmfg@leeds.ac.uk>, Lawrence Mitchell < wencel@gmail.com>, firedrake <firedrake@imperial.ac.uk> *Subject: *Re: [firedrake] Periodic domain with imported mesh
On Thu, Nov 8, 2018 at 9:08 AM Ham, David A <david.ham@imperial.ac.uk> wrote:
Dear Floriane,
Importing from FEniCS definitely won’t work as we have a completely different concept of periodicity from them.
It might be possible to load the existing gmsh file, map the boundary vertices to each other and produce the corresponding DG coordinate field, but that will be quite a fiddly process.
Gmsh supports periodicity to some extent. We can read periodic GMsh files and do the right thing in Plex. Is this a periodic Gmsh?
Thanks,
Matt
I think it can be a periodic GMSH if required. The problem occurs that Firedrake’s concept of periodic isn’t quite dmplex’s and so someone needs to sit down and do the renumbering legwork to get from one to the other. I believe Lawrence had a go once and gave up in a mess of renumberings.
I.e. I believe this is a Firedrake inadequacy rather than a Plex one.
I think we can just lie to Firedrake and not tell it the mesh is periodic. The coordinate field is automatically DG, and so will give believable numbers for all integrals. Of course output will probably not work completely right, but the solution will be understandable. Thanks, Matt
Regards,
David
Regards,
David
*From: *<firedrake-bounces@imperial.ac.uk> on behalf of "Floriane Gidel [RPG]" <mmfg@leeds.ac.uk> *Date: *Wednesday, 7 November 2018 at 15:16 *To: *Lawrence Mitchell <wencel@gmail.com> *Cc: *firedrake <firedrake@imperial.ac.uk> *Subject: *Re: [firedrake] Periodic domain with imported mesh
Ok so there's no other way to do it with Firedrake?
Could I do it with FeniCs and import my mesh and corresponding function space to firedrake ?
------------------------------
*De :* Lawrence Mitchell <wencel@gmail.com> *Envoyé :* mercredi 7 novembre 2018 14:24 *À :* Floriane Gidel [RPG] *Cc :* firedrake *Objet :* Re: [firedrake] Periodic domain with imported mesh
On 7 Nov 2018, at 14:23, Floriane Gidel [RPG] <mmfg@leeds.ac.uk> wrote:
Hi Lawrence,
I need a way to distinguish the two subdomains, that are 1) the disk, 2) the square with a hole instead of the disk (see black and blue meshes in the attached figure). Can I make the equivalent to the blue mesh (i.e., a square with a hole) using PeriodicUnitSquareMesh ? And if so, can I make sure that the nodes at the boundary of my disk mesh (black) match those of the plane mesh (blue) at the hole boundary?
Ah, that's the bit I was missing. With periodic unit square mesh it is not possible. One could hack something that moved the mesh nodes around to capture the circle appropriately. But that's going to be fiddly too.
Cheers, Lawrence
_______________________________________________ firedrake mailing list firedrake@imperial.ac.uk https://mailman.ic.ac.uk/mailman/listinfo/firedrake
--
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/>
-- 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/>
Hmm. OK. For some reason I thought it was worse than this. Is there an example somewhere we could try? From: Matthew Knepley <knepley@gmail.com> Date: Thursday, 8 November 2018 at 14:32 To: "Ham, David A" <david.ham@imperial.ac.uk> Cc: "mmfg@leeds.ac.uk" <mmfg@leeds.ac.uk>, Lawrence Mitchell <wencel@gmail.com>, firedrake <firedrake@imperial.ac.uk> Subject: Re: [firedrake] Periodic domain with imported mesh On Thu, Nov 8, 2018 at 9:18 AM Ham, David A <david.ham@imperial.ac.uk<mailto:david.ham@imperial.ac.uk>> wrote: From: Matthew Knepley <knepley@gmail.com<mailto:knepley@gmail.com>> Date: Thursday, 8 November 2018 at 14:13 To: "Ham, David A" <david.ham@imperial.ac.uk<mailto:david.ham@imperial.ac.uk>> Cc: "mmfg@leeds.ac.uk<mailto:mmfg@leeds.ac.uk>" <mmfg@leeds.ac.uk<mailto:mmfg@leeds.ac.uk>>, Lawrence Mitchell <wencel@gmail.com<mailto:wencel@gmail.com>>, firedrake <firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk>> Subject: Re: [firedrake] Periodic domain with imported mesh On Thu, Nov 8, 2018 at 9:08 AM Ham, David A <david.ham@imperial.ac.uk<mailto:david.ham@imperial.ac.uk>> wrote: Dear Floriane, Importing from FEniCS definitely won’t work as we have a completely different concept of periodicity from them. It might be possible to load the existing gmsh file, map the boundary vertices to each other and produce the corresponding DG coordinate field, but that will be quite a fiddly process. Gmsh supports periodicity to some extent. We can read periodic GMsh files and do the right thing in Plex. Is this a periodic Gmsh? Thanks, Matt I think it can be a periodic GMSH if required. The problem occurs that Firedrake’s concept of periodic isn’t quite dmplex’s and so someone needs to sit down and do the renumbering legwork to get from one to the other. I believe Lawrence had a go once and gave up in a mess of renumberings. I.e. I believe this is a Firedrake inadequacy rather than a Plex one. I think we can just lie to Firedrake and not tell it the mesh is periodic. The coordinate field is automatically DG, and so will give believable numbers for all integrals. Of course output will probably not work completely right, but the solution will be understandable. Thanks, Matt Regards, David Regards, David From: <firedrake-bounces@imperial.ac.uk<mailto:firedrake-bounces@imperial.ac.uk>> on behalf of "Floriane Gidel [RPG]" <mmfg@leeds.ac.uk<mailto:mmfg@leeds.ac.uk>> Date: Wednesday, 7 November 2018 at 15:16 To: Lawrence Mitchell <wencel@gmail.com<mailto:wencel@gmail.com>> Cc: firedrake <firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk>> Subject: Re: [firedrake] Periodic domain with imported mesh Ok so there's no other way to do it with Firedrake? Could I do it with FeniCs and import my mesh and corresponding function space to firedrake ? ________________________________ De : Lawrence Mitchell <wencel@gmail.com<mailto:wencel@gmail.com>> Envoyé : mercredi 7 novembre 2018 14:24 À : Floriane Gidel [RPG] Cc : firedrake Objet : Re: [firedrake] Periodic domain with imported mesh
On 7 Nov 2018, at 14:23, Floriane Gidel [RPG] <mmfg@leeds.ac.uk<mailto:mmfg@leeds.ac.uk>> wrote:
Hi Lawrence,
I need a way to distinguish the two subdomains, that are 1) the disk, 2) the square with a hole instead of the disk (see black and blue meshes in the attached figure). Can I make the equivalent to the blue mesh (i.e., a square with a hole) using PeriodicUnitSquareMesh ? And if so, can I make sure that the nodes at the boundary of my disk mesh (black) match those of the plane mesh (blue) at the hole boundary?
Ah, that's the bit I was missing. With periodic unit square mesh it is not possible. One could hack something that moved the mesh nodes around to capture the circle appropriately. But that's going to be fiddly too. Cheers, Lawrence _______________________________________________ firedrake mailing list firedrake@imperial.ac.uk<mailto:firedrake@imperial.ac.uk> https://mailman.ic.ac.uk/mailman/listinfo/firedrake -- 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/> -- 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/>
On 8 Nov 2018, at 14:34, Ham, David A <david.ham@imperial.ac.uk> wrote:
Hmm. OK. For some reason I thought it was worse than this. Is there an example somewhere we could try?
When I looked at this, I ran out of brain, I summarised the issues I found here: https://github.com/firedrakeproject/firedrake/issues/1246 Basically: 1. Right now the Mesh constructor hard-codes a P1 coordinate field, one needs to change it so that you can pass a coordinate element that it will use (easy). 2. There is a reordering that needs to be applied to map from the Plex coordinate field to the Firedrake one. I didn't figure this out. (Matt: we don't "just use" the plex coordinate field as is, because we don't use any of your evaluation routines. Hence we need it to be a fully-fledged function, with all the numbering conventions that we have). Lawrence
On Thu, Nov 8, 2018 at 9:41 AM Lawrence Mitchell <wencel@gmail.com> wrote:
On 8 Nov 2018, at 14:34, Ham, David A <david.ham@imperial.ac.uk> wrote:
Hmm. OK. For some reason I thought it was worse than this. Is there an example somewhere we could try?
When I looked at this, I ran out of brain, I summarised the issues I found here:
https://github.com/firedrakeproject/firedrake/issues/1246
Basically:
1. Right now the Mesh constructor hard-codes a P1 coordinate field, one needs to change it so that you can pass a coordinate element that it will use (easy).
Yep.
2. There is a reordering that needs to be applied to map from the Plex coordinate field to the Firedrake one. I didn't figure this out.
(Matt: we don't "just use" the plex coordinate field as is, because we don't use any of your evaluation routines. Hence we need it to be a fully-fledged function, with all the numbering conventions that we have).
What about just projecting the coordinate field into your DG space? I think to do this you only need a gadget that evaluates the coordinates at any point you ask for. Luckily, we have that. Toby made all coordinates use a DMField object, so you can ask it to evaluate somewhere and it will. 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/>
Dear all, As I couldn't apply periodic BC on my imported mesh, I solved my weak form on FreeFEM, from which I can save the solution in .vtk. I'd still like to use Firedrake to solve the other FE problems, but for this I would need to project my FreeFEM solution to a Firedrake function. I know that the way to do this is to import the .h5 function with DumbCheckpoint, but as the FreeFEM solution is saved in .vtk format, would you have any hint on how to assign its values to a Firedrake function ? Perhaps one way would be to browse the .vtk file and assign each point data to the corresponding node on my Firedrake function. But that is rather complicated because saved nodes coordinates are rounded compared to the initial imported mesh. Do you have any advice on what would be the best way to do this (if there is any...) ? Thanks, Floriane ________________________________ De : Matthew Knepley <knepley@gmail.com> Envoyé : jeudi 8 novembre 2018 17:40 À : Lawrence Mitchell Cc : Ham, David A; Floriane Gidel [RPG]; Firedrake Project Objet : Re: [firedrake] Periodic domain with imported mesh On Thu, Nov 8, 2018 at 9:41 AM Lawrence Mitchell <wencel@gmail.com<mailto:wencel@gmail.com>> wrote:
On 8 Nov 2018, at 14:34, Ham, David A <david.ham@imperial.ac.uk<mailto:david.ham@imperial.ac.uk>> wrote:
Hmm. OK. For some reason I thought it was worse than this. Is there an example somewhere we could try?
When I looked at this, I ran out of brain, I summarised the issues I found here: https://github.com/firedrakeproject/firedrake/issues/1246 Basically: 1. Right now the Mesh constructor hard-codes a P1 coordinate field, one needs to change it so that you can pass a coordinate element that it will use (easy). Yep. 2. There is a reordering that needs to be applied to map from the Plex coordinate field to the Firedrake one. I didn't figure this out. (Matt: we don't "just use" the plex coordinate field as is, because we don't use any of your evaluation routines. Hence we need it to be a fully-fledged function, with all the numbering conventions that we have). What about just projecting the coordinate field into your DG space? I think to do this you only need a gadget that evaluates the coordinates at any point you ask for. Luckily, we have that. Toby made all coordinates use a DMField object, so you can ask it to evaluate somewhere and it will. 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/>
Dear Floriane, There are a couple of ways to do this. They are all a little hacky. 1. Round the coordinates on both sides to the same number of digits, and then use sorting to get the mapping from one to the other. 2. Load the vtk file then use vtk’s inbuilt interpolation to interpolate the vtk values at the Firedrake node values. From the firedrake perspective, this amounts to interpolating from an external data source. See: https://www.firedrakeproject.org/interpolation.html#interpolation-from-exter... Regards, David From: "Floriane Gidel [RPG]" <mmfg@leeds.ac.uk> Date: Tuesday, 27 November 2018 at 10:28 To: Matthew Knepley <knepley@gmail.com>, Lawrence Mitchell <wencel@gmail.com> Cc: "Ham, David A" <david.ham@imperial.ac.uk>, firedrake <firedrake@imperial.ac.uk> Subject: RE: [firedrake] Periodic domain with imported mesh Dear all, As I couldn't apply periodic BC on my imported mesh, I solved my weak form on FreeFEM, from which I can save the solution in .vtk. I'd still like to use Firedrake to solve the other FE problems, but for this I would need to project my FreeFEM solution to a Firedrake function. I know that the way to do this is to import the .h5 function with DumbCheckpoint, but as the FreeFEM solution is saved in .vtk format, would you have any hint on how to assign its values to a Firedrake function ? Perhaps one way would be to browse the .vtk file and assign each point data to the corresponding node on my Firedrake function. But that is rather complicated because saved nodes coordinates are rounded compared to the initial imported mesh. Do you have any advice on what would be the best way to do this (if there is any...) ? Thanks, Floriane ________________________________ De : Matthew Knepley <knepley@gmail.com> Envoyé : jeudi 8 novembre 2018 17:40 À : Lawrence Mitchell Cc : Ham, David A; Floriane Gidel [RPG]; Firedrake Project Objet : Re: [firedrake] Periodic domain with imported mesh On Thu, Nov 8, 2018 at 9:41 AM Lawrence Mitchell <wencel@gmail.com<mailto:wencel@gmail.com>> wrote:
On 8 Nov 2018, at 14:34, Ham, David A <david.ham@imperial.ac.uk<mailto:david.ham@imperial.ac.uk>> wrote:
Hmm. OK. For some reason I thought it was worse than this. Is there an example somewhere we could try?
When I looked at this, I ran out of brain, I summarised the issues I found here: https://github.com/firedrakeproject/firedrake/issues/1246 Basically: 1. Right now the Mesh constructor hard-codes a P1 coordinate field, one needs to change it so that you can pass a coordinate element that it will use (easy). Yep. 2. There is a reordering that needs to be applied to map from the Plex coordinate field to the Firedrake one. I didn't figure this out. (Matt: we don't "just use" the plex coordinate field as is, because we don't use any of your evaluation routines. Hence we need it to be a fully-fledged function, with all the numbering conventions that we have). What about just projecting the coordinate field into your DG space? I think to do this you only need a gadget that evaluates the coordinates at any point you ask for. Luckily, we have that. Toby made all coordinates use a DMField object, so you can ask it to evaluate somewhere and it will. 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/>
participants (4)
- 
                
                Floriane Gidel [RPG]
- 
                
                Ham, David A
- 
                
                Lawrence Mitchell
- 
                
                Matthew Knepley