Python-based structural analysis CAE software solution process organization method and device

By designing the solution process of a structure analysis CAE software based on Python, the dynamic modification of functional modules and the customization of the solution process were realized, which solved the limitations of the fixed solution process in the existing technology and improved the user experience and development efficiency.

CN121787138APending Publication Date: 2026-04-03CHINA AIRPLANT STRENGTH RES INST
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-06
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

The fixed solution process of existing structural analysis CAE software is difficult to adapt to the changing scenarios of complex industrial equipment. The threshold for secondary development by users is high, which makes it impossible to fully explore the potential of the software. It also lacks openness and scalability.

Method used

Design a solution process for a structure analysis CAE software based on Python. Through functional module interface calls, the module is encapsulated and dynamically modified using the Python language to form a custom solution process.

Benefits of technology

It improves user experience and development efficiency, meets personalized computing needs, and realizes software flexibility and scalability to adapt to computing needs in different scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121787138A_ABST
    Figure CN121787138A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of structural analysis software design, and particularly relates to a Python-based structural analysis CAE software solution process organization method and device. The method comprises the following steps: S1, completing the development of a functional module based on a preset programming language, and appointing unified input and output data formats; s2, packaging the developed function module into a Python callable form, and forming an extension module corresponding to the function module; s3, calling one or more packaged extension modules according to a preset logic sequence by utilizing a Python language to form a solving process function for executing a fixed solving process; and S4, modifying the existing extension module or adding a new extension module in the solution process function to realize dynamic modification of the existing fixed solution process. According to the method, the use experience and the development efficiency of the user are improved, and the personalized calculation requirements of different users in different scenes are met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of structural analysis software design, specifically relating to a method and apparatus for organizing the solution process of a Python-based structural analysis CAE software. Background Technology

[0002] Structural analysis CAE software is a concentrated engineering embodiment of numerical methods, software technology, and industrial knowledge. Its main function is to analyze and predict the structural functional performance of a specific structure under given loads and boundary conditions, providing guidance for structural design and improvement. Structural analysis CAE software is one of the most widely used industrial software applications in equipment development. Whether structural analysis CAE software can adapt to the changing needs of complex industrial equipment in various scenarios and whether it can meet the expansion requirements of new algorithms and functions by users is one of the important indicators for measuring the software's advancement.

[0003] Most existing domestic and international structural analysis software uses fixed solution processes to complete structural analysis. That is, for a given analysis scenario, the user uses a pre-defined sequence of functional modules arranged in a certain order (referred to as a fixed solution process) to complete the calculation. The advantage of a fixed solution process lies in its good solution stability and ease of use. However, with the accelerated pace of equipment development in my country, more and more scenarios and problems in the field of structural analysis are difficult to solve using the fixed solution processes provided by structural analysis CAE software. Especially with the development of software technology and algorithms, more and more new algorithms are emerging, forcing users to conduct secondary development based on foreign commercial structural analysis CAE software to achieve simulation calculations for specific scenarios. However, users often treat this secondary development based on foreign commercial software as a "black box," frequently ignoring the software principles and basic kernel, failing to fully explore the software's potential, and exhibiting certain deficiencies in openness and scalability, resulting in a high barrier to entry. Summary of the Invention

[0004] To address the aforementioned issues, this application provides a method and apparatus for organizing the solution process of a structural analysis CAE software based on Python. It designs the functional module interfaces required for the structural analysis CAE software solution process and enables Python to call these functional modules.

[0005] The first aspect of this application provides a method for organizing the solution process of a structure analysis CAE software based on Python, mainly including:

[0006] Step S1: Develop the functional modules based on the preset programming language and agree on a unified input and output data format;

[0007] Step S2: Encapsulate the developed functional modules into a Python callable form to form an extension module corresponding to the functional module;

[0008] Step S3: Using the Python language, call one or more encapsulated extension modules in a preset logical order to form a solution process function for executing a fixed solution process;

[0009] Step S4: Modify existing extension modules or add new extension modules in the solution process function to achieve dynamic modification of the existing fixed solution process.

[0010] Preferably, in step S1, the preset programming language is Fortran, and the functional module is compiled into a static library file or an executable program file; the unified input and output data format is implemented through a predefined function interface.

