Incorrect documentation of DirichletBC implies it does not apply to interior facets

Bug #1077912 reported by Martin Sandve Alnæs on 2012-11-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
DOLFIN
Undecided
Unassigned

Bug Description

According to

http://fenicsproject.org/documentation/dolfin/1.0.0/python/programmers-reference/fem/bcs/DirichletBC.html#dolfin.fem.bcs.DirichletBC

"The topological approach is faster, but will only identify degrees of freedom that are located on a facet that is entirely on the boundary."

However, this does not seem to be the case. I will attach here a code which changes behaviour when switching between marking all facets or all facets on the boundary, look for the lines:

if enable_bug:
    boundaries.set_all(walldomain)
else:
    Wall().mark(boundaries, walldomain)

Martin Sandve Alnæs (martinal) wrote :
Johan Hake (johan-hake) wrote :

Not exactly sure what the bug is...

Having rows which are zero is obviously a problem. This only occurs in the assemble_system statement when all facets are marked. Is this what you mean?

Martin Sandve Alnæs (martinal) wrote :

The zero rows is only a symptom of the underlying bug. Looking at the sparsity pattern of B you can see there are dramatic changes between setting enable_bug=1/0, so this is not an assemble_system specific issue.

If DirichletBC with method=topological only applies to dofs on the boundary, then the markers in the interior facets should not matter. However they do get used, causing the boundary condition to be applied to interior dofs as well as boundary dofs in the enable_bug=1 case in the provided code.

While this may very well be useful for some situations, it is contrary to the description in the documentation as quoted, and contrary to the name "boundary conditions".

The problem could be limited to for example DBC on subspaces of mixed elements, at least I failed to simplify it to a pure scalar case.

On 11/12/2012 02:27 PM, Martin Sandve Alnæs wrote:
> The zero rows is only a symptom of the underlying bug. Looking at the
> sparsity pattern of B you can see there are dramatic changes between
> setting enable_bug=1/0, so this is not an assemble_system specific
> issue.

Sure but then this would be a separate bug, compared to what you mention
below.

> If DirichletBC with method=topological only applies to dofs on the
> boundary, then the markers in the interior facets should not matter.
> However they do get used, causing the boundary condition to be applied
> to interior dofs as well as boundary dofs in the enable_bug=1 case in
> the provided code.
>
> While this may very well be useful for some situations, it is contrary
> to the description in the documentation as quoted, and contrary to the
> name "boundary conditions".

Agree. Not sure how to deal with it as setting dirichlet dofs inside the
domain can be very useful.

Johan

1) No, the sparsity pattern _shows_ what I mention. There is only one issue here, and my bug title is wrong because assemble_system is not that issue :)

2) As a minimum the documentation should be changed to reflect the actual behaviour. However I find the current behaviour counterintuitive, while e.g. adding another method string which allows internal facets explicitly would make it clear what happens.

This code should define _boundary_ conditions everywhere:
boundaries = MeshFunction("uint", mesh, dim-1)
boundaries.set_all(7)
bc = DirichletBC(V, mesh, boundaries, 7)

while this could be syntax for allowing interior facets with the topological method:
bc = DirichletBC(V, mesh, boundaries, 7, method="interior")

still misuse of the term "BC", but at least with clear intention.

summary: - Incorrect DirichletBC behaviour with assemble_system
+ Incorrect DirichletBC behaviour applying to interior facets

This is not a bug. The problem is the interpretation of what boundary
means. The boundary is whatever the user specifies and it can lie in
the interior.

--
Anders

On Mon, Nov 12, 2012 at 12:26:54PM -0000, Martin Sandve Alnæs wrote:
> Public bug reported:
>
> According to
>
> http://fenicsproject.org/documentation/dolfin/1.0.0/python/programmers-
> reference/fem/bcs/DirichletBC.html#dolfin.fem.bcs.DirichletBC
>
> "The topological approach is faster, but will only identify degrees of
> freedom that are located on a facet that is entirely on the boundary."
>
> However, this does not seem to be the case. I will attach here a code
> which changes behaviour when switching between marking all facets or all
> facets on the boundary, look for the lines:
>
> if enable_bug:
> boundaries.set_all(walldomain)
> else:
> Wall().mark(boundaries, walldomain)
>
> ** Affects: dolfin
> Importance: Undecided
> Status: New
>

Martin Sandve Alnæs (martinal) wrote :

Boundary (topology), the closure minus the interior of a subset of a topological space; an edge in the topology of manifolds, as in the case of a 'manifold with boundary'

As I said above, this is at the very least a documentation bug. The sentence I quote makes no sense when all facets may be considered on the boundary. I.e. "a facet that is entirely on the boundary". An alternative interpretation of what "boundary" means also does not match the on_boundary argument to subdomain.inside. And BoundaryMesh takes the exterior boundary. Right? So some clarification of terms is in order, at least in the DirichletBC documentation.

Martin

Den 13. nov. 2012 kl. 10:12 skrev Anders Logg <email address hidden>:

