← Back to team overview

dolfin team mailing list archive

Re: [Question #136385]: Please clarify behavior of "exterior_facet_domains"

 

Question #136385 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/136385

    Status: Open => Answered

Johan Hake proposed the following answer:
ds is just short for ds(0). ds does not stand for a boundary integral over the 
whole domain. It is just a boundary intergral over the zeros domain. 

What you want is:

  L = g*ds(0) + (g+g1)*ds(1)
  b1 = assemble( L, exterior_facet_domains=boundary_parts,mesh=msh)

In this way g will be assembled over the whole domain and g1 only over 
subdomain 1.

We have discused introducing a boundary measure, a la ds, which should 
represent the whole domain, but it became too complicated to implement.

Johan

On Thursday December 2 2010 13:51:18 JG wrote:
> New question #136385 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/136385
> 
> Hello -- I could not find documentation on how to use
> "exterior_facet_domains" correctly. By trial and error I observed the
> following confusing behavior (python file below).  I will appreciate any
> clarification on how to use this option correctly. Thanks! --Jay
> 
> --------------------------
> 
> from dolfin import *
> 
> msh =  UnitSquare(2,2)
> g = Constant(3.)
> g1 = Constant(1.)
> 
> # boundary part
> class Top(SubDomain):
>     def inside(self, x, on_boundary):
>         return on_boundary and abs(x[1]-1) < DOLFIN_EPS
> boundary_parts = MeshFunction("uint", msh, msh.topology().dim()-1)
> boundary_parts.set_all(0)
> Gamma = Top()
> Gamma.mark(boundary_parts, 1)
> 
> # assemble a form
> U = FunctionSpace(msh, 'Raviart-Thomas', 2)
> v = TestFunction(U)
> n = FacetNormal(msh)
> L = g*ds +  g1*ds(1)
> 
> # unfortunately, assembling L in 3 ways, we obtain 3 different values
> b1 = assemble( L, exterior_facet_domains=boundary_parts,mesh=msh)
> b2 = assemble( L, mesh=msh)
> b3 = assemble( g*ds, mesh=msh) + \
>      assemble( g1*ds(1), exterior_facet_domains=boundary_parts, mesh=msh)
> 
> print  (b1, b2, b3)  # only b3 gives the correct value
> 
> 
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp

You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.