Simulation error correction method, device and system based on multi-agent cooperation

By employing a multi-agent collaborative approach, the diagnostic and repair functions are decoupled. The reviewer agent generates a structured diagnostic report, which is then used by the executor agent to repair the code. This solves the problems of inaccurate error localization and inconsistent repair results during simulation, and achieves efficient simulation error correction through an automated closed loop.

CN122152585APending Publication Date: 2026-06-05ZHEJIANG YUANSUAN TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ZHEJIANG YUANSUAN TECH CO LTD
Filing Date
2026-05-08
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, error diagnosis and code modification during simulation lack clear functional boundaries, making it difficult to distinguish whether the problem originates from the diagnosis stage or the repair stage when repair fails. Furthermore, the lack of an independent intermediate diagnostic layer leads to inaccurate error localization and inconsistent repair results.

Method used

By employing a multi-agent collaborative approach, the functions of the diagnostic agent and the repair agent are decoupled, and the constraints of the read-only/strict dependency mode are applied. This allows error root cause analysis and code modification to be completed independently in different functional modules. The reviewer agent generates a structured diagnostic report, and the executor agent performs code repair in the strict dependency mode, thus achieving automated closed-loop processing.

Benefits of technology

It improves the accuracy of error location and the consistency between repair results and diagnostic conclusions, reduces mutual interference between diagnosis and repair, and realizes automated closed-loop processing from error capture to repair completion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122152585A_ABST
    Figure CN122152585A_ABST
Patent Text Reader

Abstract

The application provides a simulation error correction method, device and system based on multi-agent cooperation, and relates to the technical field of artificial intelligence. The method comprises the following steps: performing a scientific simulation task, capturing error information and obtaining a current simulation configuration file, user demand description, running environment information and historical correction records; inputting the above information into a reviewer agent, and generating a structured diagnostic report by the reviewer agent in a read-only mode; inputting the diagnostic report into an executor agent, and parsing the report and generating a corrected file by the executor agent in a strict dependence mode; and re-executing the simulation based on the corrected file until the simulation is successful or the maximum number of iterations is reached. The application decouples the diagnosis and repair functions and restricts the read-only / strict dependence mode, so that error root cause analysis and code modification are independently completed, mutual interference is reduced, error positioning accuracy and modification result consistency are improved, and automatic closed-loop processing is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to a simulation error correction method, apparatus and system based on multi-agent collaboration. Background Technology

[0002] In the field of scientific simulation, the simulation process relies heavily on the configuration of model parameters, the setting of boundary conditions, and the selection of numerical algorithms. Due to the high degree of model coupling, the nonlinear correlation between parameters, and the complexity of the operating environment, problems such as initialization failure, convergence anomalies, computational divergence, and physical quantity out-of-bounds errors are prone to occur during simulation execution. In existing technologies, automatic repair methods based on large language models often complete error diagnosis and code modification within the same model, lacking clear functional boundaries. This leads to modifications deviating from the actual source of the problem, and the lack of an independent intermediate diagnostic layer makes it difficult to distinguish whether the problem originated in the diagnosis or repair phase when repair fails. Therefore, there is an urgent need for a simulation error correction method that decouples error diagnosis and code repair functions at the system structure level. Summary of the Invention

[0003] The purpose of this invention is to provide a simulation error correction method, device, and system based on multi-agent collaboration. By decoupling the functions of the diagnostic agent and the repair agent and constraining the read-only / strictly dependent mode, the root cause analysis of errors and code modification are completed independently in different functional modules. This reduces the mutual interference between diagnosis and repair, improves the accuracy of error location and the consistency between the modification results and the diagnostic conclusions, and realizes automated closed-loop processing from error capture to repair completion.

[0004] In a first aspect, the present invention provides a simulation error correction method based on multi-agent cooperation, applied to a simulation error correction system based on multi-agent cooperation. The system includes multiple decoupled agents that communicate with each other based on a preset standardized information interaction protocol. The method includes: The system executes scientific simulation tasks, captures error information generated during the execution of these tasks, and acquires simulation task data and historical correction records. The simulation task data includes: the current simulation configuration file, the user's original simulation requirement description, and simulation runtime environment information. Error messages, simulation task data, and historical correction records are input into the reviewer agent, which then generates a structured diagnostic report in read-only mode. The read-only mode indicates that the reviewer agent does not generate executable code and / or configuration modification instructions. The diagnostic report is input into the executor agent. In strict dependency mode, the executor agent parses the diagnostic report, generates modified code and / or configuration items, and outputs the corrected file. Strict dependency mode indicates that the executor agent does not diagnose errors on its own. The simulation task is re-executed based on the corrected file until the preset termination conditions are met. The termination conditions include successful completion of the simulation or reaching the preset maximum number of iterations. When the maximum number of iterations is reached, the automatic correction process is terminated, intermediate diagnostic reports and modification records are saved, and manual intervention is notified.

[0005] In some preferred embodiments of the present invention, before the step of outputting the corrected file, the method further includes: Perform consistency verification and / or automatic physical rationality verification; if the consistency verification conclusion is rejection, the executor AI agent is required to revise or the reviewer AI agent to re-examine the diagnostic report; if the consistency verification conclusion is a warning, the preset strategy is executed; if the automatic physical rationality verification conclusion is that there is an issue that can be adjusted, it is automatically adjusted and then re-verified; if the automatic physical rationality verification conclusion is that there is an issue that cannot be adjusted, it is transferred to human intervention.

[0006] In some preferred embodiments of the present invention, the conformance verification includes: Extract the set of modification differences between the corrected file and the original file, as well as the set of expected modification ranges specified in the diagnostic report, and verify whether the set of modification differences is included in the set of expected modification ranges. And / or, extract the expected set of parameters to be adjusted from the diagnostic report, parse the actual set of parameters to be modified from the set of modification differences, and verify whether the expected set of parameters to be adjusted is included in the actual set of parameters to be modified. And / or, map the modification ideas described in the diagnostic report and the modification summary generated by the executor agent to the vector space respectively, calculate the cosine similarity, and determine that the modification deviates from the diagnostic intent when the cosine similarity is lower than the preset threshold, and issue a warning or trigger manual review.

[0007] In some preferred embodiments of the present invention, automatic verification of physical plausibility includes: Perform dimensional consistency verification on the configuration files in the revised file to ensure that the dimensions of the input parameters and boundary conditions are correct and consistent. And / or, verify the rationality of dimensionless parameters, including Reynolds number and / or Mach number and / or Fourier number, and determine whether the dimensionless parameters are within the physically reasonable range; And / or, verify the conservation laws, including the conservation of mass and / or energy, to ensure that the boundary conditions and initial conditions meet the physical conservation requirements; And / or, verify the numerical stability, including the CFL condition and / or the Peckley number, to ensure that the corrected parameters meet the numerical stability requirements.

[0008] In some preferred embodiments of the present invention, the system includes: a verification agent; the method includes: Input the diagnostic report and the corrected documents into the verification agent for consistency verification and / or automatic verification of physical rationality.

[0009] In some preferred embodiments of the present invention, the system includes: a knowledge management intelligent agent; the method further includes: maintaining a historical case library based on the knowledge management intelligent agent, retrieving and providing similar historical cases and corresponding diagnostic reports when the reviewer intelligent agent performs diagnosis, and retrieving and providing historical successfully repaired code patterns when the executor intelligent agent performs repair.

[0010] In some preferred embodiments of the present invention, the executor agent adopts a hierarchical multi-sub-agent architecture, which includes a global coordinating agent and multiple specialized executor agents; the method further includes: The global coordinating agent breaks down the repair task into multiple sub-tasks and assigns each sub-task to a corresponding specialized execution agent. Each specialized intelligent agent executes its assigned sub-tasks in parallel; The global coordinating agent merges the modification results of various professional execution agents to generate a corrected file.

