evaluate boundary integrals

Asked by James Lai

Hi,

After obtaining my solution using dolfin through python

problem = VariationalProblem(a,L,bcs)
U = problem.solve()

is there any way to integrate the solution over a given boundary edge?

Lets say I set up subdomains, then if I want to integrate n dot u over subdomain 1, I tried

ds_in = Measure('exterior_facet',1,None)
n_in = Constant((-1,0))
val = Integral(dot(n_in,u),ds_in)

It seems like when i do this, val is a not a number, but a Integral type. Is there any way to evaluate this integral and get a number out of it ?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
DOLFIN Edit question
Assignee:
No assignee Edit question
Solved by:
Johan Hake
Solved:
Last query:
Last reply:
Revision history for this message
Best Johan Hake (johan-hake) said :
#1

On Friday 26 February 2010 12:34:59 James Lai wrote:
> New question #102549 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/102549
>
> Hi,
>
> After obtaining my solution using dolfin through python
>
> problem = VariationalProblem(a,L,bcs)
> U = problem.solve()
>
> is there any way to integrate the solution over a given boundary edge?
>
> Lets say I set up subdomains, then if I want to integrate n dot u over
> subdomain 1, I tried
>
> ds_in = Measure('exterior_facet',1,None)
> n_in = Constant((-1,0))
> val = Integral(dot(n_in,u),ds_in)
>
> It seems like when i do this, val is a not a number, but a Integral type.
> Is there any way to evaluate this integral and get a number out of it ?

What you get there is an integral form, like a and L above, but scalar. You
need to assemble it to get the value. A slightly smaller example using
predefined Measures and Facet normals should also work:

  val = assemble(dot(FacetNormal(mesh),u)*ds(1), \
           exterior_facet_domains=domain, mesh=mesh)

Here domain is a either an instance of SubDomain or a MeshFunction defining
the dumain for your exterior integral form. Note that you probably need to
pass the mesh as you are assembling a functional.

Johan

Revision history for this message
James Lai (jhlai2) said :
#2

Cool, thanks for response, it works