Project 03

ASRE-Lab

Autonomous Smart Reverse Engineering Laboratory

Starting question

How can I systematically compare many engineering designs and simulation results without creating, running, and analysing every case manually?

ASRE-Lab turns engineering questions into structured computational studies by connecting parametric design, physics simulation, validation and analysis in one workflow.

Research workspace

ASRE-Lab research workspace during a completed comparative study.

ASRE-Lab research study workspace with workflow navigation, evidence workspace and Evidence inspector

01

Why I built ASRE-Lab

For a while, ancient civilizations were one of my main interests. I spent a lot of time watching Ahmed Adly's long-form series, which covered history, archaeology, engineering ideas and experiments that had been done before. The pyramids were the part that interested me most. We cannot go back and ask the people who designed them what they were trying to achieve, but the structures are still here, and their geometry has physical properties we can study today.

My first thought was almost embarrassingly simple. If someone puts a machine in front of you, you look for the power button. Maybe there was some obvious engineering feature in the pyramid that could reveal what it was meant to do. I quickly realised there probably would not be one magical property that explained everything. So I started thinking from the perspective of whoever designed it. If an engineer wanted certain structural, thermal, vibration or acoustic properties, the geometry they chose would affect them.

Comparison becomes the idea

WHY?

That led me to comparison. Take a pyramid, a cube and other geometries. Change proportions and materials while keeping other variables controlled, then compare enough cases for patterns to appear. I wanted to know what actually changed because of geometry. If a behavior repeatedly appeared in pyramidal shapes but weakened or disappeared elsewhere, that would not prove what the builders intended, but it would give me something measurable to investigate.

That way of working, a reference geometry surrounded by controlled alternatives and judged by contrast, is where the "reverse engineering" in the name comes from.

  1. 01Original geometryThe reference shape under study
  2. 02Controlled variantsDeliberate changes, one variable at a time
  3. 03Same supported physical modelIdentical solver, inputs and assumptions
  4. 04ComparisonDifferences read as the effect of geometry
Reverse engineering by contrast: hold the physics constant, vary the design deliberately, then compare the response.

Then I hit the scale problem

The problem was scale. The study could easily involve hundreds of cases, and I would still have to compare the results, find patterns and understand which variables actually mattered. I had very little research experience, and doing that properly by hand did not seem realistic.

Where AI first entered the idea

WHY?

That was where AI first entered the idea. I wanted a system that could help me work through all those results and identify useful contrasts. That became the first part of ASRE-Lab, the analysis module.

Then I realised I needed the designs

WHY?

Then I realised I still needed hundreds of designs, and I did not know CAD. I could spend months learning it well enough to build every geometry manually, but the research itself would still be waiting. So design generation became part of ASRE-Lab too.

Then came simulation

WHY?

Then came simulation. The geometries meant very little without physical results, but hundreds of real experiments would require laboratories, equipment, money and expertise I did not have. Computational simulation made the idea possible, but brought its own barriers like meshing, boundary conditions, numerical solvers, convergence and validation.

  1. A pyramid question
  2. Too many results to compare → analysis
  3. Too many designs to draw → design generation
  4. No physical results → simulation
  5. Meshing, solvers, convergence, validation

The realisation

Eventually I realised this was not really a pyramid problem. A beginner can have a genuinely interesting engineering question and still get stuck long before testing it because CAD, simulation, statistics, experiment design and validation all stand between the question and the evidence. Experienced researchers may already know those tools or have access to teams and laboratories. A beginner usually does not.

I wanted to make the distance between having a question and being able to investigate it seriously smaller. The pyramid study gave me the problem. ASRE-Lab became the tool I wished I had when I started.

02

How ASRE-Lab works

ASRE-Lab is a platform for turning an engineering question into a structured computational study. You define what you want to investigate, ASRE-Lab creates controlled design variations, runs the supported physics simulations, keeps track of whether the results can be trusted, then compares the experiments to show what changed, what mattered, and what should be tested next.

WHY?

The idea is to bring CAD, simulation, validation and analysis into one research workflow, so someone with a good engineering question can spend more time investigating the question itself and less time stitching together different technical tools.

  1. Research question
  2. Study
  3. Design
  4. Simulation
  5. Evidence
  6. Analysis
  7. Human decision