[0011] In some preferred embodiments of the present invention, the method further includes: Define a set of states; wherein the set of states includes at least one of the following: normal operation state, error capture state, diagnostic state, repair state, verification state, re-execution state, success state, and manual intervention state; Define state transition conditions, which include: when an error is detected, transition from the normal operation state to the error capture state; when information capture is completed, transition from the error capture state to the diagnostic state; when diagnosis is successful, transition from the diagnostic state to the repair state; when modification is completed, transition from the repair state to the verification state; when verification is successful, transition from the verification state to the re-execution state; when re-execution of simulation is successful, transition from the re-execution state to the success state; when re-execution of simulation fails, transition from the re-execution state to the error capture state and increment the iteration count. The execution flow is controlled by the state set and state transition conditions.

[0012] Secondly, the present invention provides a simulation error correction device based on multi-agent cooperation, applied to a simulation error correction system based on multi-agent cooperation. The system includes multiple decoupled agents that communicate with each other based on a preset standardized information interaction protocol. The device includes: The error capture and preprocessing module is used to execute scientific simulation tasks, capture error information generated during the execution of scientific simulation tasks, and obtain simulation task data and historical correction records. Among them, the simulation task data includes: the current simulation configuration file, the user's original simulation requirement description, and simulation runtime environment information. The multi-agent collaboration module is used to input error information, simulation task data, and historical correction records into the reviewer agent, which then generates a structured diagnostic report in read-only mode. The read-only mode indicates that the reviewer agent does not generate executable code and / or configuration modification instructions. The multi-agent collaboration module is also used to input the diagnostic report into the executor agent. In strict dependency mode, the executor agent parses the diagnostic report, generates modified code and / or configuration items, and outputs the corrected file. The strict dependency mode indicates that the executor agent does not diagnose errors on its own. The collaborative control and iteration management module is used to re-execute the simulation task based on the corrected file until the preset termination conditions are met. The termination conditions include successful completion of the simulation or reaching the preset maximum number of iterations. When the maximum number of iterations is reached, the automatic correction process is terminated, intermediate diagnostic reports and modification records are saved, and manual intervention is notified.

[0013] Thirdly, the present invention provides a simulation error correction system based on multi-agent cooperation, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method provided in the first aspect above.

[0014] This invention brings the following beneficial effects: This invention provides a simulation error correction method, apparatus, and system based on multi-agent collaboration. The method and apparatus are applied to a simulation error correction system based on multi-agent collaboration. The system includes multiple decoupled agents that communicate based on a pre-defined standardized information exchange protocol. The method includes: executing a scientific simulation task; capturing error information generated during the execution of the scientific simulation task; and acquiring simulation task data and historical correction records. The simulation task data includes: the current simulation configuration file, the user's original simulation requirement description, and simulation runtime environment information. The error information, simulation task data, and historical correction records are input to a reviewer agent, which generates a structured diagnostic report in read-only mode. Read-only mode indicates that the reviewer agent does not generate executable code and / or configuration modification instructions. The diagnostic report is input to an executor agent, which operates in strict dependency mode. The system parses diagnostic reports, generates modified code and / or configuration items, and outputs corrected files. The strict dependency mode indicates that the executor agent does not diagnose errors independently. Based on the corrected files, the simulation task is re-executed until a preset termination condition is met. The termination condition includes successful simulation completion or reaching a preset maximum number of iterations. When the maximum number of iterations is reached, the automatic correction process terminates, intermediate diagnostic reports and modification records are saved, and manual intervention is notified. Through functional decoupling of the diagnostic and repair agents and the constraints of read-only / strict dependency modes, root cause analysis and code modification are completed independently in different functional modules, reducing interference between diagnosis and repair, improving the accuracy of error localization and the consistency between modification results and diagnostic conclusions, and achieving automated closed-loop processing from error capture to repair completion. Attached Figure Description

[0015] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0016] Figure 1 A flowchart illustrating a simulation error correction method based on multi-agent cooperation provided in an embodiment of the present invention; Figure 2 A schematic diagram of a simulation error correction device based on multi-agent cooperation provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of a simulation error correction system based on multi-agent cooperation, provided as an embodiment of the present invention.

[0017] Icons: 310 - Error capture and preprocessing module; 320 - Multi-agent collaboration module; 330 - Collaborative control and iterative management module; 400 - Memory; 401 - Processor; 402 - Bus; 403 - Communication interface. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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 some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0019] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0020] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0021] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention. In addition, the terms "first," "second," "third," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0022] Furthermore, terms such as "horizontal," "vertical," and "sag" do not imply that components must be absolutely horizontal or suspended, but rather that they can be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal relative to "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted.

[0023] In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0024] The following detailed description of some embodiments of the present invention is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0025] This invention provides a simulation error correction method based on multi-agent collaboration, which is applied to a simulation error correction system based on multi-agent collaboration. The system includes multiple decoupled agents that communicate with each other based on a preset standardized information interaction protocol.

[0026] Specifically, the system comprises multiple decoupled agents, including at least a Reviewer Agent and a Writer Agent. "Decoupling" means that the Reviewer Agent is limited to read-only mode, meaning it does not generate any executable code or configuration modification instructions, and is only responsible for error diagnosis; the Writer Agent is limited to strict dependency mode, meaning it only performs modifications based on the diagnostic report and does not diagnose errors itself. Their functions are independent and their responsibilities are separated, thus avoiding interference between diagnosis and repair.

[0027] The reviewer agent is constructed by initializing it with a carefully designed system prompt: "You are a rigorous scientific simulation error analysis expert. Your sole responsibility is to analyze the provided error logs and configuration files and generate a comprehensive diagnostic report in natural language. The report must include the error type, possible causes, and high-level, non-code-level remediation suggestions. You must absolutely not generate any executable code or direct configuration file modification instructions." Furthermore, its diagnostic accuracy and domain expertise can be further enhanced by fine-tuning on a dedicated dataset consisting of numerous "scientific simulation error scenarios - professional diagnostic reports."

[0028] The executor agent is constructed by initializing it with a specific system prompt, explicitly stated as: "You are a precise and efficient simulation code and configuration repair expert. You will receive an analysis report provided by a diagnostic expert. Your sole responsibility is to strictly follow the guidance of this report to modify the provided original configuration file or code. You must never diagnose errors on your own or deviate from the recommendations of the diagnostic report." Similarly, fine-tuning can be performed on a dataset consisting of "professional diagnostic report - correct code / configuration file" to improve the accuracy and reliability of its repair operations.

[0029] The agents communicate with each other based on a pre-defined standardized information exchange protocol. This protocol defines the data structure of the diagnostic report, including: error_type (an enumeration of error types), error_severity (the severity level of the error), possible_causes (a list of possible causes, each with a confidence score), affected_files (a list of affected files), affected_code_range (the range of affected codes), parameters_to_adjust (a list of parameters to be adjusted), and fix_suggestion_levels (layered repair suggestions, including modification_approach and expected_modification_location). This standardized design ensures unambiguous information transmission.

[0030] See Figure 1 The flowchart shown in this embodiment of the invention provides a simulation error correction method based on multi-agent cooperation. The method includes: Step S102: Execute the scientific simulation task, capture error information generated during the execution of the scientific simulation task, and obtain the simulation task data and historical correction records; wherein, the simulation task data includes: the current simulation configuration file, the user's original simulation requirement description, and simulation runtime environment information.