[0011] Preferably, in step S2, when the functional module is a static library file, the encapsulation process includes:

[0012] Step S21: Build an interface library and create an intermediate scheduler in the interface library. The intermediate scheduler calls the static library corresponding to the functional module through opcode mapping.

[0013] Step S22: Generate an extension module with the same input and output as the functional module using Python;

[0014] Step S23: Reference the interface library in the extension module.

[0015] Preferably, in step S2, when the functional module is an executable program file, the encapsulation process includes:

[0016] In the Python environment, the executable program file can be directly referenced through operating system command invocation, and input parameters can be passed and output results can be received in a pre-defined format.

[0017] Preferably, step S4 further includes:

[0018] Step S41: Use Python's getsource function to obtain the source code of the solution process function;

[0019] Step S42: Modify the source code, including adding, deleting, or changing the extended modules called therein and their execution order;

[0020] Step S43: The modified source code is used to form a new solution flow function.

[0021] The second aspect of this application provides a Python-based CAE software solution process organization device, mainly including:

[0022] The functional module development unit is used to develop functional modules based on a preset programming language and to agree on a unified input and output data format.

[0023] The functional module encapsulation unit is used to encapsulate the developed functional modules into a Python callable form, forming an extension module corresponding to the functional module.

[0024] The solution process function generation unit is used to call one or more encapsulated extension modules in a preset logical order using the Python language to form a solution process function for executing a fixed solution process.

[0025] The solution process modification unit is used to modify existing extension modules or add new extension modules in the solution process function, so as to realize the dynamic modification of the existing fixed solution process.

[0026] This application realizes secondary development based on a fixed solution process, solves the problems of difficulty in expanding the solution function and algorithm of existing software and difficulty in designing user-defined solution processes, improves user experience and development efficiency, and meets the personalized computing needs of different users in different scenarios. Attached Figure Description

[0027] Figure 1 This is a flowchart of a preferred embodiment of the method for organizing the solution process of the structure analysis CAE software based on Python, as described in this application. Detailed Implementation

[0028] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be described in more detail below with reference to the accompanying drawings. In the drawings, the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The described embodiments are only some, not all, of the embodiments of this application. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application. The embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0029] The first aspect of this application provides a method for organizing the solution process of a structure analysis CAE software based on Python, such as... Figure 1 As shown, it mainly includes:

[0030] Step S1: Develop the functional modules based on the preset programming language and agree on a unified input and output data format;

[0031] Step S2: Encapsulate the developed functional modules into a Python callable form to form an extension module corresponding to the functional module;

[0032] Step S3: Using the Python language, call one or more encapsulated extension modules in a preset logical order to form a solution process function for executing a fixed solution process;

[0033] Step S4: Modify existing extension modules or add new extension modules in the solution process function to achieve dynamic modification of the existing fixed solution process.

[0034] This application first completes the design and definition of functional modules in step S1.

[0035] In some optional implementations, in step S1, the preset programming language is Fortran, and the functional module is compiled into a static library file or an executable program file; the unified input and output data format is implemented through a predefined function interface.

[0036] In this embodiment, the design and definition of functional modules are completed using the Fortran language, and the input, output, and data formats of the functional modules are agreed upon. To ensure compatibility and interoperability between functional modules, all functional modules must adhere to a unified design interface. After compilation, the modules are released as static libraries or executable programs. An example is defining functions in Fortran:

[0037] SUBROUTINE Function(IN1, IN2, OUT1, OUT2).

[0038] Here, `Function` represents the specific function name, `IN1` and `IN2` represent input data in a specific format, and `OUT1` and `OUT2` represent output data in a specific format. The function `Function` is compiled into a static library or an executable program for later use. If generating a static library, the name resolution property must be set to lowercase during compilation, and character parameter passing must be set to be placed after all parameters.

[0039] Next, in step S2, the functional module is encapsulated using Python. To distinguish it from the functional module, the converted Python module is referred to as an extension module. Since either static library files or executable program files can be selected when generating functional modules, module encapsulation needs to be performed for different situations.

[0040] In some optional implementations, in step S2, when the functional module is a static library file, the encapsulation process includes:

[0041] Step S21: Build an interface library and create an intermediate scheduler in the interface library. The intermediate scheduler calls the static library corresponding to the functional module through opcode mapping.