The workflow only covers the physics ASRE-Lab actually supports, and a person still makes the final decision. The easiest way to understand how it works is to follow an experiment through the system.

The Study

Everything starts with a Study. A Study is the container for the actual research question. It stores what I am trying to investigate, the variables I want to change, the quantities I want to measure, the constraints I care about and the simulations that belong to the experiment.

For example, a Study could ask how changing the geometry of a chamber affects its acoustic behavior while keeping its volume within a certain range. The variables being deliberately changed are called factors: height, wall thickness or chamber length. The quantities being measured are responses: resonant frequency, maximum stress or pressure drop.

Study identity and fingerprint
WHY?

This sounds like simple bookkeeping, but without it a collection of simulations is just a collection of files. The Study gives them experimental structure. ASRE also gives the Study a reproducible identity. The scientific parts of the definition are normalized and hashed, a hash being essentially a digital fingerprint. If something that changes the science changes, such as the factor range or the simulations included, the fingerprint changes too.

Why AI is involved

CAD compilation, meshing, physics, evidence validation and scientific analysis are deterministic engineering systems. The larger architecture is designed so an AI research copilot can understand a question, construct a plan, select supported tools, explain results and help decide what to investigate next. But each layer keeps its own authority.

CAD engine
creates geometry
Mesh system
creates the numerical representation
Solvers
create physical results
Evidence system
records what evidence actually exists
Deterministic analysis
calculates the statistics
AI
reasons over those records, helps plan and explain. It does not manufacture them.

The interesting version of an AI engineering system is not one that simply sounds confident about physics. It is one where reasoning is connected to tools that can independently justify the claims being made.

The software underneath

The interface is built with Next.js and deployed through Vercel. The main backend is FastAPI on a Hetzner server, with Caddy in front handling HTTPS and reverse proxying, so sensitive credentials stay server-side.

Workers, jobs, queue and database

A simple analogy is a restaurant. FastAPI is the waiter taking the order. Redis or Valkey is the order rail carrying tickets into the kitchen. Celery workers are the cooks doing the expensive work. CFD has its own worker because OpenFOAM has a different runtime and heavier requirements.

WHY?

A simulation can take much longer than an ordinary web request, so the browser is never left connected to one calculation. ASRE creates a durable job with an identity and a state: queued, running, completed or failed. The result is persisted independently from the page that asked for it. If fifty simulations are requested and three fail, those failures stay visible while the successful results are kept.

Supabase provides authentication, PostgreSQL for studies, designs, simulations and evidence, and private object storage for generated engineering files. Owner-scoping means one user's research artifacts are not public file paths sitting on a server.

Chain of responsibility

  1. Research question
  2. Study
  3. Design / CAD
  4. Geometry meaning
  5. Mesh / numerical representation
  6. Physics model
  7. Solver
  8. Evidence
  9. Study dataset
  10. Analysis
  11. Human decision

Production path

  1. Next.js frontend on Vercel
  2. Caddy + FastAPI on Hetzner
  3. Redis / Valkey queue
  4. Celery workers + dedicated CFD worker
  5. Supabase PostgreSQL + private storage

None of those layers is supposed to silently replace the authority of another. A statistical model cannot rewrite the physics. An AI explanation cannot create validation evidence. A mesh is not accepted merely because it rendered correctly. Underneath the simple flow is the part I spent most of the project building: making sure every step knows what it is responsible for, what it received, what it produced and where its authority stops.

Why the interface is structured this way

During the redesign, I noticed that AI-generated interfaces could look polished very quickly, but many of them started to look like the same site in different colors: large hero text, rounded SaaS cards, gradients, generic dashboards and the same component patterns repeated.

That was a problem for ASRE-Lab. A scientific workspace needs hierarchy. The researcher has to know where they are, what they are looking at, which stage comes next, what evidence exists and what action they are about to take.

So I stopped asking AI to invent the interface identity from scratch and spent time studying mature tools and product interfaces.

