Efficient local grid encryption method and system based on OpenFOAM

By proposing an efficient local mesh encryption method in OpenFOAM, by combining and dividing multiple local mesh sets at one time, the problem of excessive calculation steps and time consumption caused by multiple iterations and divisions in the traditional method is solved, and more efficient meshing is achieved.

CN119788326AActive Publication Date: 2025-04-08ZHEJIANG UNIV

Patent Information

Application Number
CN202411786738.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-04-08
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

The method used for local grid encryption in traditional OpenFOAM requires multiple iterations and divisions, especially when multiple local areas need to be encrypted, resulting in excessive calculation steps and time consumption.

Method used

An efficient local mesh encryption method based on OpenFOAM is proposed. By obtaining the initial model of the target object, dividing the background mesh, determining the area to be encrypted, merging the local mesh collection, and performing a mesh division, achieving simultaneous encryption of multiple local mesh.

Benefits of technology

The calculation steps and time required for meshing are significantly reduced, and the efficiency of meshing is improved, especially when multiple local meshings are needed, the meshing time can be greatly reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119788326A_ABST
    Figure CN119788326A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient local grid encryption method and system based on OpenFOAM (Open Field Operating and Maintenance). Comprising the following steps: firstly, determining a region needing local grid division and defining a corresponding local grid set; and then, the defined local grid sets are combined into a single grid set, so that the requirement of independently dividing each local grid set for multiple times is avoided. In this way, a user can efficiently divide a plurality of local grid sets at a time, the grid division efficiency and speed are remarkably improved, and especially when the number of local grids needing to be divided is large, the grid division time can be greatly shortened. According to the method, local grid division which needs to be completed in multiple steps originally is simplified to be completed in one step, so that the calculation efficiency is remarkably improved. In addition, the method has good expansibility, more complex grid division requirements can be met conveniently, and efficient division of locally encrypted grids in a computational domain is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a pre-processing method for computational fluid dynamics (CFD), and in particular to an efficient local grid encryption method and system based on OpenFOAM. Background Art

[0002] Computational fluid dynamics (CFD) is a method widely used in engineering, environmental science and other fields. It can simulate the complex phenomena of liquid and gas flow and interaction with solids. In order to perform CFD simulation, the computational domain must first be meshed so that the relevant equations can be solved on it.

[0003] OpenFOAM is an open source CFD toolbox that provides a wide range of simulation functions and tools. In OpenFOAM, meshing the computational domain is a basic and crucial task. Although OpenFOAM provides a variety of tools to help users with meshing, traditional methods usually involve multiple iterations and divisions, especially when a specific area in the simulation needs to be encrypted.

[0004] refineHexMesh is a command in OpenFOAM for structural mesh refinement. Although this command is very effective in local meshing, when a large number of local areas are involved, users need to run the command multiple times for each area, which consumes a lot of time and computing resources. Summary of the invention

[0005] In order to reduce the calculation steps and time required for meshing the computational domain and improve the efficiency of meshing, the present invention proposes a fast meshing method based on OpenFOAM pre-processing. The present invention is particularly suitable for applications that require encryption of multiple local areas. The use of this method for meshing greatly reduces the calculation steps and time required for pre-processing before fluid numerical simulation, thereby improving the efficiency of meshing. The present invention is suitable for meshing complex computational domains in the fields of fluid dynamics simulation, heat conduction simulation, structural mechanics simulation, etc.

[0006] The technical solution of the present invention is as follows:

[0007] 1. An efficient local mesh refinement method based on OpenFOAM

[0008] (1) Acquire the target object, identify and model the target object, and obtain an initial target model;

[0009] (2) Using OpenFOAM to mesh the computational domain corresponding to the initial target model, the background mesh is obtained;

[0010] (3) Determine several regions in the computational domain where the local grids to be encrypted are located according to actual needs, and record the IDs corresponding to the background grids contained in each region to form a local grid set;

[0011] (4) After merging the local grid sets corresponding to the several areas where the local grids to be encrypted are located, a global grid set is obtained;

[0012] (5) After meshing the global grid set, all the encrypted local grids are obtained, and then the target model is updated to complete the encryption of the local grids.

[0013] In (3) above, the shape of the region includes a rectangular parallelepiped and a sphere.

[0014] The above (4) is specifically:

[0015] First, the background grid ID in each local grid set is extracted, and then the duplicate background grid IDs are removed and the remaining background grid IDs are sorted to obtain the global grid set.

[0016] The target objects include target objects in the fields of fluid dynamics simulation, heat conduction simulation, and structural mechanics simulation.

