← Back to team overview

dolfin team mailing list archive

Re: DirichletBC Dimension Problems

 

You are defining the boundary condition dbc for V1 which is the second
subset of V. This will lead to an offset (size of V0) being used when
applying the boundary condition which won't work on the forms a_p, Lp
since they are not defined on V (but on V1).

-- 
Anders


On Mon, Mar 16, 2009 at 11:21:41PM +0100, ndl@xxxxxxxxxxxxxx wrote:
> If we remove the boundary conditions there are no problems.
> Am I doing something wrong?
> 
> int main()
> {
>   Rectangle mesh(0.,0.,10.,4.,101,31,Rectangle::left);
>   MyFunctionSpace V(mesh);
>   SubSpace V0(V,0), V1(V,1);// V0=V1
>   DirichletBoundary dbdry; // (x[0]<DOLFIN_EPS...)
>   Constant bc(1.0) ;
>   DirichletBC dbc(V1,bc,dbdry);
>   Function eta_phi(V), eta(V0), phi(V1);
>   MyBilinearForm a(V,V);
>   MyLinearForm L(V);
>   L.eta0=eta;L.phi0=phi;
>   eta_phi.vector().zero();
>   phi=eta_phi[1];
>   MySubBilinearForm a_p(V1,V1);
>   Function p(V1);
>   MySubLinearForm Lp(V1);
>   VariationalProblem pde(a_p,Lp,dbc);
>   Lp.f=phi;
>   pde.solve(p);
>   return (EXIT_SUCCESS);
> }
> ----------------------------------------------------------------
> The ffc form files are of the type:
> 
> My.form-------------------------------------------------------------
> P=FiniteElement("Lagrange","triangle",1)
> Th=P+P
> ----------------------------------------------------------------
> and
> 
> MySub.form--------------------------------------------------------------
> P =FiniteElement("Lagrange","triangle",1)
> P = TestFunction(element)
> ----------------------------------------------------------------
> 
> 
> 
> 
> On Monday 16 March 2009, Anders Logg wrote:
> > On Sat, Mar 14, 2009 at 11:25:48PM +0100, ndl@xxxxxxxxxxxxxx wrote:
> > > Hi.
> > > I'm having some "dimension" troubles when applying some DirichletBC's.
> > >
> > > I've something like this:
> > > -------------------------------
> > > MyFunctionSpace V(mesh); //Th=P1+P1
> > > SubSpace V0(V,0); //S
> > > SubSpace V1(V,1); //P
> > > ...
> > > DirichletBoundary dirichletboundary;
> > > DBC bc(t);
> > > DirichletBC dbc(V1,bc,dirichletboundary);
> > > .....
> > > MyBilinearForm a(V1,V1);
> > > Function p(V1);
> > > MyLinearForm L(V1);
> > > VariationalProblem pde(a,L,dbc);
> > > pde.solve(p);
> > > ----------------------------------------------
> > > The V dimension is 24136 and V1 is half:12068.
> >
> > How did you define the function space V?
> >
> > Try sending a minimal example (~10 lines) that reproduces this bug.
> 
> 

Attachment: signature.asc
Description: Digital signature


Follow ups

References