A finite element model data double output method based on a large language model
By constructing domain-specific system prompts and deterministic engineering calculation tools, consistent finite element analysis scripts and structured model data are generated, solving the problems of limited output length and inconsistency in existing technologies, and realizing an efficient and reliable finite element modeling process.
Patent Information
- Application Number
- CN202611404059.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-10
- Publication Date
- 2026-11-24
AI Technical Summary
Existing finite element analysis modeling methods suffer from limitations in output length, inconsistencies between scripts and structured data, a lack of clear termination and interruption mechanisms, and a lack of integration with engineering domain standards, resulting in generated results that do not meet actual needs.
The system constructs domain-specific prompts, combines them with deterministic engineering calculation tools to generate finite element analysis scripts and structured model data, uses range objects to replace item-by-item enumeration, and controls the generation process through a low-quality retrieval termination mechanism and a user interruption mechanism.
It enables the generation of consistent finite element analysis scripts and structured model data in the same modeling task, reduces output length, provides a unified data interface, and improves the reliability of the generated results and the efficiency of resource utilization.
Smart Images

Figure CN123159012A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of computer simulation technology, and relates to finite element simulation modeling technology in computer-aided engineering (CAE), specifically to a dual output method for finite element model data based on a large language model. Background Technology
[0002] Finite element analysis models typically include geometric parameters, nodal coordinates, element connection relationships, material constitutive parameters, section properties, local coordinate transformations, boundary conditions, loads, and analysis control parameters. In computer simulation workflows, existing modeling methods mainly include graphical interface template modeling, manually written solver scripts, and code generation assisted by general-purpose large language models.
[0003] The first method is graphical interface template modeling. Graphical interface templates are suitable for predefined standard structures, but when the structural form, cross-section, or connection method exceeds the template's coverage, the template needs to be redeveloped, which is time-consuming, costly, and lacks flexibility.
[0004] The second method is to manually write solver scripts. Manually writing scripts requires users to be familiar with the command names, parameter order, and engineering modeling rules of the finite element solver, which has a high learning cost and is prone to modeling defects such as numbering conflicts, inconsistent units, incorrect local coordinate directions, or incorrect element connections.
[0005] The third approach involves using a general-purpose large language model to assist in code generation. While general-purpose large language models can generate scripts, they typically only return text code, which is difficult for databases, visualization programs, or deterministic post-processing programs to directly parse. Furthermore, general-purpose large language models lack constraints on units, coordinate systems, mesh generation, material parameters, and command formats specific to engineering domains. Therefore, their generated results may not conform to engineering realities, leading to incorrect analysis results or even solver errors.
[0006] The above three methods also share the following common technical problems: First, there is a contradiction between the limited output length and the need for item-by-item enumeration. If a large language model is required to write hundreds to thousands of nodes and units into a structured array item by item, the length of the output text will increase linearly with the number of nodes or units, easily reaching the maximum output length of the model, resulting in truncated, incomplete, and unusable data.
[0007] Secondly, inconsistencies arise from the separate generation of scripts and structured data. If scripts and structured data are generated separately, the two generation processes may use different numbering or different calculation results, leading to inconsistencies in node coordinates, element topology, section numbering, and material parameters, making it impossible for the two types of outputs to corroborate each other.
[0008] Third, there is a lack of clear termination and interruption mechanisms. When the search quality is low or the user wishes to stop midway, the existing generation process lacks clear termination and interruption mechanisms, resulting in invalid search calls and wasted generation resources.
[0009] Therefore, there is a need in this field for a dual-output method that can combine engineering specifications, computational tools, and large language model generation processes, so that scripts and structured model data come from the same input and the same tool computation results, and adopts a reversible compact representation of rule nodes and rule units, thereby reducing output length and providing a unified data interface for subsequent parsing. Summary of the Invention
[0010] The technical problem to be solved by this invention is: how to enable a large language model to simultaneously generate consistent finite element analysis scripts and structured model data in the same modeling task while adhering to engineering field standards, control the output length of the structured data to avoid truncation, and provide a clear termination and interruption mechanism for the retrieval and generation process.
[0011] To address the aforementioned technical problems, this invention provides a dual-output method for finite element model data based on a large language model, comprising the following steps: S1. Construct domain specification system prompts, read persistent project convention files, and inject the modeling specifications of the target engineering domain into the system prompts of the large language model; S2. Receive engineering parameters input by the user, organize the engineering parameters into a structured parameter description, and use the structured parameter description as the data source for the current modeling task; S3. Invoke the knowledge retrieval tool and the deterministic engineering calculation tool. The knowledge retrieval tool returns the command syntax and examples of the target solver, and the deterministic engineering calculation tool returns the numerical values and reference identifiers used for modeling based on the engineering parameters. S4. The large language model simultaneously generates a finite element analysis script for the target solver and structured model data wrapped with preset tags that is independent of the solver in the final response of the current modeling task. The finite element analysis script and the structured model data are generated based on the same structured parameter description and the same tool return results. S5. The regularly distributed node sequence and cell sequence in the structured model data are compressed using range representation, and the enumeration of each node sequence and cell sequence is replaced by a range object, wherein the range object includes an identifier range and coordinate information. S6. Parse the final response, identify and extract the structured model data through the preset marker, perform syntax parsing on the extracted structured model data, save the parsed structured model data as message content and display it on the front end.
[0012] Furthermore, the modeling specifications mentioned in step S1 include unit system rules, global and local coordinate system conventions, mesh generation rules, material parameter rules, connection simulation rules, command format, and output data mode; after the persistent engineering convention file is modified, the updated content will be loaded when the system prompt is built again.
[0013] Furthermore, the deterministic engineering calculation tool mentioned in step S3 includes a section calculation tool; the section calculation tool returns the area, moment of inertia, torsional constant, and centroid coordinates of the section according to the engineering parameters, and writes the section profile and attributes into the section cache before returning a reference identifier; the section entries in the structured model data reference the section calculation results through the reference identifier, and the reference identifier is the identifier actually returned by the section calculation tool.
[0014] Furthermore, the finite element analysis script reuses the same node numbers, element numbers, material numbers, section numbers, and geometric transformation numbers as the structured model data; the range object in the structured model data is a compact expression of the regular node cycle or regular element cycle in the finite element analysis script.
[0015] Further, the regularly distributed node sequence in step S5 is a sequence of three or more consecutively numbered nodes that vary at constant or linear intervals along each coordinate axis; the coordinate information is a fixed value or a range of values consisting of a start value and an end value, where the value range indicates that the coordinates are linearly distributed from the start value to the end value; for nodes or units that do not meet the regular distribution conditions, they are represented by an independent item-by-item description array.
[0016] Furthermore, step S6 also includes performing a comprehensive verification on the structured model data, and the comprehensive verification result satisfies:
[0017] In the formula, For the syntax check results, For the result of the number type and uniqueness verification, For the result of the reference integrity check, For the results of the range validity check, The consistency verification result between the finite element analysis script and the structured model data is represented by the symbol ∧, which indicates logical AND. The comprehensive verification is considered to have passed only when all individual verification results are true.
[0018] Furthermore, in step S3, the knowledge retrieval tool returns retrieval results based on the cosine similarity between the query and the knowledge document; when the highest similarity of a retrieval result is less than 0.4, the retrieval is recorded as a low-quality retrieval, and the retrieval stops after three consecutive rounds of low-quality retrieval. The large language model generates the final response based on the system prompts and the results returned by the tool; the total number of rounds of tool calls does not exceed six.
[0019] Furthermore, the method also includes: setting a cancellation flag in response to a user's interruption request; during the streaming output of the large language model, detecting the cancellation flag each time a streaming data block is received; when the cancellation flag is detected to be set, stopping reading and closing the streaming connection; saving the generated portion of the content as a message and attaching an interruption prompt.
[0020] This invention also provides a dual-output system for finite element model data based on a large language model, comprising: The domain specification module is used to read the persistent project convention file and inject the modeling specifications of the target project domain into the system prompt words of the large language model; The parameter input module is used to receive engineering parameters input by the user, organize the engineering parameters into a structured parameter description, and use the structured parameter description as the data source for the current modeling task. The knowledge retrieval module is used to return the command syntax and examples of the target solver; A deterministic engineering calculation tool module is used to return numerical values and reference identifiers for modeling based on the engineering parameters; The Agent orchestration module is used to coordinate the calls between the large language model, the knowledge retrieval module, and the deterministic engineering calculation tool module according to the loop of model judgment, tool invocation, tool result return, continued judgment or generation of final response; The large language model interface module is used to call the large language model to simultaneously generate a finite element analysis script for the target solver and structured model data wrapped with preset tags that is independent of the solver in the final response of the current modeling task, and to compress the regularly distributed node sequence and element sequence in the structured model data using range representation. The streaming communication module is used to establish a communication channel between the front end and the back end, and to send generated events to the front end in real time. The dual-output parsing module is used to identify and extract the structured model data through the preset markers, perform syntax parsing, save the parsed structured model data as message content, and display it on the front end.
[0021] The present invention also provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the above-described method for dual output of finite element model data based on a large language model.
[0022] Compared with the prior art, the beneficial effects of the present invention are as follows: This invention constructs domain specification system prompts by reading persistent engineering agreement files, injecting modeling specifications such as unit systems, coordinate systems, mesh generation, material parameters, connection simulation, and command formats into a large language model. It then uses numerical values and reference identifiers returned by deterministic engineering calculation tools to replace the model's own estimation, significantly improving the conformity of the generated finite element analysis script to units, coordinates, meshes, materials, and connection rules. The generated results can be directly used for finite element modeling. Simultaneously, a single user modeling task generates two types of products in the same final response: an executable script and program-parseable structured model data. This balances solution execution and data reuse, eliminating the need for separate generation processes to obtain these two types of products.
[0023] This invention enables finite element analysis scripts and structured model data to be generated based on the same structured parameter descriptions and the same tool return results. Both types of output reuse the same node, element, material, section, and geometric transformation numbers, and reference the same tool calculation results through section cache reference identifiers. This generation mechanism ensures that the script and structured model data describe the same finite element model, reducing the risk of inconsistencies in numbering, coordinates, parameters, and reference relationships when generated separately. In an enhanced implementation, a deterministic verification of the correspondence between the two types of output can be performed through a comprehensive check of five aspects: syntax, numbering, reference, range, and consistency. The comprehensive check is considered passed only when all aspects are true, further improving the reliability of the output results.
[0024] This invention replaces item-by-item enumeration with range objects for regular node sequences with three or more consecutive numbers and constant or linearly equidistant intervals along each coordinate axis, as well as regular unit sequences that connect consecutive nodes and have the same attributes. This reduces the number of output records for a single regular sequence from linearly increasing with the number of items to a constant level. The overall structured output size is approximately the sum of the number of range objects and the number of item-by-item records, effectively reducing the risk of data truncation caused by the maximum output length limit of large language models. At the same time, item-by-item records are retained for nodes and units that do not meet the regular distribution conditions, such as support connections and isolated anchor points, so that the model topology is not lost due to compression. Furthermore, range objects can be completely restored according to the expansion formula, and the representation method is reversible.
[0025] This invention employs a low-quality retrieval termination mechanism to stop invalid retrievals when the highest similarity score in three consecutive rounds of retrieval falls below a threshold. It also prevents the tool from looping indefinitely by maximizing the number of tool call rounds. Furthermore, a user interruption mechanism responds to cancellation requests at any time during streaming output while preserving generated content, making resource consumption during the retrieval and generation process controllable and user-intervention-enabled. In addition, the field patterns of the structured model data are independent of the solver, providing a unified data interface for subsequent database storage, 3D reconstruction, model comparison, range expansion, and other solver adaptations. All of these extensions can be implemented according to application needs without altering the basic message structure of the dual output.
[0026] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description
[0027] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein: Figure 1 This is a flowchart illustrating the overall process of the dual output method for finite element model data based on a large language model, according to an embodiment of the present invention. Figure 2 This is a system architecture block diagram of an embodiment of the present invention; Figure 3 This is a flowchart illustrating the construction process of the domain specification system prompt words according to an embodiment of the present invention. Figure 4 This is a schematic diagram of a dual-output data stream according to an embodiment of the present invention; Figure 5 This is a schematic diagram comparing the range representation method and item-by-item enumeration in an embodiment of the present invention; Figure 6 This is a schematic diagram illustrating the generation process and rendering effect of dual outputs in an embodiment of the present invention. Detailed Implementation
[0028] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0029] Example 1 This embodiment uses the OpenSeesPy solver in the field of bridge engineering as an example, combined with... Figure 1 , Figures 3 to 6 The method of this invention is described below. Users input the bridge type, span length of each span, pier location and height, main beam and pier cross-sections, support parameters, concrete grade, and secondary dead load through the bridge parameter wizard. All values are uniformly converted to a unit system based on Newtons, meters, and seconds before entering the Agent.
[0030] It should be noted that this embodiment does not describe document database persistence, 3D model reconstruction, or other solver script conversions as completed processing steps. The current implementation stores the complete assistant response in a server-side session data structure and displays the script and structured model data separately on the front end; these capabilities can be extended after the structured data interface.
[0031] Step S1: Construct domain specification system prompts like Figure 3 As shown, the backend reads the persistent engineering convention file and combines its contents with fixed role descriptions, current bridge parameters, tool definitions, parameter extraction rules, retrieval stop rules, and model data patterns to form system prompts. The persistent engineering conventions specify at least the following: the use of a unit system based on Newtons, meters, and seconds; global coordinate axes X, Y, and Z corresponding to the longitudinal, transverse, and vertical directions of the bridge, respectively; a unified coordinate system for the top surface of the main beam or a designated reference surface; discretization of beams, piers, and cap beams according to the maximum element length and minimum number of segments; alignment of intersecting component nodes; use of physically meaningful connection elements or master-slave constraints for non-overlapping components; and the use of unified symbols and units for material strength, strain, and density. After the persistent engineering convention file is modified, subsequent tasks will reread and update the content.
[0032] The system prompt specifies that the structured parameters in the current user message are the sole source of parameters for the current model, and old model code and section attributes from historical dialogues must not be reused. The system prompt further specifies the generation order: first, call the tools for pier section, main beam section, support layout, support material, and material properties according to the current parameters, and then generate the complete code; after the code, a structured model data block wrapped with preset tags must be output; rule nodes and elements are represented using range objects, and section entries must use the reference identifier store_id returned by the section calculation tool.
[0033] Step S2: Receive engineering parameters The parameter wizard organizes user input into a structured parameter description that includes arrays of span lengths, support locations, bridge type rules, main girder section objects, support objects, support material objects, and material grade objects. Each span length uses the actual values directly from the array, without using the total length divided by the number of spans for backward calculation. Each pier object is imported as a whole into the pier section calculation tool to avoid omitting parameters such as column spacing, cap beams, tie beams, or segmented section parameters.
[0034] The main beam section object includes the overall height, top and bottom plate widths, top and bottom plate thicknesses, cantilever parameters, web parameters, internal and external chamfers, and modeling mode. The section calculation tool returns the area and moment of inertia based on these parameters. and Torsional constant Centroid coordinates and The return value includes the outline data and the reference identifier `store_id`; both the generated code and the structured model data directly use this return value. This specification uses... To represent the torsion constant, to avoid confusion with the symbols of structured model data blocks. Confusing.
[0035] Step S3: Knowledge Retrieval and Deterministic Tool Invocation The agent first determines whether computational tools such as knowledge base retrieval or cross-sections are needed; if so, it issues tool calls, and the tool execution results serve as the input for the next round of modeling. The knowledge base returns the command title, source file, category, similarity, text summary, and code example; the cross-section and support tools return numerical results.
[0036] The knowledge retrieval module uses term frequency and inverse document frequency methods to convert the query text into a high-dimensional vector, then uses truncated singular value decomposition to reduce the vector dimension, and performs L2 normalization. Let the normalized query vector be q, and the vector of the j-th knowledge document be... The similarity is:
[0037] In the formula, To query the cosine similarity with the j-th knowledge document; This is the transpose of the query vector; Let be the normalized vector of the j-th knowledge document. The system follows... Return to the first few results from largest to smallest.
[0038] When the highest similarity score in a search result is below 0.4, the search is recorded as a low-quality search. After three consecutive rounds of low-quality searches, the agent stops searching and instead uses the obtained tool results, persistent engineering conventions, and existing model knowledge to generate the final response. The system also sets the maximum number of tool call rounds to six to prevent tools from running indefinitely. Necessary calculation tools such as cross-sectional analysis are not omitted due to the lack of a command in the knowledge base documentation.
[0039] Step S4: Generate finite element analysis script like Figure 4 As shown, the large language model generates a complete OpenSeesPy script based on the current parameters and tool results. The script sequentially performs model dimension and degree of freedom settings, material definitions, section and elastic property references, geometric transformations, node generation, element generation, constraints and supports, mass or loads, gravity analysis, and modal analysis. Regular nodes and elements can be generated in a Python loop to avoid repetitive line-by-line execution within the script itself.
[0040] The node, element, material, section, and geometric transformation numbers in the script are reused when generating the structured model data. For example, if the script uses nodes 1001 to 1031 to represent nodes of a main beam span, the structured model data does not reassign numbers but uses the same endpoint numbers to form node range objects.
[0041] Step S5: Generate structured model data After the script finishes, the large language model outputs structured model data blocks wrapped with preset tags in the final response of the current modeling task. Let the final response of a modeling task be R, and its composition be represented as follows:
[0042] In the formula, C is the explanatory text preceding the script; C is the finite element analysis script enclosed in code fences. This is an optional description between the script and the structured model data; M represents the structured model data block. This is a summary explanation following the structured model data. The symbol ⊕ indicates that the text segments are connected sequentially, rather than being numerically added together.
[0043] The structured model data block M satisfies:
[0044] In the formula, The starting tag is <|model_data|>; J represents the structured model data conforming to JSON syntax. End marker< / |model_data|> .
[0045] The structured model data includes the following top-level field: nodes, which contains node data, and can be further categorized by component groups (e.g., ...). The `<individual>` array stores the extent objects (e.g., piers, etc.) and irregular or isolated nodes in the `individual` array; `elements` contains element data, each entry including element type (`type`), group (`group`), number and connection relationship, section number (`section`), and geometric transformation number (`transform`); `materials` contains material data, including integer material number (`id`), material type (`type`), description (`desc`), and parameter objects (`params`); `sections` contains section data, including integer section number (`id`), section shape (`shape`), section cache reference identifier (`store_id`), and attribute objects (`props`); `transforms` contains geometric transformation data, including integer number (`id`), transformation type (`type`), and local coordinate direction vector (`vecxz`); `boundary` contains boundary and constraint data, `fixities` stores the fixed state of node degrees of freedom, and `constraints` stores rigid connections or equal degrees of freedom constraints; `analysis` contains the analysis summary, such as whether gravity conditions and modal analysis order are included.
[0046] The cross-section property object `props` must include at least the area `A` and the moment of inertia about the centroidal axis. and Torsional constant Centroid x-coordinate and centroid vertical coordinates `store_id` is a unique identifier returned by the section calculation tool after writing the section profile and attributes to the server-side section cache. The structured model data uses this identifier to reference the section calculation results, eliminating the need to repeatedly output long section profile coordinates in each response. Each section entry uses the actual `store_id` returned by the tool and must not be fabricated by the large language model. All node, element, material, section, and geometric transformation numbers are integers, and numbers of the same type must not be duplicated. The structured model data does not contain comments or trailing commas. The material, section, geometric transformation, and node numbers in the structured model data must be consistent with the corresponding numbers in the script.
[0047] like Figure 5 As shown, for three or more consecutively numbered nodes that vary constantly or linearly along each coordinate axis, the following range object is used: Let the node number range be [ , If ], then the number of nodes N is:
[0048] The number of the i-th node for: , .
[0049] For any coordinate component q (q is any coordinate component among x, y, or z), if the coordinate in the range object uses an endpoint array [ , If the coordinates of the i-th node are given, then the coordinates of the i-th node are given. for:
[0050] If the coordinate in the range object uses a fixed value ,but:
[0051] In the formula, and These are the starting node number and the ending node number, respectively; N is the number of nodes; i is the node index starting from zero; Number the i-th node; , These are the starting and ending values of the coordinate component, respectively. This is the coordinate value of the i-th node; For fixed coordinate values. When N=1, endpoint interpolation expressions are not used; when there are fewer than three nodes or the coordinates do not meet the linear equidistant spacing condition, the nodes are stored in the item-by-item description array individual. If the spacing, direction, or attributes of two consecutive segments are different, they are split into two range objects.
[0052] For a sequence of elements that connects consecutive nodes and has the same element type, section number, geometric transformation number, and grouping, the following representation is used: Let the range of unit numbers be [ , ], the node number endpoint is [ , ], then the number of units for: ;
[0053] Two consecutive node elements should satisfy the above constraint. The k-th element number... and its starting node End point They are respectively: ; , ,
[0054] In the formula, and These are the starting unit number and the ending unit number, respectively; Number of units; and These are the endpoints for node numbering; k is the cell number starting from zero; Number the k-th unit; , These are the start and end node numbers of the k-th element, respectively. If there are changes in cross-section, geometric transformation, element type, or grouping between elements, the range objects are divided at the change location; support connection elements, rigid connection endpoints, or other elements that do not satisfy continuous connection relationships are recorded item by item.
[0055] For a single rule sequence containing N items, the number of records enumerated item by item increases linearly with N, while the number of fields in the range object remains constant. If the entire model contains K rule sequences and U irregular data items, the structured output size is approximately:
[0056] In the formula, K represents the number of range objects; U represents the number of records per item. This method reduces the output length and the risk of data truncation due to the maximum output length, but does not claim that it will never truncate under arbitrary input sizes.
[0057] Taking a single-span main beam with a span of 30m, divided into 30 equally spaced units, as an example, there are 31 nodes. The node numbers range from 1001 to 1031. The x-coordinate changes from 0m to 30m, while the y and z coordinates are both 0. The node range is represented using the aforementioned object. According to the expansion formula, the coordinates of the i-th node... for:
[0058] In the formula, i = 0, 1, ..., 30; This represents the longitudinal coordinate of the i-th node, in meters. The 30 main beam elements are represented using the element range object described above. The k-th element is numbered 1+k, connecting nodes 1001+k and 1002+k, where k = 0, 1, ..., 29. Top and bottom nodes of supports, isolated anchor points, and elements with irregular connections are not represented using range objects but are recorded in an item-by-item description array.
[0059] Step S6: Parse the final response, save and display it Figure 6 Taking the modeling task of a three-span continuous beam bridge (span arrangement 30m+30m+30m, total length 90m) as an example, the generation process and rendering effect of dual output are shown. Figure 6The left side shows the generation process. The parameter input area shows the input parameters for bridge type, piers, main beams and supports. The reasoning process area shows the calls to tools for knowledge base retrieval, component section calculation, support layout calculation and material property calculation, as well as the numerical values and reference identifier store_id returned by the tools. The code output area shows that the script is generated in the order of material, section, node and element, support, constraint to analysis. Figure 6 The right side shows the rendering effect. The front end displays the explanatory text in the final response, the finite element analysis script wrapped in code fences, and the structured model data wrapped in preset markers. The regularly distributed node sequence is displayed in range object compression.
[0060] like Figure 6 As shown, the front-end message component uses paired preset tags to identify structured model data blocks, removes the beginning and end tags, and then calls the JSON parsing function. If parsing is successful, it displays the indented structured model data, along with the number of top-level fields and a copy button. If parsing fails, it retains and displays the original data text, ensuring the entire reply is not lost due to formatting errors in a single data block. The last code snippet before the structured model data block is displayed as a copyable final script. The parsed structured model data is saved as message content and displayed on the front end.
[0061] Therefore, the current embodiment has implemented preset tag block separation, JSON syntax parsing, formatted display and copying, but does not describe the field-level integrity verification, database field storage and 3D model reconstruction, which have not yet been implemented, as already completed.
[0062] Homogeneity Constraints and Synthesis Verification This embodiment uses the following generation constraints to ensure that the script and structured model data describe the same finite element model: the structured parameters in the current user message are the only inputs for geometric and material parameters; the section properties, support arrangement, and support material parameters use the same return result from a deterministic engineering calculation tool; the script and structured model data reuse the same node, element, material, section, and geometric transformation numbers; the range objects in the structured model data are a compact expression of the regular node loops or regular element loops in the script; element node references, section references, and geometric transformation references in the structured model data must be able to resolve to the corresponding entries; before the generation ends, three or more consecutive regular nodes or elements are converted into range objects, and the overall length of the structured model data is controlled.
[0063] In the enhanced implementation, the comprehensive verification result V is defined as follows:
[0064] In the formula, The result of JSON syntax validation; The result is the verification of the number type and uniqueness. The integrity verification results are used for nodes, sections, and geometric transformations. The results are used to verify the range start and end values, quantitative relationships, and interpolation conditions. This represents the consistency verification result between the script and the structured model data; the symbol ∧ indicates logical AND. The overall verification result V is true only when all individual items are true. The current embodiment implements preset tag recognition and JSON syntax parsing, and implements numbering, referencing, and range rule constraints through system prompts; the above enhanced verification can be integrated into the parsing process as an independent deterministic verification module.
[0065] Streaming output and user interrupts After a user submits a request, the backend creates a cancellation flag based on a thread event object for each session being generated and starts a background thread to run the synchronous Agent generator. The background thread writes events such as thought text, tool start, tool end, status, output text or error to an asynchronous queue. The WebSocket coroutine reads events from the queue and sends them to the frontend in real time, thereby avoiding the synchronous generation process blocking the network event loop.
[0066] When a user issues an interruption request, the backend sets a cancellation flag for the corresponding session. The Agent loop, tool call boundaries, and large language model streaming client check this flag each time they receive a streaming data block. If the flag is set, they stop reading and close the streaming connection. The already generated content is still saved as a message, with an appended message indicating that the session was interrupted, thus preserving the content already received by the user. The check interval depends on the frequency of server-side streaming data block arrivals and is not limited to a fixed time interval.
[0067] Example 2 like Figure 2 As shown, this embodiment provides a dual-output system for finite element model data based on a large language model, including: The parameter input module is used to receive engineering parameters input by the user, organize the user's input in the bridge type, span, pier, section, support and material interface into a structured parameter description, and use the structured parameter description as the data source for the current modeling task; The domain specification module is used to read the persistent project convention file, inject the modeling specifications of the target project domain into the system prompt words of the large language model, and load the updated convention content when the system prompt words are built in the next task. The knowledge retrieval module is used to perform semantic retrieval of solver documents and code examples, and returns the command syntax and examples of the target solver. The deterministic engineering calculation tool module is used to calculate the cross-sectional profile, cross-sectional area, moment of inertia, torsional constant, centroid, support coordinates, and support material parameters based on the engineering parameters, and returns the numerical values and reference identifiers for modeling. The Agent orchestration module is used to coordinate the calls between the large language model, the knowledge retrieval module, and the deterministic engineering calculation tool module according to the loop of model judgment, tool invocation, tool result return, continued judgment or generation of final response; The large language model interface module is used to call the large language model to simultaneously generate a finite element analysis script for the target solver and structured model data wrapped with preset tags that is independent of the solver in the final response of the current modeling task, and to compress the regularly distributed node sequence and element sequence in the structured model data using range representation. The streaming communication module is used to establish a communication channel between the front end and the back end, placing the generation process in a background thread and sending generation events to the front end in real time through an asynchronous queue; The dual-output parsing module is used to identify and extract the structured model data through the preset markers, perform syntax parsing, save the parsed structured model data as message content and display it on the front end, and display the final script, structured model data and general description respectively.
[0068] This implementation is for bridge modeling in OpenSeesPy. Other solvers, database persistence, 3D reconstruction, and cross-solver transformations are optional extensions and are not steps performed in this implementation.
[0069] Example 3 Without changing the dual-output data format, the following modules can be added: The field validator is used to verify the consistency of numbering, references, ranges, and codes according to the rules of common-origin constraints and comprehensive validation. The persistence adapter is used to write the parsed structured model data as a whole or by field into the document database, and record the task number, version number and generation time. Range expander, used to restore the complete set of nodes and elements according to the expansion formula in step S5; A 3D reconstructor for generating visual geometry based on node coordinates, element connections, section store_id, and grouping information; The solver adapter is used to establish a mapping from uniform elements, materials, and boundary conditions to the target solver commands; if there is no equivalent model between the two solvers, it returns an unsupported message or asks the user to confirm the approximation method, rather than unconditionally claiming that direct conversion is possible.
[0070] All of the above extensions use the same structured model data interface, so there is no need to change the basic message structure of the dual output of the large language model.
[0071] Generalization notes: Persistent engineering convention files can be customized according to the target solver (such as ANSYS APDL, ABAQUS, LS-DYNA) and engineering field (such as building structures, mechanical parts). Simply replace the specification content to adapt; scripts are oriented towards specific solvers, but the format of structured model data is not bound to any solver; the range representation method is applicable to the node and element data of any finite element software because it only depends on the regular distribution characteristics of spatial coordinates and is independent of the solver type.
[0072] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A dual-output method for finite element model data based on a large language model, characterized in that, Includes the following steps: S1. Construct domain specification system prompts, read persistent project convention files, and inject the modeling specifications of the target engineering domain into the system prompts of the large language model; S2. Receive engineering parameters input by the user, organize the engineering parameters into a structured parameter description, and use the structured parameter description as the data source for the current modeling task; S3. Invoke the knowledge retrieval tool and the deterministic engineering calculation tool. The knowledge retrieval tool returns the command syntax and examples of the target solver, and the deterministic engineering calculation tool returns the numerical values and reference identifiers used for modeling based on the engineering parameters. S4. The large language model simultaneously generates a finite element analysis script for the target solver and structured model data wrapped with preset tags that is independent of the solver in the final response of the current modeling task. The finite element analysis script and the structured model data are generated based on the same structured parameter description and the same tool return results. S5. The regularly distributed node sequence and cell sequence in the structured model data are compressed using range representation, and the enumeration of each node sequence and cell sequence is replaced by a range object, wherein the range object includes an identifier range and coordinate information. S6. Parse the final response, identify and extract the structured model data through the preset marker, perform syntax parsing on the extracted structured model data, save the parsed structured model data as message content and display it on the front end.
2. The dual output method for finite element model data based on a large language model according to claim 1, characterized in that, The modeling specifications mentioned in step S1 include unit system rules, global and local coordinate system conventions, mesh generation rules, material parameter rules, connection simulation rules, command format, and output data mode. After the persistent engineering convention file is modified, the updated content will be loaded the next time the system prompt is built.
3. The dual output method for finite element model data based on a large language model according to claim 1, characterized in that, The deterministic engineering calculation tools mentioned in step S3 include cross-section calculation tools; The cross-section calculation tool returns the area, moment of inertia, torsional constant, and centroid coordinates of the cross-section based on the engineering parameters, and writes the cross-section profile and attributes into the cross-section cache before returning a reference identifier; The cross-section entries in the structured model data reference the cross-section calculation results through the reference identifier, which is the identifier actually returned by the cross-section calculation tool.
4. The dual output method for finite element model data based on a large language model according to claim 1, characterized in that, The finite element analysis script reuses the same node numbers, element numbers, material numbers, section numbers, and geometric transformation numbers as the structured model data; The range object in the structured model data is a compact expression of the regular node cycle or regular element cycle in the finite element analysis script.
5. The dual output method for finite element model data based on a large language model according to claim 1, characterized in that, The regularly distributed node sequence mentioned in step S5 is a sequence of three or more consecutively numbered nodes that vary at constant or linear intervals along each coordinate axis. The coordinate information is a fixed value, or a range of values consisting of a start value and an end value. When the value is within the range, it indicates that the coordinates are linearly distributed from the start value to the end value. For nodes or cells that do not meet the regular distribution conditions, they are represented by independent, item-by-item description arrays.
6. The dual output method for finite element model data based on a large language model according to claim 1, characterized in that, Step S6 further includes performing a comprehensive verification on the structured model data, and the comprehensive verification result satisfies: In the formula, For the syntax check results, For the result of the number type and uniqueness verification, For the result of the reference integrity check, For the results of the range validity check, The consistency verification result between the finite element analysis script and the structured model data is represented by the symbol ∧, which indicates a logical AND. The comprehensive verification is considered to have passed only if all the individual verification results are true.
7. The dual output method for finite element model data based on a large language model according to claim 1, characterized in that, The knowledge retrieval tool described in step S3 returns retrieval results based on the cosine similarity between the query and the knowledge document; When the highest similarity of a search result is less than 0.4, the search is recorded as a low-quality search. After three consecutive rounds of low-quality searches, the search stops, and the large language model generates the final response based on the system prompts and the results returned by the tools. The total number of rounds of tool calls does not exceed six.
8. The dual output method for finite element model data based on a large language model according to claim 1, characterized in that, This also includes: setting a cancellation flag in response to a user's interruption request; During the streaming output of the large language model, the cancellation flag is detected each time a streaming data block is received. When the cancellation flag is detected to be set, reading is stopped and the streaming connection is closed. The generated portion of the content is saved as a message with an interruption prompt attached.
9. A dual-output system for finite element model data based on a large language model, characterized in that, include: The domain specification module is used to read the persistent project convention file and inject the modeling specifications of the target project domain into the system prompts of the large language model. The parameter input module is used to receive engineering parameters input by the user, organize the engineering parameters into a structured parameter description, and use the structured parameter description as the data source for the current modeling task. The knowledge retrieval module is used to return the command syntax and examples of the target solver; A deterministic engineering calculation tool module is used to return numerical values and reference identifiers for modeling based on the engineering parameters; The Agent orchestration module is used to coordinate the calls between the large language model, the knowledge retrieval module, and the deterministic engineering calculation tool module according to the loop of model judgment, tool invocation, tool result return, continued judgment or generation of final response; The large language model interface module is used to call the large language model to simultaneously generate a finite element analysis script for the target solver and structured model data wrapped with preset tags that is independent of the solver in the final response of the current modeling task, and to compress the regularly distributed node sequence and element sequence in the structured model data using range representation. The streaming communication module is used to establish a communication channel between the front end and the back end, and to send generated events to the front end in real time. The dual-output parsing module is used to identify and extract the structured model data through the preset markers, perform syntax parsing, save the parsed structured model data as message content, and display it on the front end.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the dual output method for finite element model data based on a large language model as described in any one of claims 1 to 8.
