Skip to content
Preview.su2@modelscript/cfd 8 diagnostic rules
Parser WASM GLR
Diagnostics 8 rules
DAE Arena Lowering
Simulation Native Solvers
Projections Modelica
Live ExampleTransonicNACA0012.su2

SU2 Transonic Compressible Airfoil Euler/RANS Deck

Compressible flow solver deck and boundary marker specification for a NACA 0012 airfoil at Mach 0.80 and 1.25 deg angle of attack.

Playground
Source (15 lines)
1% SU2 Transonic Compressible Flow Configuration
2SOLVER= EULER
3MATH_PROBLEM= DIRECT
4MACH_NUMBER= 0.80
5AOA= 1.25
6FREESTREAM_PRESSURE= 101325.0
7FREESTREAM_TEMPERATURE= 288.15
8REF_AREA= 1.0
9REF_LENGTH= 1.0
10MARKER_EULER= ( airfoil )
11MARKER_FAR= ( farfield )
12CONV_NUM_METHOD_FLOW= ROE
13TIME_DISCRE_FLOW= EULER_IMPLICIT
14ITER= 500
15MESH_FILENAME= mesh_NACA0012_transonic.su2
Unstructured Airfoil Mesh & Mach Number Field
NACA 0012 TRANSONIC MACH FIELD & UNSTRUCTURED O-GRID (M = 0.80, α = 1.25°) Shock (M = 1.32 → 0.78) MARKER_EULER (airfoil) SU2 SOLVER DECK Freestream Mach 0.80 Angle of Attack α 1.25° Convective Flux ROE Upwind Lift Coeff (C_L) 0.348 Drag Coeff (C_D) 0.0224 Peak Local Mach 1.32
Drag to pan · Click % to reset

CFD (SU2 & OpenFOAM) ​

@modelscript/cfd (languages/cfd) provides native WebAssembly GLR parsing, parametric configuration materialization, 3D CAD boundary marker synthesis, aerodynamic flow regime analysis, and cross-domain TGG synchronization for Computational Fluid Dynamics solver configurations.


Supported Extensions & Dialects ​

ExtensionDialectDescription
.cfg, .su2SU2 ConfigurationNative Stanford University Unstructured (SU2_CFD) key-value & marker configuration
.cfgtParametric CFD TemplateSU2 or OpenFOAM template supporting {{ expr }} parameter expressions
.cfdOpenFOAM / Native CFDOpenFOAM dictionary syntax (FoamFile, dimensions, internalField, boundaryField) and SU2 directives

Parametric Template Materialization ({{ expr }}) ​

CFD templates (.cfgt, .cfg, .cfd) can embed mathematical expressions in {{ ... }} blocks bound to SysML v2 or Modelica workspace parameters:

ini
SOLVER= RANS
KIND_TURB_MODEL= SST
MACH_NUMBER= {{ cruise_speed / sqrt(1.4 * 287.05 * ambient_temp) }}
AOA= {{ angle_of_attack_deg }}
REYNOLDS_NUMBER= {{ rho_air * cruise_speed * chord_length / mu_air }}
MARKER_HEATFLUX= ( battery_plate, {{ heat_dissipation_watts / plate_area }} )

materializeCfdConfig(templateText, parameters) (languages/cfd/src/materializer.ts) evaluates each expression via evaluateCfdExpression, supporting arithmetic operators (+, -, *, /, ^), built-in math functions (sin, cos, tan, sqrt, abs, min, max, log, exp), and constants (PI, E).


3D CAD Boundary Condition Synthesis ​

When a user assigns a fluid or thermal boundary condition to a 3D CAD face in the viewport, synthesizeCfdBoundary and applyBoundaryActionToConfig (languages/cfd/src/boundary-synthesizer.ts) synthesize and merge the appropriate directives for either SU2 or OpenFOAM:

Boundary ConditionSU2 Directive (.cfg / .su2)OpenFOAM boundaryField Entry (.cfd)
Velocity / Total Inlet (inlet)MARKER_INLET= ( <face>, <T_total>, <P_total>, <nx>, <ny>, <nz> )type fixedValue; value uniform (<vx> <vy> <vz>);
Pressure Outlet (outlet)MARKER_OUTLET= ( <face>, <back_pressure_Pa> )type fixedValue; value uniform <pressure>;
Adiabatic / Heat-Flux Wall (wall)MARKER_HEATFLUX= ( <face>, <heat_flux_W_m2> )type noSlip; / type fixedGradient; gradient uniform <q>;
Isothermal Wall (isothermal)MARKER_ISOTHERMAL= ( <face>, <temp_K> )type fixedValue; value uniform <temp_K>;
Far-Field (farfield)MARKER_FAR= ( <face> )type freestream;
Symmetry Plane (symmetry)MARKER_SYM= ( <face> )type symmetryPlane;

