← Back to team overview

dolfin team mailing list archive

Re: assembly on sub domains

 

On Thu, May 08, 2008 at 09:21:58AM -0400, Jake Ostien wrote:
> Nuno David Lopes wrote:
> > On Thursday 08 May 2008, Anders Logg wrote:
> >   
> >> On Thu, May 08, 2008 at 11:33:49AM +0100, Nuno David Lopes wrote:
> >>     
> >>> But then what is the difference between
> >>> a MeshFunction for interior and exterior face_domains?
> >>> Shouldn't they be the same only with different markers for the boundary
> >>> and for the interior?
> >>>
> >>> MeshFunction<unsigned int> facets_subdomains(mesh, mesh.topology().dim()
> >>> - 1); (it has the information for all the facets, doesn't it?)
> >>>       
> >> Yes it does.
> >>
> >>     
> >>> Is the problem in the order of the markers:
> >>> 0...n-1 in the exterior
> >>> 0...n-1 in the interior
> >>>
> >>> If we dont need the interior could we use the same MeshFunction, knowing
> >>> that the interior is marked with 0?
> >>>       
> >> Are you talking about the facets in the interior? Those are not
> >> included when integrating *ds terms anyway.
> >>     
> >
> > Exactly. If I understood it well, only if you have *dS terms you need the 
> > information for the interior facets.
> > But that information is in the same MeshFunction as for exterior facets. 
> >
> >   
> >> For the cells in the interior, you need to have a MeshFunction defined
> >> on the cells, so something like
> >>
> >>   MeshFunction<unsigned int> cell_domains(mesh, mesh.topology().dim());
> >>     
> >
> >
> > Ok thats clear form me. 
> > For a 3D mesh:  
> > Cells information are in   Meshfunction cell_domains(mesh,'3') 
> > Facets information are in a MeshFunction facets_domains(mesh,'2')
> >
> > And still if you want to use: "assemble" you need 3 MeshFunctions:
> >
> > assemble(A,a,mesh, cell_domains,int_facet_domains,ext_facets_domains)
> >                                ^MeshF 1^      ^^MeshF 2^^          ^^MeshF3^^
> >
> > I really don't understand the difference between MeshF 2 and MeshF 3?
> > And if they are different how to construct them. 
> > (That's why I've referred the order of the markers, since that seems important 
> > for  FFC)
> >  
> >   
> >   
> 
> The MeshFunctions for the interior facets and the exterior facets can be 
> constructed in a very similar fashion.  Consider this loop over facets:
> 
>   /// loop over facets
>   for (FacetIterator facet(mesh); !facet.end(); ++facet) {
>                
>     /// Check if we have an exterior facet
>     if ( facet->numEntities(mesh.topology().dim()) != 2 ) {
>     ...mark exterior facets i.e. ext_facet_domains(*facet) = n
>     } else {
>     ...mark interior facets i.e. int_facet_domains(*facet) = m
>     }
>    
>   }
> 
> The difference comes during assembly, where, for example, assembly over 
> the exterior facets first checks if the facet is actually on the 
> exterior of the mesh, and then it checks if the marker of that facet 
> matches an associated integral defined in the form file.  Since assembly 
> of exterior facets happens separately from the interior facets, it makes 
> sense to have a MeshFunction for both the exterior and interior facets. 
> As I see it its also necessary to split them up since FFC wants to order 
> subdomains from 0 to n-1.  If you wanted one MeshFunction for both 
> interior and exterior domains you might have an exterior domain ds0 and 
> an interior domain dS1, but FFC would complain since you don't have a 
> dS0 (you mentioned this above).
> 
> 
> Jake

This really needs to be explained in the manual at some point... :-)

But we (obviously) need a few more iterations on the interface first.
I agree it's difficult to understand exactly what can be expected when
assembling over subdomains. The only way to know is to look at the
code.

-- 
Anders


Follow ups

References