[firedrake] RectangleMesh

David Ham David.Ham at imperial.ac.uk
Fri Feb 24 12:58:16 GMT 2017


Hi Floriane,

you can do this using a par_loop with a custom kernel. I don't have time to
work out the precise syntax for this today so I've raised an issue on
GitHub so we don't lose this question. See:
https://github.com/firedrakeproject/firedrake/issues/1022 I hope to get
back to this next week, or maybe someone else will get to it faster.

Regards,

David

On Thu, 23 Feb 2017 at 15:03 Floriane Gidel [RPG] <mmfg at leeds.ac.uk> wrote:

>
> Dear David,
>
>
> Thanks for your fast answer.
>
>
> I change the coordinates for saving purpose only (once the WF are solved).
>
> So my objective is to solve the WF in a fixed 2D RectangleMesh, and then
> save the functions in a 3D mesh in which I apply the coordinate transforms
> to get moving boundaries.
>
> I managed to do this when Ny>1, and I changed my code so that it
> works for Ny=1, but I would like a general command that works whatever the
> value of Ny.
>
>
> So my question would be : how can I make the link between the
> x-coordinates in a RectangleMesh, and the x-coordinates in the 3D mesh
> obtained by extrusion of the RectangleMesh ?
>
>
> For instance, for a function h_2D defined in the RectangleMesh, if I want
> to change the z-coordinate of the extruded mesh as z_new = z*h_2D/H0 so
> that the top boundary of the 3D domain for a given (xi,yi) coordinates
> moves as h_2D(xi,yi), how can I find the indices "..." to substitute into
> the following expression :
>
>
> mesh_3D.coordinates.dat.data[ ..., 2]*= h_2D.dat.data[ ... ]/H0 ?
>
>
> Thank you very much,
>
> Floriane
>
>
>
>
>
>
>
>
>
>
> ------------------------------
> *De :* firedrake-bounces at imperial.ac.uk <firedrake-bounces at imperial.ac.uk>
> de la part de David Ham <David.Ham at imperial.ac.uk>
> *Envoyé :* jeudi 23 février 2017 14:16:06
> *À :* firedrake
> *Objet :* Re: [firedrake] RectangleMesh
>
> Dear Floriane,
>
> The thing to understand is that there is no guaranteed relationship
> between vertex number and the location of that vertex. Vertex numbers are
> (as far as the user is concerned), completely arbitrary. This is fine
> because none of the correct ways to access vertices  depend on what the
> order is.
>
> When you say that you are applying a change of coordinates, what do you
> mean? Do you mean that you are changing the coordinate values before you
> compute? If so, please tell us mathematically what you are attempting to do
> and we can tell you the right way to do it.
>
> Regards,
>
> David
>
> On Thu, 23 Feb 2017 at 14:08 Floriane Gidel [RPG] <mmfg at leeds.ac.uk>
> wrote:
>
> Dear all,
>
>
> I have a question concerning the mesh definition with RectangleMesh:
>
>
> I define my  mesh as a Rectangle mesh, with quadrilaterals as:
>
> hor_mesh = RectangleMesh(Nx, Ny, 10.0, 1.0, quadrilateral=True).
>
>
> As my functions are only (x,t) dependent, I'd like to get only one element
> in y, i.e. Ny=1.
>
> However I noticed that if I set Ny=1, then the x-coordinates are swapped
> from 10.0 to 0.0 . Basically, I obtain
>
> hor_mesh.coordinates.dat.data[:,0] = [10.0 10.0 9.9 9.9 ...... 0.0]
>
> instead of
>
> hor_mesh.coordinates.dat.data[:,0] = [0.0 0.0 0.1 0.1 ........ 10.0] (that
> I obtain for Ny>1)
>
>
> Can someone explain me what happens there ? Is there a way to avoid that ?
>
> And if I use the integral on ds(1), will it be at x=0 of x=10 in that case?
>
>
> The reason why I want to understand this is because I apply a change of
> coordinate in some part of the domain (let's say for x<L<Lx) and the
> coordinate transform does not give the right result for Ny=1 (while it does
> for Ny>1).
>
>
> Thanks in advance for your help,
>
> Floriane
>
>
>
> --
> Dr David Ham
> Department of Mathematics
> Imperial College London
>
-- 
Dr David Ham
Department of Mathematics
Imperial College London
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list