Skip to content

Architecture

System key: surface plant blue, wells purple, reservoir red, economics teal

TANGO is one Python package, src/tango_core/, built in layers. A user writes a YAML config and starts a run; everything below that line is validated code. Each layer imports only the layers beneath it, with one exception: core/specs.py uses the well-pattern helper from components/reservoir/. The third-party engines run in-process: TESPy is called from components/surface/, CoolProp from core/ (fluid properties).

%%{init: {"theme":"base","themeVariables":{"primaryColor":"#FFFFFF","primaryTextColor":"#202124","primaryBorderColor":"#DADCE0","lineColor":"#5F6368","secondaryColor":"#F8F9FA","tertiaryColor":"#F8F9FA","clusterBkg":"#F8F9FA","clusterBorder":"#DADCE0","edgeLabelBackground":"#FFFFFF"},"flowchart":{"curve":"basis","nodeSpacing":40,"rankSpacing":64,"useMaxWidth":true}} }%%
flowchart TB
  user("User<br/>config.yml, starts a run")
  subgraph pkg ["src/tango_core"]
    cli("tango_core<br/>run · validate")
    pymoo("pymoo_api<br/>NSGA-II")
    wf("workflows<br/>Workflow")
    orchs("orchestrators<br/>timestep loop")
    reg("registry<br/>(type, variant)")
    comps("components<br/>well · reservoir<br/>surface · economic")
    core("core<br/>Component · Stream<br/>schemas · errors")
  end
  ext("TESPy · CoolProp")

  user --> cli
  user --> pymoo
  cli --> wf
  pymoo --> wf
  wf --> orchs
  wf --> reg
  reg --> comps
  orchs --> core
  comps --> core
  comps --> ext

  class cli,wf,orchs code
  class pymoo code
  class reg,comps code
  class core code
  class ext code
  class user human
  classDef well  fill:#F3EDF9,stroke:#7D4FB0,color:#7D4FB0,font-size:15px
  classDef res   fill:#FBEAE7,stroke:#D2402C,color:#D2402C,font-size:15px
  classDef surf  fill:#E8F0FA,stroke:#2F6FBF,color:#2F6FBF,font-size:15px
  classDef econ  fill:#E0F2F1,stroke:#007B83,color:#007B83,font-size:15px
  classDef code  fill:#FFFFFF,stroke:#DADCE0,color:#202124,font-size:15px
  classDef err   fill:#FCE8E6,stroke:#D93025,color:#D93025,font-size:15px
  classDef out   fill:#FFFFFF,stroke:#9AA0A6,color:#5F6368,stroke-dasharray:4 3,font-size:15px
  classDef human fill:#202124,stroke:#9AA0A6,color:#FFFFFF,font-size:15px

Where is what

Layer Path Holds
Entry points src/tango_core/cli.py tango_core run, validate, init
src/tango_core/pymoo_api.py NSGA-II optimization over full runs
src/tango_core/results_export.py write_results: YAML plus CSV files
Workflow src/tango_core/workflows/ Workflow: config in, orchestrator out
Orchestration src/tango_core/orchestrators/ SystemDirect, SystemBCIteration
Components src/tango_core/components/ wells, reservoir, surface plant, economics, COMPONENT_REGISTRY
Core src/tango_core/core/ Component, Stream, LockedState, specs, policies, errors, numerics

Around the package:

Path Role
templates/ The maintained configs; each backs a test or an application
applications/ Multi-run pipelines (sweeps, optimizations) built on those configs
tests/ unit/ and regtest/

Next: how a config becomes objects and what flows between components. For how a run iterates, see Runtime.