# stokesianpynamics/stokesmfs architecture

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

- Interactive diagram: https://gitdiagram.com/stokesianpynamics/stokesmfs
- Repository: https://github.com/stokesianpynamics/stokesmfs

## Overview

StokesMFS is a Python solver for three-dimensional Stokes flow around discretized particles, using the Method of Fundamental Solutions. The principal workflow supplies boundary nodes and interior sites, builds the linear system and boundary-velocity vector, solves for site forces, then uses the result for force/torque calculations or flow visualization. Examples also demonstrate resistance and conditioning studies and particle motion. The examples excerpt is partial, so links for unsampled example details are limited to capabilities documented in the README.

Main entry points: [`examples.py`](https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py) (Example runner), [`pythonMFS.py`](https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py) (Oseen matrix)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_geometry["Particle geometry"]
  node_sphere["Sphere points<br/>[pythonMFS.py]"]
  node_spheroid["Spheroid points<br/>[pythonMFS.py]"]
  node_sites["Interior sites<br/>[pythonMFS.py]"]
end

subgraph group_solver["MFS solver"]
  node_matrix["Oseen matrix<br/>[pythonMFS.py]"]
  node_rhs["Boundary velocities<br/>[pythonMFS.py]"]
  node_force["Site forces<br/>[pythonMFS.py]"]
  node_torque["Force and torque<br/>[pythonMFS.py]"]
end

subgraph group_workflows["Analysis workflows"]
  node_examples["Example runner<br/>[examples.py]"]
  node_flow["Flow evaluation<br/>[examples.py]"]
  node_visualization["Flow plots<br/>[examples.py]"]
  node_resistance["Resistance study<br/>[examples.py]"]
  node_numerics["Numerics study<br/>[examples.py]"]
  node_motion["Particle motion<br/>[examples.py]"]
end

node_user(("Engineer"))
node_numpy["NumPy"]
node_matplotlib["Matplotlib"]

node_user -->|"runs"| node_examples
node_examples -->|"requests points"| node_sphere
node_examples -.->|"requests points"| node_spheroid
node_examples -->|"finds sites"| node_sites
node_examples -->|"builds system"| node_matrix
node_examples -->|"builds conditions"| node_rhs
node_examples -->|"solves forces"| node_force
node_examples -->|"calculates torque"| node_torque
node_matrix -->|"array operations"| node_numpy
node_rhs -->|"array operations"| node_numpy
node_force -->|"pseudoinverse"| node_numpy
node_torque -->|"uses forces"| node_force
node_examples -->|"evaluates velocity"| node_flow
node_flow -->|"builds evaluation matrix"| node_matrix
node_examples -->|"plots results"| node_visualization
node_visualization -->|"renders plots"| node_matplotlib
node_examples -->|"demonstrates"| node_resistance
node_resistance -->|"uses force results"| node_torque
node_examples -->|"demonstrates"| node_numerics
node_examples -->|"demonstrates"| node_motion
node_motion -->|"rebuilds system"| node_matrix
node_motion -->|"solves forces"| node_force

click node_examples "https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py"
click node_sphere "https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py"
click node_spheroid "https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py"
click node_sites "https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py"
click node_matrix "https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py"
click node_rhs "https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py"
click node_force "https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py"
click node_torque "https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py"
click node_flow "https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py"
click node_visualization "https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py"
click node_resistance "https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py"
click node_numerics "https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py"
click node_motion "https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.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_sphere,node_spheroid,node_sites toneBlue
class node_matrix,node_rhs,node_force,node_torque toneAmber
class node_examples,node_flow,node_visualization,node_resistance,node_numerics,node_motion toneMint
class node_user,node_numpy,node_matplotlib toneIndigo
```

## Components

### Particle geometry

- [Sphere points](https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py): `pythonMFS.py`
- [Spheroid points](https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py): `pythonMFS.py`
- [Interior sites](https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py): `pythonMFS.py`

### MFS solver

- [Oseen matrix](https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py): `pythonMFS.py`
- [Boundary velocities](https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py): `pythonMFS.py`
- [Site forces](https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py): `pythonMFS.py`
- [Force and torque](https://github.com/stokesianpynamics/stokesmfs/blob/main/pythonMFS.py): `pythonMFS.py`

### Analysis workflows

- [Example runner](https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py): `examples.py`
- [Flow evaluation](https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py): `examples.py`
- [Flow plots](https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py): `examples.py`
- [Resistance study](https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py): `examples.py`
- [Numerics study](https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py): `examples.py`
- [Particle motion](https://github.com/stokesianpynamics/stokesmfs/blob/main/examples.py): `examples.py`

### Other components

- **Engineer**
- **NumPy**
- **Matplotlib**

## Connections

- Engineer → Example runner: runs
- Example runner → Sphere points: requests points
- Example runner → Spheroid points: requests points
- Example runner → Interior sites: finds sites
- Example runner → Oseen matrix: builds system
- Example runner → Boundary velocities: builds conditions
- Example runner → Site forces: solves forces
- Example runner → Force and torque: calculates torque
- Oseen matrix → NumPy: array operations
- Boundary velocities → NumPy: array operations
- Site forces → NumPy: pseudoinverse
- Force and torque → Site forces: uses forces
- Example runner → Flow evaluation: evaluates velocity
- Flow evaluation → Oseen matrix: builds evaluation matrix
- Example runner → Flow plots: plots results
- Flow plots → Matplotlib: renders plots
- Example runner → Resistance study: demonstrates
- Resistance study → Force and torque: uses force results
- Example runner → Numerics study: demonstrates
- Example runner → Particle motion: demonstrates
- Particle motion → Oseen matrix: rebuilds system
- Particle motion → Site forces: solves forces
