dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #01480
Re: Possible bug?
ok, so I know what the problem is.
If you write
Stokes12::LinearForm(f) lform0(f);
Stokes23::LinearForm(f) lform1(f);
then f first gets associated with Stokes12 and then you reassociate it
with Stokes23, so at the point where you then want to assemble first
Stokes12, the Function f is associated with the FiniteElement for
Stokes23, so it tries to interpolate its values at more points than it
should (the nodal points for Stokes23 rather than Stokes12).
I think the best way to solve this is a redesign of the Function
class, so that user-defined Functions are not associated with a
particular FiniteElement. I'll send a suggestion in a separate post.
/Anders
On Wed, Nov 09, 2005 at 09:23:34AM -0600, Anders Logg wrote:
> ok, I suspected as much.
>
> I'll see if I can reproduce it. It should be an easy fix.
>
> /Anders
>
> On Wed, Nov 09, 2005 at 09:17:27AM -0600, Andy Ray Terrel wrote:
>
> > Okay so I am getting the error when I don't use the arrays as Anders
> > suggested, but the error goes away when I define two functions f0, and
> > f1. And build the forms off of them.
> >
> > Andy
> >
> >
> >
> > Anders Logg wrote:
> >
> > >Do you get the same error if you don't use arrays? Say that you do
> > >
> > >#include "Stokes12.h";
> > >#include "Stokes23.h";
> > >
> > >MyFunction f;
> > >MyBC bc;
> > >
> > >Stokes12::BilinearForm bform0;
> > >Stokes23::BilinearForm bform1;
> > >Stokes12::LinearForm(f) lform0(f);
> > >Stokes23::LinearForm(f) lform1(f);
> > >
> > >UnitSquare mesh(8,8);
> > >Matrix A;
> > >Vector x, b;
> > >
> > >FEM::assemble(bform0, lform1, A, b, mesh, bc);
> > >FEM::assemble(bform1, lform1, A, b, mesh, bc);
> > >
> > >The only thing I can think of is that f is used in both forms. That
> > >should be ok, but it could be the cause.
> > >
> > >/Anders
> > >
> > >On Wed, Nov 09, 2005 at 08:45:52AM -0600, Andy Ray Terrel wrote:
> > >
> > >
> > >>Recently I have had some trouble putting LinearForm pointers into an
> > >>array and trying to work on them. Basically if I have more than one in
> > >>the array I either get a segfault or numbers that don't match up to when
> > >>I am doing things without the array. The code looks something like this:
> > >>---------------------------------------------------------------------------------------------------
> > >>include "Stokes12.h";
> > >>include "Stokes23.h";
> > >>
> > >>MyFunction f;
> > >>MyBC bc;
> > >>
> > >>BilinearForm* bforms[2]={new Stokes12::BilinearForm(), new
> > >>Stokes23::BilinearForm()};
> > >>LinearForm* lforms[2]={new Stokes12::LinearForm(f), new
> > >>Stokes23::LinearForm(f)};
> > >>for(int i=0; i<2; i++){
> > >> ...
> > >> UnitSquare mesh(8,8);
> > >> Matrix A;
> > >> Vector x, b;
> > >> FEM::assemble(*(bforms[i]), *(lforms[i]), A, b, mesh, bc);
> > >> ...
> > >>}
> > >>------------------------------------------------------------------------------------------------
> > >>
> > >>So I have gotten around the problem by using python to just write the
> > >>different files and running them, but I thought someone might want to
> > >>know about the problem I was having.
> > >>
> > >>
> > >>
> > >>
> > >
> > >
> > >
> >
>
--
Anders Logg
Research Assistant Professor
Toyota Technological Institute at Chicago
http://www.tti-c.org/logg/
References