dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #17739
Re: [Question #102549]: evaluate boundary integrals
Question #102549 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/102549
Status: Open => Answered
Johan Hake proposed the following answer:
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
--
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.