← Back to team overview

dolfin team mailing list archive

Re: [HG DOLFIN] Major cleanup of DirichletBC:

 

On Thu, May 22, 2008 at 12:47:37PM +0200, Kristian Oelgaard wrote:
> Quoting Anders Logg <logg@xxxxxxxxx>:
> 
> > On Thu, May 22, 2008 at 11:50:36AM +0200, Dag Lindbo wrote:
> > > Anders Logg wrote:
> > > > On Thu, May 22, 2008 at 11:26:41AM +0200, Dag Lindbo wrote:
> > > >> DOLFIN wrote:
> > > >>> One or more new changesets pushed to the primary dolfin repository.
> > > >>> A short summary of the last three changesets is included below.
> > > >>>
> > > >>> changeset:   4224:c5a7da38ff2c966e5f2483b5232993fb75ac6aa1
> > > >>> tag:         tip
> > > >>> user:        Anders Logg <logg@xxxxxxxxx>
> > > >>> date:        Thu May 22 10:19:48 2008 +0200
> > > >>> files:       dolfin/fem/DirichletBC.cpp dolfin/fem/DirichletBC.h
> > > >>> description:
> > > >>> Major cleanup of DirichletBC:
> > > >>>  - Store boundary facets in array, common for all different
> > representations
> > > >>>  - BCs may now be specified in 3 differenet ways: SubDomain,
> > MeshFunction, or as Mesh data
> > > >>>  - Should speed up repeated application of BCs
> > > >>>  - Tested on a few different applications, but please check that
> > nothing broke.
> > > >>>    In particular, geometric and pointwise application has not been
> > tested.
> > > >> Noting broke here!
> > > > 
> > > > ok, nice. Thanks for checking (Kristian also).
> > > > 
> > > >> However, I'm not seeing the speedup... (and I'm reapplying the
> > dirichlet
> > > >> bcs every timestep). My code spends a good 30% of runtime applying
> > > >> dirichlet BCs (linear systems are pre-factorized so the solve step
> > takes
> > > >> no time). Any hints?
> > > > 
> > > > The speedup may not be noticeable if a lot of time is spent on
> > > > evaluating the function. Would be interesting to profile.
> > > > 
> > > > The difference from before is that each time apply() is called, we
> > > > only iterate over the actual facets included in your subdomain of the
> > > > boundary, not the entire mesh and then skipping those facets which
> > > > don't belong to your boundary. Also, depending on which type of search
> > > > ("topological", "geometric", "pointwise"), the new implementation
> > > > should avoid initializing mesh facets.
> > > > 
> > > 
> > > Does this mean that there now is a distinct difference in performance
> > > between giving the subdomain as a class that inherits from SubDomain
> > > (overloading bool inside) and pre-computing a mesh function with
> > > subdomain markers? /Dag
> > 
> > There is some overhead but I don't know how big it is. The performance
> > for the three different ways to specify boundary conditions should be
> > 
> >   MeshData > MeshFunction > SubDomain
> 
> Is there a demo somewhere that shows how to use MeshData and MeshFunction
> instead of SubDomain?

I'll be adding one later today. In the meantime, here's the short version:

  bc = DirichletBC(g, mesh, 3)

This sets u = g on subboundary number 3 as specified in the mesh file.

See meshbc.xml.gz for the XML format.

-- 
Anders



Follow ups

References