MurderousCoder's picture
Update
2ef91ed verified
|
Raw History Blame Contribute Delete
1.52 kB
metadata
title: OpenFOAM blockMesh API
emoji: πŸ”§
colorFrom: blue
colorTo: green
sdk: docker
app_port: 7860

OpenFOAM blockMesh API

This Space provides an API endpoint for running OpenFOAM's blockMesh utility.

πŸš€ API Endpoints

Health Check

GET /health

Run blockMesh

POST /blockmesh
Content-Type: application/json

{
  "blockMeshDict": "your blockMeshDict content here"
}

πŸ“ Usage Example

curl -X POST https://YOUR-USERNAME-openfoam-blockmesh-api.hf.space/blockmesh \
  -H "Content-Type: application/json" \
  -d '{
    "blockMeshDict": "/*--------------------------------*- C++ -*----------------------------------*\\\nFoamFile\n{\n    version     2.0;\n    format      ascii;\n    class       dictionary;\n    object      blockMeshDict;\n}\n..."
  }'

πŸ”§ Response Format

{
  "output": "blockMesh output...",
  "success": true,
  "mesh_info": {
    "checkMesh": "mesh statistics..."
  }
}

βš™οΈ Technical Details

  • OpenFOAM Version: 11
  • Python: 3.x
  • Framework: Flask with CORS enabled
  • Port: 7860 (Hugging Face default)

πŸ“¦ What's Included

  • Full OpenFOAM 11 installation
  • ParaView 5.10 (for potential future visualization)
  • Python Flask API
  • Automatic mesh validation with checkMesh

⏱️ Execution

  • Maximum execution time: 30 seconds per blockMesh run
  • Cases are automatically cleaned up after execution

πŸ”’ Security

This is a public API. Do not use for sensitive or production workloads.