← Back to team overview

dolfin team mailing list archive

Re: Functions for applying boundary conditions to the RHS vector only now accept the solution vector x. Where Dirichlet boundary conditions are applied, b = x - bc.The is useful for applying boundary conditions within Newton iterations. [...]

 

A possibility would be a function "FEM::assembleBCresidual".

Garth

On Fri, 2005-12-02 at 09:11 +0100, Garth N. Wells wrote:
> Quoting Anders Logg <logg@xxxxxxxxx>:
> 
> > This looks strange to me, but maybe I don't understand it.
> > 
> > What if you don't even have a vector x? What vector should x should
> > you then give as an argument?
> 
> If you don't have a vector x, you don't want to use this function :-). It's
> basically returning the Dirichlet boundary condition "residual".
> 
> > 
> > Maybe it is better to just call the standard version of applyBC()
> > without x and then do
> > 
> > b *= -1.0;
> > b += x;
> 
> This would add x to all elements of b, not just to elements where Dirichlet
> boundary conditions are applied. I originally used the old applyBC for a vector
> to use an analogous procedure to the above, but this required two temporary
> vectors to be created, initialised and have boundary conditions applied at each
> Newton iteration (in addtion to the usual assemble of b) - not very nice.
> 
> > 
> > This would be two lines of code extra (one if you put them on the same
> > line... :-). It's probably better to put this in the Newton solver
> > since the Newton solver knows why this operation should be performed.
> 
> The Newton solver knows nothing about the boundary coniditons. The BC's need to
> be applied by the user in the resdiudal vector b. This is done in the class
> NonlinearFunction.
> 
> A possibility is a function that inserts components of x into b (rather than the
> BC value), where Dirichlet BCs are applied. PETSc has a function to the set the
> vector R, where F(u) = R is being solved, so R would contain the Dirichlet BCs.
> 
> 
> Garth
> 
> > 
> > /Anders
> > 
> > 
> > On Thu, Dec 01, 2005 at 02:16:12PM +0100, dolfin@xxxxxxxxxx wrote:
> > > Commit from garth (2005-12-01 14:16 CET)
> > > -----------------
> > > 
> > > Functions for applying boundary conditions to the RHS vector only
> > now accept the solution vector x. Where Dirichlet boundary conditions
> > are applied, b = x - bc.The is useful for applying boundary conditions
> > within Newton iterations.
> > > 
> > > This is not consistent with the other applyBC functions which return b = bc
> > (no minus sign). This is due to the definition of the nonlinear function
> > F(u)=0.
> > > For Poisson's equation, I've been using the format F(u) = (grad v,grad u) -
> > (v,f), hence the need for the minus. Is there a preference as to how we
> > set-up nonlinear problems?
> > > 
> > > Would it be better to use a different name for funtions that return the
> > difference between the current approximate solution and the Dirichlet BC?
> > > 
> > >   dolfin  src/kernel/fem/FEM.cpp       1.43
> > >   dolfin  src/kernel/fem/dolfin/FEM.h  1.23
> > > 
> > > _______________________________________________
> > > DOLFIN-dev mailing list
> > > DOLFIN-dev@xxxxxxxxxx
> > > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> > > 
> > 
> > -- 
> > Anders Logg
> > Research Assistant Professor
> > Toyota Technological Institute at Chicago
> > http://www.tti-c.org/logg/
> > 
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
> > 
> 
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/cgi-bin/mailman/listinfo/dolfin-dev
-- 
Dr. Garth N. Wells
Faculty of Civil Engineering and Geosciences
Delft University of Technology
Stevinweg 1
2628 CN Delft
The Netherlands

tel.     +31 15 278 7922
fax.     +31 15 278 6383
e-mail   g.n.wells@xxxxxxxxxxxxxxx
url      http://www.mechanics.citg.tudelft.nl/~garth





Follow ups

References