Post · 2 min read· pp. 31–32

4.2.1. Glue Code Overview

The OpenFAST glue code is the software layer that connects individual physics modules (ElastoDyn, AeroDyn, HydroDyn, ServoDyn, etc.) into a coupled simulation. It lives primarily in modules/openfast-library/src/ and relies on the ModVar module in modules/nwtc-library/src/ModVar.f90 for an abstract description of every variable exchanged between modules.

High-level responsibilities include:

  • Initialising each module and registering its variables with the glue code
  • Managing multi-rate sub-stepping (modules whose time step is a divisor of the global time step)
  • Mapping outputs of one module to inputs of another (motion meshes, load meshes, and scalar variables)
  • Running the time-stepping loop under either loose coupling or tight generalized-alpha coupling
  • Linearising the assembled system to produce state-space matrices

4.2.1.1. Source files

FilePurpose
FAST_Subs.f90Top-level initialisation: reads input file, calls each module’s _Init, and calls MV_AddModule to register every module with the glue code.
FAST_ModGlue.f90Combines per-module variable descriptions into a monolithic ModGlueType structure via ModGlue_CombineModules; performs linearization (ModGlue_Linearize_OP) and steady-state trimming (ModGlue_CalcSteady).
FAST_Solver.f90Implements the generalized-alpha tight-coupling solver (FAST_SolverStep), the input-output convergence loop (FAST_CalcOutputsAndSolveForInputs), and Jacobian assembly.
FAST_Mapping.f90Mesh-to-mesh and variable-to-variable transfer mappings.
FAST_Funcs.f90Wrappers around module-level CalcOutput, UpdateStates, CalcContStateDeriv, GetOperatingPoint, and SetOperatingPoint that dispatch to the correct module instance.
ModVar.f90 (nwtc-library)The ModVar module: data structures (ModVarType, ModVarsType, ModDataType, DatLoc) and all MV_* subroutines.

4.2.1.2. Module coupling categories

Each module is assigned to exactly one coupling category during initialisation in FAST_SolverInit:

CategoryFlagDescription
Tight Coupling (TC)MC_TightStates and accelerations are solved simultaneously via the generalized-alpha Newton iteration. ElastoDyn, BeamDyn, and SubDyn are tight-coupling modules when ModCoupling ≥ 2.
Option 1MC_Option1Modules whose inputs depend on TC outputs and are converged in the same Newton loop (e.g. HydroDyn, MoorDyn, ServoDyn with structural controllers).
Option 2MC_Option2Loosely coupled modules that are called once per step before the convergence loop (InflowWind, SeaState, AeroDyn, etc.).
PostMC_PostModules whose input solve is deferred until after the convergence loop (ServoDyn, ExternalInflow).

4.2.1.3. Time-stepping loop (overview)

Each call to FAST_SolverStep follows this sequence:

  1. Correction iterations (outer loop) – at most p%MaxConvIter iterations.
  2. Option 2 – input solve + state update + CalcOutput for loosely coupled modules.
  3. Option 1 – input solve + state update for semi-implicit modules.
  4. TC input solve – gather inputs for the tight-coupling modules.
  5. Convergence iterations (inner loop) – Newton-Raphson updates of TC states and inputs until the update norm falls below ConvTol or the iteration limit is reached.
  6. Post-solve input solves – ServoDyn, ExternalInflow.

Module registration and variable ordering are described in detail in Module Variables (ModVar). How the per-module variables are assembled into global arrays and Jacobian matrices is covered in ModGlue – Combining Modules into Global Arrays. The solver algorithm and Jacobian construction are covered in Solver.