Skip to content

Three-dimensional local p-refinement functionality

João Isler requested to merge jisler/nektar:feature/ChangeOrderRegion into master

Issue/feature addressed

In this merge request, a new functionality is added in Nektar++. The user now is able to refine the mesh locally using p-refinement.

Proposed solution

Essentially, in the XML file, the user can now define a specific region in the mesh (surfaces in 3D meshes, parallelograms in 2D and lines in 1D) so that the elements which the vertices lay within this region are refined (p-refinement). Thus, the user can change the polynomial order locally in the mesh without needing to re-design the mesh, but just increasing the polynomial order in the desired region. This new functionally is important since the p-refinement has exponential convergence compared to linear convergence of the h-refinement. Thus, regions in the flow field that require a more subtle refinement might be tackled with this tool. For the user to make use of this tool, one has to add in the XML file a new tag called REFINEMENTS (<REFINEMENTS> ... </REFINEMENTS>). The description of how to use this tag is described in the user-guide.


The main changes in the code were done in the MeshGraph.cpp and MeshGraph.h files. The code is composed of three parts. Firstly, the function called MeshGraph::ReadRefinementInfo() reads the information that the user provides. Secondly, the functions MeshGraph::SetRefinementInfo and MeshGraph::PRefinementElmts select and refine the elements that have their vertices within the region provided by the user. Finally, three functions were added to check if the vertices are inside the specific region depending if the mesh is 1D, 2D or 3D. The functions are MeshGraph::CheckIfVertIsInsideLine, MeshGraph::CheckIfVertIsInsideParallelogram and MeshGraph::CheckIfVertIsInsideCylinder.


The test cases below were added:

  1. solvers/IncNavierStokesSolver/Tests/ChanFlow_3DH1D_pRef
  • This test was designed to test the local 3D p-refinement functionality in a Quasi-3D simulation (2D mesh). Both types of elements (tria and quads) were used, so that it shows that this new capability works for both elements and can deal with multiple composites. In addition, since this test is a quais-3D simulation it uses a Fourier expansion in the third direction, demonstrating that the local p-refinement implementation is also compatible with this approach.
  1. solvers/ADRSolver/Tests/Helmholtz3D_Cube_pRef.xml
  • This test case checks the local 3D p-refinement in a 3D mesh. The mesh is composed of hexahedral elements. In addition, it tests the possibility of using multiple refinements in the same composite.


During the development of this new tool, it was found that the local p-refinement does not work when the DG method is used, which leads us to believe that there is a bug in the trace interpolation. This bug will be solved in another merge request. Therefore, this new tool, for now, can only be employed for CG methods.


  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).
Edited by João Isler

Merge request reports