# mtopopt/mto architecture

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

- Interactive diagram: https://gitdiagram.com/mtopopt/mto
- Repository: https://github.com/mtopopt/mto

## Overview

MTO is a parallel, density-based topology-optimization solver built on OpenFOAM for thermal-fluid, solid-mechanical, and coupled thermal-fluid-structural problems. The principal user workflow is to run an optimization case with the selected solver, which iteratively evaluates physical behavior and updates the design; users then reconstruct parallel results for visualization. The tree shows separate solver variants and domain-specific physics, adjoint, boundary-condition, and optimization modules. Internal execution links are mostly unverified because the main solver sources were not excerpted; those links are therefore dashed.

Main entry points: [`new_2022.12.15/MTO_ThermalFluid/src/MTO_ThermalFluid.C`](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/MTO_ThermalFluid.C) (Thermal-fluid solver), [`new_2022.12.15/MTO_ThermalFluidStructural/src/MTO_TFS.C`](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/MTO_TFS.C) (Coupled solver), [`new_2022.12.15/MTO_solid/MTO_SolidDisplacement/MTO_SolidDisplacement.C`](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_solid/MTO_SolidDisplacement/MTO_SolidDisplacement.C) (Solid displacement solver), [`new_2022.12.15/MTO_ThermalFluid/src/sensitivity.H`](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/sensitivity.H) (Sensitivity evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_thermal["Thermal-fluid physics"]
  node_tf_solver["Thermal-fluid solver<br/>[MTO_ThermalFluid.C]"]
  node_fluid_solver["Fluid solver<br/>[MTO_Fluid.C]"]
  node_tf_primal["Primal flow and heat<br/>[Primal_U.H]"]
  node_tf_adjoint["Adjoint equations<br/>[AdjointFlow_Ua.H]"]
  node_tf_cost["Objective function<br/>[costfunction.H]"]
  node_tf_properties["Fluid and heat properties"]
end

subgraph group_structural["Structural physics"]
  node_tfs_solver["Coupled solver<br/>[MTO_TFS.C]"]
  node_tfs_flow["Flow equations<br/>[NS.H]"]
  node_tfs_heat["Heat transfer<br/>[HeatTransfer.H]"]
  node_tfs_elasticity["Linear elasticity<br/>[LinearElasticity.H]"]
  node_solid_solver["Solid displacement solver"]
  node_solid_elasticity["Solid elasticity<br/>[LinearElasticity.H]"]
end

subgraph group_optimization["Design optimization"]
  node_density["Density design<br/>[createFields.H]"]
  node_sensitivity["Sensitivity evaluation<br/>[sensitivity.H]"]
  node_filter["Design filtering<br/>[filter_x.H]"]
  node_mma["MMA optimizer<br/>[MMA.C]"]
  node_update["Design update<br/>[update.H]"]
end

subgraph group_boundaries["Physics boundaries"]
  node_adjoint_bc["Adjoint outlet conditions"]
  node_traction_bc["Traction displacement condition"]
end

node_user(("Case user"))
node_openfoam["OpenFOAM"]
node_results["Reconstructed results"]

node_user -->|"runs case"| node_tf_solver
node_openfoam -.->|"provides runtime"| node_tf_solver
node_tf_solver -.->|"solves primal"| node_tf_primal
node_tf_solver -.->|"solves adjoint"| node_tf_adjoint
node_tf_solver -.->|"evaluates objective"| node_tf_cost
node_tf_solver -.->|"uses design"| node_density
node_tf_solver -.->|"computes sensitivities"| node_sensitivity
node_sensitivity -.->|"filters sensitivities"| node_filter
node_tf_solver -.->|"updates optimization"| node_mma
node_mma -.->|"returns design"| node_update
node_tf_solver -.->|"reads properties"| node_tf_properties
node_tf_solver -.->|"uses boundary condition"| node_adjoint_bc
node_user -.->|"selects variant"| node_fluid_solver
node_user -.->|"selects variant"| node_tfs_solver
node_tfs_solver -.->|"solves flow"| node_tfs_flow
node_tfs_solver -.->|"solves heat"| node_tfs_heat
node_tfs_solver -.->|"solves elasticity"| node_tfs_elasticity
node_user -.->|"selects variant"| node_solid_solver
node_solid_solver -.->|"solves elasticity"| node_solid_elasticity
node_solid_solver -.->|"uses boundary condition"| node_traction_bc
node_user -->|"reconstructs output"| node_results

click node_tf_solver "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/MTO_ThermalFluid.C"
click node_fluid_solver "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_fluid/src/MTO_Fluid.C"
click node_tf_primal "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/Primal_U.H"
click node_tf_adjoint "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/AdjointFlow_Ua.H"
click node_tf_cost "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/costfunction.H"
click node_tf_properties "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/readTransportProperties.H"
click node_tfs_solver "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/MTO_TFS.C"
click node_tfs_flow "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/NS.H"
click node_tfs_heat "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/HeatTransfer.H"
click node_tfs_elasticity "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/LinearElasticity.H"
click node_solid_solver "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_solid/MTO_SolidDisplacement/MTO_SolidDisplacement.C"
click node_solid_elasticity "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_solid/MTO_SolidDisplacement/LinearElasticity.H"
click node_density "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/createFields.H"
click node_sensitivity "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/sensitivity.H"
click node_filter "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/filter_x.H"
click node_mma "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/MMA/MMA.C"
click node_update "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/update.H"
click node_adjoint_bc "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/adjointOutletVelocityPower/adjointOutletVelocityPowerFvPatchVectorField.C"
click node_traction_bc "https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_solid/MTO_SolidDisplacement/tractionDisplacement/tractionDisplacementFvPatchVectorField.C"

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_tf_solver,node_fluid_solver,node_tf_primal,node_tf_adjoint,node_tf_cost,node_tf_properties,node_user toneBlue
class node_tfs_solver,node_tfs_flow,node_tfs_heat,node_tfs_elasticity,node_solid_solver,node_solid_elasticity toneAmber
class node_density,node_sensitivity,node_filter,node_mma,node_update toneMint
class node_adjoint_bc,node_traction_bc toneRose
class node_openfoam,node_results toneIndigo
```

## Components

### Thermal-fluid physics

- [Thermal-fluid solver](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/MTO_ThermalFluid.C): `new_2022.12.15/MTO_ThermalFluid/src/MTO_ThermalFluid.C`
- [Fluid solver](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_fluid/src/MTO_Fluid.C): `new_2022.12.15/MTO_fluid/src/MTO_Fluid.C`
- [Primal flow and heat](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/Primal_U.H): `new_2022.12.15/MTO_ThermalFluid/src/Primal_U.H`
- [Adjoint equations](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/AdjointFlow_Ua.H): `new_2022.12.15/MTO_ThermalFluid/src/AdjointFlow_Ua.H`
- [Objective function](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/costfunction.H): `new_2022.12.15/MTO_ThermalFluid/src/costfunction.H`
- [Fluid and heat properties](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/readTransportProperties.H): `new_2022.12.15/MTO_ThermalFluid/src/readTransportProperties.H`

### Structural physics

- [Coupled solver](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/MTO_TFS.C): `new_2022.12.15/MTO_ThermalFluidStructural/src/MTO_TFS.C`
- [Flow equations](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/NS.H): `new_2022.12.15/MTO_ThermalFluidStructural/src/NS.H`
- [Heat transfer](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/HeatTransfer.H): `new_2022.12.15/MTO_ThermalFluidStructural/src/HeatTransfer.H`
- [Linear elasticity](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluidStructural/src/LinearElasticity.H): `new_2022.12.15/MTO_ThermalFluidStructural/src/LinearElasticity.H`
- [Solid displacement solver](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_solid/MTO_SolidDisplacement/MTO_SolidDisplacement.C): `new_2022.12.15/MTO_solid/MTO_SolidDisplacement/MTO_SolidDisplacement.C`
- [Solid elasticity](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_solid/MTO_SolidDisplacement/LinearElasticity.H): `new_2022.12.15/MTO_solid/MTO_SolidDisplacement/LinearElasticity.H`

### Design optimization

- [Density design](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/createFields.H): `new_2022.12.15/MTO_ThermalFluid/src/createFields.H`
- [Sensitivity evaluation](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/sensitivity.H): `new_2022.12.15/MTO_ThermalFluid/src/sensitivity.H`
- [Design filtering](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/filter_x.H): `new_2022.12.15/MTO_ThermalFluid/src/filter_x.H`
- [MMA optimizer](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/MMA/MMA.C): `new_2022.12.15/MTO_ThermalFluid/src/MMA/MMA.C`
- [Design update](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/update.H): `new_2022.12.15/MTO_ThermalFluid/src/update.H`

### Physics boundaries

- [Adjoint outlet conditions](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_ThermalFluid/src/adjointOutletVelocityPower/adjointOutletVelocityPowerFvPatchVectorField.C): `new_2022.12.15/MTO_ThermalFluid/src/adjointOutletVelocityPower/adjointOutletVelocityPowerFvPatchVectorField.C`
- [Traction displacement condition](https://github.com/mtopopt/mto/blob/master/new_2022.12.15/MTO_solid/MTO_SolidDisplacement/tractionDisplacement/tractionDisplacementFvPatchVectorField.C): `new_2022.12.15/MTO_solid/MTO_SolidDisplacement/tractionDisplacement/tractionDisplacementFvPatchVectorField.C`

### Other components

- **Case user**
- **OpenFOAM**
- **Reconstructed results**

## Connections

- Case user → Thermal-fluid solver: runs case
- OpenFOAM → Thermal-fluid solver: provides runtime
- Thermal-fluid solver → Primal flow and heat: solves primal
- Thermal-fluid solver → Adjoint equations: solves adjoint
- Thermal-fluid solver → Objective function: evaluates objective
- Thermal-fluid solver → Density design: uses design
- Thermal-fluid solver → Sensitivity evaluation: computes sensitivities
- Sensitivity evaluation → Design filtering: filters sensitivities
- Thermal-fluid solver → MMA optimizer: updates optimization
- MMA optimizer → Design update: returns design
- Thermal-fluid solver → Fluid and heat properties: reads properties
- Thermal-fluid solver → Adjoint outlet conditions: uses boundary condition
- Case user → Fluid solver: selects variant
- Case user → Coupled solver: selects variant
- Coupled solver → Flow equations: solves flow
- Coupled solver → Heat transfer: solves heat
- Coupled solver → Linear elasticity: solves elasticity
- Case user → Solid displacement solver: selects variant
- Solid displacement solver → Solid elasticity: solves elasticity
- Solid displacement solver → Traction displacement condition: uses boundary condition
- Case user → Reconstructed results: reconstructs output
