# this-is-kb/nanofem architecture

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

- Interactive diagram: https://gitdiagram.com/this-is-kb/nanofem
- Repository: https://github.com/this-is-kb/nanofem

## Overview

NanoFEM is a phase-0 research finite-element framework for nanoscale mechanics: its repository defines a layered architecture and APIs, but the README explicitly says finite-element mathematics is not implemented yet. The intended workflow is model and mesh setup, theory/material/element definition, analysis, then result recovery or export. The graph shows that architecture and the sampled static-analysis orchestration; several subsystem connections are omitted because their source was not sampled.

Main entry points: [`src/nanofem/analysis/static.py`](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/static.py) (Static analysis), [`src/nanofem/constraints/handler.py`](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/constraints/handler.py) (Constraints), [`src/nanofem/postprocess/recovery.py`](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/postprocess/recovery.py) (Field recovery), [`src/nanofem/elements/factory.py`](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/elements/factory.py) (Element factory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_modeling["Model definition"]
  node_mesh["Mesh topology<br/>[mesh.py]"]
  node_model["Model<br/>[model.py]"]
  node_dofs["DOF numbering<br/>[dof_handler.py]"]
  node_constraints["Constraints<br/>[handler.py]"]
  node_materials["Materials<br/>[material.py]"]
  node_geometry["Geometry<br/>[base.py]"]
end

subgraph group_numerics["Numerical foundations"]
  node_numerics["Numerical toolkit"]
  node_reference["Reference cells<br/>[element.py]"]
  node_quadrature["Quadrature rules<br/>[rules.py]"]
  node_interpolation["Shape functions<br/>[shape_functions.py]"]
  node_mapping["Geometric mapping<br/>[base.py]"]
end

subgraph group_formulation["Physics and elements"]
  node_theories["Physical theories<br/>[base.py]"]
  node_elements["Element factory<br/>[factory.py]"]
  node_kernels["Element kernels"]
end

subgraph group_execution["Analysis and results"]
  node_analysis["Analysis base<br/>[base.py]"]
  node_static["Static analysis<br/>[static.py]"]
  node_transient["Transient analysis<br/>[transient.py]"]
  node_modal["Modal analysis<br/>[modal.py]"]
  node_buckling["Buckling analysis<br/>[buckling.py]"]
  node_assembly["Global assembly<br/>[assembler.py]"]
  node_solver["Linear solver<br/>[linear.py]"]
  node_recovery["Field recovery<br/>[recovery.py]"]
  node_output["Result output<br/>[export.py]"]
end

node_engineer(("Engineer"))

node_engineer -->|"defines model"| node_model
node_static -->|"builds elements"| node_elements
node_static -->|"assembles system"| node_assembly
node_static -->|"partitions DOFs"| node_constraints
node_static -->|"solves system"| node_solver
node_mesh -->|"resolves regions"| node_constraints
node_dofs -->|"maps DOFs"| node_constraints
node_recovery -->|"queries response"| node_elements
node_recovery -->|"uses constitutive law"| node_theories

click node_mesh "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/mesh/mesh.py"
click node_model "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/core/model.py"
click node_dofs "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/core/dof_handler.py"
click node_constraints "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/constraints/handler.py"
click node_materials "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/materials/material.py"
click node_geometry "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/geometry/base.py"
click node_numerics "https://github.com/this-is-kb/nanofem/tree/main/src/nanofem/numerics"
click node_reference "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/reference/element.py"
click node_quadrature "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/quadrature/rules.py"
click node_interpolation "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/interpolation/shape_functions.py"
click node_mapping "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/mapping/base.py"
click node_theories "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/physics/base.py"
click node_elements "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/elements/factory.py"
click node_kernels "https://github.com/this-is-kb/nanofem/tree/main/src/nanofem/kernels"
click node_analysis "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/base.py"
click node_static "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/static.py"
click node_transient "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/transient.py"
click node_modal "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/modal.py"
click node_buckling "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/buckling.py"
click node_assembly "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/assembly/assembler.py"
click node_solver "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/linalg/linear.py"
click node_recovery "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/postprocess/recovery.py"
click node_output "https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/postprocess/export.py"

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_mesh,node_model,node_dofs,node_constraints,node_materials,node_geometry toneBlue
class node_numerics,node_reference,node_quadrature,node_interpolation,node_mapping toneAmber
class node_theories,node_elements,node_kernels toneMint
class node_analysis,node_static,node_transient,node_modal,node_buckling,node_assembly,node_solver,node_recovery,node_output toneRose
class node_engineer toneIndigo
```

## Components

### Model definition

- [Mesh topology](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/mesh/mesh.py): `src/nanofem/mesh/mesh.py`
- [Model](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/core/model.py): `src/nanofem/core/model.py`
- [DOF numbering](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/core/dof_handler.py): `src/nanofem/core/dof_handler.py`
- [Constraints](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/constraints/handler.py): `src/nanofem/constraints/handler.py`
- [Materials](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/materials/material.py): `src/nanofem/materials/material.py`
- [Geometry](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/geometry/base.py): `src/nanofem/geometry/base.py`

### Numerical foundations

- [Numerical toolkit](https://github.com/this-is-kb/nanofem/tree/main/src/nanofem/numerics): `src/nanofem/numerics`
- [Reference cells](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/reference/element.py): `src/nanofem/numerics/reference/element.py`
- [Quadrature rules](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/quadrature/rules.py): `src/nanofem/numerics/quadrature/rules.py`
- [Shape functions](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/interpolation/shape_functions.py): `src/nanofem/numerics/interpolation/shape_functions.py`
- [Geometric mapping](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/mapping/base.py): `src/nanofem/numerics/mapping/base.py`

### Physics and elements

- [Physical theories](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/physics/base.py): `src/nanofem/physics/base.py`
- [Element factory](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/elements/factory.py): `src/nanofem/elements/factory.py`
- [Element kernels](https://github.com/this-is-kb/nanofem/tree/main/src/nanofem/kernels): `src/nanofem/kernels`

### Analysis and results

- [Analysis base](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/base.py): `src/nanofem/analysis/base.py`
- [Static analysis](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/static.py): `src/nanofem/analysis/static.py`
- [Transient analysis](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/transient.py): `src/nanofem/analysis/transient.py`
- [Modal analysis](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/modal.py): `src/nanofem/analysis/modal.py`
- [Buckling analysis](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/analysis/buckling.py): `src/nanofem/analysis/buckling.py`
- [Global assembly](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/assembly/assembler.py): `src/nanofem/numerics/assembly/assembler.py`
- [Linear solver](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/numerics/linalg/linear.py): `src/nanofem/numerics/linalg/linear.py`
- [Field recovery](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/postprocess/recovery.py): `src/nanofem/postprocess/recovery.py`
- [Result output](https://github.com/this-is-kb/nanofem/blob/main/src/nanofem/postprocess/export.py): `src/nanofem/postprocess/export.py`

### Other components

- **Engineer**

## Connections

- Engineer → Model: defines model
- Static analysis → Element factory: builds elements
- Static analysis → Global assembly: assembles system
- Static analysis → Constraints: partitions DOFs
- Static analysis → Linear solver: solves system
- Mesh topology → Constraints: resolves regions
- DOF numbering → Constraints: maps DOFs
- Field recovery → Element factory: queries response
- Field recovery → Physical theories: uses constitutive law