[0017] 2. An efficient local mesh encryption system based on OpenFOAM

[0018] A target model building unit, used for acquiring a target object and identifying and modeling the target object;

[0019] A background meshing unit is used to mesh the computational domain corresponding to the initial target model;

[0020] A local grid set generating unit is used to determine several regions where the local grids to be encrypted are located in the computational domain according to actual needs and generate local grid sets corresponding to different regions;

[0021] A global grid set generating unit is used to merge local grid sets corresponding to several areas where the local grids to be encrypted are located;

[0022] The encrypted mesh division unit is used to divide the global mesh set into meshes to obtain all the encrypted local meshes.

[0023] 3. A computer device

[0024] The device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the OpenFOAM-based efficient local grid encryption method when executing the computer program.

[0025] 4. A computer-readable storage medium

[0026] The medium stores a computer program, which, when executed by a processor, implements the steps of the OpenFOAM-based efficient local grid encryption method.

[0027] V. A computer program product

[0028] The product includes a computer program / instruction, which, when executed by a processor, implements the steps of an efficient local grid encryption method based on OpenFOAM.

[0029] The beneficial effects of the present invention are:

[0030] The present invention simplifies the local grid division which originally needs multiple steps to be completed into one step, thereby significantly improving the calculation efficiency.

[0031] The present invention can efficiently divide multiple local grid sets at one time, significantly improving the efficiency and speed of grid division, and can greatly reduce the grid division time, especially when a large number of local grids need to be divided.

[0032] In addition, the present invention has good scalability, can easily cope with more complex grid division requirements, and realizes efficient division of local encrypted grids in the calculation domain. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The present invention is further described using the accompanying drawings, but the embodiments in the accompanying drawings do not constitute any limitation to the present invention. A person skilled in the art can obtain other drawings based on the following drawings without creative work.

[0034] Figure 1 The grid division of bubble groups with different volume fractions; (a) is the grid division when the volume fraction α=40%, and (b) is the grid division when the volume fraction α=10%.

[0035] Figure 2 The grid cases with and without local encryption of bubble clusters; (a) is the grid case without local encryption of bubble clusters, and (b) is the grid case with local encryption of bubble clusters.

[0036] Figure 3 The difference between the traditional method of local grid encryption and the method adopted by the present invention; (a) is a schematic diagram of the traditional method of local grid encryption, and (b) is a schematic diagram of the method adopted by the present invention.

[0037] Figure 4 These are the implementation steps of the local grid encryption method adopted by the present invention.

[0038] Figure 5The time required for the encryption process of the traditional local grid encryption method and the local grid encryption method adopted by the present invention.

[0039] Figure 6 Verification of the calculation results after local meshing for a bubble group with a volume fraction of 1%. DETAILED DESCRIPTION

[0040] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.

[0041] Example

[0042] This embodiment is the pre-processing part of the calculation of sparse bubble group collapse, which specifically involves the grid division of bubble group. The study of direct numerical simulation of bubble group collapse is crucial to revealing the cavitation mechanism, and therefore has become a hot research field. In the actual cavitation process, the volume fraction of the cavitation area varies widely, with a minimum of less than 0.1% and a maximum of more than 40%. Therefore, it is necessary to study bubble groups within different volume fraction ranges. When calculating the collapse of bubble groups, the grid resolution at the bubble is crucial to the calculation results and directly affects the convergence of the calculation. To this end, it is necessary to ensure that the grid resolution at the bubble is high enough during the calculation process. In order to save the number of grids, the bubble group grid is usually refined by layer-by-layer encryption, which is characterized by a high grid resolution in the bubble group area, and the farther away from the bubble group, the lower the grid resolution.

[0043] like Figure 1 (a) and Figure 1 As shown in (b), the grid division of a bubble group containing 13 bubbles is taken as an example. Under the condition of ensuring the consistency of the grid resolution at the bubble, if the local grid encryption scheme is not adopted, when the volume fraction of the bubble group is 40%, the total number of grids is 1.54 million; and when the volume fraction is 10%, the total number of grids increases to 5.68 million. This shows that the number of grids increases significantly with the decrease of volume fraction. The reason for this result is that in the bubble group with a volume fraction of 10%, the distance between bubbles is far, and the larger area in the middle of the bubble also maintains the same grid resolution as the bubble. This part of the grid is actually wasted. Therefore, in order to improve the computational efficiency, it is necessary to fully consider the distance between bubbles and the changes in volume fraction when designing the grid, so as to optimize the grid division and reduce unnecessary waste of computing resources.

