SELF_AdaptiveMesh_2D Module

Emit a solver-ready Mesh2D_t from an adaptively refined, 2:1-balanced quad-forest (AMR Stage 4b). This closes the adaptive-refinement loop: with the Stage-1 indicator flagging elements, Stage 2b mutating the forest, and Stage 4a balancing it, EmitMesh produces the nonconforming mesh - leaf geometry, conforming-side connectivity, and a mortar table for the 2:1 hanging faces - that the existing mortar solver machinery already handles.

Each leaf of the forest becomes an element (in leaf-list order). For every leaf face the Stage-4a FaceNeighbor query classifies the face and drives the emitted connectivity:

  • domain boundary -> sideInfo(3)=0, sideInfo(5)=base BC id
  • same-level leaf -> conforming interior side (sideInfo(3)=neighbour, (4)=10*side+flip)
  • one-level-finer face -> this leaf is the BIG side of a 2:1 mortar; the two small elements are the finer neighbour node's children on the shared face
  • one-level-coarser face-> this leaf is a SMALL side; filled when its big side is processed

Mortar sides carry sideInfo(1)=mortar index and sideInfo(3)=sideInfo(5)=0 so the conforming side-exchange machinery skips them, exactly as in the hand-built SimpleMortarMesh. The mortar table follows the same 8-row layout (big elem/side; small elem + 10*side+flip per sub-edge; two sub-edge global side ids), with sub-edge 1 covering the big edge coordinate [-1,0] and sub-edge 2 covering [0,1], and the small-side flips inherited from the base face flip.

Decomposition (AMR Stage 5): every rank builds the same GLOBAL connectivity and mortar tables deterministically from the (rank-replicated) forest, generates a fresh contiguous decomposition over the leaf list - leaf-list order is Morton order within each root tree, so contiguous ranges are space-filling-curve partitions - and stores only its local slice of the element-sized arrays, exactly as the built-in mesh constructors do. sideInfo(3) carries global element ids, nUniqueSides is the global side count, and mortarInfo/nMortars are replicated in full with global ids on every rank, which is what SideExchange/MortarExchange require. Repartitioning is implicit: each epoch's emitted mesh is re-decomposed over the new leaf list, so equal-count partitions move with the refinement.


Uses

  • module~~self_adaptivemesh_2d~~UsesGraph module~self_adaptivemesh_2d SELF_AdaptiveMesh_2D module~self_mesh_2d SELF_Mesh_2D module~self_adaptivemesh_2d->module~self_mesh_2d module~self_constants SELF_Constants module~self_adaptivemesh_2d->module~self_constants module~self_quadtreemesh_2d SELF_QuadTreeMesh_2D module~self_adaptivemesh_2d->module~self_quadtreemesh_2d module~self_refinementprimitives_2d SELF_RefinementPrimitives_2D module~self_adaptivemesh_2d->module~self_refinementprimitives_2d module~self_lagrange SELF_Lagrange module~self_adaptivemesh_2d->module~self_lagrange module~self_mesh_2d_t SELF_Mesh_2D_t module~self_mesh_2d->module~self_mesh_2d_t iso_c_binding iso_c_binding module~self_constants->iso_c_binding iso_fortran_env iso_fortran_env module~self_constants->iso_fortran_env module~self_quadtreemesh_2d->module~self_mesh_2d module~self_quadtreemesh_2d->module~self_constants module~self_quadtreemesh_2d->module~self_refinementprimitives_2d module~self_quadtreemesh_2d->module~self_lagrange module~self_refinementprimitives_2d->module~self_constants module~self_refinementprimitives_2d->module~self_lagrange module~self_lagrange->module~self_constants module~self_lagrange->iso_c_binding module~self_lagrange->iso_fortran_env module~self_lagrange_t SELF_Lagrange_t module~self_lagrange->module~self_lagrange_t module~self_mesh_2d_t->module~self_constants module~self_mesh_2d_t->module~self_lagrange module~self_mesh_2d_t->iso_c_binding HDF5 HDF5 module~self_mesh_2d_t->HDF5 module~self_domaindecomposition SELF_DomainDecomposition module~self_mesh_2d_t->module~self_domaindecomposition module~self_hdf5 SELF_HDF5 module~self_mesh_2d_t->module~self_hdf5 module~self_quadrature SELF_Quadrature module~self_mesh_2d_t->module~self_quadrature module~self_mesh SELF_Mesh module~self_mesh_2d_t->module~self_mesh module~self_supportroutines SELF_SupportRoutines module~self_mesh_2d_t->module~self_supportroutines module~self_lagrange_t->module~self_constants module~self_lagrange_t->iso_c_binding module~self_lagrange_t->iso_fortran_env module~self_lagrange_t->HDF5 module~self_lagrange_t->module~self_hdf5 module~self_lagrange_t->module~self_quadrature module~self_lagrange_t->module~self_supportroutines module~self_domaindecomposition_t SELF_DomainDecomposition_t module~self_domaindecomposition->module~self_domaindecomposition_t module~self_hdf5->module~self_constants module~self_hdf5->iso_fortran_env module~self_hdf5->HDF5 mpi mpi module~self_hdf5->mpi module~self_quadrature->module~self_constants module~self_quadrature->iso_fortran_env module~self_mesh->module~self_constants module~self_mesh->iso_c_binding module~self_mesh->module~self_domaindecomposition module~self_supportroutines->module~self_constants module~self_supportroutines->iso_fortran_env module~self_domaindecomposition_t->module~self_constants module~self_domaindecomposition_t->module~self_lagrange module~self_domaindecomposition_t->iso_c_binding module~self_domaindecomposition_t->module~self_supportroutines module~self_domaindecomposition_t->mpi

Used by

  • module~~self_adaptivemesh_2d~~UsedByGraph module~self_adaptivemesh_2d SELF_AdaptiveMesh_2D module~self_amrcontroller_2d SELF_AMRController_2D module~self_amrcontroller_2d->module~self_adaptivemesh_2d

Contents


Subroutines

public subroutine EmitMesh(forest, baseMesh, outMesh)

Build outMesh (a conforming-or-mortar Mesh2D_t) from a 2:1-balanced forest. baseMesh is the mesh the forest was initialised from (supplies BC metadata and the communicator; on nRanks > 1 the forest must be rank-replicated so every rank emits identical global tables). The forest must already be balanced (MaxLevelJump <= 1); EmitMesh does not mutate it.

Arguments

TypeIntentOptionalAttributesName
type(QuadTreeMesh2D), intent(in) :: forest
type(Mesh2D), intent(in) :: baseMesh
type(Mesh2D), intent(out) :: outMesh