Journal of Frontiers of Computer Science and Technology ›› 2025, Vol. 19 ›› Issue (12): 3243-3256.DOI: 10.3778/j.issn.1673-9418.2508051

• Special Issue on Theory and Technology of Multimodal Large Language Model • Previous Articles     Next Articles

Multimodal Information Fusion-Guided Graphical Interface Code Generation Framework for OpenFOAM

LU Bin, LIU Jianfeng, WANG Haolin, ZHANG Yuzhi, CHEN Rui   

  1. College of Software, Nankai University, Tianjin 300457, China
  • Online:2025-12-01 Published:2025-12-01

多模态信息融合指导的OpenFOAM图形界面代码生成框架

卢斌,刘建峰,王浩琳,张玉志,陈锐   

  1. 南开大学 软件学院,天津  300457

Abstract: Addressing the dual challenges of OpenFOAM?s high learning curve due to its reliance on command-line operations and the generally long development cycles and high customization costs of traditional simulation interfaces, this paper proposes the AutoCode4OF framework, which aims to achieve end-to-end automatic generation of a complete OpenFOAM executable interface code from multimodal inputs. The main innovations of the framework include: (1) At the input level, it integrates multimodal information such as images, natural language text, and existing code snippets to jointly represent user intent; (2) In terms of knowledge processing, by constructing a professional knowledge graph in the field of computational fluid dynamics (CFD) and introducing retrieval-augmented generation (RAG) along with dual front-end and back-end validation mechanisms, it significantly enhances the physical rationality and reliability of the generated code; (3) In system architecture design, it adopts a multi-agent collaborative working mechanism, decomposing the overall task into specialized modules such as knowledge retrieval, task planning, code generation, material setup, and testing verification, with each module collaborating to ensure the quality and completeness of the output. Experimental results show that AutoCode4OF achieves scores of 0.956, 0.997, and 100% in code quality, functional completeness, and compilation success rate, respectively. It demonstrates strong applicability and stability across various stages, including mesh generation, solution computation, and post-processing result validation, highlighting its high practical engineering application value and providing new insights for the intelligent development of scientific computing software.

Key words: OpenFOAM, multimodal large language model, knowledge graph, multi-agent systems, code generation

摘要: 针对OpenFOAM因依赖命令行操作而导致的使用门槛高,以及传统仿真界面普遍存在开发周期长、定制成本高的多重挑战,提出AutoCode4OF框架,旨在实现从多模态输入到完整OpenFOAM可执行界面代码的端到端自动生成。该框架主要创新包括:(1)在输入层面,框架融合图像、自然语言文本以及已有代码片段等多模态信息,联合表征用户意图;(2)在知识处理层面,通过构建计算流体力学(CFD)领域的专业知识图谱,并引入检索增强生成(RAG)与前后端双重验证机制,显著提升生成代码在物理意义上的合理性与可靠性;(3)在系统架构设计上,采用多智能体协同工作机制,将整体任务分解为知识检索、任务规划、代码生成、素材设置以及测试验证等多个专业模块,各模块分工协作,共同保障输出结果的质量与完整性。实验结果表明,AutoCode4OF在代码质量、功能完整性和编译成功率方面分别达到0.956、0.997和100%,在网格生成、求解计算以及后处理结果验证等多个环节中均展现出良好的适用性与稳定性,具备较高的实际工程应用价值,并为科学计算软件的智能化发展提供了新思路。

关键词: OpenFOAM, 多模态大模型, 知识图谱, 多智能体系统, 代码生成