CFD automation script generation and closed-loop verification method and device, and storage medium
By generating and verifying closed loops, the problem of cross-platform reuse and verification closed loops in CFD simulation workflow is solved, achieving efficient and reliable automation of simulation tasks and traceability of results.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- WUHAN UNIV OF TECH
- Filing Date
- 2026-05-19
- Publication Date
- 2026-07-14
AI Technical Summary
The existing CFD simulation workflow faces challenges in script automation, including cross-platform semantic inconsistencies, difficulties in reuse, and a lack of verification loops, making it difficult to pinpoint the cause of automation failures.
By acquiring CFD simulation tasks input by users, a structured task specification is generated using a large model, and then transformed into a platform-independent intermediate representation. This is compiled into an executable script, subjected to static checks and minimal trial runs, to achieve multi-level verification and minimal repair, and generate a traceable result package.
It improves the success rate of CFD script automation, lowers the operational threshold, enables cross-platform and cross-version script reuse, ensures the reliability and reproducibility of simulation results, and provides an auditable data loop.
Smart Images

Figure CN122387584A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of CFD simulation process control technology, and in particular to a method, apparatus and storage medium for CFD automated script generation and closed-loop verification. Background Technology
[0002] In existing computational fluid dynamics (CFD) engineering applications, a typical workflow includes: geometry / mesh preparation, physical model and boundary condition setting, solution iteration and convergence monitoring, and post-processing to extract metrics and generate graphs / reports.
[0003] This process involves many highly repetitive steps and requires a high level of proficiency in software operation. Especially during batch processing, parameter scanning, and version migration, manual configuration is prone to omissions / misconfigurations and non-reproducible issues. To reduce repetitive work, mainstream CFD software generally provides scripts or API entry points. For example, ANSYS Fluent supports reading and executing scripts via journal / TUI commands, and there is also an automated path using PyFluent to drive Fluent sessions in Python.
[0004] However, in engineering practice, script automation still faces two structural obstacles: (1) Script languages / interfaces change with software and versions, and semantic inconsistencies between different platforms make it difficult to reuse the same requirements across different software, requiring a unified cross-platform expression and deterministic generation mechanism; (2) Generating scripts does not equate to task completion: mesh quality, solution convergence, physical consistency, output integrity, etc., require programmatic verification. Without a verification loop, automation often ends in failure and the cause is difficult to pinpoint. Summary of the Invention
[0005] In view of this, it is necessary to provide a method, apparatus and storage medium for CFD automated script generation and closed-loop verification, so as to achieve the reuse of the same requirement in different software and improve the success rate of CFD script automation through closed-loop verification.
[0006] To achieve the above objectives, in a first aspect, the present invention provides a method for CFD automated script generation and closed-loop verification, comprising: Obtain the target description of the CFD simulation task input by the user, and output the task specification of the target description under structured constraints using a large model; The task specification is transformed into an intermediate representation independent of the CFD platform, and the intermediate representation is compiled into an executable script for the CFD platform. Static checks are performed on the task specification, the intermediate representation, and the executable script, and a minimized trial run of the executable script is performed in the CFD platform; Once the static checks and minimized trial runs pass, a full simulation is performed based on the executable script, and the simulation results are verified. Once the verification is successful, a traceable result package is generated; the result package includes the executable script, the target description, the task specification, the intermediate representation, the CFD version, the verification report, and the result file index.
[0007] One possible implementation also includes: When any of the static checks, minimum trial runs, and verifications fails, the failure type is determined based on the failure log; Based on the failure type, perform minimal repair operations; the minimal repair operations include repairing local fields in the intermediate representation or replacing local script fragments in the template library.
[0008] In one possible implementation, performing static checks on the task specification, the intermediate representation, and the executable script includes: Perform schema validation on the task specification and the intermediate representation, perform syntax or rule validation on the executable script, and output a static check report.
[0009] In one possible implementation, verifying the simulation results includes: Verify the convergence, physical consistency, and output integrity of the simulation results.
[0010] In one possible implementation, the task specification includes: Target platform and version, geometric input and mesh input, physical model, material parameters, boundary conditions, solution control, convergence conditions, post-processing metrics and resource constraints.
[0011] In one possible implementation, the intermediate representation includes: Boundary set, mesh strategy, physical model, solution control, convergence and stopping conditions, post-processing observations and export format.
[0012] In one possible implementation, the executable script is a Fluent journal script or a PyFluent script.
[0013] Secondly, the present invention also provides a CFD automated script generation and closed-loop verification device, comprising: The acquisition unit is used to acquire the target description of the CFD simulation task input by the user, and output the task specification of the target description under structured constraints using a large model; The conversion unit is used to convert the task specification into an intermediate representation that is independent of the CFD platform, and to compile the intermediate representation into an executable script for the CFD platform. The inspection unit is used to perform static checks on the task specification, the intermediate representation, and the executable script, and to perform a minimized trial run of the executable script in the CFD platform; The verification unit is used to perform a full simulation based on the executable script and verify the simulation results when the static check and the minimized trial run pass. The generation unit is used to generate a traceable result package after the verification is passed; the result package includes the executable script, the target description, the task specification, the intermediate representation, the CFD version, the verification report, and the result file index.
[0014] Thirdly, the present invention also provides an electronic device, including a memory and a processor, wherein, The memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the CFD automated script generation and closed-loop verification method described in any of the above implementations.
[0015] Fourthly, the present invention also provides a computer-readable storage medium for storing a computer-readable program or instruction, wherein the program or instruction, when executed by a processor, is capable of implementing the steps in the CFD automated script generation and closed-loop verification method described in any of the above implementations.
[0016] The beneficial effects of this invention are as follows: The CFD automated script generation and closed-loop verification method, apparatus, and storage medium provided by this invention acquire the target description of the CFD simulation task input by the user, and output the task specification of the target description under structured constraints using a large model. The task is described in natural language, and AI is used to generate structured task specifications and drive script generation, reducing the operational threshold and repetitive labor. The task specification is transformed into an intermediate representation independent of the CFD platform. By introducing a platform-independent intermediate representation, the task semantics are decoupled from the platform script, enabling the reuse of the same task intent under different platforms or different versions of script interfaces. Furthermore, the intermediate representation is compiled into an executable script for the CFD platform. Static checks are performed on the task specification, intermediate representation, and executable script, and a minimized trial run of the executable script is performed in the CFD platform. When the static checks and minimized trial run pass, a complete simulation is performed based on the executable script, and the simulation results are verified. When the verification passes, a traceable result package is generated to achieve regression testing and reproduction. The success rate of CFD script automation is improved through verification closure. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A schematic flowchart of an embodiment of the CFD automated script generation and closed-loop verification method provided by the present invention; Figure 2 This is a schematic diagram of the dual-channel Fluent adapter provided by the present invention; Figure 3 This is a schematic diagram of a multi-level verification access control system provided by the present invention; Figure 4 The overall system structure block diagram provided by the present invention; Figure 5 A flowchart illustrating the AI-assisted CFD automated script generation and closed-loop verification method provided by this invention; Figure 6 A schematic diagram of an embodiment of the CFD automated script generation and closed-loop verification device provided by the present invention; Figure 7 A schematic diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0020] In the description of the embodiments of the present invention, unless otherwise stated, "multiple" means two or more. "And / or" describes the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.
[0021] The terms "first," "second," etc., used in the embodiments of this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a technical feature defined with "first" or "second" may explicitly or implicitly include at least one of that feature.
[0022] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0023] This invention provides a method, apparatus, and storage medium for CFD automated script generation and closed-loop verification, which will be described below.
[0024] Figure 1 This is a schematic flowchart of an embodiment of the CFD automated script generation and closed-loop verification method provided by the present invention, as shown below. Figure 1 As shown, the CFD automated script generation and closed-loop verification methods include: S101. Obtain the target description of the CFD simulation task input by the user, and output the task specification of the target description under structured constraints using a large model; S102. The task specification is converted into an intermediate representation independent of the CFD platform, and the intermediate representation is compiled into an executable script for the CFD platform. S103. Perform static checks on the task specification, the intermediate representation, and the executable script, and perform a minimized trial run of the executable script in the CFD platform; S104. When the static check and minimized trial run pass, perform a full simulation based on the executable script and verify the simulation results; S105. Once the verification is successful, a traceable result package is generated; the result package includes the executable script, the target description, the task specification, the intermediate representation, the CFD version, the verification report, and the result file index.
[0025] In S101, the target description of the CFD simulation task input by the user is obtained. The target description may include a natural language task description, geometric / mesh input, target software and version, output requirements (post-processing indicators / file format), resource constraints, etc.
[0026] Call the large model and output a structured task specification (TaskSpec) based on predefined Schema / CFG constraints, ensuring that the fields are complete and the format is parsable, avoiding the direct output of executable scripts.
[0027] In some embodiments of the present invention, the task specifications include: Target platform and version, geometric input and mesh input, physical model, material parameters, boundary conditions, solution control, convergence conditions, post-processing metrics and resource constraints.
[0028] In this embodiment, the large model is not limited to a specific vendor's model; it can be a generative large model with natural language understanding, code generation, or structured output capabilities, preferably a large language model with enhanced code capabilities. Its deployment method can be local deployment, private deployment, or cloud API calls.
[0029] In this approach, large models do not directly output executable CFD scripts. Instead, they output structured TaskSpecs under predefined Schema / CFG constraints. TaskSpecs are preferably expressed in JSON or YAML and should include at least the following fields: target platform and version, geometric / mesh input, physical model, material parameters, boundary conditions, solution control, convergence conditions, post-processing metrics, and resource constraints.
[0030] This embodiment limits AI generation to structured TaskSpecs and generates scripts by a deterministic compiler / template engine, which solves the problems of high uncertainty, easy generation of executable scripts from large models, easy generation of syntax / semantic errors, omission of key configurations, and non-executability caused by version drift.
[0031] In S102, the TaskSpec is converted into a platform-independent intermediate representation, CFD-IR. CFD-IR includes at least: geometry / region / boundary set, mesh strategy, physical model and materials, numerical discretization / solver control, convergence and stopping conditions, post-processing observations, and export format.
[0032] In some embodiments of the present invention, the intermediate representation includes: Boundary set, mesh strategy, physical model, solution control, convergence and stopping conditions, post-processing observations and export format.
[0033] The CFD-IR can be compiled into a target platform script using a deterministic compiler, and the script can then be executed.
[0034] This embodiment utilizes a cross-platform unified intermediate representation, CFD-IR, combined with compiled generation. By expressing tasks as CFD-IR and generating Fluent scripts using a deterministic compiler, the semantics of the same task become transferable, versionable, and testable. By introducing platform-independent CFD-IR, task semantics are decoupled from platform scripts, solving the problem in existing CFD automation where the same task intent is difficult to reuse across different platforms / versions of script interfaces, leading to high migration costs and maintenance difficulties.
[0035] In S103, the TaskSpec and intermediate representation CFD-IR are subjected to schema verification, and the generated script is subjected to syntax and rule verification (such as command sequence integrity, path validity, blacklist of prohibited operations, etc.), and a static inspection report is output.
[0036] A minimal trial run of the executable script was performed on the CFD platform to verify that the critical objects and settings existed and that there were no fatal errors in the logs.
[0037] In S104, when the static check and minimum trial run pass, Fluent is invoked in the local or controlled environment to execute the executable script, perform a complete simulation, collect logs, exit codes, monitored quantities (residuals, force coefficients, etc.) and output file paths, verify the simulation results, and check convergence, physical consistency and output integrity.
[0038] In S105, once the verification is successful, the executable script, target description, task specification, CFD intermediate representation, CFD version, verification report, and result file index are saved, generating a traceable result package that supports reproduction and regression testing.
[0039] By linking and saving "natural language requirements - specifications - scripts - logs - results", regression testing and reproduction are achieved, solving the problem of the lack of auditable and traceable data loop in existing technologies.
[0040] In summary, the CFD automated script generation and closed-loop verification method provided in this embodiment of the invention obtains the target description of the CFD simulation task input by the user, and outputs the task specification of the target description under structured constraints using a large model. The task is described in natural language, and AI is used to generate structured task specifications and drive script generation, reducing the operational threshold and repetitive labor. The task specification is transformed into an intermediate representation independent of the CFD platform. By introducing a platform-independent intermediate representation, the task semantics are decoupled from the platform script, enabling the reuse of the same task intent under different platforms or different versions of script interfaces. Furthermore, the intermediate representation is compiled into an executable script for the CFD platform. Static checks are performed on the task specification, intermediate representation, and executable script, and a minimized trial run of the executable script is performed in the CFD platform. When the static checks and minimized trial run pass, a complete simulation is performed based on the executable script, and the simulation results are verified. When the verification passes, a traceable result package is generated to achieve regression testing and reproduction. The verification closed loop improves the success rate of CFD script automation.
[0041] In some embodiments of the present invention, the executable script is a Fluent journal script or a PyFluent script.
[0042] Figure 2 This is a schematic diagram of the dual-channel Fluent adapter provided by the present invention. Figure 2It should be noted that the same CFD-IR can be mapped to different Fluent adapter channels; the Journal channel focuses on stable batch processing, while the PyFluent channel focuses on programmable control; both channels support the execution of sample recording and backfeeding to the template library for version migration and regression validation.
[0043] The target platform script is generated deterministically based on CFD-IR, as follows: Fluent Journal line: Generates .jou (TUI command sequence), reads and executes via file / read-journal, and can record standard samples for template library / regression data using file / start-journal / stop-journal.
[0044] PyFluent line: Generates Python scripts, starts / connects to Fluent using the session interface, sets parameters using session.execute_tui or settings API, and uses PyFluent journaling to record and replay to create a runnable sample library.
[0045] In some embodiments of the present invention, performing static checks on the task specification, the intermediate representation, and the executable script includes: Perform schema validation on the task specification and the intermediate representation, perform syntax or rule validation on the executable script, and output a static check report.
[0046] Perform schema validation on TaskSpec / CFD-IR; perform syntax / rule validation on the generated script (e.g., command sequence integrity, path validity, blacklist of prohibited operations, etc.), and output a static check report.
[0047] The purpose of the static inspection report is to perform structural integrity, syntax correctness, rule compliance, and security checks on the TaskSpec, CFD-IR, and generated scripts before the target CFD software is officially executed, and to output traceable inspection results as an entry threshold before execution.
[0048] If the static check report fails, the system will block subsequent pre-flight and formal execution, and proceed to the repair or recompile process; if it passes, it will serve as the pass certificate for the first layer of multi-level verification and be included in the audit result package for regression testing, problem localization and version tracing.
[0049] In some embodiments of the present invention, the verification of the simulation results includes: Verify the convergence, physical consistency, and output integrity of the simulation results.
[0050] This invention provides a solidified three-layer verification mechanism, as follows: (1) Structure / Syntax Layer: TaskSpec must be generated using JSON Schema or CFG constraints; static script check must pass; (2) Pre-flight before execution: Perform a minimal dry run (such as 1~N iterations or short time steps) to verify that the object exists, key settings are effective, and there are no fatal errors in the logs; (3) Post-flight after execution: check convergence, physical consistency and output integrity (file exists and the format is correct).
[0051] Figure 3 This is a schematic diagram of a multi-level verification access control system provided by the present invention. Figure 3 It should be noted that G1 is used to eliminate structural and interface errors; G2 is used to verify script executability at low cost; G3 is used to determine whether the simulation results meet the credible completion conditions; any access control failure will not proceed to the subsequent stage, but will trigger the log-driven minimum repair loop.
[0052] In some embodiments of the present invention, it further includes: When any of the static checks, minimum trial runs, and verifications fails, the failure type is determined based on the failure log; Based on the failure type, perform minimal repair operations; the minimal repair operations include repairing local fields in the intermediate representation or replacing local script fragments in the template library.
[0053] If any of the static checks, minimal trial runs, or verifications fail, the failure type is classified based on the log signature (such as missing boundary assignment, command unavailable, path not found, non-convergence, missing output, etc.), and only a "minimum patch" is generated to perform minimal repair operations.
[0054] Minimal repair operations can include locally modifying IR fields or replacing template fragments, and then returning to the compilation and verification phases to form a regression loop.
[0055] The CFD automated script generation and closed-loop verification method provided in this invention upgrades "script generation" to "reliable task completion" through multi-level verification and auditable closed loop (structure / syntax layer + pre-flight dry-run + post-flight convergence / physical consistency / output integrity) + log-driven minimum repair loop.
[0056] This embodiment solidifies the verification into "structure / syntax layer → dry-run before execution → convergence / physical consistency / output integrity after execution", and triggers log parsing and minimum repair loop in case of failure, which solves the problems of lacking CFD-oriented reliability gates and the inability to guarantee the correct completion of simulation by only performing string / format verification.
[0057] This invention provides an AI-assisted CFD automation method. Users describe simulation tasks using natural language, and the AI (large model) outputs a task specification (TaskSpec) under structured constraints. The system normalizes the TaskSpec into a platform-independent CFD-IR and compiles the same CFD-IR into a target platform script (preferably an ANSYS Fluentjournal or PyFluent script) using a deterministic compiler. The executor then calls Fluent to execute the script, and a multi-level verification module performs gate checks on the script, execution process, and output results. If failure occurs, a minimal patch is generated through log parsing and a minimal repair module, and regression verification is performed until success or the resource limit is reached. This end-to-end data and control flow can be abstracted as: "TaskSpec generator → CFD-IR → platform compiler → script static check → Runner → dynamic verification → (report upon success, return to compilation with minimal repair if failure)".
[0058] Figure 4 This is a system overall structure block diagram provided by the present invention. Figure 4 It should be noted that the main process adopts a single closed loop of "generation → compilation → verification → execution → validation → repair"; AI is only used to generate structured TaskSpec; when repair fails, it only falls back to the compilation stage to avoid complex cross arrows.
[0059] The system provided by this invention includes: 1. Input Interface Module: Receives natural language task description, geometric / mesh input, target software and version, output requirements (post-processing metrics / file format), resource constraints, etc.
[0060] 2. AI Task Specification Generation Module (TaskSpec Generator): Calls the large model and outputs a structured TaskSpec based on predefined Schema / CFG constraints, ensuring that the fields are complete and the format is parsable, avoiding the direct output of executable scripts.
[0061] 3. Intermediate Representation Builder (CFD-IR Builder): Converts TaskSpec into platform-independent CFD-IR. CFD-IR includes at least: geometry / region / boundary set, mesh strategy, physical model and materials, numerical discretization / solver control, convergence and stopping conditions, post-processing observations, and export format.
[0062] 4. Knowledge Retrieval and Template Library Module: Retrieves example scripts, recorded script samples, and parameter templates by "Platform-Version-Task Type", providing a version-sensitive context for compilation and reducing the risk of knowledge obsolescence and illusion.
[0063] Example scripts preferably refer to validated and executable script samples on the target CFD platform, including Fluent Journal (.jou / TUI command sequences) samples, standard operation samples obtained through recording, and PyFluent session scripts and journaling replay samples. These samples can serve as template libraries and sources of regression data.
[0064] Version-sensitive context optimization is achieved by retrieving template libraries, recorded sample libraries, parameter templates, and version API / command information by "platform-version-task type". For example, when the target platform is Fluent 2023R2, the system prioritizes retrieving journal samples, PyFluent script samples, and parameter templates corresponding to this version, and uses the search results as context constraints for subsequent compilation. By introducing real script samples and template fragments consistent with the current version, the problems of knowledge obsolescence, version drift, and command illusion that occur when the model generates scripts solely based on parameter memory can be reduced.
[0065] 5. Platform compilation and generation module (IR→Script Compiler): Generates target platform scripts in a deterministic manner based on CFD-IR.
[0066] Fluent Journal line: Generates .jou (TUI command sequence), reads and executes via file / read-journal, and can record standard samples for template library / regression data using file / start-journal / stop-journal.
[0067] PyFluent line: Generates Python scripts, starts / connects to Fluent using the session interface, sets parameters using session.execute_tui or settings API, and uses PyFluent journaling to record and replay to create a runnable sample library.
[0068] 6. Script Static Inspection Module (Structure / Syntax Layer Access Control): Performs schema verification on TaskSpec / CFD-IR; performs syntax / rule verification on generated scripts (e.g., command sequence integrity, path validity, blacklist of prohibited operations, etc.), and outputs a static inspection report.
[0069] 7. Execution and Monitoring Module (Runner): Calls Fluent to execute scripts in a local or controlled environment, and collects logs, exit codes, monitoring quantities (residuals, force coefficients, etc.) and output file paths.
[0070] 8. Multi-level Validation Module (Validator): Solidifies three-level validation.
[0071] (1) Structure / Syntax Layer: TaskSpec must be generated using JSON Schema or CFG constraints; static script check must pass; (2) Pre-flight before execution: Perform a minimal dry-run (such as 1~N iterations or short time steps) to verify that the object exists, critical settings are effective, and there are no fatal errors in the logs; (3) Post-flight after execution: check convergence, physical consistency and output integrity (file exists and the format is correct).
[0072] 9. Log parsing and minimal repair module (Repair): When verification fails, the module classifies the failure type based on the log signature (such as missing boundary assignment, unavailable command, non-existent path, non-convergence, missing output, etc.), generates only a "minimal patch" (locally modifies the IR field or replaces the template fragment), and returns to the compilation and verification stage to form a regression loop.
[0073] 10. Audit and Traceability Module (Audit): Saves natural language input, TaskSpec, CFD-IR, script file list, template version, logs, validation reports and result file index, and supports reproduction and regression testing.
[0074] Figure 5 This is a flowchart illustrating the AI-assisted CFD automated script generation and closed-loop verification method provided by the present invention. Figure 5 It should be noted that the main process is a unidirectional execution from S501 to S508. If S506 or S507 fails, it enters S509 for minimal repair based on the logs. After repair, it only rolls back to S504 (recompiling and generating the script) before resuming the verification and execution process. Figure 5 As shown, it includes the following steps: Step S501: Obtain the user's natural language task description, geometric / mesh input, target software (Fluent) and version, and post-processing output requirements.
[0075] Step S502: AI-assisted generation of TaskSpec.
[0076] Call the large model and output a structured TaskSpec under Schema / CFG constraints. The fields should include at least the mesh strategy, physical model, solution control, convergence threshold, post-processing metrics, and resource constraints.
[0077] Step S503: Construct CFD-IR.
[0078] The TaskSpec is normalized to a platform-independent CFD-IR, which includes boundary set, mesh policy, physical model, solution control, convergence / stopping, post-processing and export format.
[0079] Step S504: Compile and generate Fluent script.
[0080] CFD-IR is compiled into a Fluent journal (.jou) or PyFluent script using a deterministic compiler. The journal line is preferred, and the journal is read and executed by Fluent via file / read-journal.
[0081] Step S505: Static check of the structure / syntax layer.
[0082] Perform schema validation on TaskSpec / CFD-IR and static rule checks on the script.
[0083] Step S506, pre-flight dry-run.
[0084] Perform a minimal trial run to verify that critical objects and settings exist and that there are no fatal errors in the logs.
[0085] Step S507: Formal execution and post-flight verification.
[0086] After solving and post-processing, check convergence, physical consistency and output integrity.
[0087] Step S508, Failure Minimum Repair Loop.
[0088] If any verification fails, parse the log to generate a failure signature and perform minimal repairs, then return to step S504 or S505 for regression verification and re-execution.
[0089] Step S509: Results Summary and Reporting.
[0090] Once verification is successful, a traceable result package (script + parameters + version + log + verification report + result index) will be output.
[0091] This invention relates to the fields of computer-aided engineering automation and computational fluid dynamics simulation process control technology. Specifically, it relates to a system and method that utilizes artificial intelligence (large model) to assist in generating structured task specifications, and compiles them into ANSYS Fluent executable scripts through intermediate representations. This achieves automated meshing / solving / post-processing, as well as multi-level verification and auditable closed-loop systems. Fluent-side script execution can be performed via journal (TUI command sequence) and read from file / read-journal, or via the PyFluent session interface to execute TUI commands / setting APIs, and supports journaling recording and playback.
[0092] The CFD automated script generation and closed-loop verification method provided by this invention has the following advantages: (1) Reduce the operational threshold and repetitive work: Users describe tasks in natural language, and AI generates structured TaskSpec and drives script generation, reducing the input errors and omissions in the multi-level menu of the GUI.
[0093] (2) Improve reliability and reproducibility: Through three-layer access control and minimum repair loop, "script generation" is transformed into "executable task completion that passes convergence / consistency / integrity verification", and audit evidence is saved to support regression testing and reproduction.
[0094] (3) Cross-platform / cross-version migration capability: CFD-IR decouples task semantics from platform scripts, and the compiler’s deterministic output reduces the impact of version drift. The same IR can be extended to backends of different platform scripts.
[0095] (4) Auditable: Outputs a result package of "script + parameters + version + log + verification report" to facilitate peer review and project accountability.
[0096] To better implement the CFD automated script generation and closed-loop verification method in this embodiment of the invention, based on the CFD automated script generation and closed-loop verification method, correspondingly, as follows: Figure 6 As shown, this embodiment of the invention also provides a CFD automated script generation and closed-loop verification device. The CFD automated script generation and closed-loop verification device 600 includes: The acquisition unit 601 is used to acquire the target description of the CFD simulation task input by the user, and output the task specification of the target description under structured constraints using a large model; The conversion unit 602 is used to convert the task specification into an intermediate representation that is independent of the CFD platform, and to compile the intermediate representation into an executable script for the CFD platform. The inspection unit 603 is used to perform static checks on the task specification, the intermediate representation and the executable script, and to perform a minimized trial run of the executable script in the CFD platform; The verification unit 604 is used to perform a full simulation based on the executable script and verify the simulation results when the static check and the minimized trial run pass. The generation unit 605 is used to generate a traceable result package after the verification is passed; the result package includes the executable script, the target description, the task specification, the intermediate representation, the CFD version, the verification report, and the result file index.
[0097] The CFD automated script generation and closed-loop verification device 600 provided in the above embodiments can realize the technical solutions described in the above CFD automated script generation and closed-loop verification method embodiments. The specific implementation principles of each module or unit can be found in the corresponding content in the above CFD automated script generation and closed-loop verification method embodiments, and will not be repeated here.
[0098] like Figure 7 As shown, the present invention also provides an electronic device 700. The electronic device 700 includes a processor 701, a memory 702, and a display 703. Figure 7 Only some components of the electronic device 700 are shown, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
[0099] In some embodiments, processor 701 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 702 or process data, such as the CFD automated script generation and closed-loop verification method of the present invention.
[0100] In some embodiments, processor 701 may be a single server or a group of servers. The server group may be centralized or distributed. In some embodiments, processor 701 may be local or remote. In some embodiments, processor 701 may be implemented on a cloud platform. In some embodiments, the cloud platform may include a private cloud, public cloud, hybrid cloud, community cloud, distributed cloud, internal cloud, multi-cloud, or any combination thereof.
[0101] In some embodiments, memory 702 may be an internal storage unit of electronic device 700, such as a hard disk or memory of electronic device 700. In other embodiments, memory 702 may also be an external storage device of electronic device 700, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc. equipped on electronic device 700.
[0102] Furthermore, the memory 702 may include both internal storage units of the electronic device 700 and external storage devices. The memory 702 is used to store application software and various types of data installed on the electronic device 700.
[0103] In some embodiments, display 703 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an organic light-emitting diode (OLED) touchscreen. Display 703 is used to display information from electronic device 700 and to display a visual user interface. Components 701-703 of electronic device 700 communicate with each other via a system bus.
[0104] In one embodiment, when processor 701 executes the CFD automated script generation and closed-loop verification program in memory 702, the following steps can be implemented: Obtain the target description of the CFD simulation task input by the user, and output the task specification of the target description under structured constraints using a large model; The task specification is transformed into an intermediate representation independent of the CFD platform, and the intermediate representation is compiled into an executable script for the CFD platform. Static checks are performed on the task specification, the intermediate representation, and the executable script, and a minimized trial run of the executable script is performed in the CFD platform; Once the static checks and minimized trial runs pass, a full simulation is performed based on the executable script, and the simulation results are verified. Once the verification is successful, a traceable result package is generated; the result package includes the executable script, the target description, the task specification, the intermediate representation, the CFD version, the verification report, and the result file index.
[0105] It should be understood that when the processor 701 executes the CFD automated script generation and closed-loop verification program in the memory 702, in addition to the functions mentioned above, it can also perform other functions, as detailed in the description of the corresponding method embodiments above.
[0106] Furthermore, the embodiments of the present invention do not specifically limit the type of electronic device 700 mentioned. Electronic device 700 can be a mobile phone, tablet computer, personal digital assistant (PDA), wearable device, laptop computer, or other portable electronic device. Exemplary embodiments of portable electronic devices include, but are not limited to, portable electronic devices running iOS, Android, Microsoft, or other operating systems. The aforementioned portable electronic device can also be other portable electronic devices, such as a laptop computer with a touch-sensitive surface (e.g., a touch panel). It should also be understood that in some other embodiments of the present invention, electronic device 700 may not be a portable electronic device, but rather a desktop computer with a touch-sensitive surface (e.g., a touch panel).
[0107] Accordingly, embodiments of the present invention also provide a computer-readable storage medium for storing computer-readable programs or instructions. When the programs or instructions are executed by a processor, they can implement the steps or functions in the CFD automated script generation and closed-loop verification methods provided in the above-described method embodiments.
[0108] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.), and the computer program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.
[0109] The CFD automated script generation and closed-loop verification method, apparatus, and storage medium provided by the present invention have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for automated CFD script generation and closed-loop verification, characterized in that, include: Obtain the target description of the CFD simulation task input by the user, and output the task specification of the target description under structured constraints using a large model; The task specification is transformed into an intermediate representation independent of the CFD platform, and the intermediate representation is compiled into an executable script for the CFD platform. Static checks are performed on the task specification, the intermediate representation, and the executable script, and a minimized trial run of the executable script is performed in the CFD platform; Once the static checks and minimized trial runs pass, a full simulation is performed based on the executable script, and the simulation results are verified. Once the verification is successful, a traceable result package is generated; the result package includes the executable script, the target description, the task specification, the intermediate representation, the CFD version, the verification report, and the result file index.
2. The CFD automated script generation and closed-loop verification method according to claim 1, characterized in that, Also includes: When any of the static checks, minimum trial runs, and verifications fails, the failure type is determined based on the failure log; Based on the failure type, perform minimal repair operations; the minimal repair operations include repairing local fields in the intermediate representation or replacing local script fragments in the template library.
3. The CFD automated script generation and closed-loop verification method according to claim 1, characterized in that, The static analysis of the task specification, the intermediate representation, and the executable script includes: Perform schema validation on the task specification and the intermediate representation, perform syntax or rule validation on the executable script, and output a static check report.
4. The CFD automated script generation and closed-loop verification method according to claim 1, characterized in that, The verification of the simulation results includes: Verify the convergence, physical consistency, and output integrity of the simulation results.
5. The CFD automated script generation and closed-loop verification method according to claim 1, characterized in that, The task specifications include: Target platform and version, geometric input and mesh input, physical model, material parameters, boundary conditions, solution control, convergence conditions, post-processing metrics and resource constraints.
6. The CFD automated script generation and closed-loop verification method according to claim 1, characterized in that, The intermediate representation includes: Boundary set, mesh strategy, physical model, solution control, convergence and stopping conditions, post-processing observations and export format.
7. The CFD automated script generation and closed-loop verification method according to claim 1, characterized in that, The executable script is a Fluent journal script or a PyFluent script.
8. A CFD automated script generation and closed-loop verification device, characterized in that, include: The acquisition unit is used to acquire the target description of the CFD simulation task input by the user, and output the task specification of the target description under structured constraints using a large model; The conversion unit is used to convert the task specification into an intermediate representation that is independent of the CFD platform, and to compile the intermediate representation into an executable script for the CFD platform. The inspection unit is used to perform static checks on the task specification, the intermediate representation, and the executable script, and to perform a minimized trial run of the executable script in the CFD platform; The verification unit is used to perform a full simulation based on the executable script and verify the simulation results when the static check and the minimized trial run pass. The generation unit is used to generate a traceable result package after the verification is passed; the result package includes the executable script, the target description, the task specification, the intermediate representation, the CFD version, the verification report, and the result file index.
9. An electronic device, characterized in that, Including memory and processor, among which, The memory is used to store programs; The processor, coupled to the memory, is used to execute the program stored in the memory to implement the steps in the CFD automated script generation and closed-loop verification method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store computer-readable programs or instructions, which, when executed by a processor, can implement the steps in the CFD automated script generation and closed-loop verification method according to any one of claims 1 to 7.