A natural language based finite element simulation automation method and system
Patent Information
- Application Number
- CN202611098096.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-23
- Publication Date
- 2026-10-20
AI Technical Summary
手动选面在CAE仿真环境中面临技术挑战:CAE多边形面(UF_caegeom_type=31)与CAD几何面(UF_solid_type=70)属于不同的对象类型,使用错误的面类型掩码(MaskTriple)会导致SelectionManager静默拒绝,用户点击几何面时无任何响应;此外,SelectObject(单数)API在NX 2506等新版本中存在参数签名不兼容问题;
当用户以自然语言描述仿真需求时,系统能够自动完成语义解析与参数结构化。用户无需掌握复杂菜单操作和编程语法,从根本上解决了传统CAE软件培训周期长、操作门槛高的技术痛点,将仿真能力从专职CAE工程师下沉至普通设计人员。
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer-aided engineering technology, specifically to an automated method and system for finite element simulation based on natural language. Background Technology
[0002] Currently, the typical process for performing structural static simulation using commercial finite element software includes the following steps: Engineers import the geometric model into CAD / CAE software; manually create FEM and SIM files, and configure the solver type and analysis type; manually perform 3D mesh generation, setting the element type and mesh size; manually select and assign materials from the material library; manually select surfaces on the geometric surface and apply fixed constraint boundary conditions; manually select surfaces and apply force loads (including force magnitude, direction, and unit); submit the solution to the solver for calculation using Nastran or other solvers; manually read and parse the result file (e.g., .f06 file) to determine if the simulation results are reasonable; if the results are abnormal, manually adjust the parameters and re-execute the above process.
[0003] The aforementioned prior art has the following technical problems: High operational threshold: Engineers need to be familiar with the operation logic and menu structure of specific CAE software, and the training period is long; Inefficient: A single static analysis case typically requires tens of minutes to several hours of manual operation time; Common errors: Manual selection of surfaces and parameter input are prone to errors, which can lead to invalid simulation results. Unreproducible: Manual operations lack standardized script records, making it difficult to accurately reproduce the same analysis.
[0004] Existing technologies also include automation solutions that use Python scripts to drive software such as ANSYS or ABAQUS. However, these solutions typically use predefined script templates, hard-coding specific analysis procedures into script files, which are then executed via command-line calls. This approach has the following drawbacks: Lack of semantic understanding: Users must describe simulation requirements using predefined parameter formats or programming languages, and cannot directly input using natural language; Surface selection relies on manual selection: For the selection of constraint surfaces and load surfaces, existing solutions either rely on users to pre-annotate surface indices or require users to manually select surfaces during script execution. Manual surface selection faces technical challenges in CAE simulation environments: CAE polygon surfaces (UF_caegeom_type=31) and CAD geometric surfaces (UF_solid_type=70) belong to different object types. Using an incorrect surface type mask (MaskTriple) will cause SelectionManager to silently reject the selection, resulting in no response when the user clicks on the geometric surface; in addition, the SelectObject (singular) API has parameter signature incompatibility issues in newer versions such as NX 2506. Lack of result diagnostic capability: Existing solutions can only output simulation results and cannot automatically determine the validity of the results and provide diagnostic suggestions; Poor scalability: Adding new analysis types requires rewriting the entire script template, and there is a lack of a configurable semantic-to-API mapping mechanism. Summary of the Invention
[0005] To address the problems existing in the prior art, the purpose of this invention is to provide an automated finite element simulation method and system based on natural language, which can automatically complete the entire closed loop from semantic understanding of natural language, script generation, simulation execution to result diagnosis, thereby reducing the threshold of CAE simulation operation, reducing manual intervention, and improving simulation efficiency and reproducibility.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: A natural language-based automated finite element simulation method includes the following steps: S1 calls the large language model to perform semantic parsing on the natural language description text, and outputs structured simulation parameters including analysis type, geometry name, material name, mesh size, constraint parameters, load parameters and surface selection mode; S2, based on the structured simulation parameters, generates a first script and a second script through the template engine; the first script corresponds to the geometry import, solution configuration, mesh generation, and material assignment steps that are automatically executed in the background; the second script corresponds to the boundary condition application and solution submission steps that include surface selection logic. S3. Based on the surface selection mode, the surface acquisition strategy corresponding to the mode is used to determine the constraint surface and load surface, and boundary conditions are applied to the constraint surface and load surface; the surface selection modes include interactive surface selection mode, named group mode and automatic discovery mode; S4, execute the first script and the second script in sequence to drive the finite element software to complete the simulation calculation and obtain the result file; S5 is the parsing result file, which performs multi-level rule verification on the parsing results. The multi-level rules include fatal error detection, strain energy convergence verification, force balance verification, and yield criterion verification. S6 generates a diagnostic report based on the verification results.
[0007] Furthermore, the interactive surface selection mode allows users to select target surfaces by popping up a dialog box through the native surface selection interface of the finite element software; the named group mode determines the target surface by reading the surface objects in the predefined groups in the simulation model; and the automatic discovery mode automatically determines the constraint surfaces and load surfaces by traversing the sub-objects of the geometry in the finite element model and sorting them based on spatial coordinates.
[0008] Furthermore, the semantic parsing in step S1 includes the following sub-steps: S11, construct a domain-specific schema containing multiple predefined fields, including analysis type, geometry name, material name, mesh size, constraint type and location, load type and magnitude, load direction, surface selection mode, and solver type; S12, a large language model prompting project based on the Few-Shot paradigm, uses parsing examples of typical simulation requirements as context input to the large language model, guiding the model to output structured simulation parameters JSON that conform to the schema. S13, For any missing required fields in the parsing results, the system automatically generates follow-up questions and waits for the user to complete them until all required fields are complete; For any missing non-required fields in the parsing results, the system automatically completes the default values according to preset rules; The non-required fields include at least the grid size and load unit, wherein when the grid size is missing, adaptive grid division is used by default, and when the load unit is missing, it is automatically inferred based on the unit system and load type; In step S2, the template engine generates scripts based on a mapping table from JSON fields to the finite element software API. The mapping table supports configuration extensions to adapt to different analysis types.
[0009] Furthermore, the multi-level rule verification in step S5 includes a four-level verification process from P0 to P3: P0 level: Fatal error detection, checks whether the result file contains the FATAL error flag; P1 level: Strain energy rationality verification, check whether the strain energy Epsilon value converges and is not close to zero; Level P2: Force balance verification. Each component of the resultant force OLOAD RESULTANT is compared with each component of the single-point constraint reaction force SPCFORCE RESULTANT axis by axis. A dual tolerance strategy of absolute error taking precedence over relative error is adopted. When the absolute difference is less than 0.001N, balance is directly determined. Otherwise, a 5% relative error threshold is used for judgment. P3 level: Yield criterion verification, which compares the maximum stress with the material's yield strength to determine whether yielding has occurred.
[0010] Furthermore, the interactive face selection mode pops up a face selection dialog box through the SelectObjects API of the finite element software, and uses the CAE polygon face type mask MaskTriple(Type=31, Subtype=9) to accurately match the target face. The interactive face selection mode has a cancel-reselection loop and an automatic rollback mechanism when the number of cancel-reselection loops exceeds the upper limit.
[0011] Furthermore, the automatic discovery mode is implemented through the following sub-steps: S31, traverse all child objects CAE_Face of CAE_Body in the finite element model and obtain the centroid coordinates of each face; S32, sort by the centroid X-axis coordinate, select the surface with the smallest X-coordinate as the constraint surface, and select the surface with the largest X-coordinate as the load surface.
[0012] Further, step S5 involves parsing the result file, including: extracting strain energy Epsilon data from the result file using a tabular format, extracting it from the data row below the header row of LOAD SEQ NO EPSILON, and distinguishing between serial number characters and page number characters to avoid misjudgment; extracting the complete six-component resultant values of the external load resultant OLOAD RESULTANT and the single-point constraint reaction force SPCFORCE RESULTANT from the TOTALS row.
[0013] Furthermore, in step S6, the diagnostic report is generated in both Markdown and JSON formats; when the user modifies the parameters and re-executes, the system updates the structured simulation parameters and executes steps S2 to S6 again, comparing and displaying the iteration results with the original results.
[0014] Furthermore, the mapping from material names to the finite element software material library in step S1 employs a multi-level matching strategy: priority is given to exact matching of the full material name entered by the user; if no match is found, matching is performed after ignoring case; if still no match is found, keyword fuzzy inclusion matching is used; if all attempts fail, a new material entry is created directly using the string entered by the user. Each material record in the mapping database contains at least: the standard name of the material in the finite element software library, the yield strength value, and the brittleness assessment identifier.
[0015] Furthermore, in step S4, the first script and the second script report the execution progress to the external engine through a preset format status identifier string during execution; the status identifier string contains the current step number and the execution result flag, and the external engine determines the current execution stage and whether it has been successfully completed by parsing the string.
[0016] Furthermore, the parsing strategy for the result file in step S5 includes the following: the extraction of strain energy Epsilon adopts tabular parsing, and after locating the header row of LOADSEQNOEPSILON, the value is extracted from the data row immediately following it. The serial number characters and page number characters in the data row are distinguished to avoid misinterpreting the page number as data; the resultant external load OLOAD RESULTANT and the single-point constraint reaction SPCFORCE RESULTANT are directly extracted from the TOTALS row to avoid the loss of values caused by zero-value placeholders when accumulating row by row; when the result file does not contain displacement or stress data, the system generates a prompt message and suggests reading from the alternative output file to distinguish between data extraction failure and simulation abnormality itself.
[0017] A natural language-based automated finite element simulation system includes: The semantic parsing module is used to call a large language model to perform semantic parsing on natural language description text, and output structured simulation parameters including analysis type, geometry name, material name, mesh size, constraint parameters, load parameters and surface selection mode. The script generation module is used to generate a first script and a second script respectively through a template engine based on structured simulation parameters. The first script corresponds to the geometry import, solution configuration, mesh generation, and material assignment steps that are automatically executed in the background. The second script corresponds to the boundary condition application and solution submission steps that include surface selection logic. The surface determination module is used to determine the constraint surface and load surface according to the surface selection mode and the surface acquisition strategy corresponding to the mode, and to apply boundary conditions to the constraint surface and load surface; the surface selection mode includes at least interactive surface selection mode, named group mode and automatic discovery mode; The script execution module is used to execute the first script and the second script in sequence, driving the finite element software to complete the simulation calculation and obtain the result file. The results analysis module is used to parse the results file and perform multi-level rule verification on the parsed results. The multi-level rules include at least fatal error detection, strain energy convergence verification, force balance verification and yield criterion verification. The report generation module is used to generate diagnostic reports based on the verification results.
[0018] A storage medium storing a computer program, which, when executed by a processor, implements the aforementioned method for automating finite element simulation based on natural language.
[0019] In summary, the present invention has the following advantages: When users describe simulation requirements in natural language, the system can automatically complete semantic parsing and parameter structuring. Users do not need to master complex menu operations and programming syntax, fundamentally solving the technical pain points of long training cycles and high operating thresholds of traditional CAE software, and democratizing simulation capabilities from dedicated CAE engineers to ordinary designers.
[0020] By using a dual-script step-by-step generation and background batch processing execution mechanism, the static analysis process, which traditionally requires tens of minutes to several hours of manual operation, is greatly compressed, significantly improving efficiency and shortening the product design iteration cycle.
[0021] A face selection mechanism with three complementary modes is proposed, which effectively solves the fundamental defects of existing automated solutions, such as face selection relying on manual annotation and script execution being easily interrupted.
[0022] The judgment experience of senior simulation engineers is formalized into a four-level automatic verification system. After the simulation is completed, the system automatically performs intelligent diagnosis on the results, which effectively avoids false alarms caused by numerical noise in near-zero components. It can automatically intercept invalid simulations caused by mesh distortion and improper boundary condition settings, reduce the probability of human misjudgment, and ensure the credibility of simulation results.
[0023] The system employs a configurable architecture that maps JSON fields to the NX API, decoupling analysis types from core parsing logic. When a new analysis type needs to be added, only the corresponding entry needs to be added to the mapping table; the core generation logic does not need to be rewritten, resulting in extremely low expansion costs. Simultaneously, the system supports automatic triggering of a new closed-loop iteration after users modify natural language parameters based on diagnostic reports, and supports comparisons of old and new results, providing efficient technical support for design optimization. Attached Figure Description
[0024] Figure 1 This is the overall system architecture diagram.
[0025] Figure 2 Flowchart for the step-by-step generation method of dual scripts.
[0026] Figure 3 Flowchart for selecting the face mode.
[0027] Figure 4 This is a flowchart for the P0-P3 four-level rule verification process.
[0028] Figure 5 This is the overall flowchart of the complete method. Detailed Implementation
[0029] The present invention will now be described in further detail.
[0030] A natural language-based automated finite element simulation method includes the following steps: Step S1: Semantic parsing It receives natural language description text input from the user, calls a large language model (such as DeepSeek) to perform semantic parsing, and outputs structured simulation parameters in JSON format. This JSON contains multiple predefined fields such as analysis type, geometry name, material name, mesh size, constraint type and location, load type and magnitude, load direction, surface selection mode, and solver type.
[0031] The parsing process employs a domain-specific Few-Shot hinting project, including parsing examples for typical simulation requirements as context. For any missing required fields in the parsing results, the system automatically generates follow-up questions and waits for the user to complete them until all required fields are filled.
[0032] Step S2: Generation in stages using dual scripts Figure 2 This demonstrates the decision-making process for generating structured simulation parameters (JSON) into two independent NX Journal scripts, including the mapping process from fields to template variables, the three-branch decision-making for face selection modes (interactive / named_group / auto), and the segmentation logic in Steps 1-4 and Steps 5-6. Details are as follows: Based on the structured simulation parameters in JSON format, two independent NX Journal Python scripts are generated using a template engine: The first script (Steps 1-4) corresponds to the steps executed automatically in the background, including FEM / SIM file creation, solution scheme configuration, 3D tetrahedral mesh generation (including setting parameters such as mesh size, element type, and growth rate), and loading and assigning materials from the library. This script requires no user interaction and is run automatically in the background by the system through a batch executor.
[0033] The second script (Steps 5-6) corresponds to the steps requiring surface selection, including applying fixed constraint boundary conditions, applying force loads, and submitting the solution. This script uses different strategies to obtain constraint surfaces and load surfaces based on the surface selection mode selected by the user.
[0034] Step S3: Face Selection Mode Figure 3 The complete decision-making and execution flow for three face selection modes is demonstrated: interactive face selection mode (SelectObjects pop-up → user selection → cancel-reselection loop → over-limit fallback auto), named group mode (SIMCaeGroup predefined → script reading → BC application), and automatic mode (traversing CAE_Body → collecting CAE_Face → centroid calculation → X coordinate sorting → min-X / max-X face selection). Details are as follows: The face selection mode is determined by the `face_selection_mode` field in the structured simulation parameters JSON. This invention provides the following three feasible modes, each suitable for different use cases: Mode 1: Interactive Face Selection Mode (default): A face selection dialog box pops up via NX's native SelectObjects API, allowing the user to directly select the target face in the graphical interface. Key technical features include: (a) Use the MaskTriple object to set the face type filter: set the Type field to an integer value of 31 (corresponding to the NX kernel constant UF_caegeom_type) and the Subtype field to an integer value of 9 (corresponding to UF_caegeom_face_subtype), thereby accurately matching CAE polygon faces. Unlike the CAD solid face type code (Type=70, Subtype=2), this solution is the first to apply the correct CAE geometry face type code in a CAE simulation face selection scenario, resolving the compatibility issues in the old solution where the use of the CAD face type code caused MaskTriple to fail to match any objects in the CAE environment, and the SelectionManager to silently reject and not respond when the user clicked on a face. (b) The use of SelectObjects (plural) instead of SelectObject (singular) resolves the parameter signature incompatibility issue in NX 2506; (c) Replace integer constants with SelectionScope.AnyInAssembly + SelectionAction.ClearAndEnableSpecific enumeration objects to ensure cross-version compatibility; (d) Built-in cancel-reselection loop mechanism (maximum 5 cancellations). When the user cancels the selection, the system will pop up a dialog box again. If the cancellation exceeds 5 times, it will automatically revert to the centroid sorting automatic selection strategy. (e) The centroid coordinate extraction employs a multi-level backoff strategy: First, the X-coordinate of the first vertex of the first edge of the face is retrieved; if this fails, the exact bounding box of the face is obtained through the AskBoundingBoxExact interface of NXOpen.UF, and the X-coordinate of the bounding box center is retrieved; if this still fails, the process backoffs to 0.0 and outputs a warning. This multi-level backoff strategy ensures that usable approximate centroid values can still be obtained when the face geometry information is partially accessible, avoiding the interruption of the entire process due to abnormalities in a single face geometry data, thus improving the robustness of the system. (f) Boundary condition application includes try / except exception protection, outputting a clear error message without interrupting the process when constraint or load application fails. This mode is suitable for scenarios requiring precise specification of asymmetric or irregular geometries.
[0035] Mode 2: Named Group Mode: Employing a phased decoupling strategy, this mode is suitable for non-interactive scenarios requiring batch execution or high reproducibility. After the first script completes mesh generation, it pauses. The system displays a guide to creating predefined named CaeGroups on the user interface, guiding the user to create "SimPilot_Constraint_Face" (constraint face group) and "SimPilot_Load_Face" (load face group) in the finite element simulation model (SIM). Target geometric faces are dragged into the corresponding Groups and saved. When the second script is triggered, it iterates through the CaeGroup set of the SIM model using the NXOpen API, matches predefined names, and calls the GetEntities() method to read the CAE_Face objects within the group, which are then used as the target faces for applying boundary conditions. This mode decouples face selection from the script execution flow through the native CaeGroup grouping mechanism, offering optimal reproducibility and batch processing capabilities.
[0036] Mode 3: Automatic Discovery Mode (auto): This mode uses an automatic surface discovery algorithm to determine constraint and load surfaces without any manual intervention. The algorithm traverses all sub-objects (CAE_Face) of the CAE_Body in the finite element model, obtaining the centroid coordinates of each surface; it sorts them by X-axis coordinate, selecting the surface with the smallest X-coordinate as the constraint surface (min-X strategy) and the surface with the largest X-coordinate as the load surface (max-X strategy). This mode is suitable for typical scenarios with regular geometry and symmetrical distribution of constraints and load surfaces. In practice, it can complete the entire process in approximately 49 seconds, making it the only fully automatic mode requiring no user interaction. This strategy is also automatically adopted when the interactive surface selection mode reverts due to exceeding the maximum number of reselections.
[0037] Step S4: Script execution The batch executor of the finite element software (such as run_journal.exe in Siemens NX) is invoked to execute the first and second scripts sequentially. The first script runs in a headless background mode, outputting a status indicator after completing Steps 1-4. For interactive face selection mode, after the first script finishes execution, the second script launches the NX graphical interface, pops up the SelectObjects dialog box for the user to select faces, applies boundary conditions after face selection, and submits the solution. For named group mode, after the first script finishes execution, the system displays a CaeGroup creation guide (including group naming conventions and operation steps) on the user interface. After the user completes group creation, the second script continues execution. For automatic discovery mode, the two scripts execute continuously without user intervention.
[0038] Step S5: Result Analysis and Multi-Rule Validation Figure 4 It demonstrates the complete process from parsing the .f06 file to the step-by-step verification of the four-level rules, including the judgment conditions and exception outputs for each rule.
[0039] Parse the .f06 result file output by the Nastran solver to extract the following data: strain energy (Epsilon), resultant external load (OLOAD RESULTANT), single-point constraint reaction force (SPCFORCE RESULTANT), nodal displacement, element stress, and mesh statistics. Epsilon is extracted tabularly from the data rows below the "LOAD SEQ NO EPSILON" header row (distinguishing between sequence number characters and page number characters to avoid misinterpretation). OLOAD and SPCFORCE are directly extracted from the TOTALS row to obtain the complete six-component resultant force values (avoiding numerical loss caused by zero-value placeholders "----" during line-by-line parsing). Displacement and stress data are output to binary OP2 or HDF5 files under Nastran's default configuration. If the data is not extracted from the .f06 file, the system generates a helpful message and suggests using the NX ResultAccess API to read an alternative file, thus distinguishing data extraction failure from simulation anomalies.
[0040] Perform level 4 rule validation on the extraction results: P0 Fatal Error Detection: Check if the .f06 file contains the FATAL error flag; P1 strain energy rationality: Check whether the Epsilon value converges and is not close to zero; P2 Force Balance Verification: The resultant force component in OLOAD RESULTANT is compared with the reaction force component in SPCFORCE axis by axis. A dual tolerance strategy of absolute error taking precedence over relative error is adopted. When the absolute difference is less than 0.001N (engineering zero value), balance is directly determined. Otherwise, a 5% relative error threshold is used to avoid false alarms caused by numerical noise in near-zero components. P3 Yield Criterion Verification: Compare the maximum stress with the material's yield strength to determine whether yielding has occurred.
[0041] Step S6: Report Generation and Iterative Closure A diagnostic report (Markdown + JSON dual format) is generated based on the verification results, including result data, rule verification conclusions, and diagnostic suggestions. If the user is not satisfied with the results or the verification fails, the system supports modifying the parameters and re-executing steps S1-S6 to form an iterative closed loop.
[0042] This invention also provides an automated finite element simulation system based on natural language, comprising: The semantic parsing module is used to call a large language model to perform semantic parsing on natural language description text, and output structured simulation parameters including analysis type, geometry name, material name, mesh size, constraint parameters, load parameters and surface selection mode. The script generation module is used to generate a first script and a second script respectively through a template engine based on structured simulation parameters. The first script corresponds to the geometry import, solution configuration, mesh generation, and material assignment steps that are automatically executed in the background. The second script corresponds to the boundary condition application and solution submission steps that include surface selection logic. The surface determination module is used to determine the constraint surface and load surface according to the surface selection mode and the surface acquisition strategy corresponding to the mode, and to apply boundary conditions to the constraint surface and load surface; the surface selection mode includes at least interactive surface selection mode, named group mode and automatic discovery mode; The script execution module is used to execute the first script and the second script in sequence, driving the finite element software to complete the simulation calculation and obtain the result file. The results analysis module is used to parse the results file and perform multi-level rule verification on the parsed results. The multi-level rules include at least fatal error detection, strain energy convergence verification, force balance verification and yield criterion verification. The report generation module is used to generate diagnostic reports based on the verification results.
[0043] The specific implementation of each module in this embodiment can be found in the above method steps, and will not be repeated here. It should be noted that the device provided in this embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure can be divided into different functional modules to complete all or part of the functions described above.
[0044] The present invention also provides a storage medium storing a computer program, which, when executed by a processor, implements the above-described method for automating finite element simulation based on natural language.
[0045] The storage medium described in this embodiment can be a disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), USB flash drive, portable hard drive, etc.
[0046] Example 1: Static Analysis of a Cantilever Beam (Interactive Surface Selection Mode - Default Scheme) Step S1: Semantic parsing User input in natural language: "Perform static analysis on the cantilever beam bars_50_10_3.prt, using Steel material, 3mm mesh size, apply a fixed constraint on the left end face, and apply a force of 1000N in the positive Y-axis direction on the right end face." The system defaults to an interactive face selection mode (face_selection_mode="interactive"), calling the DeepSeek API and passing in prompts containing Few-Shot examples to parse and obtain structured simulation parameters in JSON format. { "analysis_type": "structural_static", "geometry_name": "bars_50_10_3.prt", "material_name": "Steel", "mesh_size": 3.0, "mesh_unit": "mm", "element_type": "CTETRA(10)", "constraint_type": "fixed", "constraint_face_description": "Left end face", "load_type": "force", "load_magnitude": 1000.0, "load_unit": "N", "load_direction": [0.0, 1.0, 0.0], "load_face_description": "Right end face", "face_selection_mode": "interactive", "solver": "NX_NASTRAN", "solution_type": "SOL 101" } Step S2: Generation in stages using dual scripts The script generation module queries the material mapping database for the NX material library name corresponding to "Steel", which has a yield strength of 250 MPa. Based on the structured parameters, it fills in the two templates STEPS_1_4_TEMPLATE and STEPS_5_6_TEMPLATE, generating two independent Python script files.
[0047] The first script covers: creating FEM / SIM files, importing geometry, 3D tetrahedral mesh CTETRA(10) with a global size of 3mm, and loading and assigning materials.
[0048] The second script contains interactive selection logic: If face_selection_mode is "interactive", call the _pick_face_interactive() function; The SelectObjects API (complex form, compatible with NX 2506) pops up a face selection dialog box, and MaskTriple(Type=31, Subtype=9) is used to precisely match the CAE polygon faces; After selecting a face and returning, extract the centroid coordinates of the face (multi-strategy backtracking: edge vertex X → tag bounding box → 0.0); If the user cancels the selection, the system will automatically pop up the dialog box again, up to 5 times; if the limit is exceeded, it will fall back to the min-X / max-X automatic discovery strategy. Create a FixedConstraint Builder for the selected constraint surface and wrap it with try / except exception protection; Create a Force Builder for the selected load surface, set its direction and size, and wrap it with try / except exception protection; Submit to the Nastran solver.
[0049] Steps S3-S4: Execution The engine module executes the first script headless in the background via run_journal.exe (approximately 20 seconds), completing the mesh generation and outputting "JOB_STATUS: STEPS_1_4_SUCCESS". The second script launches the NX graphical interface, pops up the SelectObjects dialog box, and guides the user to select on the left and right end faces of the cantilever beam. After the user confirms the selection, the system automatically applies fixed constraints and a 1000N Y-direction force load, submits the solution, and outputs "JOB_STATUS: STEPS_5_6_SUCCESS".
[0050] Step S5: Result Analysis and Verification The engine module reads the .f06 result file generated by Nastran, performs tabular parsing to extract Epsilon (extracted from the data rows below the header line "LOAD SEQ NO EPSILON"), and extracts the complete six-component resultant force of OLOAD and SPCFORCE from the TOTALS line. The parsing yields: Epsilon=1.5e-8 (converged); Maximum displacement=0.45 mm; Maximum stress=85 MPa; OLOAD RESULTANT: Fx=0.0 N, Fy=999.8 N, Fz=0.0 N; SPCFORCE RESULTANT: Fx=0.0 N, Fy=-999.8 N, Fz=0.0 N.
[0051] P0-P4 four-level verification: P0: No FATAL identifier in the .f06 file, passed; P1: Epsilon=1.5e-8, converged and non-zero, passed; P2: The absolute difference between the external load and reaction force on each of the Fx, Fy, Fz axes is less than 0.001N or the relative error is <5%, passed; P3: Maximum stress 85 MPa < Steel yield strength 250 MPa, safety factor 2.94, passed.
[0052] Step S6: Report generation The system generates diagnostic reports in both Markdown and JSON formats, containing all result data and verification conclusions, which are displayed on the desktop panel.
[0053] Embodiment 2: Batch execution scenario in named group mode User inputs natural language: "Perform static analysis on the workpiece model_A.prt, use Aluminum as the material, set the mesh size to 5mm, apply a 500N downward pressure on the upper surface, fix the lower surface, and use the named group mode." The system parses to obtain face_selection_mode="named_group". After the first script automatically completes meshing in the background, it pauses and displays guidance on the user interface: create in the SIM model The two CaeGroups, "SimPilot_Constraint_Face" and "SimPilot_Load_Face", are used to drag and drop constraint and load surfaces into the CaeGroups and save them. After the user clicks "Continue", the second script reads the surface objects from the CaeGroups and applies the constraint surfaces (BCs). This mode is suitable for scenarios that require batch processing of multiple identical structural models—the user only needs to preset the CaeGroup once, and it can be reused directly in subsequent analyses.
[0054] Example 3: Scenario with accompanying parameter iteration Based on the results of Example 1, the user felt that the mesh was too coarse and entered the following in natural language: "Change the mesh to 1mm and run it again."
[0055] The system parses the new JSON parameters (other fields are inherited from the previous round), updates `mesh_size` to 1.0mm. Steps S2-S6 are re-executed to generate a new mesh generation script and run the entire process. The iteration results are compared and displayed with the original results.
[0056] The above embodiments are preferred embodiments of the present invention, but the embodiments of the present invention are not limited to the above embodiments. Any changes, modifications, substitutions, combinations, or simplifications made without departing from the spirit and principle of the present invention shall be considered equivalent substitutions and shall be included within the protection scope of the present invention.
Claims
1. A method for automating finite element simulation based on natural language, characterized in that: Includes the following steps, S1 calls the large language model to perform semantic parsing on the natural language description text, and outputs structured simulation parameters including analysis type, geometry name, material name, mesh size, constraint parameters, load parameters and surface selection mode; S2, based on the structured simulation parameters, generates a first script and a second script through the template engine; the first script corresponds to the geometry import, solution configuration, mesh generation, and material assignment steps that are automatically executed in the background; the second script corresponds to the boundary condition application and solution submission steps that include surface selection logic. S3. Based on the surface selection mode, the surface acquisition strategy corresponding to the mode is used to determine the constraint surface and load surface, and boundary conditions are applied to the constraint surface and load surface; the surface selection modes include interactive surface selection mode, named group mode and automatic discovery mode; S4, execute the first script and the second script in sequence to drive the finite element software to complete the simulation calculation and obtain the result file; S5 is the parsing result file, which performs multi-level rule verification on the parsing results. The multi-level rules include fatal error detection, strain energy convergence verification, force balance verification, and yield criterion verification. S6 generates a diagnostic report based on the verification results.
2. The automating method for finite element simulation based on natural language according to claim 1, characterized in that, The interactive surface selection mode allows users to select the target surface by popping up a dialog box through the native surface selection interface of the finite element software; the named group mode determines the target surface by reading the surface objects in the predefined group in the simulation model; and the automatic discovery mode automatically determines the constraint surface and load surface by traversing the sub-objects of the geometry in the finite element model and sorting them based on spatial coordinates.
3. The automating method for finite element simulation based on natural language according to claim 1, characterized in that, Semantic parsing in step S1 includes the following sub-steps: S11, construct a domain-specific schema containing multiple predefined fields, including analysis type, geometry name, material name, mesh size, constraint type and location, load type and magnitude, load direction, surface selection mode, and solver type; S12, a large language model prompting project based on the Few-Shot paradigm, uses parsing examples of typical simulation requirements as context input to the large language model, guiding the model to output structured simulation parameters JSON that conform to the schema. S13, For any missing required fields in the parsing results, the system automatically generates follow-up questions and waits for the user to complete them until all required fields are complete; For any missing non-required fields in the parsing results, the system automatically completes the default values according to preset rules; The non-required fields include at least the grid size and load unit, wherein when the grid size is missing, adaptive grid division is used by default, and when the load unit is missing, it is automatically inferred based on the unit system and load type; In step S2, the template engine generates scripts based on a mapping table from JSON fields to the finite element software API. The mapping table supports configuration extensions to adapt to different analysis types.
4. The automating method for finite element simulation based on natural language according to claim 1, characterized in that, Step S5, multi-level rule validation, includes a four-level validation process from P0 to P3: P0 level: Fatal error detection, checks whether the result file contains the FATAL error flag; P1 level: Strain energy rationality verification, check whether the strain energy Epsilon value converges and is not close to zero; Level P2: Force balance verification. Each component of the resultant force OLOAD RESULTANT is compared with each component of the single-point constraint reaction SPCFORCERESULTANT axis by axis. A dual tolerance strategy of absolute error taking precedence over relative error is adopted. When the absolute difference is less than 0.001N, balance is directly determined. Otherwise, a 5% relative error threshold is used for judgment. P3 level: Yield criterion verification, which compares the maximum stress with the material's yield strength to determine whether yielding has occurred.
5. The automating method for finite element simulation based on natural language according to claim 2, characterized in that, The interactive face selection mode pops up a face selection dialog box through the SelectObjects API of the finite element software. It uses the CAE polygon face type mask MaskTriple(Type=31, Subtype=9) to accurately match the target face. The interactive face selection mode has a cancel-reselection loop and an automatic rollback mechanism when the number of cancel-reselection loops exceeds the limit. The automatic rollback to the automatic discovery mode will occur when the number of cancel-reselection loops exceeds the limit.
6. The automating method for finite element simulation based on natural language according to claim 2, characterized in that, Automatic discovery mode is achieved through the following sub-steps: S31, traverse all child objects CAE_Face of CAE_Body in the finite element model and obtain the centroid coordinates of each face; S32, sort by the centroid X-axis coordinate, select the surface with the smallest X-coordinate as the constraint surface, and select the surface with the largest X-coordinate as the load surface.
7. The automating method for finite element simulation based on natural language according to claim 4, characterized in that, Step S5 involves parsing the result file, including: extracting strain energy Epsilon data from the result file using a tabular format, extracting it from the data row below the header row of LOAD SEQNO EPSILON, and distinguishing between serial number characters and page number characters to avoid misjudgment; extracting the complete six-component resultant values of the external load resultant OLOAD RESULTANT and the single-point constraint reaction force SPCFORCE RESULTANT from the TOTALS row.
8. The automating method for finite element simulation based on natural language according to claim 1, characterized in that, In step S6, the diagnostic report is generated in both Markdown and JSON formats. When the user modifies the parameters and re-executes the process, the system updates the structured simulation parameters and executes steps S2 to S6 again, comparing the iteration results with the original results.
9. A system for an automated finite element simulation method based on natural language as described in any one of claims 1-8, characterized in that, include: The semantic parsing module is used to call a large language model to perform semantic parsing on natural language description text, and output structured simulation parameters including analysis type, geometry name, material name, mesh size, constraint parameters, load parameters and surface selection mode. The script generation module is used to generate a first script and a second script respectively through a template engine based on structured simulation parameters. The first script corresponds to the geometry import, solution configuration, mesh generation, and material assignment steps that are automatically executed in the background. The second script corresponds to the boundary condition application and solution submission steps that include surface selection logic. The surface determination module is used to determine the constraint surface and load surface according to the surface selection mode and the surface acquisition strategy corresponding to the mode, and to apply boundary conditions to the constraint surface and load surface; the surface selection mode includes at least interactive surface selection mode, named group mode and automatic discovery mode; The script execution module is used to execute the first script and the second script in sequence, driving the finite element software to complete the simulation calculation and obtain the result file. The results analysis module is used to parse the results file and perform multi-level rule verification on the parsed results. The multi-level rules include at least fatal error detection, strain energy convergence verification, force balance verification and yield criterion verification. The report generation module is used to generate diagnostic reports based on the verification results.
10. A storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the natural language-based finite element simulation automation method as described in any one of claims 1-8.