> This is not a bug. The problem is the interpretation of what boundary
> means. The boundary is whatever the user specifies and it can lie in
> the interior.
>
> --
> Anders
>
>
> On Mon, Nov 12, 2012 at 12:26:54PM -0000, Martin Sandve Alnæs wrote:
>> Public bug reported:
>>
>> According to
>>
>> http://fenicsproject.org/documentation/dolfin/1.0.0/python/programmers-
>> reference/fem/bcs/DirichletBC.html#dolfin.fem.bcs.DirichletBC
>>
>> "The topological approach is faster, but will only identify degrees of
>> freedom that are located on a facet that is entirely on the boundary."
>>
>> However, this does not seem to be the case. I will attach here a code
>> which changes behaviour when switching between marking all facets or all
>> facets on the boundary, look for the lines:
>>
>> if enable_bug:
>> boundaries.set_all(walldomain)
>> else:
>> Wall().mark(boundaries, walldomain)
>>
>> ** Affects: dolfin
>> Importance: Undecided
>> Status: New
>>
>
> --
> You received this bug notification because you are a member of DOLFIN
> Core Team, which is subscribed to DOLFIN.
> https://bugs.launchpad.net/bugs/1077912
>
> Title:
> Incorrect DirichletBC behaviour applying to interior facets
>
> Status in DOLFIN:
> New
>
> Bug description:
> According to
>
> http://fenicsproject.org/documentation/dolfin/1.0.0/python
> /programmers-
> reference/fem/bcs/DirichletBC.html#dolfin.fem.bcs.DirichletBC
>
> "The topological approach is faster, but will only identify degrees of
> freedom that are located on a facet that is entirely on the boundary."
>
> However, this does not seem to be the case. I will attach here a code
> which changes behaviour when switching between marking all facets or
> all facets on the boundary, look for the lines:
>
> if enable_bug:
> boundaries.set_all(walldomain)
> else:
> Wall().mark(boundaries, walldomain)
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/dolfin/+bug/1077912/+subscriptions

Anders Logg (logg) wrote :

I agree it may be confusing and I can clarify this in the
documentation. But I would not call this a bug. It is a well-known
feature that DirichletBC can be used to set "boundary conditions"
anywhere. It's been like that for ca 10 years. That's also why we have
the on_boundary parameter to allow setting conditions on the actual
boundary.

--
Anders

On Tue, Nov 13, 2012 at 10:40:04AM -0000, Martin Sandve Alnæs wrote:
> Boundary (topology), the closure minus the interior of a subset of a
> topological space; an edge in the topology of manifolds, as in the case
> of a 'manifold with boundary'
>
> As I said above, this is at the very least a documentation bug. The
> sentence I quote makes no sense when all facets may be considered on the
> boundary. I.e. "a facet that is entirely on the boundary". An
> alternative interpretation of what "boundary" means also does not match
> the on_boundary argument to subdomain.inside. And BoundaryMesh takes the
> exterior boundary. Right? So some clarification of terms is in order, at
> least in the DirichletBC documentation.
>
> Martin
>
> Den 13. nov. 2012 kl. 10:12 skrev Anders Logg <email address hidden>:
>
> > This is not a bug. The problem is the interpretation of what boundary
> > means. The boundary is whatever the user specifies and it can lie in
> > the interior.
> >
> >> Public bug reported:
> >>
> >> According to
> >>
> >> http://fenicsproject.org/documentation/dolfin/1.0.0/python/programmers-
> >> reference/fem/bcs/DirichletBC.html#dolfin.fem.bcs.DirichletBC
> >>
> >> "The topological approach is faster, but will only identify degrees of
> >> freedom that are located on a facet that is entirely on the boundary."
> >>
> >> However, this does not seem to be the case. I will attach here a code
> >> which changes behaviour when switching between marking all facets or all
> >> facets on the boundary, look for the lines:
> >>
> >> if enable_bug:
> >> boundaries.set_all(walldomain)
> >> else:
> >> Wall().mark(boundaries, walldomain)
> >>
> >> ** Affects: dolfin
> >> Importance: Undecided
> >> Status: New
> >>
> >
>

Martin Sandve Alnæs (martinal) wrote :
Download full text (3.3 KiB)

Ok, great :) Is there a better place to report documentation errors than as bugs?

Martin

Den 13. nov. 2012 kl. 19:22 skrev Anders Logg <email address hidden>:

