I am working on implementation of AMR for my finite volume code. Let me use a 2-D mesh to describe my question.

Starting with SINGLE initial cell (let the mesh refine level k = 0) as a root of a quad-tree, and keeping splitting the cell into 4, 16, 64... sub-cells for k = 1, 2, 3...during refinement is simple and works well for a SQUARE domain (length:width = 1:1) (case 1 in the figure).

What if the mesh domain is a RECTANGLE domain (aspect ratio > 1, e.g., cases 2)? In this case, quartering of the initial prolate cell can only generate more prolate sub-cells, which is bad because almost all numerical methods (FDM/FVM/FEM) favor a mesh formed from (near) square cells.

To avoid aspect ratio issue during refinement, I think of using a forest with MORE initial cells (case 3). In this mothed, combined data structures of array and quad-tree is used, and features

  • initial generation of a coarse mesh to fit the domain (aspect ratio of which can be >>1), with square cells (or cell with aspect ratio ~1) which then serve as roots of quad-tree of its sub-cells;
  • the root cells forming the initial coarse mesh can be stored in a array with number of cells kept constant;
  • sub-cells are stored in a quad-tree under each of the root cells above, and can be frequently added/removed during AMR.

Pros: easier to fit domain with any aspect ratio.

Cons: more complex traverse of cells/sub-cells.

Is my solution practicable? Any suggetion?

enter image description here

  • 2
    $\begingroup$ All AMR techniques assume a coarse mesh is available, and that coarse mesh is never the actual problem domain itself in interesting applications. So there is nothing wrong with the third approach in that sense. An issue may be related to handling of the hanging nodes, and another would be the representation of the fine mesh used in the calculation. But afaik, both are solved problems; you just need to go and shop for the solution you prefer. $\endgroup$ May 14, 2021 at 4:50
  • $\begingroup$ As an addition to my comment, are you aware of the question/answer at the link scicomp.stackexchange.com/a/33227 ? $\endgroup$ May 14, 2021 at 7:22
  • $\begingroup$ @Abdullah Ali Sivas: thanks a lot. I read it and the data structure and method you mentioned is new to me. I need some time to try it. $\endgroup$
    – Freewill
    May 14, 2021 at 17:12

1 Answer 1


All "real" implementations of adaptive mesh refinement start from an unstructured coarse mesh because the domains one wants to solve on are just not always rectangles :-) So your CASE 3 is exactly what people do: in your situation, the coarse mesh just consists of two squares.

For this very particular case, one can also implement what is called "anisotropic refinement": Where a cell is not replaced by 4 children upon mesh refinement, but only 2 children that split the cell either east-west or north-south.

I will add the usual notice: There are many, very good software libraries that implement adaptive mesh refinement. You can spend a lot of time (a year or two) implementing good algorithms that can be used on complex geometries, or you can just use the excellent work of others. You probably get what my suggestion would be.

  • $\begingroup$ Thanks a lot for your suggestions. At the very beginning of learnning CFD, I want to figure it out the basic rationale of AMR, so I did it from scratch. @WolfgangBangerth $\endgroup$
    – Freewill
    May 25, 2021 at 2:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.