# ansys/pyansys-workflows architecture

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

- Interactive diagram: https://gitdiagram.com/ansys/pyansys-workflows
- Repository: https://github.com/ansys/pyansys-workflows

## Overview

##### Project type and purpose
- This is an open-source repository of example workflows, written in Python, that demonstrate how to use the PyAnsys ecosystem libraries to automate different parts of an Ansys simulation pipeline (geometry creation, meshing, solver setup, post-processing).
- Its goal is to guide users through four multiphysics workflows, each in its own folder, showing best practices for scripting and integration with various Ansys products (SpaceClaim/Discovery/Geometry Service, Fluent Meshing, Fluent Solver, Mechanical, DPF).

##### File structure
- Top-level workflow directories:
- geometry-mesh
- geometry-mesh-fluent
- geometry-mechanical-dpf
- fluent-mechanical
- Each workflow folder contains:
- requirements_X.Y.txt (version-specific dependencies)
- one Python script per stage: e.g., wf_*_01_geometry.py, wf_*_02_mesh.py, wf_*_03_solver.py, wf_*_04_post.py
- Supporting files:
- pyproject.toml (project metadata)
- CI/CD and docs under .github and doc/
- Templates for contribution, code style, testing

##### README for additional insights
- The README outlines the four workflows, the sequence of scripts to run, the Ansys products involved at each stage, and how to select the proper requirements file based on Ansys version.
- It also describes how the scripts generate outputs in a consistent outputs/ folder.

##### Main components
a. Workflow Orchestrator (Python scripts)
– wf_*_01_geometry.py
– wf_*_02_mesh.py
– wf_*_03_solver.py
– wf_*_04_post.py
b. PyAnsys Libraries
– pyansys.spaceclaim or geometry_service API
– pyansys.mesh or fluent_meshing API
– pyansys.fluent or fluent_solver API
– pyansys.mechanical API
– pyansys.dpf.core (post-processing)
c. External Services / Applications
– Ansys SpaceClaim / Discovery / Geometry Service
– Ansys Fluent Meshing Server / PRIME Server
– Ansys Fluent Solver
– Ansys Mechanical
– Ansys Data Processing Framework (DPF)
d. Environment & Configuration
– Virtual environment (.venv)
– requirements files for Ansys versions 24.1, 24.2, 25.1
e. Artifacts & Data Flow
– CAD geometry files (e.g., .stp, .pmdb)
– Mesh files (e.g., .msh)
– Solver setup and results
– Post-processed data or visualization plots
f. CI/CD & Documentation
– GitHub Actions pipelines for testing each workflow against supported Ansys versions
– Sphinx-based documentation under doc/source

##### Relationships and interactions
- The virtual environment and requirements file control which version of PyAnsys and underlying Ansys installation is targeted.

##### Architectural patterns and design principles
- Modular “pipeline” pattern: discrete, single-responsibility scripts chained together.
- Layered architecture:
- Presentation/Orchestration (scripts)
- Domain services (PyAnsys libraries)
- Third-party integrations (Ansys products)
- Dependency injection via requirements files to handle multiple Ansys versions.
- Convention-over-configuration: each workflow follows the same file naming and folder structure for predictability.

##### Key details not to miss
- The version selection mechanism via different requirements files. Represent this as a decision point before environment setup.
- The identical structure repeated across four workflow modules—group them into parallel lanes.
- The outputs folder convention: each script writes to outputs/, feeding the next script.
- CI/CD automation as an orthogonal process validating each workflow.

