File size: 1,518 Bytes
9712770
2ef91ed
 
 
 
9712770
2ef91ed
9712770
 
2ef91ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
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
```bash
GET /health
```

### Run blockMesh
```bash
POST /blockmesh
Content-Type: application/json

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

## πŸ“ Usage Example

```bash
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

```json
{
  "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.