← Back to team overview

dolfin team mailing list archive

Re: assembly on sub domains

 

On Wed, May 07, 2008 at 10:10:02AM +0100, Nuno David Lopes wrote:
> >Anders Logg
> >Mon, 28 Jan 2008 02:00:43 -0800
> >>On Fri, Jan 25, 2008 at 10:55:27AM -0500, Jake Ostien wrote:
> >> I have a question about general usage of SubDomains.  I have a problem 
> >> where I would really like to partition a domain (via some criterion) 
> >> into 2 sub domains, and then assemble the global system as two separate 
> >> assemblies over the sub domains.  The context here is for plasticity, 
> >> initially I have a domain that is elastic but evolves such that there 
> >> are two regions (elastic + plastic).  I am currently not dealing with 
> >> this in a very elegant manner, and I was hoping that if I could somehow 
> >> generate an elastic sub domain and a plastic sub domain, I could more 
> >> efficiently assemble.  Does that sound possible currently, or could I 
> >> add something like that in?  Eventually I think we'd like to extend the 
> >> concept to assembly over facets on the boundary of the elastic/plastic 
> >> interface as well, but this might be a good first step.
> >> 
> >> Jake
> 
> >You can define a form as a sum of contributions from different
> >subdomains, for example:
> 
> >dx0 = Integral("cell", 0)
> >dx1 = Integral("cell", 1)  
> 
> >a = v*u*dx0 + dot(grad(v), grad(u))*dx1
> 
> >This gives two terms, one of which will be used in subdomain 0 and the
> >other in subdomain 1.
> 
> >Subdomains can be specified in DOLFIN by creating a subclass of
> >SubDomain and overloading the inside() function, or by specifying a
> >MeshFunction<uint> over the cells of the mesh.
> 
> >You can also have integrals over arbitrary facets of the domain, like
> >for example the boundary between your two subdomains. You can have
> >several such integrals:
> 
> >  ds0 = Integral("exterior facet", 0)
> > ds1 = Integral("exterior facet", 1)
> >  ds2 = Integral("exterior facet", 2)
> 
> >  dS0 = Integral("interior facet", 0)
> > dS1 = Integral("interior facet", 1)
> >  dS2 = Integral("interior facet", 2)
> 
> 
> 
> But how could we link the subdomains markers defined in a MeshFunction 
> with the variational form in the cpp.

You link these when you assemble by passing the subdomains as
arguments to the assembler. This won't work if you are using the
LinearPDE class, since it is currently unaware of subdomains.
So you must assemble the matrix and vector manually (by calling
assemble).

-- 
Anders


> Example:
> 
> I have in a "Foo.form"  something like:
> -------------------------------------------------------------------
> P1=FiniteElement("Lagrange","tetrahedron",1)
> 
> f=Function(P1)
> 
> dx0 = Integral("cell", 0)
> dx1 = Integral("cell", 1)  
> 
> a = f*v*u*dx0 + dot(grad(v), grad(u))*dx1
> ------------------------------------------------------------------
> and in "main.cpp" something like
> ----------------------------------------------------------------------------------------------------------
> MeshFunction<unsigned int> b_subdomains(mesh,"b_subdomains.xml");
> //Boundary subdomain markers
> 
> MeshFunction<unsigned int> v_subdomains(mesh,"v_subdomains.xml");
> //Volume subdomain   (0 and 1) markers
> 
> Function f(mesh,10.0);
> FooBilinearForm a( f );//constructors for finite element form's (Problem here)
> -----------------------------------------------------------------------------------------------------------
> I'm missing something...
> 
> Shouldn't 
> FooBilinearForm a( f );
> be replaced by  something like
> FooBilinearForm a( f ,v_subdomains);  ?
> 
> 


Follow ups

References