Codebase Architecture
The Shardian workspace is structured as a monorepo containing the symbolic training engine, C++ and Fortran solver modules, and the licensing infrastructure.
1. Directory Structure
shardian-workspace/
├── applications/
│ ├── openfoam_cfd/ # Shardian Aero (OpenFOAM C++ library source)
│ │ ├── Make/ # Compilation directives (files, options)
│ │ └── AdvancedZonalModel/
│ ├── wrf/ # Shardian Atmos (WRF Fortran boundary layer modules)
│ │ └── phys/ # module_bl_eml_sr.F source files
│ ├── license-server/ # Go/SQLite authentication server & key generator CLI
│ └── shardian-web/ # Main public website and installer scripts
├── eml-sr-core/ # Symbolic regression JAX-based training framework
├── scripts/ # Build, deployment, and weight export utilities
└── datasets/ # High-fidelity DNS training and validation profiles
2. Component Design & Clean Boundaries
To maintain high performance and avoid runtime dependency overhead (e.g., calling Python interpreters or JAX from C++), the codebase enforces a strict separation between Offline Training and Online Simulation.
graph LR
subgraph "Offline Phase (Python)"
A[eml-sr-core] -->|Symbolic Fit| B(Math Expressions)
end
subgraph "Online Phase (C++ & Fortran)"
C[export scripts] -->|Code Generation| D(Hardcoded Source)
D --> E[wmake libso / compile WRF]
end
B --> C
A. Shardian Aero (applications/openfoam_cfd)
- Technology: C++ (OpenFOAM Foundation standard).
- Compilation: Built using
wmake libso, which outputs the dynamic librarylibShardianAero.soto the user's$FOAM_USER_LIBBINpath. - Coupling: Extends
RASModelin OpenFOAM. It calculates \(\nu_t\) using hardcoded inline algebraic equations representing the symbolic models.
B. Shardian Atmos (applications/wrf)
- Technology: Modern Fortran.
- Integration: Injects
module_bl_eml_sr.Finto the WRF compilation pipeline. It hooks into the WRF physics driver (phys/module_pbl_driver.F) at flagbl_pbl_physics = 99. - Zero-Dependency: The JAX-discovered symbolic boundary layer formulas are written directly as nested Fortran arithmetic blocks.
C. License Server (applications/license-server)
- Technology: Go / SQLite.
- Database: A single lightweight database (
licenses.db) storing issued API keys, active scopes, expiration dates, and activation statuses. - Endpoints: Exposes HTTPS endpoints (
/v1/verifyfor solvers,/v1/adminfor key management). - Authentication: Evaluated in the first time-step of a simulation using a lightweight HTTPS thread, caching the result to avoid repeating checks.