Small Flask app for exploring the drop-impact scaling theory described in the paper linked below. The browser collects Weber number We and Ohnesorge number Oh, then calls JSON endpoints to compute Reynolds number, classify the impact regime, and predict BetaMax. The homepage also supports batch CSV uploads for beta predictions.
- Paper: https://arxiv.org/abs/2408.12714
- Live site: https://unifying-theory-website.vercel.app/
SLtheoryWebsite/
app.py
batchProcess.py
calculateReynoldsNumber.py
deploy.sh
regimeDecide.py
phase_diagram_svg.py
SLtheory_prediction.py
SLtheory_model.json
static/
site.css
site.js
templates/index.html
requirements.txt
runtime.txt
vercel.json
app.py creates the Flask app, registers the blueprints, caps request bodies at 1 MB, and runs the server locally. calculateReynoldsNumber.py serves the homepage and computes Reynolds number. regimeDecide.py classifies the regime from We and Oh and returns the model-based predBeta prediction using SLtheory_prediction.py and SLtheory_model.json. batchProcess.py accepts CSV uploads with We and Oh columns, reuses the same theory-range validation as /regime, and returns a CSV with beta filled in or error for invalid rows. The phase diagram is rendered in Python by phase_diagram_svg.py. The frontend is split between templates/index.html, static/site.css, and static/site.js.
pip install -r requirements.txt
python app.pyOr use the helper script to create a virtualenv, install dependencies, and start the local server in one step:
chmod +x deploy.sh
./deploy.shBy default the script serves the app at http://127.0.0.1:5000. You can override the port from the CLI with ./deploy.sh 8000 or ./deploy.sh --port 8000. You can still override the bind address or default port with environment variables such as HOST=0.0.0.0 PORT=8000 ./deploy.sh.
The app is configured for Python 3.9 in runtime.txt.
GET /renders the single-page UI fromtemplates/index.html.POST /addexpects JSON like{"weberNumber": 10, "ohnesorgeNumber": 0.1}with1 <= We <= 10^3and10^-3 <= Oh <= 10^2, and returns{"result": <Re>}rounded to two decimals.POST /regimeexpects the same JSON and range bounds, and returns{"regime": "I" | "II" | "III" | "IV", "predBeta": <BetaMax>}withpredBetarounded to two decimals.POST /batchexpectsmultipart/form-datawith a.csvfile field namedfile. The CSV must containWeandOhheaders, uses the same1 <= We <= 10^3and10^-3 <= Oh <= 10^2limits as/regime, and returns a CSV download with abetacolumn. Invalid rows are marked aserrorand summarized inX-Row-Errors. Uploads larger than 1 MB are rejected with HTTP 413.GET /regime-diagram.svgreturns a server-rendered SVG of the Weber-Ohnesorge phase diagram. OptionalweberNumber,ohnesorgeNumber, andthemequery parameters add the current input marker and match the active light or dark theme.
The frontend calls /add and /regime separately after the user submits the input form, then renders Re, Regime, and predBeta together. Numeric results are rounded in the Python endpoints and displayed to two decimal places in the UI. Inputs outside the theory range are rejected in both the browser and the Flask routes. The regime figure is generated by Python and returned as SVG.
vercel.json routes all traffic to app.py using @vercel/python, so Vercel is the intended deployment target.
- The code validates that inputs are present, JSON object shaped, numeric, finite, and positive before doing the Reynolds, regime, or
predBetacalculations, and batch CSV rows reuse the same theory-range validation. Flask-SocketIOis used to run the app locally, but there are no socket event handlers in the current app.- The page loads MathJax and a polyfill from external CDNs and embeds a YouTube iframe, so full rendering depends on external network access.