# FLUX Scientific Computing Language
[](https://github.com/MichaelCrowe11/flux-sci-lang/actions/workflows/ci.yml)
[](https://codecov.io/gh/MichaelCrowe11/flux-sci-lang)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
[](https://github.com/psf/black)
**Domain-Specific Language for PDEs, CFD, and Computational Physics**
FLUX is a high-performance DSL designed for scientific computing, specializing in partial differential equations, computational fluid dynamics, electromagnetic simulations, and finite element analysis.
## Features
### Core Scientific Computing Features
- **Native PDE Syntax**: Write equations in mathematical notation (∂u/∂t = ∇²u)
- **Advanced Mesh Support**: Structured, unstructured, and adaptive mesh refinement
- **Multi-Physics**: CFD, electromagnetics, structural analysis, heat transfer
- **GPU Acceleration**: CUDA kernel generation and parallel execution
- **Modern Solvers**: Finite element, finite volume, and spectral methods
- **Code Generation**: Compile to C++, CUDA, Python for maximum performance
### Implemented Features (v0.1.0)
- ✅ PDE-specific lexer with Unicode math operators (∇, ∂, ×, ⊗)
- ✅ Parser for PDE definitions and boundary conditions
- ✅ Mesh generation (structured grids, unstructured, AMR)
- ✅ Code generation backends (Python, C++, CUDA)
- ✅ Scientific templates (heat equation, Navier-Stokes, Maxwell)
- ✅ GPU kernel generation for parallel computing
- ✅ Field operations and mathematical operators
- ✅ Boundary condition specification
## Installation
```bash
# Clone the repository
git clone https://github.com/yourusername/flux-lang.git
cd flux-lang
# Install dependencies
pip install numpy scipy matplotlib
# Optional: CUDA toolkit for GPU acceleration
# Download from https://developer.nvidia.com/cuda-downloads
```
## Quick Start
### Compile a FLUX Program
Compile FLUX scientific code to your target backend:
```bash
# Compile to Python (default)
python flux_scientific.py examples/heat_equation.flux
# Compile to CUDA for GPU acceleration
python flux_scientific.py examples/gpu_accelerated_cfd.flux -b cuda
# Compile to C++ for performance
python flux_scientific.py examples/navier_stokes_cavity.flux -b cpp
```
### Interactive Scientific Computing
Start the interactive scientific environment:
```bash
python flux_scientific.py -i
```
Example session:
```
flux-sci> mesh StructuredGrid 50 50
Created StructuredGrid with 2601 nodes, 2500 cells
flux-sci> compile examples/heat_equation.flux python
Compiling examples/heat_equation.flux to python...
Generated code written to output/generated.py
Compilation successful!
```
### Run Benchmarks
Test FLUX with included scientific benchmarks:
```bash
python flux_scientific.py --benchmark
```
## Language Examples
### Hello World
```flux
function main() {
print("Hello, FLUX World!")
}
main()
```
### Variables and Types
```flux
// Immutable variable
let pi = 3.14159
// Mutable variable
var counter = 0
counter = counter + 1
// Constant
const MAX_SIZE = 100
// Type annotations (optional)
let name: string = "FLUX"
let age: int = 1
```
### Functions
```flux
function add(a: int, b: int) -> int {
return a + b
}
// Async function (syntax supported, async not yet implemented)
async function fetch_data(url: string) -> string {
// Implementation
}
```
### Vectors and AI Operations
```flux
// Create vectors
let embedding1 = embed("artificial intelligence")
let embedding2 = embed("machine learning")
// Semantic similarity using ~~ operator
let similarity = embedding1 ~~ embedding2
print("Similarity: " + str(similarity))
// Vector operations
let v1 = vector(1.0, 2.0, 3.0)
let v2 = vector(4.0, 5.0, 6.0)
let dot_product = v1 @ v2 // Matrix multiplication operator
```
### Tensor Operations
```flux
// Create tensors
let matrix = tensor([[1, 2], [3, 4]])
let weights = tensor([[0.1, 0.2], [0.3, 0.4]])
// Matrix multiplication
let result = matrix @ weights
// Special tensors
let zeros_3x3 = zeros(3, 3)
let ones_2x4 = ones(2, 4)
let random_5x5 = random(5, 5)
```
### Quantum Computing (Basic)
```flux
// Create a qubit
let q = qubit()
// Apply quantum gates
q = hadamard(q) // Put in superposition
// Quantum circuits (syntax supported)
quantum circuit bell_pair() {
classical {
// Classical preprocessing
}
quantum {
// Quantum operations
}
classical {
// Classical postprocessing
}
}
```
### Control Flow
```flux
// If statement
if x > 0 {
print("Positive")
} else if x < 0 {
print("Negative")
} else {
print("Zero")
}
// While loop
while condition {
// Loop body
}
// For loop (syntax planned)
for item in collection {
process(item)
}
// Match expression (syntax supported)
match value {
1 => print("One"),
2 => print("Two"),
_ => print("Other")
}
```
## Examples Directory
The `examples/` directory contains several demonstration programs:
- `hello_world.flux` - Basic hello world and string operations
- `fibonacci.flux` - Recursive and iterative Fibonacci implementations
- `vectors_ai.flux` - Vector operations and semantic similarity
- `tensors_ml.flux` - Tensor operations and ML concepts
- `quantum_basic.flux` - Basic quantum computing demonstrations
## Architecture
```
flux-lang/
├── src/
│ ├── __init__.py # Package initialization
│ ├── lexer.py # Tokenization
│ ├── parser.py # AST generation
│ └── interpreter.py # Execution engine
├── examples/ # Example FLUX programs
├── flux.py # CLI and REPL
└── README.md # This file
```
## Development Status
FLUX is currently in early development (v0.1.0). The following features are planned:
### Near-term Goals
- [ ] Complete type system implementation
- [ ] Async/await execution
- [ ] Import/module system
- [ ] Standard library expansion
- [ ] Error handling improvements
- [ ] Debugger support
### Long-term Goals
- [ ] MLIR backend for compilation
- [ ] WebAssembly target
- [ ] GPU acceleration
- [ ] Distributed computing primitives
- [ ] Full quantum circuit simulation
- [ ] Package manager
- [ ] IDE plugins (VSCode, etc.)
## Contributing
Contributions are welcome! Areas where help is needed:
1. **Standard Library**: Implementing built-in functions and types
2. **Quantum Operations**: Expanding quantum computing support
3. **AI Integration**: Connecting to real LLM APIs
4. **Optimization**: Performance improvements
5. **Documentation**: Tutorials and examples
6. **Testing**: Unit tests and integration tests
## License
FLUX is open-source software. License details to be determined.
## Acknowledgments
FLUX is inspired by:
- Shopify Liquid (templating philosophy)
- Python (syntax and simplicity)
- Rust (memory safety concepts)
- Julia (scientific computing)
- Q# (quantum computing)
- Mojo (AI compilation)
---
**FLUX: Write once, run everywhere, understand everything.**
Raw data
{
"_id": null,
"home_page": "https://github.com/MichaelCrowe11/flux-scientific",
"name": "flux-sci-lang",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "scientific-computing, PDE, CFD, DSL, computational-physics, finite-element, GPU",
"author": "Michael Crowe",
"author_email": "Michael Crowe <michael@flux-sci.org>",
"download_url": "https://files.pythonhosted.org/packages/e6/66/e6e76f95c20aacf62e738bccdc9dad8d99c3062e1171a31521e2c6f3eddb/flux_sci_lang-0.1.0.tar.gz",
"platform": null,
"description": "# FLUX Scientific Computing Language\r\n\r\n[](https://github.com/MichaelCrowe11/flux-sci-lang/actions/workflows/ci.yml)\r\n[](https://codecov.io/gh/MichaelCrowe11/flux-sci-lang)\r\n[](https://www.python.org/downloads/)\r\n[](https://opensource.org/licenses/MIT)\r\n[](https://github.com/psf/black)\r\n\r\n**Domain-Specific Language for PDEs, CFD, and Computational Physics**\r\n\r\nFLUX is a high-performance DSL designed for scientific computing, specializing in partial differential equations, computational fluid dynamics, electromagnetic simulations, and finite element analysis.\r\n\r\n## Features\r\n\r\n### Core Scientific Computing Features\r\n- **Native PDE Syntax**: Write equations in mathematical notation (\u2202u/\u2202t = \u2207\u00b2u)\r\n- **Advanced Mesh Support**: Structured, unstructured, and adaptive mesh refinement\r\n- **Multi-Physics**: CFD, electromagnetics, structural analysis, heat transfer\r\n- **GPU Acceleration**: CUDA kernel generation and parallel execution\r\n- **Modern Solvers**: Finite element, finite volume, and spectral methods\r\n- **Code Generation**: Compile to C++, CUDA, Python for maximum performance\r\n\r\n### Implemented Features (v0.1.0)\r\n- \u2705 PDE-specific lexer with Unicode math operators (\u2207, \u2202, \u00d7, \u2297)\r\n- \u2705 Parser for PDE definitions and boundary conditions\r\n- \u2705 Mesh generation (structured grids, unstructured, AMR)\r\n- \u2705 Code generation backends (Python, C++, CUDA)\r\n- \u2705 Scientific templates (heat equation, Navier-Stokes, Maxwell)\r\n- \u2705 GPU kernel generation for parallel computing\r\n- \u2705 Field operations and mathematical operators\r\n- \u2705 Boundary condition specification\r\n\r\n## Installation\r\n\r\n```bash\r\n# Clone the repository\r\ngit clone https://github.com/yourusername/flux-lang.git\r\ncd flux-lang\r\n\r\n# Install dependencies\r\npip install numpy scipy matplotlib\r\n\r\n# Optional: CUDA toolkit for GPU acceleration\r\n# Download from https://developer.nvidia.com/cuda-downloads\r\n```\r\n\r\n## Quick Start\r\n\r\n### Compile a FLUX Program\r\n\r\nCompile FLUX scientific code to your target backend:\r\n\r\n```bash\r\n# Compile to Python (default)\r\npython flux_scientific.py examples/heat_equation.flux\r\n\r\n# Compile to CUDA for GPU acceleration \r\npython flux_scientific.py examples/gpu_accelerated_cfd.flux -b cuda\r\n\r\n# Compile to C++ for performance\r\npython flux_scientific.py examples/navier_stokes_cavity.flux -b cpp\r\n```\r\n\r\n### Interactive Scientific Computing\r\n\r\nStart the interactive scientific environment:\r\n\r\n```bash\r\npython flux_scientific.py -i\r\n```\r\n\r\nExample session:\r\n```\r\nflux-sci> mesh StructuredGrid 50 50\r\nCreated StructuredGrid with 2601 nodes, 2500 cells\r\n\r\nflux-sci> compile examples/heat_equation.flux python\r\nCompiling examples/heat_equation.flux to python...\r\nGenerated code written to output/generated.py\r\nCompilation successful!\r\n```\r\n\r\n### Run Benchmarks\r\n\r\nTest FLUX with included scientific benchmarks:\r\n\r\n```bash\r\npython flux_scientific.py --benchmark\r\n```\r\n\r\n## Language Examples\r\n\r\n### Hello World\r\n```flux\r\nfunction main() {\r\n print(\"Hello, FLUX World!\")\r\n}\r\n\r\nmain()\r\n```\r\n\r\n### Variables and Types\r\n```flux\r\n// Immutable variable\r\nlet pi = 3.14159\r\n\r\n// Mutable variable\r\nvar counter = 0\r\ncounter = counter + 1\r\n\r\n// Constant\r\nconst MAX_SIZE = 100\r\n\r\n// Type annotations (optional)\r\nlet name: string = \"FLUX\"\r\nlet age: int = 1\r\n```\r\n\r\n### Functions\r\n```flux\r\nfunction add(a: int, b: int) -> int {\r\n return a + b\r\n}\r\n\r\n// Async function (syntax supported, async not yet implemented)\r\nasync function fetch_data(url: string) -> string {\r\n // Implementation\r\n}\r\n```\r\n\r\n### Vectors and AI Operations\r\n```flux\r\n// Create vectors\r\nlet embedding1 = embed(\"artificial intelligence\")\r\nlet embedding2 = embed(\"machine learning\")\r\n\r\n// Semantic similarity using ~~ operator\r\nlet similarity = embedding1 ~~ embedding2\r\nprint(\"Similarity: \" + str(similarity))\r\n\r\n// Vector operations\r\nlet v1 = vector(1.0, 2.0, 3.0)\r\nlet v2 = vector(4.0, 5.0, 6.0)\r\nlet dot_product = v1 @ v2 // Matrix multiplication operator\r\n```\r\n\r\n### Tensor Operations\r\n```flux\r\n// Create tensors\r\nlet matrix = tensor([[1, 2], [3, 4]])\r\nlet weights = tensor([[0.1, 0.2], [0.3, 0.4]])\r\n\r\n// Matrix multiplication\r\nlet result = matrix @ weights\r\n\r\n// Special tensors\r\nlet zeros_3x3 = zeros(3, 3)\r\nlet ones_2x4 = ones(2, 4)\r\nlet random_5x5 = random(5, 5)\r\n```\r\n\r\n### Quantum Computing (Basic)\r\n```flux\r\n// Create a qubit\r\nlet q = qubit()\r\n\r\n// Apply quantum gates\r\nq = hadamard(q) // Put in superposition\r\n\r\n// Quantum circuits (syntax supported)\r\nquantum circuit bell_pair() {\r\n classical {\r\n // Classical preprocessing\r\n }\r\n quantum {\r\n // Quantum operations\r\n }\r\n classical {\r\n // Classical postprocessing\r\n }\r\n}\r\n```\r\n\r\n### Control Flow\r\n```flux\r\n// If statement\r\nif x > 0 {\r\n print(\"Positive\")\r\n} else if x < 0 {\r\n print(\"Negative\")\r\n} else {\r\n print(\"Zero\")\r\n}\r\n\r\n// While loop\r\nwhile condition {\r\n // Loop body\r\n}\r\n\r\n// For loop (syntax planned)\r\nfor item in collection {\r\n process(item)\r\n}\r\n\r\n// Match expression (syntax supported)\r\nmatch value {\r\n 1 => print(\"One\"),\r\n 2 => print(\"Two\"),\r\n _ => print(\"Other\")\r\n}\r\n```\r\n\r\n## Examples Directory\r\n\r\nThe `examples/` directory contains several demonstration programs:\r\n\r\n- `hello_world.flux` - Basic hello world and string operations\r\n- `fibonacci.flux` - Recursive and iterative Fibonacci implementations\r\n- `vectors_ai.flux` - Vector operations and semantic similarity\r\n- `tensors_ml.flux` - Tensor operations and ML concepts\r\n- `quantum_basic.flux` - Basic quantum computing demonstrations\r\n\r\n## Architecture\r\n\r\n```\r\nflux-lang/\r\n\u251c\u2500\u2500 src/\r\n\u2502 \u251c\u2500\u2500 __init__.py # Package initialization\r\n\u2502 \u251c\u2500\u2500 lexer.py # Tokenization\r\n\u2502 \u251c\u2500\u2500 parser.py # AST generation\r\n\u2502 \u2514\u2500\u2500 interpreter.py # Execution engine\r\n\u251c\u2500\u2500 examples/ # Example FLUX programs\r\n\u251c\u2500\u2500 flux.py # CLI and REPL\r\n\u2514\u2500\u2500 README.md # This file\r\n```\r\n\r\n## Development Status\r\n\r\nFLUX is currently in early development (v0.1.0). The following features are planned:\r\n\r\n### Near-term Goals\r\n- [ ] Complete type system implementation\r\n- [ ] Async/await execution\r\n- [ ] Import/module system\r\n- [ ] Standard library expansion\r\n- [ ] Error handling improvements\r\n- [ ] Debugger support\r\n\r\n### Long-term Goals\r\n- [ ] MLIR backend for compilation\r\n- [ ] WebAssembly target\r\n- [ ] GPU acceleration\r\n- [ ] Distributed computing primitives\r\n- [ ] Full quantum circuit simulation\r\n- [ ] Package manager\r\n- [ ] IDE plugins (VSCode, etc.)\r\n\r\n## Contributing\r\n\r\nContributions are welcome! Areas where help is needed:\r\n\r\n1. **Standard Library**: Implementing built-in functions and types\r\n2. **Quantum Operations**: Expanding quantum computing support\r\n3. **AI Integration**: Connecting to real LLM APIs\r\n4. **Optimization**: Performance improvements\r\n5. **Documentation**: Tutorials and examples\r\n6. **Testing**: Unit tests and integration tests\r\n\r\n## License\r\n\r\nFLUX is open-source software. License details to be determined.\r\n\r\n## Acknowledgments\r\n\r\nFLUX is inspired by:\r\n- Shopify Liquid (templating philosophy)\r\n- Python (syntax and simplicity)\r\n- Rust (memory safety concepts)\r\n- Julia (scientific computing)\r\n- Q# (quantum computing)\r\n- Mojo (AI compilation)\r\n\r\n---\r\n\r\n**FLUX: Write once, run everywhere, understand everything.**\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "FLUX Scientific Computing Language - Domain-Specific Language for PDEs, CFD, and Computational Physics",
"version": "0.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/MichaelCrowe11/flux-sci-lang/issues",
"Documentation": "https://flux-sci-lang.readthedocs.io",
"Homepage": "https://github.com/MichaelCrowe11/flux-sci-lang",
"Repository": "https://github.com/MichaelCrowe11/flux-sci-lang"
},
"split_keywords": [
"scientific-computing",
" pde",
" cfd",
" dsl",
" computational-physics",
" finite-element",
" gpu"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "7a634c1186177c7848c2ea08e73142bf45c8014ed2bcf88c8d4f3ea655e47dbc",
"md5": "928224288f6dd2292b409a8a8afb49ca",
"sha256": "79103160909510f252146fdb05a8ec24458d7f29764d206de7cb1ca2ce375198"
},
"downloads": -1,
"filename": "flux_sci_lang-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "928224288f6dd2292b409a8a8afb49ca",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 25263,
"upload_time": "2025-09-20T07:37:22",
"upload_time_iso_8601": "2025-09-20T07:37:22.830076Z",
"url": "https://files.pythonhosted.org/packages/7a/63/4c1186177c7848c2ea08e73142bf45c8014ed2bcf88c8d4f3ea655e47dbc/flux_sci_lang-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "e666e6e76f95c20aacf62e738bccdc9dad8d99c3062e1171a31521e2c6f3eddb",
"md5": "ed1544e12fedd333a3a3e9f21405da2c",
"sha256": "c1d04c15fb0f6919d1aa7152cdf4e21e24ffc759efbeeb0997e758595a304371"
},
"downloads": -1,
"filename": "flux_sci_lang-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "ed1544e12fedd333a3a3e9f21405da2c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 52567,
"upload_time": "2025-09-20T07:37:24",
"upload_time_iso_8601": "2025-09-20T07:37:24.316122Z",
"url": "https://files.pythonhosted.org/packages/e6/66/e6e76f95c20aacf62e738bccdc9dad8d99c3062e1171a31521e2c6f3eddb/flux_sci_lang-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-20 07:37:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "MichaelCrowe11",
"github_project": "flux-scientific",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "flux-sci-lang"
}