[0031] Specifically, the system monitors the simulation process in real time. Monitored objects include: simulation software log files, standard output stream, standard error stream, process exit codes, and system resource usage. Once an abnormal state is detected (such as the appearance of keywords like "ERROR," "FATAL," or "CRASH" in the logs, abnormal process exit, or output results significantly exceeding physically reasonable limits), the system automatically triggers the error handling process. Captured error information includes the complete error log; the current simulation configuration file (the original configuration or code submitted by the user); the user's original simulation requirement description in natural language (e.g., "simulate fully developed turbulent flow in a pipe"); simulation runtime environment information including software version, number of parallel processes, operating system, etc.; and historical correction records (if any) of modifications from previous iterations. All information is encapsulated in a standard format and prepared for submission to the reviewer agent.

[0032] Step S104: Input the error information, simulation task data and historical correction records into the reviewer agent, and the reviewer agent generates a structured diagnostic report in read-only mode; wherein, read-only mode indicates that the reviewer agent does not generate executable code and / or configuration modification instructions.

[0033] Specifically, the reviewer agent, set to read-only mode using the aforementioned dedicated system prompts and fine-tuned on a dedicated dataset, performs the following operations: First, it parses the error log to identify key error codes and anomaly information; then, it correlates and analyzes configuration files to locate potentially erroneous configuration items or code segments; next, it combines the user's requirement description to determine whether the current error matches the expected simulation objective; finally, it synthesizes all information to generate a structured diagnostic report. This diagnostic report, primarily in natural language supplemented by structured fields, details the error type, possible causes (including primary and secondary causes), suggested repair strategies (but not specific executable code), and information on files and code locations requiring special attention. The reviewer agent's output is saved only as a diagnostic report; it does not generate any executable code or direct configuration modification instructions, ensuring the objectivity and independence of the diagnostic process.

[0034] Step S106: Input the diagnostic report into the executor agent. In strict dependency mode, the executor agent parses the diagnostic report, generates modified code and / or configuration items, and outputs the corrected file. The strict dependency mode indicates that the executor agent does not diagnose errors on its own.

[0035] Specifically, the executor agent, after being set to strict dependency mode via the aforementioned dedicated system prompts and fine-tuned on a dedicated dataset, performs the following operations: parses the diagnostic report to understand the error type and repair suggestions; locates the files and code that need modification as indicated in the diagnostic report; generates specific modification code or configuration items based on the repair approach in the diagnostic report; and outputs the corrected file. During the modification process, the executor agent strictly adheres to the principle of "no self-diagnosis": if a problem is not explicitly pointed out in the diagnostic report, the executor will not proactively make additional modifications; if the suggestions in the diagnostic report are ambiguous, the executor can request more information from the system, but will not speculate on the cause of the error. After modification, the executor agent outputs the corrected file and can generate a brief modification record explaining the specific modifications made and the basis for those modifications.

[0036] Step S108: Re-execute the simulation task based on the corrected file until the preset termination conditions are met; wherein, the termination conditions include successful completion of the simulation or reaching the preset maximum number of iterations; when the maximum number of iterations is reached, terminate the automatic correction process, save the intermediate diagnostic report and modification record, and notify manual intervention.

[0037] Specifically, the system receives the corrected file output by the executor agent, replaces the original file, and restarts the simulation task. During the re-execution of the simulation, the system also performs real-time monitoring. If the simulation completes successfully and the results meet expectations, the entire error correction process ends, and the system outputs the successful execution result. If errors still occur in the simulation, the system captures new error information, along with the current correction record (i.e., the updated historical correction record), and returns to step S102 to enter the next round of diagnosis-repair iteration.

[0038] To avoid infinite loops, the system presets a maximum number of iterations N. max (This can be dynamically adjusted according to the complexity of the task; a typical value is set to 3-5 times.) The system maintains a global iteration counter `iter`. count If an error still occurs after each re-run of the simulation, then iter count Incrementing. When iter count >N max When the automatic correction process is terminated, all intermediate diagnostic reports and modification records are saved, and manual intervention is notified. Upon termination, the system can generate a complete correction history log for manual analysis.

[0039] Furthermore, in some preferred embodiments of the present invention, before the step of outputting the corrected document, the method further includes: performing consistency verification and / or automatic physical rationality verification; wherein, if the conclusion of the consistency verification is rejection, the executor agent is required to revise or the reviewer agent is required to re-examine the diagnostic report; if the conclusion of the consistency verification is a warning, a preset strategy is executed; if the conclusion of the automatic physical rationality verification is that there is a problem that can be adjusted automatically, the verification is performed again after automatic adjustment; if the conclusion of the automatic physical rationality verification is that there is a problem that cannot be adjusted automatically, manual intervention is required.

[0040] Specifically, this embodiment provides detailed implementation methods for two verification mechanisms: Implementation methods for consistency verification: Consistency verification is used to ensure that the executor agent strictly follows the diagnostic guidelines of the reviewer agent. In one specific implementation, the system automatically compares the configuration files or code before and after modification, extracts all changed lines of code and configuration items, and generates a set of modification differences. Simultaneously, the affected_files and affected_code_range fields are extracted from the diagnostic report to form a set of expected modification ranges. Verification rules require .like Does it exist in the middle? If the modification is not approved, it will be deemed a "rejection," requiring the executor AI to modify the report or the reviewer AI to re-examine the diagnostic report.

[0041] In another implementation, the set of parameters to be adjusted is extracted from the parameters_to_adjust field of the diagnostic report. ,from The actual set of parameters modified in the parsing ,verify If a parameter requires adjustment but is not actually modified, it is judged as "rejected". When the verification passes but a semantic deviation occurs (e.g., the scope of modification is correct but the intention of modification is not consistent), the system can issue a "warning" and execute a preset strategy (such as automatic acceptance, requesting manual review, etc.).

[0042] Implementation of automated verification of physical plausibility: Automatic verification of physical rationality is based on fundamental physical laws from scientific simulation. In one implementation, the system performs dimensional consistency verification on the revised configuration file, verifying whether the unit systems of physical quantities such as velocity, pressure, density, and viscosity are consistent and whether the dimensions match. For example, if a boundary condition specifies both velocity U (m / s) and pressure P (Pa), the system verifies their compatibility in the sense of Bernoulli's equation, i.e., verifying (1 / 2)ρU 2Does it match the order of magnitude of the pressure P?

[0043] In another implementation, the system verifies key dimensionless parameters: Reynolds number Re = ρUL / μ, Mach number Ma = U / c, and Fourier number Fo = αt / L. 2 The system determines whether the flow is within a physically reasonable range. If the user's requirement is "laminar flow" and Re > 2300, a risk is identified; if Ma < 0.3 and the user selects a compressible solver, a warning is issued. Furthermore, the system verifies the conservation of mass (|∑ | ≤ ε mass Energy conservation and numerical stability conditions (CFL = UΔt / Δx ≤ CFL) max Pe Δ = UΔx / Γ ≤ 2). If a problem that can be adjusted automatically is found (such as an excessively large time step), the system will automatically adjust the parameters and re-verify; if a serious problem that cannot be adjusted automatically is found (such as an incorrect physical model selection), then manual intervention will be required.

[0044] By performing consistency verification and automatic physical rationality verification, and taking corresponding actions (rework, re-examination, automatic adjustment, manual intervention) for different verification conclusions (rejection, warning, self-adjustable, non-self-adjustable), the system achieves hierarchical processing of verification results, improving its adaptability and robustness. Simultaneously, this mechanism ensures that repair actions strictly follow the diagnostic report, avoiding invalid modifications beyond the diagnostic scope and significantly reducing the inherent "illusion" risk of large language models.

[0045] Furthermore, in some preferred embodiments of the present invention, consistency verification includes: extracting the set of modification differences between the corrected file and the original file, and the set of expected modification ranges specified in the diagnostic report, and verifying whether the set of modification differences is included in the set of expected modification ranges; and / or, extracting the set of parameters to be adjusted from the diagnostic report, parsing the set of parameters actually modified from the set of modification differences, and verifying whether the set of parameters to be adjusted is included in the set of parameters actually modified; and / or, mapping the modification idea description in the diagnostic report and the modification summary generated by the executor agent to vector spaces respectively, calculating cosine similarity, and determining that the modification deviates from the diagnostic intent when the cosine similarity is lower than a preset threshold, issuing a warning or triggering manual review.

[0046] Specifically, to ensure that the executor agent strictly follows the diagnostic guidelines of the reviewer agent, this embodiment of the invention introduces a diagnostic report consistency verification mechanism. This mechanism is executed after the executor agent completes the modifications but before outputting the corrected file. The specific verification rules include: First, consistency verification of the scope of modification: The system automatically compares the configuration files or code before and after the modification, extracts all changed lines of code and configuration items, and generates a set of modification differences. Simultaneously, the affected_files and affected_code_range fields are extracted from the diagnostic report to form a set of expected modification ranges. The verification rules require: ; In other words, all actual modifications must fall within the scope specified in the diagnostic report. The set of modifications that exceed the expected scope is defined as follows: ; like If modifications exceed the expected range, the system determines that the consistency verification has failed, refuses to output the correction file, and triggers the re-repair mechanism.

[0047] Second, modify the content parameter matching verification: extract the list of parameters to be adjusted from the parameters_to_adjust field of the diagnostic report. Differences from actual modifications The actual set of parameters modified in the parsing The verification rules require: ; This means that all parameters required to be adjusted according to the diagnostic report must be actually modified. The set of parameters not adjusted according to the diagnostic requirements is defined as follows: ; like If there are parameters that require adjustment for diagnostic purposes but have not actually been modified, the system determines that the consistency verification has failed.

[0048] Third, semantic verification of modification intent: For complex modifications that cannot be verified through simple parameter matching, this invention introduces a verification mechanism based on semantic similarity. The `modification_approach` field in the diagnostic report and the `modification_summary` field generated by the executor agent are mapped to a vector space through an embedding model to obtain the corresponding semantic vectors. ; ; Calculate the cosine similarity between the two: ; in This represents the magnitude of the vector. When the similarity is below a preset threshold: ; in The similarity threshold is typically set to 0.8. If the modification is deemed to deviate from the diagnostic intent, the system will issue a warning and allow for manual review.

[0049] Comprehensive judgment rules: Define a consistency verification result function. : ; If any of the above verification rules fails (i.e., the result is "reject"), the system will reject the output of the executor agent, provide feedback on the modification record and the reason for the verification failure to the executor agent, requiring it to revise again, or provide feedback to the reviewer agent to re-examine the accuracy of the diagnostic report. If the result is "warning", the system can choose to automatically accept, request manual review, or process according to a preset strategy.

[0050] By employing a triple mechanism of range verification, parameter matching verification, and semantic similarity verification, the system ensures that repair actions strictly adhere to the diagnostic report at the syntactic, parameter, and semantic levels. This avoids unfounded additional modifications during the execution phase, thereby reducing the probability of unreasonable modifications due to model speculation and improving system stability. In particular, semantic similarity verification can handle complex modifications that cannot be resolved through simple parameter matching, further enhancing the constraint on repair actions.

[0051] Furthermore, in some preferred embodiments of the present invention, automatic verification of physical rationality includes: performing dimensional consistency verification on the configuration file in the modified file to ensure that the dimensions of the input parameters and boundary conditions are correct and consistent; and / or, performing rationality verification on dimensionless parameters, including Reynolds number and / or Mach number and / or Fourier number, to determine whether the dimensionless parameters are within the physically reasonable range; and / or, verifying conservation laws, including mass conservation and / or energy conservation, to ensure that the boundary conditions and initial conditions meet the physical conservation requirements; and / or, verifying numerical stability, including CFL condition and / or Peckley number, to ensure that the modified parameters meet the numerical stability requirements.

[0052] Specifically, after the consistency verification passes, this embodiment of the invention further introduces an automatic physical rationality verification mechanism. This mechanism can be executed independently or integrated into a multi-agent architecture as a verification agent. Based on the fundamental physical laws of scientific simulation, this mechanism pre-verifies the corrected configuration file and expected calculation results. The main verification rules include: Dimensional Consistency Verification: Based on the principle of dimensional homogeneity in physical equations, verify the correctness of the dimensions of all input parameters and boundary conditions. For fluid simulations, verify whether the unit systems of physical quantities such as velocity, pressure, density, and viscosity are consistent and whether the dimensions match. For example, if a boundary condition specifies both velocity (m / s) and pressure (Pa), verify the compatibility of the two in the sense of Bernoulli's equation, i.e., verify... With pressure Do the orders of magnitude match, where, For density, For speed.

[0053] Second, verification of the range of dimensionless parameters: Based on similarity theory, verify whether the key dimensionless parameters are within a physically reasonable range. This mainly includes: Reynolds number verification: ; in The fluid density is expressed in kg / m³. The characteristic velocity is (m / s). The characteristic length (m) is... The dynamic viscosity is expressed in Pa·s. The system verifies whether the calculated Reynolds number is within the expected range based on user requirements (e.g., laminar flow, turbulent flow, transitional flow). For example, if the user requirement is "laminar flow,"... ,in If the critical Reynolds number is found (usually 2300 for circular pipe flow), then it is determined that there may be a risk of physical rationality.

[0054] Mach number verification: ; in The characteristic velocity is (m / s). The speed of sound is the local speed of sound (m / s). , For specific heat ratio, The gas constant is For temperature. The system verifies whether the Mach number matches the user-defined compressibility assumption. If The user selected a compressible solver, or The system issued a warning when the user selected an incompressible solver.

[0055] Fourier number verification: ; in The thermal diffusivity is (m² / s). , Thermal conductivity, Specific heat capacity at constant pressure; Time (s); The feature length is (m). The system verifies whether the Fourier number matches the time step and grid scale to ensure the stability of the time discretization. For explicit time schemes, this is typically required. To ensure numerical stability.

[0056] Third, conservation law verification: Based on the physical conservation laws, verify whether the boundary conditions and initial conditions satisfy the global conservation requirements.

[0057] Mass conservation equation (for incompressible flow): ; in To control the volume boundary, It is a velocity vector. It is an area infinitesimal vector.

[0058] Mass conservation equation (for compressible flow): ; The system verifies whether the sum of the mass flow rates at each boundary is close to zero within the numerical precision range, i.e.: ; in For the first Mass flow rate at each boundary For mass conservation tolerance (typical value taken) ).

[0059] Energy conservation verification (for steady-state problems): ; in, The heat flux density vector, The heat source term is per unit volume.

[0060] Fourth, numerical stability verification: Based on the stability conditions in computational fluid dynamics, verify whether the modified parameters meet the numerical stability requirements.

[0061] CFL condition verification: ; in The characteristic velocity is (m / s). The time step is in seconds. The grid feature size is (m). This represents the stability limit. For explicit time formats, Typically, 1.0 is used; for implicit schemes, larger values ​​can be used but are limited by precision. The system automatically calculates the CFL number based on the solver type. If the stability boundary is exceeded, it is recommended to adjust the time step or mesh size.

[0062] For multidimensional problems, the CFL condition can be generalized as follows: ; Pecley number verification: ; in The characteristic velocity is (m / s). is the grid size (m). The diffusion coefficient (m² / s) is given by the momentum equation, which is the kinematic viscosity. For the energy equation, thermal diffusivity This condition ensures the stability of the numerical solution and avoids non-physical oscillations in convection-dominated problems. When When using this method, it is recommended to use an upwind grid or a finer mesh.

[0063] Von Neumann stability condition (for linearization problems): ; in As the amplification factor, This represents the phase angle of the Fourier mode. The system can evaluate the stability of the numerical solution based on the theoretical amplification factor of the selected numerical scheme, combined with the current grid scale and time step.

[0064] If the automatic physical rationality verification finds potential problems, the system generates a verification report and can automatically trigger secondary repairs (such as adjusting the time step, modifying mesh parameters, changing the numerical format, etc.) according to preset strategies, or escalate the problem to manual handling.

[0065] By verifying dimensionality, dimensionless parameters, conservation laws, and numerical stability, the scientific rationality of the corrected configuration is ensured from both physical laws and numerical computation methods. This mechanism can detect potential problems such as dimensional inconsistencies, out-of-range dimensionless parameters, violations of conservation laws, and numerical instability in advance, avoiding invalid simulation runs, reducing waste of computational resources, and improving the success rate of simulation tasks. In particular, the verification of CFL conditions and Peckley numbers ensures the stability and convergence of numerical calculations.

[0066] Furthermore, in some preferred embodiments of the present invention, the system includes: a verification agent; the method includes: inputting a diagnostic report and a corrected document into the verification agent, and performing consistency verification and / or automatic physical rationality verification.

[0067] Specifically, the system provided in this embodiment adds a Validator Agent to the existing reviewer and executor roles, separating the aforementioned consistency verification and automatic physical rationality verification functions. The Validator Agent is responsible for pre-simulation verification of the modified results output by the executor agent, assessing the potential risks of the modified scheme. If the verification passes, the simulation execution phase begins; if the verification fails, the verification report is fed back to the executor agent for secondary modifications, or to the reviewer agent for re-diagnosis. This architecture further strengthens the division of labor, enabling more efficient handling of complex physical verification tasks.

[0068] Furthermore, the verification agent is an independent agent specifically responsible for pre-simulation verification of the corrected file output by the executor agent. This verification agent is also built upon a large language model and professionally trained using dedicated system prompts and fine-tuning datasets. Its workflow is as follows: it receives the diagnostic report generated by the reviewer agent and the corrected file output by the executor agent, and then performs the aforementioned consistency verification (including modification range verification, parameter matching verification, and semantic similarity verification) and / or automatic physical rationality verification (including dimensional verification, dimensionless parameter verification, conservation law verification, and numerical stability verification). After verification, the verification agent feeds back the verification conclusion (pass / reject / warning, adjustable / not adjustable) to the executor agent or reviewer agent. If the conclusion is rejection, a re-revision is triggered; if the conclusion is warning, a preset strategy is executed; if the conclusion is adjustable, automatic adjustment and re-verification are performed; if the conclusion is not adjustable, manual intervention is required. By setting up an independent verification agent, the verification function is decoupled from the reviewer and executor, achieving a more refined division of labor. The verification agent can focus on risk assessment and pre-simulation, which improves the accuracy and efficiency of verification, while making the system architecture more modular, facilitating expansion and maintenance.

[0069] Furthermore, in some preferred embodiments of the present invention, the system includes: a knowledge management intelligent agent; the method further includes: maintaining a historical case library based on the knowledge management intelligent agent, retrieving and providing similar historical cases and corresponding diagnostic reports when the reviewer intelligent agent performs diagnosis, and retrieving and providing historical successfully repaired code patterns when the executor intelligent agent performs repair.

[0070] Specifically, the knowledge management agent is responsible for maintaining a historical case library, which stores historical error cases, diagnostic reports, remediation plans, and their effectiveness evaluations. Its operation is as follows: When the reviewer agent performs a diagnosis, the knowledge management agent retrieves the case most similar to the current error from the case library (e.g., vector similarity matching based on error logs), providing similar historical cases and corresponding diagnostic reports as references to help the reviewer agent more accurately pinpoint the root cause of the error. When the executor agent performs a remediation, the knowledge management agent retrieves and provides code patterns from historically successful remediations (e.g., code snippets for remediation of the same error type), assisting the executor agent in generating more reliable modification plans. This mechanism achieves continuous learning capabilities through Retrieval-Enhanced Generation (RAG) technology; the accuracy of diagnosis and remediation continuously improves with increased usage. The knowledge management agent can also periodically update and optimize the case library, such as removing low-quality cases and merging similar cases. By maintaining the historical case library and providing similar case references for other agents, the knowledge management agent enables continuous learning capabilities. With increased usage, the accuracy of diagnosis and remediation continuously improves, allowing the system to self-evolve and adapt to more types of simulated error scenarios.

[0071] Furthermore, in some preferred embodiments of the present invention, the executor agent adopts a hierarchical multi-sub-agent architecture, which includes a global coordinating agent and multiple specialized execution agents; the method further includes: the global coordinating agent decomposes the repair task into multiple sub-tasks and assigns each sub-task to a corresponding specialized execution agent; each specialized execution agent executes the assigned sub-task in parallel; the global coordinating agent merges the modification results of each specialized execution agent to generate a corrected file.

[0072] Specifically, when a repair task involves multiple different types of errors (e.g., simultaneous boundary condition errors, solver parameter errors, and mesh quality issues), the global coordinating agent first understands the overall repair objective and then decomposes the repair task into three sub-tasks: boundary condition repair, solver parameter repair, and mesh quality repair. The global coordinating agent assigns each sub-task to a corresponding specialized execution agent: the boundary condition repair agent, the solver parameter repair agent, and the mesh repair agent. Each specialized execution agent executes its assigned sub-task in parallel, each outputting targeted modification fragments. Finally, the global coordinating agent merges the modification results from all specialized execution agents to generate a unified, corrected file.

[0073] For large-scale simulation configurations, repair tasks may involve the coordinated modification of dozens of parameter files. A global coordinating agent can decompose the repair task into multiple independent subtasks based on file dependencies, assigning them to multiple specialized execution agents (e.g., multiple parameter repair agents). Each agent modifies different files or parameter segments in parallel, and finally, the global coordinating agent merges all modifications. This architecture can significantly improve the efficiency of repairing complex errors and support collaborative repair across multiple professional fields.

[0074] By employing a hierarchical multi-sub-agent architecture, complex repair tasks are decomposed into multiple sub-tasks executed in parallel, significantly improving the efficiency of repairing complex errors and supporting collaborative repair across multiple professional fields. This architecture enhances the system's ability to handle complex simulation error scenarios while maintaining the principle of decoupling diagnosis and repair.

[0075] Furthermore, in some preferred embodiments of the present invention, the method further includes: defining a state set; wherein the state set includes at least one of the following: normal operation state, error capture state, diagnostic state, repair state, verification state, re-execution state, success state, and manual intervention state; defining state transition conditions, the state transition conditions including: when an error is detected, transitioning from the normal operation state to the error capture state; when information capture is completed, transitioning from the error capture state to the diagnostic state; when diagnosis is successful, transitioning from the diagnostic state to the repair state; when modification is completed, transitioning from the repair state to the verification state; when verification is passed, transitioning from the verification state to the re-execution state; when re-execution simulation is successful, transitioning from the re-execution state to the success state; when re-execution simulation fails, transitioning from the re-execution state to the error capture state and incrementing the iteration count; and controlling the execution flow of the method according to the state set and state transition conditions.

[0076] Specifically, refer to the system state set shown in Table 1 and the state transition conditions shown in Table 2. The system controls the execution flow of the method based on the above state set and state transition conditions. During each state transition, the system records the current state, transition time, triggering conditions, and key data (such as diagnostic report ID, modification record ID, verification results, etc.) to form a complete state transition log for post-event analysis and system optimization.

[0077] Table 1

[0078] Table 2

[0079] System maintains global iteration counter It increments each time it returns from the [re-execution state] to the [error capture] state. When iter count >N max Regardless of the current state, it will be forcibly transferred to the S8 manual intervention state to avoid infinite loop.

[0080] A finite state machine control model is used to achieve precise control over the entire automatic correction process, ensuring its controllability and traceability. Each state transition records the state, triggering conditions, and key data, forming a complete state transition log for easy post-analysis and system optimization. This mechanism enables the system to distinguish whether a problem originated in the diagnosis or repair phase when a repair fails, enhancing the system's interpretability and debuggability.

[0081] The method provided in this invention uses a multi-agent collaborative architecture that decouples the diagnostic agent and the repair agent, enabling error root cause analysis and code modification to be completed independently in different functional modules. This reduces interference between diagnosis and repair, improves the accuracy of error localization, and enhances the consistency between modification results and diagnostic conclusions.

[0082] The method provided in this invention establishes a standardized structured diagnostic report as an intermediate semantic layer, which limits the scope of modification of repair behavior, avoids unfounded additional modifications during the execution phase, reduces the probability of unreasonable modifications caused by model speculation, and improves the stability of system operation.

[0083] The method provided in this invention improves the controllability and convergence stability of the automatic repair process by constructing a simulation execution monitoring and iterative control mechanism to realize a closed-loop processing flow from error capture, diagnosis and analysis, code repair to re-execution.

[0084] The method provided in this invention, by retaining diagnostic reports and modification records, enables full traceability of the error analysis path and repair behavior, thereby enhancing the interpretability and debuggability of the system.

[0085] In the embodiments of the present invention, the multi-agent architecture supports module expansion (such as adding a verification agent or a knowledge management agent) while maintaining the principle of decoupling the diagnostic and repair functions, thereby improving the system's analysis depth and processing capabilities in complex simulation error scenarios.

[0086] Through the above structural design, the embodiments of the present invention realize the automated operation of the scientific simulation error handling process, reduce the frequency of manual intervention, and improve the continuous operation capability of the system in batch simulation tasks.

[0087] For example, consider an open-source computational fluid dynamics software widely used for simulating industrial flow and heat transfer. Users define boundary conditions, initial conditions, and solver parameters using the Python script file cs_user_scripts.py.

[0088] Initial state: The user submits a Code_Saturne simulation task to calculate a pipe flow problem. However, in cs_user_scripts.py, the inlet boundary conditions are improperly set, specifically, the boundary type declaration is missing or the physical parameters are undefined, causing the simulation to crash during the initialization phase.

[0089] Step 1: Simulation execution and error capture (state S0→S1).

[0090] The system initiates the Code_Saturne simulation task and monitors the simulation's running status in real time. The simulation program crashes during the initialization phase, outputting error information to the standard error stream and log files. The system captures the critical error logs.

[0091] The system simultaneously captures the contents of the current cs_user_scripts.py configuration file, the user-submitted simulation requirement description ("simulate fully developed turbulent flow in a pipe"), and simulation runtime environment information (Code_Saturne version 7.0, number of parallel processes 4, etc.). All this information is encapsulated in a standard input format, ready to be submitted to the reviewer agent.

[0092] Step 2: Reviewer agent diagnosis (state S1→S2).

[0093] The system submits the error information captured in step one to the reviewer agent. The reviewer agent is constrained by its dedicated system prompt, which reads: "You are a rigorous scientific simulation error analysis expert, specializing in CFD software such as Code_Saturne. Your sole responsibility is to analyze the provided error logs and configuration files and generate a comprehensive diagnostic report in natural language. The report must include the error type, possible causes, and high-level, non-code-level remediation suggestions. You must absolutely not generate any executable code or direct configuration file modification instructions." After analyzing the error logs and the cs_user_scripts.py file, the reviewer agent generates the following structured diagnostic report: { "error_type": "Boundary condition definition missing", "error_severity": "High (caused initialization crash)", "possible_causes": [ { "cause": "Velocity condition is not defined at inlet boundary". "confidence": 0.95, "evidence": "The error log explicitly states that velocity needs to be specified." }, { "cause": "An error in the boundary type declaration caused Code_Saturne to fail to recognize the boundary". "confidence": 0.70, "evidence": "Check the code segments related to inlets in cs_user_scripts.py" } ], "affected_files": ["cs_user_scripts.py"], "affected_code_range": "The function cs_user_boundary_conditions defines the boundary conditions in the file", "fix_suggestion_levels": { "modification_approach": "In the boundary condition definition function of cs_user_scripts.py, a velocity definition needs to be added for the 'inlet' boundary. Based on the user requirement of 'simulating fully developed turbulent flow in the pipe,' a fully developed turbulent velocity profile should be set." "expected_modification_location": "The code block related to the boundary 'inlet' within the function cs_user_boundary_conditions in the cs_user_scripts.py file". "parameters_to_adjust": [ { "parameter": "velocity", "suggested_value_type": "A fully developed turbulent velocity profile (e.g., 1 / 7 law) or uniform inflow velocity plus turbulence intensity", "reason": "Satisfies the inlet conditions for fully developed turbulent flow" } ] }, "review_notes": "The error is very typical, caused by incomplete boundary condition definitions. After fixing it, the initialization phase should pass." } The reviewer agent only outputs this diagnostic report and does not generate any executable code, ensuring the objectivity of the diagnosis.

[0094] Step 3: The executor agent repairs (state S2→S3).

[0095] The system submits the diagnostic report generated in step two, along with the original cs_user_scripts.py file, error logs, and user requirement description, to the executor agent. The executor agent is constrained by its dedicated system prompt, which reads: "You are a precise and efficient Code_Saturne simulation code repair expert. You will receive an analysis report provided by a diagnostic expert. Your sole responsibility is to strictly follow the guidance in this report to modify the provided original configuration file or code. You must never diagnose errors on your own or deviate from the recommendations in the diagnostic report." The executor agent parses the diagnostic report, focusing on the affected_files, affected_code_range, and fix_suggestion_levels sections. It locates the function cs_user_boundary_conditions in the cs_user_scripts.py file that defines boundary conditions, and finds the code segment related to the boundary inlet. The original code might look like this: def cs_user_boundary_conditions(domain): """Define boundary conditions.""" bc_inlet = domain.add_boundary_condition("inlet", "inlet") # Speed ​​definition missing # bc_inlet.velocity = [1.0, 0.0, 0.0] # This line is commented out Based on the diagnostic report's recommendations (setting a fully developed turbulent velocity profile), the executor agent modified the code as follows: { "modified_files": ["cs_user_scripts.py"], "modification_summary": "Added a velocity definition to the inlet boundary 'inlet', setting it to a 1 / 7th power velocity profile; added definitions for turbulence intensity and length scale." "modification_basis": "Based on the fix_suggestion_levels in the diagnostic report, meet the user's requirement of 'fully developing turbulent flow'." "verification_notes": "The revised code passed the syntax check, and all required parameters have been defined." } Step 4: Re-execute the simulation after correction (state S3→S4).

[0096] The system receives the corrected cs_user_scripts.py file output by the executor agent, replaces the original file, and restarts the Code_Saturne simulation task.

[0097] The simulation successfully completed the entire process of initialization, iterative calculation, and post-processing, outputting flow field results that met expectations. The system detected that the simulation had successfully ended, and the process terminated.

[0098] This invention provides a simulation error correction method based on multi-agent collaboration, applied to a simulation error correction system based on multi-agent collaboration. The system includes multiple decoupled agents that communicate based on a preset standardized information interaction protocol. The method includes: executing a scientific simulation task; capturing error information generated during the execution of the scientific simulation task; and acquiring simulation task data and historical correction records. The simulation task data includes: the current simulation configuration file, the user's original simulation requirement description, and simulation runtime environment information. The error information, simulation task data, and historical correction records are input to a reviewer agent, which generates a structured diagnostic report in read-only mode. Read-only mode indicates that the reviewer agent does not generate executable code and / or configuration modification instructions. The diagnostic report is input to an executor agent, which... In strict dependency mode, the agent parses the diagnostic report, generates modified code and / or configuration items, and outputs the corrected file. Strict dependency mode indicates that the agent does not diagnose errors itself. Based on the corrected file, the simulation task is re-executed until a preset termination condition is met. The termination condition includes successful simulation completion or reaching a preset maximum number of iterations. When the maximum number of iterations is reached, the automatic correction process terminates, intermediate diagnostic reports and modification records are saved, and manual intervention is notified. Through functional decoupling of the diagnostic agent and the repair agent, and the constraints of read-only / strict dependency mode, error root cause analysis and code modification are completed independently in different functional modules. This reduces interference between diagnosis and repair, improves the accuracy of error localization and the consistency between modification results and diagnostic conclusions, and achieves automated closed-loop processing from error capture to repair completion.

[0099] Based on the above embodiments, this invention provides a simulation error correction device based on multi-agent cooperation, applied to a simulation error correction system based on multi-agent cooperation. The system includes multiple decoupled agents that communicate with each other based on a preset standardized information interaction protocol; see also Figure 2 The diagram shown illustrates a simulation error correction device based on multi-agent cooperation, according to an embodiment of the present invention. The device includes: The error capture and preprocessing module 310 is used to execute scientific simulation tasks, capture error information generated during the execution of scientific simulation tasks, and obtain simulation task data and historical correction records; wherein, the simulation task data includes: the current simulation configuration file, the user's original simulation requirement description, and simulation runtime environment information; The multi-agent collaboration module 320 is used to input error information, simulation task data and historical correction records into the reviewer agent, which generates a structured diagnostic report in read-only mode; wherein, read-only mode indicates that the reviewer agent does not generate executable code and / or configuration modification instructions; The multi-agent collaboration module 320 is also used to input the diagnostic report into the executor agent. In strict dependency mode, the executor agent parses the diagnostic report, generates modified code and / or configuration items, and outputs the corrected file. The strict dependency mode indicates that the executor agent does not diagnose errors on its own. The collaborative control and iteration management module 330 is used to re-execute the simulation task based on the corrected file until the preset termination conditions are met. The termination conditions include successful completion of the simulation or reaching the preset maximum number of iterations. When the maximum number of iterations is reached, the automatic correction process is terminated, the intermediate diagnostic report and modification record are saved, and manual intervention is notified.

[0100] Furthermore, in some preferred embodiments of the present invention, the apparatus further includes: a compliance verification module, used to perform consistency verification and / or automatic physical reasonableness verification; wherein, if the consistency verification conclusion is rejection, the executor AI agent is required to revise or the reviewer AI agent to re-examine the diagnostic report; if the consistency verification conclusion is a warning, a preset strategy is executed; if the automatic physical reasonableness verification conclusion is that there is an issue that can be adjusted automatically, the verification is performed again after automatic adjustment; if the automatic physical reasonableness verification conclusion is that there is an issue that cannot be adjusted automatically, manual intervention is required.

[0101] Furthermore, in some preferred embodiments of the present invention, the compliance verification module includes: a consistency verification engine module, used to extract the set of modification differences between the corrected file and the original file, and the set of expected modification ranges specified in the diagnostic report, and verify whether the set of modification differences is included in the set of expected modification ranges; and / or, to extract the set of expected adjustments from the diagnostic report, parse the set of actual modifications from the set of modification differences, and verify whether the set of expected adjustments is included in the set of actual modifications; and / or, to map the modification idea description in the diagnostic report and the modification summary generated by the executor agent to vector spaces respectively, calculate the cosine similarity, and when the cosine similarity is lower than a preset threshold, determine that the modification deviates from the diagnostic intent, issue a warning or trigger manual review.

[0102] Furthermore, in some preferred embodiments of the present invention, the compliance verification module includes: a physical verification engine module, used to perform dimensional consistency verification on the configuration file in the modified file to ensure that the dimensions of the input parameters and boundary conditions are correct and consistent; and / or, to perform rationality verification on dimensionless parameters, including Reynolds number and / or Mach number and / or Fourier number, to determine whether the dimensionless parameters are within the physically reasonable range; and / or, to verify conservation laws, including mass conservation and / or energy conservation, to ensure that the boundary conditions and initial conditions meet the physical conservation requirements; and / or, to verify numerical stability, including CFL conditions and / or Peckley number, to ensure that the modified parameters meet the numerical stability requirements.

[0103] Furthermore, in some preferred embodiments of the present invention, the system includes: a verification agent; and a compliance verification module, which is further configured to input diagnostic reports and corrected documents into the verification agent for consistency verification and / or automatic verification of physical rationality.

[0104] Furthermore, in some preferred embodiments of the present invention, the system includes: a knowledge management intelligent agent; the device further includes: a knowledge management module, used to maintain a historical case library based on the knowledge management intelligent agent, retrieve and provide similar historical cases and corresponding diagnostic reports when the reviewer intelligent agent performs diagnosis, and retrieve and provide historical successfully repaired code patterns when the executor intelligent agent performs repair.

[0105] Furthermore, in some preferred embodiments of the present invention, the executor agent adopts a hierarchical multi-sub-agent architecture, which includes a global coordinating agent and multiple specialized execution agents; the multi-agent collaboration module 320 is also used for the global coordinating agent to decompose the repair task into multiple sub-tasks and assign each sub-task to a corresponding specialized execution agent; each specialized execution agent executes the assigned sub-task in parallel; the global coordinating agent merges the modification results of each specialized execution agent to generate a corrected file.

[0106] Furthermore, in some preferred embodiments of the present invention, the apparatus further includes: a state management module, used to define a state set; wherein the state set includes at least one of the following: normal operation state, error capture state, diagnostic state, repair state, verification state, re-execution state, success state, and manual intervention state; defining state transition conditions, the state transition conditions including: when an error is detected, transitioning from the normal operation state to the error capture state; when information capture is completed, transitioning from the error capture state to the diagnostic state; when diagnosis is successful, transitioning from the diagnostic state to the repair state; when modification is completed, transitioning from the repair state to the verification state; when verification is passed, transitioning from the verification state to the re-execution state; when re-execution simulation is successful, transitioning from the re-execution state to the success state; when re-execution simulation fails, transitioning from the re-execution state to the error capture state and incrementing the iteration count; and controlling the execution flow of the method according to the state set and state transition conditions.

[0107] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the simulation error correction device based on multi-agent collaboration described above can be referred to the corresponding process in the embodiments of the simulation error correction method based on multi-agent collaboration mentioned above, and will not be repeated here.

[0108] This invention also provides a simulation error correction system based on multi-agent cooperation, used to run a simulation error correction method based on multi-agent cooperation; see [link to related documentation]. Figure 3 The diagram shown is a schematic of a simulation error correction system based on multi-agent collaboration provided by an embodiment of the present invention. The simulation error correction system based on multi-agent collaboration includes a memory 400 and a processor 401. The memory 400 is used to store one or more computer instructions, and the one or more computer instructions are executed by the processor 401 to implement the simulation error correction method based on multi-agent collaboration described above.

[0109] Furthermore, Figure 3 The simulation error correction system based on multi-agent collaboration shown also includes a bus 402 and a communication interface 403. The processor 401, the communication interface 403 and the memory 400 are connected through the bus 402.

[0110] The memory 400 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 403 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 402 can be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0111] Processor 401 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 401 or by instructions in software form. Processor 401 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 400, and processor 401 reads information from memory 400 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0112] Furthermore, this embodiment also provides a modular composition of a simulation error correction system based on multi-agent cooperation to support the implementation of the above method: The system includes the following functional modules: The simulation execution engine module is responsible for executing scientific simulation tasks, monitoring the simulation's running status, capturing error information, and re-executing the simulation after correction. This module interfaces with various scientific simulation software (such as Code_Saturne, OpenFOAM, ANSYS, Abaqus, etc.) through standard interfaces, enabling unified scheduling and monitoring of different simulation software.

[0113] Error capture and preprocessing module: Analyzes various information output by the simulation execution engine in real time. Through techniques such as keyword matching, regular expressions, and anomaly pattern recognition, it automatically identifies the time and type of error occurrence, cleans, compresses, and structures the error logs, and extracts key information for subsequent analysis.

[0114] Multi-agent collaboration module: This module comprises multiple functional agents deployed according to actual needs, including at least a reviewer agent and an executor agent, and can be expanded to include a verification agent, a knowledge management agent, a professional diagnostic agent, etc. Each agent is built based on a large language model, implements its own functions through specialized system prompts and fine-tuning datasets, and communicates and collaborates through standardized interfaces.

[0115] Consistency Verification Engine Module: Implements consistency verification of modification scope, parameter matching verification, and semantic similarity verification to ensure that modifications made by the executor agent strictly follow the diagnostic report.

[0116] The physics verification engine module implements dimensional consistency verification, dimensionless parameter verification, conservation law verification, and numerical stability verification to ensure that the corrected configuration meets the requirements of physical laws and numerical stability.

[0117] The Collaborative Control and Iterative Management module implements a finite state machine control model, coordinating the workflows of the modules mentioned above. It manages the storage and transmission of diagnostic reports and modification records, controls state transitions and iteration counts, and terminates the process upon reaching the maximum number of iterations or upon successful completion. This module also provides a human-machine interface, allowing manual viewing of intermediate results and intervention in the correction process.

[0118] Knowledge Base and History Module: Stores historical error cases, diagnostic reports, repair solutions and their effectiveness evaluations. It supports each agent to refer to similar historical cases through retrieval and enhanced generation methods, thereby continuously improving the accuracy of diagnosis and repair.

[0119] The above modules work together to achieve fully automated closed-loop correction of errors in scientific simulation.

[0120] This invention also provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are called and executed by a processor, they cause the processor to implement the aforementioned simulation error correction method based on multi-agent cooperation. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0121] The computer program products of the simulation error correction method, apparatus and system based on multi-agent cooperation provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0122] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and / or device described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0123] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0124] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0125] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A simulation error correction method based on multi-agent cooperation, characterized in that, An application to a simulation error correction system based on multi-agent cooperation; the method includes: Perform scientific simulation tasks, capture error information generated during the execution of the scientific simulation tasks, and obtain the data and historical correction records of the simulation tasks; The error information, the simulation task data, and the historical correction records are input into the reviewer agent, which then generates a structured diagnostic report in read-only mode. The diagnostic report is input into the executor agent. The executor agent parses the diagnostic report in strict dependency mode, generates modified code and / or configuration items, and outputs the corrected file. The simulation task is re-executed based on the corrected file until the preset termination condition is met.

2. The method according to claim 1, characterized in that, Prior to the step of outputting the corrected file, the method further includes: Perform consistency verification and / or automatic physical plausibility verification; wherein, if the consistency verification concludes as rejection, the executor AI is required to revise or the reviewer AI is required to re-examine the diagnostic report; if the consistency verification concludes as a warning, a preset strategy is executed; if the automatic physical plausibility verification concludes as an issue that can be adjusted, it is automatically adjusted and then re-verified; if the automatic physical plausibility verification concludes as an issue that cannot be adjusted, it is switched to manual intervention.

3. The method according to claim 2, characterized in that, The consistency verification includes: Extract the set of modification differences between the corrected file and the original file, and the set of expected modification ranges specified in the diagnostic report, and verify whether the set of modification differences is included in the set of expected modification ranges; And / or, extract the expected set of parameters to be adjusted from the diagnostic report, parse the actual set of parameters to be modified from the set of modification differences, and verify whether the expected set of parameters to be adjusted is included in the actual set of parameters to be modified; And / or, map the modification idea description in the diagnostic report and the modification summary generated by the executor agent to the vector space respectively, calculate the cosine similarity, and when the cosine similarity is lower than a preset threshold, determine that the modification deviates from the diagnostic intention, issue a warning or trigger manual review.

4. The method according to claim 2, characterized in that, The automatic verification of physical rationality includes: The configuration files in the revised file are subjected to dimension consistency verification to ensure that the dimensions of the input parameters and boundary conditions are correct and consistent. And / or, perform a rationality verification on the dimensionless parameters, which include the Reynolds number and / or Mach number and / or Fourier number, and determine whether the dimensionless parameters are within the physically reasonable range; And / or, verify the conservation laws, including mass conservation and / or energy conservation, to ensure that the boundary conditions and initial conditions meet the physical conservation requirements; And / or, verify the numerical stability, including the CFL condition and / or the Peckley number, to ensure that the corrected parameters meet the numerical stability requirements.

5. The method according to claim 1, characterized in that, The system includes: a verification agent; the method includes: The diagnostic report and the revised document are input into the verification agent for consistency verification and / or automatic verification of physical rationality.

6. The method according to claim 1, characterized in that, The system includes a knowledge management agent; the method further includes: maintaining a historical case library based on the knowledge management agent, retrieving and providing similar historical cases and corresponding diagnostic reports when the reviewer agent performs diagnosis, and retrieving and providing historically successful repair code patterns when the executor agent performs repair.

7. The method according to claim 1, characterized in that, The executor agent adopts a hierarchical multi-sub-agent architecture, which includes a global coordinating agent and multiple specialized execution agents; the method further includes: The global coordination agent decomposes the repair task into multiple sub-tasks and assigns each sub-task to a corresponding specialized execution agent. Each of the aforementioned specialized intelligent agents executes the assigned sub-tasks in parallel; The global coordinating agent merges the modification results of each of the specialized execution agents to generate the corrected file.

8. The method according to claim 1, characterized in that, The method further includes: Define a set of states; wherein the set of states includes at least one of the following: normal operation state, error capture state, diagnostic state, repair state, verification state, re-execution state, success state, and manual intervention state; Define state transition conditions, which include: when an error is detected, transition from the normal operation state to the error capture state; when information capture is completed, transition from the error capture state to the diagnostic state; when diagnosis is successful, transition from the diagnostic state to the repair state; when modification is completed, transition from the repair state to the verification state; when verification is successful, transition from the verification state to the re-execution state; when re-execution simulation is successful, transition from the re-execution state to the success state; when re-execution simulation fails, transition from the re-execution state to the error capture state and increment the iteration count. The execution flow of the method is controlled based on the set of states and the state transition conditions.

9. A simulation error correction device based on multi-agent cooperation, characterized in that, An apparatus for use in a simulation error correction system based on multi-agent cooperation; the apparatus includes: The error capture and preprocessing module is used to execute scientific simulation tasks, capture error information generated during the execution of the scientific simulation tasks, and obtain the data and historical correction records of the simulation tasks. A multi-agent collaboration module is used to input the error information, the simulation task data, and the historical correction records into the reviewer agent, which then generates a structured diagnostic report in read-only mode. The multi-agent collaboration module also inputs the diagnostic report into the executor agent. In strict dependency mode, the executor agent parses the diagnostic report, generates modified code and / or configuration items, and outputs the corrected file. The collaborative control and iterative management module is used to re-execute the simulation task based on the corrected file until the preset termination condition is met.

10. A simulation error correction system based on multi-agent cooperation, characterized in that, The method includes a processor and a memory, the memory storing computer-executable instructions executable by the processor, the processor executing the computer-executable instructions to implement the method according to any one of claims 1 to 8.