Aerodynamic Theory Slicing & Flow Regime Analysis ​

extractCfdSlicingProperties(text) (languages/cfd/src/language.ts) extracts aerodynamic coefficients directly from the CST:

  • cd: Drag coefficient (DRAG_COEFF, CD, or C_D, default 0.3)
  • refArea: Reference wetted/frontal area (REF_AREA, default 1.0 m2)
  • density: Freestream fluid density (FREESTREAM_DENSITY or RHO, default 1.225 kg/m3)
  • freeStreamVelocity: Freestream velocity (FREESTREAM_VELOCITY, default 30.0 m/s)

These properties feed directly into Modelica 1D aerodynamic drag models (Fd=12ρv2CdAref), SysML v2 performance requirements, and the Multi-Domain Theory Coordinator (CaeContractOracle).


Polyglot TGG Rules ​

@modelscript/cfd registers 6 bidirectional Triple Graph Grammar (TGG) rules in languages/cfd/src/language.ts:

Rule NameSource (cfd)Target LanguageTarget Construct
CfdDragPolarToModelicaParamCfdConfig (cd, refArea)modelicaComponentClause (parameter Real Cd, A_ref)
CfdDragPolarToSysmlAttributeCfdConfig (cd, refArea)sysml2AttributeUsage
CfdInletToModelicaFluidPortDirective (MARKER_INLET)modelicaComponentClause (Modelica.Fluid.Interfaces.FluidPort_a)
CfdHeatFluxToModelicaHeatPortDirective (MARKER_HEATFLUX)modelicaComponentClause (Modelica.Thermal.HeatTransfer.Interfaces.HeatPort_a)
CfdMarkerToSysmlPortDirective (MARKER_*)sysml2PortUsage
CfdDirectiveToSysmlConstraintDirective (MACH_NUMBER, REYNOLDS_NUMBER)sysml2ConstraintUsage

Command Line Interface (msx cfd) ​

bash
msx cfd <action> [files...] [options]
ActionDescriptionKey Options
lintValidates SU2 and OpenFOAM configuration syntax, boundary markers, and thermodynamic consistency.—
summaryPrints turbulence model, freestream conditions, reference areas, and configured markers.—
inspectDumps parsed marker tree, solver settings, and evaluated parametric expressions.—
to-modelicaGenerates Modelica 1D aerodynamic drag models (Modelica.Mechanics.Translational) and ports.--out=<file.mo>
to-daeLowers boundary conditions and drag polar into ModelScript linear-memory DAE arena.--out=<file.json>
solveInvokes external or embedded SU2 flow solver iteration for steady/unsteady aerodynamic fields.—

Examples ​

bash
# Validate boundary markers and turbulence settings in an SU2 configuration
msx cfd lint transonic_wing.cfg

# Display mesh markers, Mach number, and reference area
msx cfd summary wing_template.cfgt

# Project aerodynamic drag polar to standard Modelica component
msx cfd to-modelica transonic_wing.cfg --out=AeroDrag.mo

Diagnostic Rules ​

8 rules4 warning4 error Run with msx lint

CodeRuleSeverityMessage
C1001cfl-stability-violationwarningCourant-Friedrichs-Lewy stability number '<cfl>' exceeds recommended maximum limit for explicit scheme.
C1002unresolved-mesh-fileerrorReferenced grid mesh file '<mesh>' cannot be located or is invalid.
C1003missing-inlet-boundarywarningCFD domain '<name>' lacks a declared inlet boundary condition or stagnation state.
C1004missing-outlet-boundarywarningCFD domain '<name>' lacks a declared outlet boundary condition or pressure exit.
C1005unphysical-freestream-macherrorFreestream Mach number '<mach>' is non-physical or outside valid range [0, 25].
C1006unphysical-reynolds-numbererrorFreestream Reynolds number '<re>' must be strictly positive.
C1007negative-surface-areaerrorAerodynamic reference area '<area>' must be strictly positive.
C1008turbulent-viscosity-ratiowarningTurbulent eddy viscosity ratio '<ratio>' is non-physical.

Generated from languages/cfd/src/errors.ts. All languages →

Open-Core under the GNU AGPL v3 License; Enterprise Edition (ee/) under the ModelScript Enterprise License. • Trademark Policy