- Captures each major component and its role
- Shows how Python scripts orchestrate PyAnsys libraries and Ansys products
- Makes the repeated pipeline pattern of the workflows immediately clear
- Highlights configuration choices (Ansys versions) and CI/CD validation
- Provides a clear roadmap for contributors to add new workflows in the same architecture

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Configuration and Environment
    subgraph "Version Selection" 
        direction TB
        Config["Select requirements_X.Y.txt"]:::config
        Config -->|determines| Env["Virtual Environment (.venv)"]:::config
    end

    %% Swimlane: Geometry-Mesh
    subgraph "geometry-mesh Workflow" 
        direction TB
        GM01["wf_gm_01_geometry.py"]:::orchestration
        GM02["wf_gm_02_mesh.py"]:::orchestration
        GM01 -->|"calls pyansys.spaceclaim"| LibGMSpace["pyansys.spaceclaim"]:::libraries
        LibGMSpace -->|"invokes SpaceClaim API"| ExtGMSpace["Ansys SpaceClaim/Geometry Service"]:::external
        ExtGMSpace -->|"outputs .stp/.pmdb"| DataGMGeom["Geometry Files"]:::data
        DataGMGeom --> GM02
        GM02 -->|"calls pyansys.mesh"| LibGMMesh["pyansys.mesh"]:::libraries
        LibGMMesh -->|"invokes Fluent Meshing"| ExtGMMesh["Ansys Fluent Meshing Server"]:::external
        ExtGMMesh -->|"outputs .msh"| DataGMMesh["Mesh Files"]:::data
    end

    %% Swimlane: Geometry-Mesh-Fluent
    subgraph "geometry-mesh-fluent Workflow"
        direction TB
        GMF01["wf_gmf_01_geometry.py"]:::orchestration
        GMF02["wf_gmf_02_fluent_meshing.py"]:::orchestration
        GMF03["wf_gmf_03_fluent_solver.py"]:::orchestration
        GMF01 -->|"pyansys.geometry_service"| LibGMFGeom["pyansys.geometry_service"]:::libraries
        LibGMFGeom -->|"SpaceClaim API"| ExtGMFGeom["Ansys SpaceClaim/Geometry Service"]:::external
        ExtGMFGeom -->|"Geometry Files"| DataGMFGeom[".stp/.pmdb"]:::data
        DataGMFGeom --> GMF02
        GMF02 -->|"pyansys.fluid_meshing"| LibGMFMesh["pyansys.fluent.meshing"]:::libraries
        LibGMFMesh -->|"Fluent Meshing API"| ExtGMFMesh["Ansys Fluent Meshing Server"]:::external
        ExtGMFMesh -->|"Mesh Files"| DataGMFMesh[".msh"]:::data
        DataGMFMesh --> GMF03
        GMF03 -->|"pyansys.fluent"| LibGMFSolv["pyansys.fluent"]:::libraries
        LibGMFSolv -->|"Fluent Solver API"| ExtGMFSolv["Ansys Fluent Solver"]:::external
        ExtGMFSolv -->|"Results Files"| DataGMFRes["Solver Results"]:::data
    end

    %% Swimlane: Geometry-Mechanical-DPF
    subgraph "geometry-mechanical-dpf Workflow"
        direction TB
        GMD01["wf_gmd_01_geometry.py"]:::orchestration
        GMD02["wf_gmd_02_mechanical.py"]:::orchestration
        GMD03["wf_gmd_03_dpf.py"]:::orchestration
        GMD01 -->|"pyansys.spaceclaim"| LibGMDGeom["pyansys.spaceclaim"]:::libraries
        LibGMDGeom -->|"SpaceClaim API"| ExtGMDGeom["Ansys SpaceClaim/Geometry Service"]:::external
        ExtGMDGeom -->|"Geometry Files"| DataGMDGeom[".stp/.pmdb"]:::data
        DataGMDGeom --> GMD02
        GMD02 -->|"pyansys.mechanical"| LibGMDMech["pyansys.mechanical"]:::libraries
        LibGMDMech -->|"Mechanical API"| ExtGMDMech["Ansys Mechanical"]:::external
        ExtGMDMech -->|"Results Database"| DataGMDMech[".rth/.rst"]:::data
        DataGMDMech --> GMD03
        GMD03 -->|"pyansys.dpf.core"| LibGMDDPF["pyansys.dpf.core"]:::libraries
        LibGMDDPF -->|"DPF Processing"| ExtGMDDPF["Ansys DPF"]:::external
        ExtGMDDPF -->|"Post Data"| DataGMDDPF["Post-Processed Data"]:::data
    end

    %% Swimlane: Fluent-Mechanical
    subgraph "fluent-mechanical Workflow"
        direction TB
        FM01["wf_fm_01_fluent.py"]:::orchestration
        FM02["wf_fm_02_mechanical.py"]:::orchestration
        FM01 -->|"pyansys.fluent"| LibFMFluent["pyansys.fluent"]:::libraries
        LibFMFluent -->|"Fluent Solver API"| ExtFMFluent["Ansys Fluent Solver"]:::external
        ExtFMFluent -->|"Results Files"| DataFMFluent["Solver Results"]:::data
        DataFMFluent --> FM02
        FM02 -->|"pyansys.mechanical"| LibFMMech["pyansys.mechanical"]:::libraries
        LibFMMech -->|"Mechanical API"| ExtFMMech["Ansys Mechanical"]:::external
        ExtFMMech -->|"Results Database"| DataFMMech[".rth/.rst"]:::data
    end

    %% CI/CD and Documentation
    subgraph "CI/CD & Docs"
        direction TB
        CICD["GitHub Actions Pipelines"]:::ci
        Docs["Sphinx Documentation"]:::doc
        CICD -->|"validates workflows"| GM01
    end

    %% Click Events for Scripts
    click GM01 "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh/wf_gm_01_geometry.py"
    click GM02 "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh/wf_gm_02_mesh.py"
    click GMF01 "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh-fluent/wf_gmf_01_geometry.py"
    click GMF02 "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh-fluent/wf_gmf_02_fluent_meshing.py"
    click GMF03 "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh-fluent/wf_gmf_03_fluent_solver.py"
    click GMD01 "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mechanical-dpf/wf_gmd_01_geometry.py"
    click GMD02 "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mechanical-dpf/wf_gmd_02_mechanical.py"
    click GMD03 "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mechanical-dpf/wf_gmd_03_dpf.py"
    click FM01 "https://github.com/ansys/pyansys-workflows/blob/main/fluent-mechanical/wf_fm_01_fluent.py"
    click FM02 "https://github.com/ansys/pyansys-workflows/blob/main/fluent-mechanical/wf_fm_02_mechanical.py"

    %% Click Events for Requirements
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh/requirements_24.1.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh/requirements_24.2.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh/requirements_25.1.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh-fluent/requirements_24.1.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh-fluent/requirements_24.2.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mesh-fluent/requirements_25.1.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mechanical-dpf/requirements_24.1.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mechanical-dpf/requirements_24.2.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/geometry-mechanical-dpf/requirements_25.1.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/fluent-mechanical/requirements_24.1.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/fluent-mechanical/requirements_24.2.txt"
    click Config "https://github.com/ansys/pyansys-workflows/blob/main/fluent-mechanical/requirements_25.1.txt"

    %% Click Events for CI/CD
    click CICD "https://github.com/ansys/pyansys-workflows/blob/main/.github/workflows/ci_cd.yml"
    click CICD "https://github.com/ansys/pyansys-workflows/blob/main/.github/workflows/docs.yml"
    click CICD "https://github.com/ansys/pyansys-workflows/blob/main/.github/workflows/geometry-mesh.yml"
    click CICD "https://github.com/ansys/pyansys-workflows/blob/main/.github/workflows/geometry-mesh-fluent.yml"
    click CICD "https://github.com/ansys/pyansys-workflows/blob/main/.github/workflows/geometry-mechanical-dpf.yml"
    click CICD "https://github.com/ansys/pyansys-workflows/blob/main/.github/workflows/fluent-mechanical.yml"

    %% Click Events for Docs & Metadata
    click Docs "https://github.com/ansys/pyansys-workflows/tree/main/doc/source"
    click Docs "https://github.com/ansys/pyansys-workflows/blob/main/README.md"
    click Docs "https://github.com/ansys/pyansys-workflows/blob/main/pyproject.toml"
    click Docs "https://github.com/ansys/pyansys-workflows/tree/main/doc/Makefile"
    click Docs "https://github.com/ansys/pyansys-workflows/blob/main/doc/requirements.txt"

    %% Styles
    classDef orchestration fill:#D6EAF8,stroke:#2980B9,stroke-width:1px
    classDef libraries fill:#D5F5E3,stroke:#27AE60,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#FAD7A0,stroke:#CA6F1E,stroke-width:1px
    classDef data fill:#EBEBEB,stroke:#7F8C8D,stroke-width:1px,stroke-dasharray: 2 2
    classDef config fill:#F5B7B1,stroke:#C0392B,stroke-width:1px
    classDef ci fill:#D2B4DE,stroke:#884EA0,stroke-width:1px
    classDef doc fill:#AED6F1,stroke:#2471A3,stroke-width:1px
```