Interface references I studied

  • Zoo Design Studio ↗How a CAD-focused tool keeps geometry at the center of the workspace.
  • SimScale Workbench ↗How browser-based simulation software organizes project navigation, setup, visualization and simulation state.
  • Raycast ↗Information hierarchy, restraint, interaction speed and visual polish.

I used these as references to understand mature interaction patterns. ASRE-Lab does not copy their interfaces.

Research cockpit, not dashboard.

The principle I settled on was that the research pipeline should always stay visible. The central area gives priority to whatever the researcher is working on now, whether that is a design, a simulation, a result or a piece of evidence. Controls sit near the work they affect, and decoration stays secondary to the scientific state.

Research workspace / UI system

The research workspace keeps navigation, the active work area, and technical context visible together.

ASRE-Lab workspace showing workflow navigation, central report area and right-side inspector

03

Design and physics

  1. Engineering meaning
  2. CAD geometry
  3. Mesh
  4. Boundary condition
  5. Solver

Parametric CAD

WHY?

Once a Study needs physical designs, ASRE has to represent them. ASRE has its own typed CAD document called EngineeringDesignDocumentV2. It only accepts a defined vocabulary of engineering operations, never arbitrary code that might or might not produce a useful shape.

CAD operations, OpenCascade and BRep

It can create sketches using rectangles, circles, lines, polylines and arcs. Those sketches can be extruded, revolved, lofted or swept into solids. Solids can be combined or cut using Boolean operations, and moved, mirrored, filleted, chamfered, shelled, drilled and repeated in patterns. There are also engineering constraints: a line can stay horizontal, two features can remain equal, a circle can have a fixed radius and an angle can be constrained.

Underneath is CadQuery and OpenCascade (OCP). OpenCascade is the geometry kernel, the mathematical engine that actually knows what a solid is. It represents exact surfaces, edges and volumes, called BRep, short for Boundary Representation. Imagine a cylinder. A simple STL represents the curved wall using many little flat triangles. A BRep knows that the wall is actually cylindrical. That becomes important later, when ASRE needs to identify surfaces, rebuild geometry or prepare it for physics.

CAD compiler checks and units

ASRE does not simply expose CadQuery to the user. It places a controlled compiler in front of it that checks the design before geometry is created. Dependencies between features form a graph. A feature that depends on a missing feature is rejected. A dependency loop is rejected. Two operations that both claim to create the same immutable body are rejected. The document also cannot contain Python code, shell commands, imports or filesystem paths.

Units are handled deliberately. The scientific identity of the design uses SI units, with lengths in metres and angles in radians. OpenCascade works in millimetres, so ASRE converts at one controlled boundary so that no part of the system has to guess what a number means. Then the finished geometry is checked again: a real valid solid, a finite positive volume and valid topology. A failed Boolean or an empty body does not quietly become a valid design.

Why semantic regions matter

Suppose I create a pipe and later want to tell a CFD solver that one side is the inlet. A fragile CAD system might say "face 17 is the inlet." That works until the geometry changes and face 17 becomes something else.

ASRE tries to preserve meaning. A region can be identified as the inlet, outlet, base, a support or a surface facing a certain direction. The system resolves that meaning back to the real geometry and records whether the match was exact, derived or had to be reselected. If the match becomes ambiguous, ASRE fails instead of silently applying a boundary condition to the wrong face.

Design space

WHY?

ASRE can also define a design space instead of one design. A parameter can take explicit values, move through a continuous range, use integer values or select categories. This is how one base design becomes tens or hundreds of controlled variants for a Study. The CAD system therefore does two jobs: it creates geometry, and it preserves the identity and meaning of that geometry as it changes.

Controlled design variants

Controlled design stage inside the same research study.

ASRE-Lab Design stage inside a research study

Meshing

A CAD model still cannot be directly solved by most numerical methods. The geometry has to be discretized, broken into many small pieces a computer can calculate on. The result is a mesh. For thermal, structural, modal and acoustic FEM, ASRE creates a tetrahedral mesh of first-order four-node tetrahedra, called TET4 elements. A tetrahedron is the 3D equivalent of a triangle.

Mesh quality metrics

