Hi Lawrence,


Many thanks for the reply.


You could maybe do it (a bit of hack) by building a TorusMesh, then creating a mesh hierarchy of that, and then using the code in firedrake/utility_meshes.py to do create your periodic meshes and put them back into the hierarchy (ugh).


I do need to compare solutions for different mesh refinements. So you mean I should create the TorusMesh hierarchy and build the PeriodicSquareMesh from the torus meshes? I'm unsure what you mean by putting the periodic meshes back into the hierarchy. How do I do that? Is there a way to create a 1-to-1 mapping between a torus mesh and periodic square mesh?


I will submit a github issue.


Kind regards

Wei


From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Lawrence Mitchell <lawrence.mitchell@imperial.ac.uk>
Sent: 28 October 2016 14:15:52
To: firedrake
Subject: Re: [firedrake] MeshHierarchy problem
 

> On 28 Oct 2016, at 13:24, Pan, Wei <wei.pan@imperial.ac.uk> wrote:
>
> Hi,
>
> I'm currently using a mixed formulation for solving the Euler equation with periodic boundary conditions. So right now I am using a PeriodicSquareMesh. I also need different refinements of the same mesh. I was made aware of the MeshHierarchy function.

Do you need to transfer solutions between the different refinements?  If not, just make meshes of the appropriate resolution.  Otherwise, read on...

> However MeshHierarchy does not seem to work with PeriodicSquareMesh, I get an error message saying
>
> "ValueError: total size of new array must be unchanged."


I think this is because we assume when building meshes from a DM object that the coordinate field lives in a piecewise linear space.  However, this is not the case for periodic meshes.  We rely on PETSc refinement to refine the mesh, but for periodic meshes, PETSc doesn't have a full view of the mesh (it only really knows the topology).

You could maybe do it (a bit of hack) by building a TorusMesh, then creating a mesh hierarchy of that, and then using the code in firedrake/utility_meshes.py to do create your periodic meshes and put them back into the hierarchy (ugh).

In any case, can you please report a github issue describing what you tried to do and what didn't work?

Cheers,

Lawrence
_______________________________________________
firedrake mailing list
firedrake@imperial.ac.uk
https://mailman.ic.ac.uk/mailman/listinfo/firedrake