dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #08095
Re: FFC implementation over a subdomain of \Omega
On Fri, May 30, 2008 at 10:02:29AM +0200, Anne Voigt wrote:
> Hello all,
>
> I'm working with FFC for quite a while and I like the easy way to handle
> multilinear forms with the help of FFC.
>
> But now I have a problem where I'm not sure if it is possible to
> programme this with FFC.
>
> I'm working on an optimal control problem where I have to solve an
> integral over just a part of the whole twodimensional domain (x,y) \in
> \Omega. So what I need is the bilinear form
>
> \int_{y_0}^{y_1} u*v dy where [y_0,y_1] \in \Omega
>
> Is it possible to implement something like that in FFC and how can I do
> that?
>
> Hope somebody can help me?!
Yes, that's easy (but not so well documented I admit).
The simplest way is to just supply a SubDomain as argument to the assembler:
assemble(A, form, mesh, sub_domain);
Create a SubDomain which overloads the inside() function, returning
True when you are inside your subdomain, for example
class MySubDomain : public SubDomain
{
bool inside(const real* x, bool on_boundary) const
{
return x[0] + x[1] > 1.0;
}
};
If you can't specify your domain based on an expression, you need to
create a MeshFunction that labels which cells are included in your
domain.
It's also possible to have different integrals over different
subdomains, integrals over subsets of the boundary etc.
--
Anders
References