The mesh is not accepted just because a mesher produced one. ASRE records node and element counts, minimum element volume, edge lengths, aspect ratio, element quality, and inverted and degenerate elements. An inverted or degenerate tetrahedron can destroy the numerical meaning of a simulation, so this is not graphical cleanup. Semantic regions are mapped into the mesh too, so a CAD "fixed support" still knows which mesh faces it owns.

WHY?

It would be tempting to build one universal mesh and send it to every solver. That sounds elegant, but different numerical methods have different requirements. The CFD path uses a CAD-derived hex-dominant, polyhedral finite-volume mesh built for OpenFOAM. Both paths begin from the same authoritative CAD geometry. The geometry is shared; the discretization and equations are chosen for the physics.

Defining the physics

The simulation receives the properties it actually needs, such as thermal conductivity, Young's modulus, density or acoustic properties, stored as snapshots so the exact values stay part of the record. Boundary conditions describe what the outside world does to the model: fixed temperature, heat flux or convection for thermal; fixed support, displacement, force, pressure or gravity for structures; velocity inlets, pressure boundaries, walls and symmetry for CFD; pressure boundaries and wall behaviors for acoustics. All of them attach to semantic regions, like "apply this to the inlet."

Supported solvers

Thermal
Steady 3D heat conduction (Fourier) with FEM. Gives temperatures throughout the mesh.
Structural
Linear elasticity on TET4 elements. Displacement and stress under small deformation. Not crushing, cracking or plastic deformation.
Modal
An eigenvalue problem from stiffness and mass matrices. Natural frequencies and mode shapes.
Acoustic
Linear pressure acoustics in the frequency domain (Helmholtz), one frequency at a time, lossless fluid with no mean flow.
CFD
OpenFOAM Foundation 14 on a dedicated worker. Steady, incompressible, Newtonian, single-phase, isothermal laminar internal flow within a bounded Reynolds range.

The solver registry

The solver registry is essentially the official list of what ASRE is allowed to claim it can solve. Each capability declares its solver ID, version, physical model, assumptions, inputs, supported boundary conditions, geometry limits, equations, validation status and known limitations. If a problem is outside a supported model, the correct result is to reject it. Solver adapters are explicitly registered, so a user cannot submit the name of a Python module and make the server run it. The system is deliberately closed where scientific authority matters.

Physics / pre-run

Physics configuration and supported-model context before simulation.

ASRE-Lab Physics stage with the Physics inspector showing solver, material and tolerance
Results / Analysis

Results and analysis remain connected to the same study workflow.

ASRE-Lab Results and Analysis workspace showing study results connected to the same workflow

04

Evidence and Scientific Trust

No scientific claim without traceable evidence.

AI interprets evidence. AI does not create physical evidence.

WHY?

Finishing a numerical calculation is not enough. A simulation can run successfully and still be scientifically wrong. "The solver returned a number" and "this is a scientifically usable result" are not the same statement.

Every simulation has an identity: which design produced it, which solver and version, what inputs went in and what came back. Important records are fingerprinted so evidence can be connected back to the exact calculation that created it. Then each result passes through different kinds of evidence.

  1. Numerical resultWhat did the solver produce?
  2. ValidityInside the supported physical model?
  3. Run convergenceDid the solve converge?
  4. BenchmarkDoes it reproduce a known case?
  5. RefinementDoes the answer settle with resolution?
  6. Field integrityAre spatial outputs intact?
  7. Scientific TrustBounded confidence: HIGH · MODERATE · LOW · INVALID
WHY?

The Study engine does not quietly include every completed simulation. It checks ownership, result status, convergence, evidence integrity, scientific validity, applicable benchmark failures and trust records before a run enters the authoritative dataset. A completed calculation can still be excluded.

Evidence + Scientific Trust

Persisted evidence and Scientific Trust state for the study.

ASRE-Lab Evidence stage with the Evidence inspector showing Scientific Trust classification and hashes

05

The analysis engine

WHY?

Analysis was the first part of ASRE-Lab, the thing I originally wanted help with when I had hundreds of imagined cases and no way to compare them. After one simulation, ASRE has one result. The reason the project exists is to study many results together.

The Study engine converts validated simulations into a scientific dataset. It knows which columns are factors and which are responses, and records units, missing values, constant variables, excluded simulations and the exact evidence that contributed. The dataset gets its own reproducibility hash.

