← Back to team overview

dolfin team mailing list archive

Re: how to easily distinguish between physical entities

 

On Sat, Jan 20, 2007 at 11:29:42AM +0100, Ondrej Certik wrote:
> Hello,
> I am new to fenics and I have a question how to handle complex BC.
> 
> In all the demos you are just using very simple boundary conditions,
> which can be easily handled by a code like this:
> 
>   class DirichletBC : public BoundaryCondition
>   {
>     void eval(BoundaryValue& value, const Point& p, unsigned int i)
>     {
>       if ( std::abs(p.x() - 0.0) < DOLFIN_EPS )
>         value = 0.0;
>     }
>   };
> 
>   // Neumann boundary condition
>   class NeumannBC : public Function
>   {
>     real eval(const Point& p, unsigned int i)
>     {
>       if ( std::abs(p.x() - 1.0) < DOLFIN_EPS )
>         return 1.0;
>       else
>         return 0.0;
>     }
>   };
> 
> but I have a complex geometry, let's say I build the geometry in gmsh
> and create physical entities and the dirichlet and neumann BC change
> across the entities and also other parameters in the equations are
> different for each entity. What is the preferred way to handle this?

There is no preferred way to handle this, but support is on the way...

The idea is that the (template) class MeshFunction should be used for
putting markers on a mesh, things like sub domain indicators, material
parameters etc. The MeshFunction class can be stored/loaded to/from
XML files and we will support generating a DOLFIN Mesh and
MeshFunction from for example the gmsh format.

One of the groups at Simula have very recently developed a new tool
that can be used to edit meshes and assign material parameters in a
graphical user interface, saving to DOLFIN XML etc. This new tool
should be available soon.

> This is how I do it in my FEM code so far, which uses libmesh:
> I mesh the geometry in gmsh (it assigns a number of the entity to all
> elements which result in meshing this particular entity), then I parse
> the output file and extract element numbers belonging to each entity
> and then use them in the assembly of matrices to correctly handle all
> the parameters and BCs.
> 
> The gmsh unfortunately is not able to mesh my complex 3D geometry, but
> fortunately tetgen is. But I need to write some scripts to extract the
> correct element numbers from the tetgen output, which I haven't done
> yet.
> 
> I am sure everyone who wants to solve more complex geometry need to
> tackle this problem somehow, so I would be interested in your
> approaches.
> 
> Also, it seems to me that dolfin only handles tetrahedrons in 3D so
> far. But because I am going to use tegen anyway, it doesn't matter.
> 
> BTW, I also tried several demos and they work fine, except
> dolfin-0.6.4/src/demo/pde/convection-diffusion, which runs ok and at the end:
> 
> ...
> Solving linear system of size 25140 x 25140 (uBlas Krylov solver).
> *** Error: BiCGStab breakdown. rho = 5.54996e-26
> [./dolfin/uBlasKrylovSolver.h:360: solveBiCGStab()]
> 
> 
> Thanks for any help,
> Ondrej Certik

Try installing UMFPACK and use a direct solver. The BiCGStab does not
work for me either.

/Anders


Follow ups

References