This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

controlling the size of refined mesh elements

+1 vote

On another note (for mesh refinement), is there a way I could set how small I would like the refined mesh elements to be?

I understand the method in place is edge bisection, and the way I see the refined mesh, it has divided the original elements into two which is far too coarse for my computations. If I repeat the

mesh = refine(mesh, cell_markers)

command, would that do the job of re-dividing?

Many thanks,

related to an answer for: setting condition for mesh refinement
asked Jul 16, 2013 by hnili FEniCS Novice (590 points)

1 Answer

+1 vote
 
Best answer

Yes. But you need to define new cell_markers on new mesh. You may utilize parent_vertex_indices.

answered Jul 16, 2013 by Jan Blechta FEniCS Expert (51,420 points)
selected Jul 25, 2013 by Jan Blechta

Thanks.

Other than re-stating the refine command, is there an alternate way of refining the mesh? When I look at the mesh through ParaView Wireframe, it's small in areas I don't want it to be small and still larger than I want in the problematic area.

Would there be a way to ask for mesh element size (of say 1E-5) in a certain area and a coarse mesh elsewhere?

Thanks and sorry for being a bother - current mesh (refined) is giving rise to very visible noise at the subdomain interface I have in my computational domain.

I'm not aware of it. I understand that current way is pretty annoying - you have to create new CellFunction every step. You can propose an enhancement on bitbucket. One could for example supply unsigned integer CellFunction giving number of bisections on every cell.

Alternatively you can use external mesh generator. I have experience with Triangle in 2D. You can define maximal triangle area in independent regions. Moreover dolfin-convert script handles translating all the CellFunctions and FacetFunction supplied by Triangle. There are plenty of other generators even for tetrahedron meshes, with different support in dolfin-convert.

Thanks!

Using external generators like Triangle would probably not suit my problem, as the boundary moves in every time step (based on FEniCS solution of a level set function). I am supposing establishing a two-way communication between FEniCS and an external mesh generator can be problematic (or at lease uneasy to set up), right?

Well, I'm using combination of Triangle and moving mesh. Most of the time I deform mesh by Mesh.move() method. When it becomes poor-quality I remesh. You're right, it costs a little development. In particular I have prepared mesh.poly template file which contains keywords, I parse this file with python to put floats in place of these keywords and finally call triangle and mesh-convert.py by subprocess.call(). It is not difficult programming but involves careful management of filenames, etc. For example I use a flock to place lock on currently processed files to enable running multiple computations which accidentally request same mesh on cluster. Whole chain is also wrapped by make to enable reusing of already computed mesh.

But note that you will more or less need to do something like this for every mesh generator when dealing with a priori unknown meshes.

Thanks! Use of flock is a clever idea, yet given the pretty low computational power here, it would be risky to move meshes back and forth methinks.

I'm actually beginning to think (unfortunately) there is numerical instability somewhere in the solution procedure. Would you know how much access I can have to the numerical (integration) schemes used by FEniCS, so that I could hopefully tweak them to avoid what very much seems like a numerical instability?

Many thanks,

You can create custom quadrature rule if you use development version of FEniCS. See http://fenicsproject.org/qa/655/question-about-quadratures-rules. But there are much more possible reasons causing ill-conditioning. Closing this thread as resolved. You can continue elsewhere with off-topic.

Yes, thanks! I can see some interesting codes under the FFC development version folder. Sure, I shall continue in a separate thread for questions on this and leave this thread as resolved.

...