Statistics
Means, distributions, variation, and correlations. When many correlations are tested at once, Benjamini-Hochberg false-discovery-rate correction guards against treating random patterns as discoveries. Correlation is kept as association, never causation.
Sensitivity
Standardized regression to compare how inputs are associated with an output. A fitted statistical model, not a new law of physics.
Response surfaces
A second-order approximation of what the sampled simulations are doing, used to spot curvature and interactions. Gated by data count, full rank, conditioning and cross-validation.
Constraints & Pareto
Remove designs that break required limits, then find designs where improving one objective would make another worse. A lighter but weaker design is not simply "the best."
Weighted ranking
Only from objective directions and weights the researcher declares, not a hidden AI opinion.
Robustness
Standard deviation, coefficient of variation, range and confidence intervals for repeated points. Deliberately not called full uncertainty quantification.
DOE
Full factorial designs, and Latin Hypercube sampling to spread a limited number of expensive runs evenly across the space.
EXPLORE / REFINE
EXPLORE fills poorly sampled regions using a Sobol candidate pool. REFINE investigates local structure, only when the response surface passes its gates. Both are proposals, not physical evidence, until the simulations are actually run.
Human decision / report

Human review near the final decision stage of the workflow.

ASRE-Lab workflow near the Decision and Report stages

06

How I tested whether it worked

Building a simulation system creates an uncomfortable problem. A program can run perfectly, produce beautiful plots and still be scientifically wrong. So I did not want "the simulation completed" to mean "the result is correct." No single test proves ASRE-Lab works. The argument comes from the chain.

Known answers first

For the 3D thermal FEM solver, I use a solid with one end at 300 K and the other at 400 K, where the analytical temperature field is linear. ASRE builds the CAD, meshes it, applies the conditions and solves, then compares node by node. The maximum difference must stay below 1×10⁻⁸ K. The structural solver is checked against the analytical displacement FL / EA for a bar pulled at one end.

Why residual checks matter

A solver could arrive near the right answer for the wrong reason. A residual asks how badly the solution still violates the equation. Thermal and structural benchmarks require algebraic residuals below 1×10⁻¹⁰. This does not prove the model represents the real world perfectly. It proves that the numerical problem we said we were solving was actually solved to the declared standard.

Why refinement matters

The acoustic benchmark solves a rectangular duct at 20, 15 and 10 mm and compares against an analytical plane wave. Error must fall monotonically and end below 5%. The OpenFOAM square-duct case runs at three predeclared resolutions, with a stored fine-grid pressure-gradient error of about 0.874% and observed order about 1.94. That does not mean every future CFD problem is accurate to 0.874%.

Break tests and whole-path integration tests

Try to break it

The structural model rejects an under-constrained, floating object. The acoustic solver rejects missing materials, frequencies too high for the mesh and badly conditioned systems. The CFD benchmark rejects altered geometry, wrong boundaries and results from the wrong solver or mesh. Benchmark evidence is also bound to server-owned cases: change the geometry, the speed of sound or a boundary condition and it is no longer the benchmark.

Test the whole path

Integration tests compile real CAD, mesh it, build a physics model and run the thermal, structural and modal solvers. The OpenFOAM validation goes into the separate CFD runtime, runs the real solver and evaluates the benchmark.

Failed approaches are evidence too

WHY?

A universal tetrahedral mesh would have been convenient for every solver, but the CFD validation did not justify it. The project records the pure-TET CFD path as failed and not authoritative, and production CFD uses the hex-dominant/polyhedral mesh instead. That failure changed the architecture.

07

Limits I keep explicit

  • Passing a benchmark does not mean a solver is universally validated.
  • The thermal model does not prove transient heat-transfer accuracy.
  • The structural model does not prove nonlinear material failure.
  • The acoustic solver does not model every acoustic phenomenon.
  • The CFD solver does not claim turbulence, compressible flow, combustion or arbitrary multiphysics.
  • A numerical simulation is not automatically experimental validation of the real physical world.
  • Correlation found by analysis does not prove causation.
  • The platform does not prove historical design intent.