> I agree it may be confusing and I can clarify this in the
> documentation. But I would not call this a bug. It is a well-known
> feature that DirichletBC can be used to set "boundary conditions"
> anywhere. It's been like that for ca 10 years. That's also why we have
> the on_boundary parameter to allow setting conditions on the actual
> boundary.
>
> --
> Anders
>
>
> On Tue, Nov 13, 2012 at 10:40:04AM -0000, Martin Sandve Alnæs wrote:
>> Boundary (topology), the closure minus the interior of a subset of a
>> topological space; an edge in the topology of manifolds, as in the case
>> of a 'manifold with boundary'
>>
>> As I said above, this is at the very least a documentation bug. The
>> sentence I quote makes no sense when all facets may be considered on the
>> boundary. I.e. "a facet that is entirely on the boundary". An
>> alternative interpretation of what "boundary" means also does not match
>> the on_boundary argument to subdomain.inside. And BoundaryMesh takes the
>> exterior boundary. Right? So some clarification of terms is in order, at
>> least in the DirichletBC documentation.
>>
>> Martin
>>
>> Den 13. nov. 2012 kl. 10:12 skrev Anders Logg <email address hidden>:
>>
>>> This is not a bug. The problem is the interpretation of what boundary
>>> means. The boundary is whatever the user specifies and it can lie in
>>> the interior.
>>>
>>>> Public bug reported:
>>>>
>>>> According to
>>>>
>>>> http://fenicsproject.org/documentation/dolfin/1.0.0/python/programmers-
>>>> reference/fem/bcs/DirichletBC.html#dolfin.fem.bcs.DirichletBC
>>>>
>>>> "The topological approach is faster, but will only identify degrees of
>>>> freedom that are located on a facet that is entirely on the boundary."
>>>>
>>>> However, this does not seem to be the case. I will attach here a code
>>>> which changes behaviour when switching between marking all facets or all
>>>> facets on the boundary, look for the lines:
>>>>
>>>> if enable_bug:
>>>> boundaries.set_all(walldomain)
>>>> else:
>>>> Wall().mark(boundaries, walldomain)
>>>>
>>>> ** Affects: dolfin
>>>> Importance: Undecided
>>>> Status: New
>>>>
>>>
>>
>
> --
> You received this bug notification because you are a member of DOLFIN
> Core Team, which is subscribed to DOLFIN.
> https://bugs.launchpad.net/bugs/1077912
>
> Title:
> Incorrect DirichletBC behaviour applying to interior facets
>
> Status in DOLFIN:
> New
>
> Bug description:
> According to
>
> http://fenicsproject.org/documentation/dolfin/1.0.0/python
> /programmers-
> reference/fem/bcs/DirichletBC.html#dolfin.fem.bcs.DirichletBC
>
> "The topological approach is faster, but will only identify degrees of
> freedom that are located on a facet that is entirely on the boundary."
>
> However, this does not seem to be the case. I will attach here a code
> which changes behaviour when switching between marking all facets or
> all facets on the boundary, look for the lines:
>
> if enable_bug:
> boundaries.set_all(walldomain)
> else:
> Wall().m...

Read more...

Anders Logg (logg) wrote :

Probably not, so thanks for the bug report. :-)

--
Anders

On Tue, Nov 13, 2012 at 07:29:13PM -0000, Martin Sandve Alnæs wrote:
> Ok, great :) Is there a better place to report documentation errors than
> as bugs?
>
> Martin
>
> Den 13. nov. 2012 kl. 19:22 skrev Anders Logg <email address hidden>:
>
> > I agree it may be confusing and I can clarify this in the
> > documentation. But I would not call this a bug. It is a well-known
> > feature that DirichletBC can be used to set "boundary conditions"
> > anywhere. It's been like that for ca 10 years. That's also why we have
> > the on_boundary parameter to allow setting conditions on the actual
> > boundary.
> >
> >> Boundary (topology), the closure minus the interior of a subset of a
> >> topological space; an edge in the topology of manifolds, as in the case
> >> of a 'manifold with boundary'
> >>
> >> As I said above, this is at the very least a documentation bug. The
> >> sentence I quote makes no sense when all facets may be considered on the
> >> boundary. I.e. "a facet that is entirely on the boundary". An
> >> alternative interpretation of what "boundary" means also does not match
> >> the on_boundary argument to subdomain.inside. And BoundaryMesh takes the
> >> exterior boundary. Right? So some clarification of terms is in order, at
> >> least in the DirichletBC documentation.
> >>
> >> Martin
> >>
> >> Den 13. nov. 2012 kl. 10:12 skrev Anders Logg <email address hidden>:
> >>
> >>> This is not a bug. The problem is the interpretation of what boundary
> >>> means. The boundary is whatever the user specifies and it can lie in
> >>> the interior.
> >>>
> >>>> Public bug reported:
> >>>>
> >>>> According to
> >>>>
> >>>> http://fenicsproject.org/documentation/dolfin/1.0.0/python/programmers-
> >>>> reference/fem/bcs/DirichletBC.html#dolfin.fem.bcs.DirichletBC
> >>>>
> >>>> "The topological approach is faster, but will only identify degrees of
> >>>> freedom that are located on a facet that is entirely on the boundary."
> >>>>
> >>>> However, this does not seem to be the case. I will attach here a code
> >>>> which changes behaviour when switching between marking all facets or all
> >>>> facets on the boundary, look for the lines:
> >>>>
> >>>> if enable_bug:
> >>>> boundaries.set_all(walldomain)
> >>>> else:
> >>>> Wall().mark(boundaries, walldomain)
> >>>>
> >>>> ** Affects: dolfin
> >>>> Importance: Undecided
> >>>> Status: New
> >>>>
> >>>
> >>
> >
>

summary: - Incorrect DirichletBC behaviour applying to interior facets
+ Incorrect documentation of DirichletBC implies it does not apply to
+ interior facets
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments