I need some good references on how to implement programmatically the hp-refinement of meshes in the Finite Element Method in two/three-dimension. I've searched the web a lot and read many articles and books without success. Most of the references in this regard have only concisely discussed the details of the hp-refinement in 2D/3D, which is not enough for someone to be able to implement this method as a code. The open-source FEM codes on the Internet that can do hp-refinement are too complex and involved to read, and in their manuals the details of the implementation are generally not explained.

So please introduce some books, articles, tutorials, webpages, lecture notes, etc. that practically and in detail discuss implementational aspects of the hp-refinement in FEM in 2D/3D and possibly have a complete code in this regard.

(it is to be noted that I have read books and articles by Dr. Demkowicz, but the presented ideas there are too complex for me to follow and implement as a code)

  • $\begingroup$ Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. $\endgroup$
    – Community Bot
    Jan 19, 2022 at 17:04

1 Answer 1


You really don't want to implement this yourself -- you'll spend a year or two on things others have already done, and will have done far better than you can hope for.

The difficulty is generally getting h and p refinement to work at the same time. That is not a trivial challenge. The implementation in deal.II is largely described here: https://www.math.colostate.edu/~bangerth/publications/2006-hp.pdf (which corresponds to https://dl.acm.org/doi/10.1145/1486525.1486529). I consider this the most comprehensive description of what it takes to implement hp adaptivity.

I will again, because I cannot enough, stress that it is a bad bad idea to want to implement it yourself. Your time is better used to describe what you want to do, than implement how it should be done.

  • 2
    $\begingroup$ Just to add to this, I went from starting to use deal.II to contributing in the space of 6 months because of how well-documented the code and its internal are. I think that path might be a quicker way to learning about how hp-refinement is implemented than proceeding from nothing. I don't necessarily agree with your statement that one should never reimplement things -- I've learned a ton by doing so -- but hp-refinement is a whole lot more complicated than, say, solving the Poisson equation with P1 elements from scratch. $\endgroup$ Jan 19, 2022 at 22:18
  • 3
    $\begingroup$ Yes, that's correct. Write your own P1 code in 2d. Don't write your own hp code in 3d :-) The complexity of these two are orders of magnitude apart. $\endgroup$ Jan 20, 2022 at 2:54
  • $\begingroup$ New implementation of hp-code make sense in two cases, 1) you have new implementation paradigm (exploiting new data structures, unique hardware, approximate bases, etc.), 2) internal structure/constrains of the existing software not allow for solution of your problem case. Anyway, implementation of new sustainable hp-code is almost impossible task. $\endgroup$
    – likask
    Jan 21, 2022 at 8:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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