[0044] The local mesh encryption technology can significantly reduce the number of meshes while ensuring that the mesh resolution at the bubble location remains unchanged. Take the mesh division of a bubble group containing 13 bubbles and a volume fraction of 10% as an example. Figure 2 As shown in (a), the total number of grids when the local grid division scheme is adopted is 1.81 million; Figure 2 As shown in (b), the total number of grids without the local grid division scheme is 5.68 million. This shows that local grid division significantly reduces the total number of grids, thereby improving computational efficiency.

[0045] Figure 3 The comparison between the steps of the traditional grid local encryption method and the encryption method proposed in the present invention is shown. Figure 3 As shown in (a), the traditional mesh local encryption step requires performing a local encryption operation on each bubble in the bubble group, while in OpenFOAM, each time a local encryption is performed, all meshes in the computational domain need to be traversed, which is a relatively time-consuming process. In contrast, the present invention proposes a method such as Figure 3 As shown in (b), only one local encryption operation is required to encrypt the grids near all bubbles in the bubble group. This means that it is no longer necessary to traverse all the divided grids multiple times, thus greatly saving the time required for grid encryption.

[0046] In this embodiment, the local grid encryption steps of the present invention are as follows:

[0047] like Figure 4 As shown, the present invention proposes an efficient local mesh encryption method based on OpenFOAM, and the method comprises the following steps:

[0048] (1) Acquire the target object, identify and model the target object, and obtain an initial target model; the target object includes target objects in the fields of fluid dynamics simulation, heat conduction simulation, and structural mechanics simulation.

[0049] (2) Using OpenFOAM to mesh the computational domain corresponding to the initial target model, the background mesh is obtained;

[0050] (3) According to actual needs (local areas where accurate calculation results are desired), several areas in the computational domain where the local grids to be encrypted are located are determined, recorded as local encrypted areas c1…cn, and the IDs of the background grids contained in each area are recorded to form a local grid set; with the center of each bubble in the bubble group as the center, the coordinates of the cuboid outside the bubble are determined and marked using the setSet command in OpenFOAM, that is, the IDs of all the grids in the background grid that are inside the cuboid are found and stored in the c1…cn file.

[0051] (4) After merging the local grid sets corresponding to the several areas where the local grids to be encrypted are located, a global grid set is obtained, which is recorded as a combinedSet file;

[0052] (4) Specifically:

[0053] First, the background grid ID in each local grid set is extracted, and then the duplicate background grid IDs are removed and the remaining background grid IDs are sorted to obtain the global grid set.

[0054] (5) After using the refineHexMesh command in OpenFOAM to mesh the global mesh set (i.e., binary division operation), all encrypted local meshes are obtained, and then the meshes that have not been locally encrypted are replaced with the newly divided meshes, that is, the target model is updated and the encryption of the local meshes is completed. It can also be viewed using third-party software such as ParaView, and then the calculation process such as bubble group collapse is executed. After a mesh encryption operation is performed on a background mesh, its mesh size is half of the original one, and the mesh resolution is twice the original one. The method proposed in the present invention realizes the function of obtaining a local mesh set in the background mesh that meets the local encryption requirements and encrypting multiple areas that need to be locally encrypted at the same time. This not only accurately captures all the mesh IDs that need to be encrypted in the background mesh, but also avoids the problem of too long total mesh division time caused by multiple separate divisions of each local mesh set. It can achieve efficient division of local meshes in the computational domain, especially when there are a large number of local meshes that need to be divided, which can significantly reduce the mesh division time.

[0055] From the above encryption steps, it can be seen that the more bubbles in the bubble group need to be locally encrypted, the more obvious the superiority of the local mesh encryption method of the present invention is. In order to further quantify the effect of the local mesh encryption of the present invention, the bubble groups with the number of bubbles ranging from 13 to 646 were counted, and the time required by the traditional local mesh encryption method and the encryption method of the present invention was compared. Figure 5 The results show that the more bubbles that need to be encrypted, the shorter the time required for local grid encryption of the present invention is compared with the traditional encryption method. Specifically, when the number of bubbles reaches hundreds, the time required is more than 20 times faster than the traditional method; and when the number of bubbles reaches 646, the speed is close to 100 times.

