# michael-li-2002/ifem architecture

> Architecture diagram of the GitHub repository michael-li-2002/ifem, 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/michael-li-2002/ifem
- Repository: https://github.com/michael-li-2002/ifem

## Overview

iFEM is a MATLAB finite-element software package for solving PDEs on unstructured grids in two and three dimensions. Its principal workflow is to run an FEM example, define a problem and discretization, assemble and solve the resulting system, and—when adaptive methods are used—estimate error, refine the mesh, and repeat. Mesh, degree-of-freedom, equation, and solver modules are distinct internal layers. The README describes the package broadly; sampled source does not show the runtime wiring, so the connections here reflect documented workflow rather than verified individual calls.

Main entry points: [`example/fem`](https://github.com/michael-li-2002/ifem/tree/master/example/fem) (FEM examples), [`fem`](https://github.com/michael-li-2002/ifem/tree/master/fem) (FEM assembly), [`mesh`](https://github.com/michael-li-2002/ifem/tree/master/mesh) (Mesh adaptation), [`equation`](https://github.com/michael-li-2002/ifem/tree/master/equation) (PDE definitions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Problem workflow"]
  node_examples["FEM examples"]
  node_problem["PDE definitions"]
  node_data["Problem data"]
end

subgraph group_discretization["Discretization"]
  node_mesh["Mesh generation"]
  node_dof["Degrees of freedom"]
end

subgraph group_numerics["Numerical methods"]
  node_fem["FEM assembly"]
  node_solver["Linear solvers"]
end

subgraph group_adaptivity["Adaptive methods"]
  node_error["Error estimation"]
  node_refine["Mesh adaptation"]
end

node_user(("MATLAB user"))

node_user -->|"runs"| node_examples
node_examples -->|"sets up"| node_problem
node_examples -->|"uses"| node_data
node_examples -->|"uses"| node_mesh
node_examples -->|"invokes"| node_fem
node_fem -->|"uses"| node_dof
node_fem -->|"solves with"| node_solver
node_examples -->|"estimates"| node_error
node_error -->|"marks for"| node_refine
node_examples -->|"adapts"| node_refine
node_refine -->|"updates"| node_mesh

click node_examples "https://github.com/michael-li-2002/ifem/tree/master/example/fem"
click node_problem "https://github.com/michael-li-2002/ifem/tree/master/equation"
click node_data "https://github.com/michael-li-2002/ifem/tree/master/data"
click node_mesh "https://github.com/michael-li-2002/ifem/tree/master/mesh"
click node_dof "https://github.com/michael-li-2002/ifem/tree/master/dof"
click node_fem "https://github.com/michael-li-2002/ifem/tree/master/fem"
click node_solver "https://github.com/michael-li-2002/ifem/tree/master/solver"
click node_error "https://github.com/michael-li-2002/ifem/tree/master/fem"
click node_refine "https://github.com/michael-li-2002/ifem/tree/master/mesh"

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_examples,node_problem,node_data,node_user toneBlue
class node_mesh,node_dof toneAmber
class node_fem,node_solver toneMint
class node_error,node_refine toneRose
```

## Components

### Problem workflow

- [FEM examples](https://github.com/michael-li-2002/ifem/tree/master/example/fem): `example/fem`
- [PDE definitions](https://github.com/michael-li-2002/ifem/tree/master/equation): `equation`
- [Problem data](https://github.com/michael-li-2002/ifem/tree/master/data): `data`

### Discretization

- [Mesh generation](https://github.com/michael-li-2002/ifem/tree/master/mesh): `mesh`
- [Degrees of freedom](https://github.com/michael-li-2002/ifem/tree/master/dof): `dof`

### Numerical methods

- [FEM assembly](https://github.com/michael-li-2002/ifem/tree/master/fem): `fem`
- [Linear solvers](https://github.com/michael-li-2002/ifem/tree/master/solver): `solver`

### Adaptive methods

- [Error estimation](https://github.com/michael-li-2002/ifem/tree/master/fem): `fem`
- [Mesh adaptation](https://github.com/michael-li-2002/ifem/tree/master/mesh): `mesh`

### Other components

- **MATLAB user**

## Connections

- MATLAB user → FEM examples: runs
- FEM examples → PDE definitions: sets up
- FEM examples → Problem data: uses
- FEM examples → Mesh generation: uses
- FEM examples → FEM assembly: invokes
- FEM assembly → Degrees of freedom: uses
- FEM assembly → Linear solvers: solves with
- FEM examples → Error estimation: estimates
- Error estimation → Mesh adaptation: marks for
- FEM examples → Mesh adaptation: adapts
- Mesh adaptation → Mesh generation: updates
