getfem-users
[Top][All Lists]

Re: [Getfem-users] Evaluate solution at mesh nodes.

 From: Yves Renard Subject: Re: [Getfem-users] Evaluate solution at mesh nodes. Date: Thu, 20 Oct 2011 16:01:45 +0200 User-agent: KMail/1.13.5 (Linux/2.6.32-34-server; KDE/4.4.5; x86_64; ; )

```Dear Dawid,

One way to compare the solution (on a boundary or elsewhere) is to interploate
your exact solution on a convenient Lagrange finite element on your mesh and
then compute for instance the L2-error using an assembly procedure. This
should be the most straightforward.

If you need the max difference, you can interpolate your solutionon the same
Lagrange finite element  (if it is not already on a Lagrange finite element)
and
compare on the dof that are on the corresponding boundary.

Otherwize, when you iterate by
for(getfem::mr_visitor i(R); !i.finished(), ++i) { ... }

the index i is the element number and i.f() is the face number, so that you
can ask for the vertex indices of the corresponding face.

On mercredi 19 octobre 2011, Dawid Midura wrote:
> Hi again,
>
> I probably was not clear with my last question. I guess what I need to know
> is how do I iterate over all nodes in a given instance of
> getfem::mesh_region? I know how to iterate over all convexes in a region,
> which I will call R, using mr_visitor as such:
>
> for(getfem::mr_visitor i(R); !i.finished(), ++i) { ... }
>
> Region R represents a discretization of a circular boundary of my problem
> domain, (which is a washer) and I use triangular elements. I thought i in
> the above iteration would represent a line segment with both its endpoints
> laying on the circular boundary, but this does not seem to be the case. So
> is i a triangle in the mesh in this case, whose one of the faces coincides
> with one of the segments in the disretization of the circular boundary?
> Another question is the following, what does i.f() do? I could not find a
> reference to it in the library documentation. Is it a number of faces of
> convex i? When I put i.f() inside the above loop I get i.f() equal to
> either 1 or 2. But if i represents a triangle in the mesh shouldn't I get
> i.f() equal to 3?
No. It should be 0, 1 or 2.

> By the way, in getfem is point considered a convex with
> a single face?
>
> Attached is an image of the mesh I'm working with.
>
> Thanks again,
> Dawid M.
>
> On Tue, Oct 18, 2011 at 5:02 PM, Dawid Midura <address@hidden> wrote:
> > Hi all,
> >
> > I am solving Helmholtz equation in a region laying in between two
> > cocentric circles. I set Neumann type boundary data on the inner circle,
> > and Robin type condition on the outer circle. . I want to compare the
> > FEM solution with the analytic solution that I know to see if I coded
> > the FEM solver correctly. To do so I compare both solutions at the
> > boundaries of the domain. My question is, how do I evaluate the solution
> > at a given mesh vertex? (I have both boundaries set as separate mesh
> > regions) Here, I'm referring to the original, input mesh, not finite
> > element mesh which in addition contains FEM nodes. I hope I said it
> > right. Thus far I have used getfem::interpolator_on_mesh_fem object to
> > evaluate the solution on the inner boundary, but I can't do the same for
> > the outer circular boundary as most of that boundary lies outside of the
> > computational domain (i'm using triangular elements), so what I did up
> > to this point was picking points laying very close to the outer boundary
> > but still in the computational domain and interpolated the solution at
> > those.
> >
> > Dawid M.

--

Yves Renard (address@hidden)       tel : (33) 04.72.43.87.08
Pole de Mathematiques, INSA-Lyon             fax : (33) 04.72.43.85.29
20, rue Albert Einstein
69621 Villeurbanne Cedex, FRANCE
http://math.univ-lyon1.fr/~renard

---------

```