# scicompmod/gmgpolar architecture

> Architecture diagram of the GitHub repository scicompmod/gmgpolar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scicompmod/gmgpolar
- Repository: https://github.com/scicompmod/gmgpolar

## Overview

GMGPolar is a geometric multigrid solver for polar and curvilinear-domain problems. The principal workflow is to configure a grid and problem, select geometry, coefficients, source and boundary data, then solve to convergence using multigrid or PCG. The graph also shows grid transfer, level operations and linear algebra as internal layers, plus documented cycle, extrapolation and FMG capabilities. Several subsystem links rely on the README and tree because their implementation was not sampled; uncertain call paths are omitted.

Main entry points: [`include/GMGPolar/solver.h`](https://github.com/scicompmod/gmgpolar/blob/main/include/GMGPolar/solver.h) (GMGPolar solver), [`include/Level/level.h`](https://github.com/scicompmod/gmgpolar/blob/main/include/Level/level.h) (Grid levels), [`src/ConfigParser/config_parser.cpp`](https://github.com/scicompmod/gmgpolar/blob/main/src/ConfigParser/config_parser.cpp) (Config parser), [`include/GMGPolar/MultigridMethods`](https://github.com/scicompmod/gmgpolar/tree/main/include/GMGPolar/MultigridMethods) (Multigrid cycles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_config["Configuration"]
  node_parser["Config parser<br/>[config_parser.cpp]"]
  node_grid["Polar grid<br/>[polargrid.cpp]"]
end

subgraph group_problem["Problem definition"]
  node_geometry["Domain geometry"]
  node_coefficients["Profile coefficients"]
  node_source["Source terms"]
  node_boundary["Boundary conditions"]
  node_exact["Exact solutions"]
end

subgraph group_solver["Solver runtime"]
  node_api["Solver interface<br/>[igmgpolar.h]"]
  node_gmg["GMGPolar solver<br/>[solver.h]"]
  node_cycles["Multigrid cycles"]
  node_level["Grid levels<br/>[level.h]"]
  node_result["Solution and output<br/>[solver.h]"]
end

subgraph group_numerics["Numerical components"]
  node_transfer["Grid transfer"]
  node_residual["Residual<br/>[residual.h]"]
  node_smoother["Smoothers<br/>[smoother.h]"]
  node_extrapolated["Extrapolated smoothing"]
  node_direct["Coarse solver<br/>[directSolver.h]"]
  node_linalg["Linear algebra"]
end

node_user(("User"))
node_mumps["MUMPS"]

node_user -->|"sets parameters"| node_parser
node_parser -->|"configures grid"| node_grid
node_parser -->|"selects geometry"| node_geometry
node_parser -->|"selects coefficients"| node_coefficients
node_parser -->|"configures solver"| node_api
node_parser -->|"starts solve"| node_gmg
node_gmg -->|"uses geometry"| node_geometry
node_gmg -->|"uses coefficients"| node_coefficients
node_gmg -->|"uses source"| node_source
node_gmg -->|"uses boundary data"| node_boundary
node_gmg -->|"checks error"| node_exact
node_gmg -->|"runs cycles"| node_cycles
node_gmg -->|"operates on levels"| node_level
node_cycles -->|"updates levels"| node_level
node_level -->|"uses grid"| node_grid
node_level -->|"computes residual"| node_residual
node_level -->|"smooths level"| node_smoother
node_level -->|"smooths extrapolated"| node_extrapolated
node_level -->|"solves coarse system"| node_direct
node_cycles -->|"transfers corrections"| node_transfer
node_gmg -->|"interpolates FMG"| node_transfer
node_residual -->|"uses vectors"| node_linalg
node_direct -->|"uses matrices"| node_linalg
node_direct -.->|"factorizes with MUMPS"| node_mumps
node_gmg -->|"produces solution"| node_result
node_result -->|"returns solution"| node_user

click node_parser "https://github.com/scicompmod/gmgpolar/blob/main/src/ConfigParser/config_parser.cpp"
click node_grid "https://github.com/scicompmod/gmgpolar/blob/main/src/PolarGrid/polargrid.cpp"
click node_geometry "https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/DomainGeometry"
click node_coefficients "https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/DensityProfileCoefficients"
click node_source "https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/SourceTerms"
click node_boundary "https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/BoundaryConditions"
click node_exact "https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/ExactSolution"
click node_api "https://github.com/scicompmod/gmgpolar/blob/main/include/GMGPolar/igmgpolar.h"
click node_gmg "https://github.com/scicompmod/gmgpolar/blob/main/include/GMGPolar/solver.h"
click node_cycles "https://github.com/scicompmod/gmgpolar/tree/main/include/GMGPolar/MultigridMethods"
click node_level "https://github.com/scicompmod/gmgpolar/blob/main/include/Level/level.h"
click node_transfer "https://github.com/scicompmod/gmgpolar/tree/main/src/Interpolation"
click node_residual "https://github.com/scicompmod/gmgpolar/blob/main/include/Residual/residual.h"
click node_smoother "https://github.com/scicompmod/gmgpolar/blob/main/include/Smoother/smoother.h"
click node_extrapolated "https://github.com/scicompmod/gmgpolar/blob/main/include/ExtrapolatedSmoother/extrapolatedSmoother.h"
click node_direct "https://github.com/scicompmod/gmgpolar/blob/main/include/DirectSolver/directSolver.h"
click node_linalg "https://github.com/scicompmod/gmgpolar/tree/main/include/LinearAlgebra"
click node_result "https://github.com/scicompmod/gmgpolar/blob/main/include/GMGPolar/solver.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_parser,node_grid,node_user toneBlue
class node_geometry,node_coefficients,node_source,node_boundary,node_exact toneAmber
class node_api,node_gmg,node_cycles,node_level,node_result toneMint
class node_transfer,node_residual,node_smoother,node_extrapolated,node_direct,node_linalg toneRose
class node_mumps toneIndigo
```

## Components

### Configuration

- [Config parser](https://github.com/scicompmod/gmgpolar/blob/main/src/ConfigParser/config_parser.cpp): `src/ConfigParser/config_parser.cpp`
- [Polar grid](https://github.com/scicompmod/gmgpolar/blob/main/src/PolarGrid/polargrid.cpp): `src/PolarGrid/polargrid.cpp`

### Problem definition

- [Domain geometry](https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/DomainGeometry): `src/InputFunctions/DomainGeometry`
- [Profile coefficients](https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/DensityProfileCoefficients): `src/InputFunctions/DensityProfileCoefficients`
- [Source terms](https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/SourceTerms): `src/InputFunctions/SourceTerms`
- [Boundary conditions](https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/BoundaryConditions): `src/InputFunctions/BoundaryConditions`
- [Exact solutions](https://github.com/scicompmod/gmgpolar/tree/main/src/InputFunctions/ExactSolution): `src/InputFunctions/ExactSolution`

### Solver runtime

- [Solver interface](https://github.com/scicompmod/gmgpolar/blob/main/include/GMGPolar/igmgpolar.h): `include/GMGPolar/igmgpolar.h`
- [GMGPolar solver](https://github.com/scicompmod/gmgpolar/blob/main/include/GMGPolar/solver.h): `include/GMGPolar/solver.h`
- [Multigrid cycles](https://github.com/scicompmod/gmgpolar/tree/main/include/GMGPolar/MultigridMethods): `include/GMGPolar/MultigridMethods`
- [Grid levels](https://github.com/scicompmod/gmgpolar/blob/main/include/Level/level.h): `include/Level/level.h`
- [Solution and output](https://github.com/scicompmod/gmgpolar/blob/main/include/GMGPolar/solver.h): `include/GMGPolar/solver.h`

### Numerical components

- [Grid transfer](https://github.com/scicompmod/gmgpolar/tree/main/src/Interpolation): `src/Interpolation`
- [Residual](https://github.com/scicompmod/gmgpolar/blob/main/include/Residual/residual.h): `include/Residual/residual.h`
- [Smoothers](https://github.com/scicompmod/gmgpolar/blob/main/include/Smoother/smoother.h): `include/Smoother/smoother.h`
- [Extrapolated smoothing](https://github.com/scicompmod/gmgpolar/blob/main/include/ExtrapolatedSmoother/extrapolatedSmoother.h): `include/ExtrapolatedSmoother/extrapolatedSmoother.h`
- [Coarse solver](https://github.com/scicompmod/gmgpolar/blob/main/include/DirectSolver/directSolver.h): `include/DirectSolver/directSolver.h`
- [Linear algebra](https://github.com/scicompmod/gmgpolar/tree/main/include/LinearAlgebra): `include/LinearAlgebra`

### Other components

- **User**
- **MUMPS**

## Connections

- User → Config parser: sets parameters
- Config parser → Polar grid: configures grid
- Config parser → Domain geometry: selects geometry
- Config parser → Profile coefficients: selects coefficients
- Config parser → Solver interface: configures solver
- Config parser → GMGPolar solver: starts solve
- GMGPolar solver → Domain geometry: uses geometry
- GMGPolar solver → Profile coefficients: uses coefficients
- GMGPolar solver → Source terms: uses source
- GMGPolar solver → Boundary conditions: uses boundary data
- GMGPolar solver → Exact solutions: checks error
- GMGPolar solver → Multigrid cycles: runs cycles
- GMGPolar solver → Grid levels: operates on levels
- Multigrid cycles → Grid levels: updates levels
- Grid levels → Polar grid: uses grid
- Grid levels → Residual: computes residual
- Grid levels → Smoothers: smooths level
- Grid levels → Extrapolated smoothing: smooths extrapolated
- Grid levels → Coarse solver: solves coarse system
- Multigrid cycles → Grid transfer: transfers corrections
- GMGPolar solver → Grid transfer: interpolates FMG
- Residual → Linear algebra: uses vectors
- Coarse solver → Linear algebra: uses matrices
- Coarse solver → MUMPS: factorizes with MUMPS
- GMGPolar solver → Solution and output: produces solution
- Solution and output → User: returns solution
