Inspiration
Scientific simulations are powerful but hard to use. Most people need to spend weeks learning complex programming languages and dealing with confusing configuration files just to run a simple physics simulation. We thought: what if you could just describe what you want to simulate in plain English and have it work? That's why we built Science Switch - to make scientific computing accessible to anyone, whether you're a student learning about planets or a researcher testing ideas.
## What it does
Science Switch lets you create physics simulations by chatting with an AI. You describe what you want to simulate in normal English, the AI helps you refine the details, then automatically generates and runs the simulation. Right now it supports two types of simulations: gravitational physics (like planetary orbits) using REBOUND, and fluid dynamics (like air flowing past objects) using OpenFOAM. After your simulation runs, you get an interactive 3D viewer where you can watch the results play out over time, scrub through different moments, and adjust how things look.
## How we built it
We built a React frontend that talks to a FastAPI Python backend. The backend uses Groq's AI to have conversations with users and turn those conversations into simulation commands. We wrote custom parsers that translate natural language into code for REBOUND and OpenFOAM, which run inside Docker containers so users don't need to install anything. The simulations generate data files that we convert to VTK format, then display in a Three.js 3D viewer in the browser. The whole thing uses a two-step AI process: first to chat with the user and gather details, then to generate the actual simulation code.
## Challenges we ran into
The AI sometimes generated simulations that were technically correct code but made no physical sense, like planets with negative mass. We fixed this by adding validation that checks for physics errors before running anything. Docker containers created files with weird permissions that broke everything, so we had to carefully manage file ownership and permissions. Getting the 3D visualization to work smoothly was tricky because React's state management and Three.js animations didn't play nice together - we solved this using React refs to keep the animation state separate. We also had path issues where the frontend was looking for files in the wrong place, which we fixed by making the backend return relative paths instead of absolute ones.
Accomplishments that we're proud of
We actually got it working! You can literally type "show me Earth orbiting the Sun" and within a minute you're watching a 3D animation of it. We built it in a way that makes it easy to add new simulation engines in the future. The code it generates isn't just hacked together - it follows best practices for each simulation engine. We wrote really detailed documentation that helps the AI understand exactly how to use each simulation tool. The 3D viewer lets you play through time like a video, not just look at a static picture. And most importantly, a high school student with no programming experience can now explore orbital mechanics just by describing what they want to see.
## What we learned
Combining AI with structured rules and validation works way better than using AI alone. The quality of what the AI generates depends directly on how good your documentation is. You absolutely must validate physics inputs because simulation engines will happily run impossible scenarios if you let them. Docker is complicated but worth it when it means users don't have to install a bunch of software. Loading data progressively in chunks works way better than trying to load everything at once. And building something that actually works end-to-end teaches you more than any tutorial ever could.
## What's next for Science Switch
First, we want to add molecular dynamics so you can simulate things like proteins and materials. We'll add a gallery of example simulations people can start from and customize. Users should be able to download the generated code and data files. We want to let people share their simulations with others. Long term, we're thinking about combining different types of physics in one simulation, letting people run parameter sweeps to see how changing values affects results, adding educational explanations of the physics, running bigger simulations in the cloud, and letting people adjust parameters and re-run without starting over. The big dream is making an AI that can design and optimize things like rocket nozzles or airplane wings entirely from natural language descriptions.
Log in or sign up for Devpost to join the conversation.