COMSOL_Multiphysics_MCP  by wjc9011

AI agents control COMSOL multiphysics simulations

Created 3 months ago
265 stars

Top 96.2% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

This project provides an MCP Server for COMSOL Multiphysics, enabling AI agents to automate complex multiphysics simulations. It targets engineers and researchers seeking to integrate AI with simulation workflows, offering benefits like automated model creation, physics configuration, solving, and results analysis through a standardized protocol.

How It Works

The MCP Server acts as an intermediary, exposing COMSOL functionalities via the Model Computation Protocol (MCP). It utilizes the mph Python library to programmatically control COMSOL Multiphysics, abstracting operations such as geometry building, physics setup, meshing, solving (synchronous and asynchronous), and results evaluation. A key feature is the integration of a knowledge base, supporting embedded guides and semantic search over PDF documentation for enhanced AI-driven assistance.

Quick Start & Requirements

  • Requirements: COMSOL Multiphysics (v5.x/6.x), Python 3.10+ (non-Windows Store), Java runtime.
  • Installation: Clone the repository, then python -m pip install -e ..
  • Testing: Run python -m src.server.
  • PDF Knowledge Base: Requires pymupdf, chromadb, sentence-transformers. Build with python scripts/build_knowledge_base.py.
  • Usage: Configuration examples provided for opencode.json and Claude Desktop.

Highlighted Details

  • MPH Library API: Direct access to COMSOL's Java model (model.java) is utilized for fine-grained control over components, geometry, and physics.
  • Boundary Condition Properties: Detailed mapping of physics interfaces to specific boundary condition property names (e.g., q0 for Heat Transfer's HeatFluxBoundary).
  • Client Session Management: The mph library enforces a singleton COMSOL client per Python process; the server manages this by clearing models rather than full disconnects.
  • Offline Embedding: Supports offline PDF semantic search using local HuggingFace models, configurable via HF_ENDPOINT.
  • Model Versioning: Implements structured model saving with timestamped files and _latest.mph pointers.

Maintenance & Community

The project's development status indicates ongoing work, with integration tests in progress. Specific details on maintainers, community channels (e.g., Discord/Slack), or a public roadmap are not provided in the README.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: The MIT license permits broad use, including commercial applications and linking with closed-source software.

Limitations & Caveats

Integration tests are still in progress. The inherent limitation of a single COMSOL client per Python process requires careful session management. Setup necessitates specific COMSOL and Python versions, along with a Java runtime.

Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
0
Star History
242 stars in the last 30 days

Explore Similar Projects

Starred by Edward Sun Edward Sun(Research Scientist at Meta Superintelligence Lab), Luca Antiga Luca Antiga(CTO of Lightning AI), and
2 more.

PhiFlow by tum-pbs

0.2%
2k
Differentiable PDE solving framework for ML research
Created 6 years ago
Updated 1 day ago
Feedback? Help us improve.