[0042] Step S22: Generate an extension module with the same input and output as the functional module using Python;

[0043] Step S23: Reference the interface library in the extension module.

[0044] In this embodiment, when converting the static library file into a Python extension module (pyd), C++ is used as an intermediary bridge, and the interface parameters are agreed upon. In step S21, the Fortran module interface is configured to form an interface library. The interface program of the interface library references the Function static library generated in step S1, and a number "1" is defined for the Function function. When the program execution encounters this number, the functional module compiled from the Function function is called through the number. Then, in step S22, the Function functional module definition is completed in Python, as shown below:

[0045] Function=defineModule(name="Function",op=1,inDbs=("IN1","IN2"),outDbs=("OUT1","OUT2").

[0046] Among them, IN1, IN2, OUT1, and OUT2 are the corresponding input and output data with the same format as IN1, IN2, OUT1, and OUT2 in the aforementioned step S1.

[0047] Finally, in step S23, the "Python.h" header file is referenced. Before generating the Python program's extension module pyd, the "Python.h" header file is referenced in the program. Then, the interface library generated in step S21 is referenced in the project of the generated extension module pyd to realize the configuration conversion to a Python-compatible interface.

[0048] In some optional implementations, in step S2, when the functional module is an executable program file, the encapsulation process includes:

[0049] In the Python environment, the executable program file can be directly referenced through operating system command invocation, and input parameters can be passed and output results can be received in a pre-defined format.

[0050] In this embodiment, the conversion from an executable program to a Python module is similar to the conversion from a static library to a Python module, except that the conversion object changes from a static library to an executable program. During the conversion process, calls can be completed through Python using the input / output and data format designed for the executable program, without the need for intermediate conversion. For example, if a functional module is defined using the aforementioned Function and published as an executable program, then the function can be called directly in Python. The calling or conversion method is as follows:

[0051] The function `os.system('Function.exe' + ' ' + '-i' + ' ' + IN1 + IN2 + ' ' + '-o' + ' ' + OUT1+ OUT2)` executes a command containing the input and output data in the same format as those in step S1. `os.system()` is a Python function that executes an operating system command. All the data within the parentheses is concatenated into a string and then passed to the computer's operating system for execution. `Function.exe` is the filename of the executable program to be run; it represents a pre-compiled program that performs a specific CAE calculation function (such as matrix solving or mesh generation).

[0052] Step S3 is used to design a fixed solution process. The predefined functional modules are sorted in a certain sequence. A function containing this sequence is defined in Python. During the calculation, this function is directly called to complete the calculation of the specific solution process. By utilizing the powerful programming capabilities of the Python language, several functional modules are organized in a certain logical order according to the specific solution requirements, so that they work together to complete the calculation task. In this way, a general solution process with fixed modules is formed.

[0053] Step S4 is used to modify the fixed solution process.

[0054] In some alternative implementations, step S4 further includes:

[0055] Step S41: Use Python's getsource function to obtain the source code of the solution process function;

[0056] Step S42: Modify the source code, including adding, deleting, or changing the extended modules called therein and their execution order;

[0057] Step S43: The modified source code is used to form a new solution flow function.

[0058] In this embodiment, based on an existing fixed solution process, newly developed functional modules (converted into extension modules) are introduced into a portion of the fixed solution process module sequence, completing the integration of the new functional modules. Using Python, the defined fixed solution process functions are printed out, and local functional modules within them are modified. After modification, an updated solution process function is formed. By directly running the new solution process function, secondary development and design based on the fixed solution process can be completed.

[0059] First, in step S41, the `getsource` function from Python's `inspect` is used to print the body of the previously defined `SequenceEx` function. Then, in step S42, after obtaining the source code of the fixed-flow function, the source code can be viewed and modified, adding or removing internal functional modules to form a new solution flow. For example, to modify the fixed flow defined in `SequenceEx`, implement two consecutive calls to the `Function` module, with the second call using the two data points generated in the first call as input (provided that the input and output data formats of the `Function` module are the same), the `Function` module can be called twice consecutively in the new function.

[0060] In addition, existing or newly developed functional modules can be used to design new solution processes based on the Python language, enabling them to perform computational functions different from fixed solution processes. This results in user-defined solution processes that better adapt to individual computational needs, providing users with more accurate and efficient computational services.

[0061] The functional modules in this application are designed flexibly and systematically, allowing development in any language. By adhering to a unified design interface, compatibility and interoperability between modules are ensured. Static libraries and executable programs can be converted into Python-callable extension modules, facilitating their use within Python workflows. This resolves compatibility issues between different languages, enriches the functional resources of Python workflow design, and enhances the system's flexibility and scalability. Designing fixed solution flows using Python allows for the formation of general, functionally fixed solution flows with high stability and reliability. These flows can be reused in various scenarios, providing users with efficient and convenient computational solutions. Users and developers can perform secondary development by partially modifying the fixed solution flows, reorganize functional modules to form custom solution flows, and obtain the Python source code of the currently running solution flow through specific commands for easy viewing and modification. This significantly improves the user experience and development efficiency, meeting the personalized computational needs of different users in different scenarios.

[0062] The second aspect of this application provides a Python-based CAE software solution process organization device corresponding to the above method, mainly including:

[0063] The functional module development unit is used to develop functional modules based on a preset programming language and to agree on a unified input and output data format.

[0064] The functional module encapsulation unit is used to encapsulate the developed functional modules into a Python callable form, forming an extension module corresponding to the functional module.

[0065] The solution process function generation unit is used to call one or more encapsulated extension modules in a preset logical order using the Python language to form a solution process function for executing a fixed solution process.

[0066] The solution process modification unit is used to modify existing extension modules or add new extension modules in the solution process function, so as to realize the dynamic modification of the existing fixed solution process.

[0067] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for organizing the solution process of a Python-based structural analysis CAE software, characterized in that, Includes the following steps: Step S1: Develop the functional modules based on the preset programming language and agree on a unified input and output data format; Step S2: Encapsulate the developed functional modules into a Python callable form to form an extension module corresponding to the functional module; Step S3: Using the Python language, call one or more encapsulated extension modules in a preset logical order to form a solution process function for executing a fixed solution process; Step S4: Modify existing extension modules or add new extension modules in the solution process function to achieve dynamic modification of the existing fixed solution process.

2. The method for organizing the solution process of a Python-based structural analysis CAE software according to claim 1, characterized in that, In step S1, the preset programming language is Fortran, and the functional modules are compiled into static library files or executable program files; the unified input and output data format is implemented through predefined function interfaces.

3. The method for organizing the solution process of a Python-based structural analysis CAE software according to claim 2, characterized in that, In step S2, when the functional module is a static library file, the encapsulation process includes: Step S21: Build an interface library and create an intermediate scheduler in the interface library. The intermediate scheduler calls the static library corresponding to the functional module through opcode mapping. Step S22: Generate an extension module with the same input and output as the functional module using Python; Step S23: Reference the interface library in the extension module.

4. The method for organizing the solution process of Python-based structural analysis CAE software according to claim 2, characterized in that, In step S2, when the functional module is an executable program file, the encapsulation process includes: In the Python environment, the executable file can be directly referenced through operating system command invocation, and input parameters can be passed and output results can be received in a pre-defined format.

5. The method for organizing the solution process of a Python-based structural analysis CAE software according to claim 1, characterized in that, Step S4 further includes: Step S41: Use Python's getsource function to obtain the source code of the solution process function; Step S42: Modify the source code, including adding, deleting, or changing the extended modules called therein and their execution order; Step S43: The modified source code is used to form a new solution flow function.

6. A Python-based structural analysis CAE software solution process organization device, characterized in that, include: The functional module development unit is used to develop functional modules based on a preset programming language and to agree on a unified input and output data format. The functional module encapsulation unit is used to encapsulate the developed functional modules into a Python callable form, forming an extension module corresponding to the functional module. The solution process function generation unit is used to call one or more encapsulated extension modules in a preset logical order using the Python language to form a solution process function for executing a fixed solution process. The solution process modification unit is used to modify existing extension modules or add new extension modules in the solution process function, so as to realize the dynamic modification of the existing fixed solution process.

Citation Information

Patent Citations

  • Python-based CAE software field specific language system

    CN117057108A

  • Virtual prototyping system and method

    US20070203679A1

  • Artificial intelligence cloud operating system

    WO2021211911A1