[0056] In addition, when the bubble group is relatively sparse, multiple local encryption operations can be performed on each bubble. According to the characteristics of the mesh encryption method of the present invention, when the mesh resolution at the bubble is consistent, the more times the local mesh is encrypted around each bubble, the smaller the final total mesh volume. The local mesh encryption method used in the present invention is more efficient than the traditional local encryption method. Figure 6 As shown in the figure, taking a bubble group with a volume fraction of 1% as an example, the relationship between the number of local mesh refinements performed on each bubble and the final total number of meshes, as well as the difference between the evolution of the calculated bubble group collapse radius and the collapse sound pressure are compared. Figure 6(a) is the grid distribution after a local grid division of a bubble group with a volume fraction of 1%. Figure 6 (b) is the number of local refinements and the corresponding total number of grids when the grid resolution near the bubble is the same. Figure 6 (c) shows the evolution of the equivalent radius of the bubble group with time corresponding to the simulation results of different mesh densification times near the bubble. Figure 6 (d) is the evolution of the acoustic pressure radiated by the bubble group with time corresponding to the different mesh densification times near the bubble. The results show that the more local densification times at the bubble, the fewer the total number of meshes, and the calculation results are consistent and have the same calculation accuracy.

[0057] The present invention also proposes an efficient local mesh encryption system based on OpenFOAM, comprising:

[0058] A target model building unit, used for acquiring a target object and identifying and modeling the target object;

[0059] A background meshing unit is used to mesh the computational domain corresponding to the initial target model;

[0060] A local grid set generating unit is used to determine several regions where the local grids to be encrypted are located in the computational domain according to actual needs and generate local grid sets corresponding to different regions;

[0061] A global grid set generating unit is used to merge local grid sets corresponding to several areas where the local grids to be encrypted are located;

[0062] The encrypted mesh division unit is used to divide the global mesh set into meshes to obtain all the encrypted local meshes.

[0063] The present invention also proposes a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of an efficient local grid encryption method based on OpenFOAM when executing the computer program.

[0064] The present invention also proposes a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of an efficient local grid encryption method based on OpenFOAM are implemented.

[0065] The present invention also proposes a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of an efficient local grid encryption method based on OpenFOAM.

[0066] Finally, it should be noted that the above embodiments and explanations are only used to illustrate the technical solution of the present invention rather than to limit it. Those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope disclosed in the technical solution of the present invention, which should be included in the scope of protection of the claims of the present invention.

Claims

1. An efficient local mesh encryption method based on OpenFOAM, characterized in that: The following steps are involved: (1) Acquire the target object, identify and model the target object, and obtain an initial target model; (2) Using OpenFOAM to mesh the computational domain corresponding to the initial target model, the background mesh is obtained; (3) Determine several regions in the computational domain where the local grids to be encrypted are located according to actual needs, and record the IDs corresponding to the background grids contained in each region to form a local grid set; (4) After merging the local grid sets corresponding to the several areas where the local grids to be encrypted are located, a global grid set is obtained; (5) After meshing the global grid set, all the encrypted local grids are obtained, and then the target model is updated to complete the encryption of the local grids.

2. The efficient local mesh encryption method based on OpenFOAM according to claim 1, characterized in that: In (3) above, the shape of the region includes a rectangular parallelepiped and a sphere.

3. The efficient local mesh encryption method based on OpenFOAM according to claim 1, characterized in that: The above (4) is specifically: First, the background grid ID in each local grid set is extracted, and then the duplicate background grid IDs are removed and the remaining background grid IDs are sorted to obtain the global grid set.

4. The efficient local mesh encryption method based on OpenFOAM according to claim 1, characterized in that: The target objects include target objects in the fields of fluid dynamics simulation, heat conduction simulation, and structural mechanics simulation.

5. An efficient local mesh encryption system based on OpenFOAM, characterized in that: include: A target model building unit, used for acquiring a target object and identifying and modeling the target object; A background meshing unit is used to mesh the computational domain corresponding to the initial target model; A local grid set generating unit is used to determine several regions where the local grids to be encrypted are located in the computational domain according to actual needs and generate local grid sets corresponding to different regions; A global grid set generating unit is used to merge local grid sets corresponding to several areas where the local grids to be encrypted are located; The encrypted mesh division unit is used to divide the global mesh set into meshes to obtain all the encrypted local meshes.

6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

8. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Mesh division method and device and electronic equipment

    CN114996986A

  • Self-gravity simulation method based on distance control grid encryption

    CN115640720A

  • Local grid encryption method and device for embedded discrete fracture model

    CN117390998A

  • Concave cavity flow field calculation method and device

    CN118171398A

  • Decoupled parallel meshing in computer aided design

    US20140379308A1

Cited By

  • Method for calculating field volume integral in OpenFOAM unsteady state simulation result

    CN121981022A

  • A method for calculating volume integral of field in openfoam unsteady simulation result

    CN121981022B