A non-structured grid based three-dimensional stream line generation method and system for flow field visualization

CN116310206BActive Publication Date: 2026-10-27PERA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310083185.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-08
Publication Date
2026-10-27
Estimated Expiration
2043-02-08

AI Technical Summary

Technical Problem

[0006]鉴于上述的分析,本发明实施例旨在提供一种用于流场可视化的基于非结构化网格的三维流线生成方法及系统,用以解决现有流线精度不高且未考虑流线均匀分布而影响流线可视化效果的问题

Benefits of technology

[0016]与现有技术相比,本发明至少可实现如下有益效果之一:提出一种相对均匀采样的初始质点布置方法,以保证流线初始位置均匀美观;并基于初始质点,为提高生成速度与精度,采用变步长的积分计算方法;以初始步长为试探性步长,比对相邻两个质点间矢量场数据的变化率,若变化率在阈值范围内,则认为获取的质点为流线上的下一个点,否则重新缩减步长查找计算下一个质点,以确保查找到的质点的速度矢量的变化不会过大,提高了流线的精度。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116310206B_ABST
    Figure CN116310206B_ABST
Patent Text Reader

Abstract

The application relates to a three-dimensional streamline generation method and system based on an unstructured grid for flow field visualization, and belongs to the technical field of flow field visualization. The method solves the problem that the existing streamline precision is not high and the uniform distribution of the streamlines is not considered, thereby affecting the streamline visualization effect. The method comprises the following steps: obtaining grid data and vector field data of an unstructured grid; obtaining sampling points as initial particles according to a boundary surface and / or a grid body; identifying a grid unit where the initial particles are located, and obtaining vector field data of the initial particles according to the vector field data of the grid points in the grid unit; starting from the initial particles, sequentially locating the next particle according to the integral direction and the integral step length, and moving forward and backward until a termination condition is met; the integral step length is dynamically adjusted according to the change rate of the vector field data of adjacent particles; and generating respective streamlines according to each initial particle and all the next particles located by the initial particle, so that a three-dimensional streamline set is obtained. The streamline generation speed and precision are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of flow field visualization technology, and in particular to a method and system for generating three-dimensional streamlines based on unstructured meshes for flow field visualization. Background Technology

[0002] In computer-aided engineering and scientific research, it is often necessary to visualize flow fields, transforming invisible flow field simulation data into visible flow field images. Among existing flow field data visualization techniques and methods, streamlines can intuitively describe and visualize flow, and are one of the commonly used flow field visualization methods.

[0003] A streamline is a curve formed by different fluid particles at the same moment. It indicates the velocity direction of different fluid particles at that moment, and the drawn streamline is tangent to the velocity vector of each point in the flow. There are two main types of streamline construction: one is a streamline generation algorithm based on stream functions, and the other is a streamline generation algorithm based on numerical integration. Among them, the stream function is mainly used for two-dimensional streamlines and has limitations; streamline construction based on numerical calculation is computationally simple and conforms to the discrete thinking in fluid computation, and this method is usually adopted.

[0004] Traditional numerical integration methods for streamlines mainly include the Euler method, the second-order Runge-Kutta method, and the fourth-order Runge-Kutta method. The Euler method is the simplest numerical integration method. However, this method yields relatively coarse approximations and has low accuracy. The second-order Runge-Kutta method uses the average of the vector value at point P at time t and the sum of the vector values ​​at point P at time t+Δt as the vector magnitude at time t, and then calculates the next point. The fourth-order Runge-Kutta method has the highest computational accuracy, but it is computationally complex, computationally intensive, and time-consuming.

[0005] Traditional numerical integration algorithms mostly employ a fixed integration step size, which cannot adapt to changes in the curvature of the integration curve. When adjacent vector directions on streamlines are the same or differ significantly, using the same step size results in either a relatively small step size when the vectors are the same, leading to excessive computational waste, or a relatively large step size when the vectors differ significantly, making it difficult to guarantee the accuracy of the calculated streamlines. Furthermore, existing methods do not consider the uniform distribution of streamlines, affecting the representation and visualization of the flow field. Summary of the Invention

[0006] Based on the above analysis, the present invention aims to provide a method and system for generating three-dimensional streamlines based on unstructured meshes for flow field visualization, in order to solve the problems of low streamline accuracy and failure to consider uniform streamline distribution, which affect the visualization effect of streamlines.

[0007] On one hand, embodiments of the present invention provide a method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization, comprising the following steps: Obtain mesh data and vector field data for unstructured meshes, which include 3D mesh volumes and 2D boundary surfaces; each 3D mesh volume consists of multiple 3D mesh elements; the vector field data is derived from numerical simulations, including velocity data and / or pressure data. Based on the selected boundary surface and / or mesh volume, sampling points are obtained as initial mass points, including: when a boundary surface is selected, if the current boundary surface is planar, sampling points are obtained by averaging based on the quadrilateral bounding box of the current boundary surface and according to the set number of sampling points; if the current boundary surface is curved, sampling points are obtained by sampling at equal steps based on the mesh points of the surface mesh element; when a mesh volume is selected, sampling points are obtained by averaging based on the three axial directions of the axis-aligned bounding box of each mesh volume and according to the set number of sampling points. Each initial particle is extracted sequentially, and the three-dimensional mesh cell in which the current initial particle is located is identified. Based on the vector field data of the mesh points in the three-dimensional mesh cell, the vector field data of the current initial particle is obtained. Starting from the current initial particle, the next particle is located sequentially forward and backward according to the integration direction and the integration step size, until the termination condition is met. The integration step size is dynamically adjusted according to the rate of change of the vector field data of adjacent particles. Based on each initial mass point and all its next located mass points, streamlines are generated for each mass point, resulting in a three-dimensional streamline set, which is then converted into a flow field image.

[0008] Based on a further improvement of the above method, if the current boundary surface is a plane, sampling points are obtained by averaging the sampling points based on the quadrilateral bounding box of the current boundary surface and according to the set number of sampling points, including: Triangulate the surface mesh cells of the current boundary surface into triangular mesh patches; Calculate the area of ​​each triangle and sum them up to get the total area of ​​the current boundary surface; based on the total area and the number of sampling points set, obtain the unit area of ​​each sampling point, and take the square root of the unit area to get the side length of the unit area; Based on the current bounding box of the quadrilateral, obtain the two sampling directions and their sampling lengths starting from the origin of the bounding box. Based on the sampling length and the side length per unit area, obtain the number of samples in each sampling direction. Starting from the origin of the bounding box, according to the side length per unit area, traverse and obtain sampling points in each of the two sampling directions using the following formula until the number of samples in each sampling direction is reached: , in, Indicates the coordinates of the sampling point. Represents the coordinates of the origin. and This represents a vector representing two sampling directions starting from the origin. This represents the side length per unit area.norm (·) denotes a normalized function. and These represent the sampling count indices for the two sampling directions, respectively.

[0009] Based on the above method, if the current boundary surface is curved, sampling points are obtained by sampling at equal steps based on the grid points of the surface mesh element, including: The grid points of the surface mesh cells of the current boundary surface are obtained as the sampling points. The total number of sampling points is divided by the set number of sampling points to obtain the interval number. r ; Every [number] sampling points r- One grid point is extracted as a sampling point.

[0010] Based on a further improvement to the above method, when a mesh volume is selected, sampling points are obtained by averaging the sampling points according to the three axial directions of the bounding box based on the axis alignment of each mesh volume, and according to the set number of sampling points, including: Extract each mesh volume in sequence, and discretize each 3D mesh element of the current mesh volume into a tetrahedral element; Calculate the volume of each tetrahedral element and sum them to obtain the total volume of the current mesh; based on the total volume and the number of sampling points set, obtain the unit volume of each sampling point, and take the cube root of the unit volume to obtain the side length of the unit volume; Based on the bounding box aligned with the current mesh axis, obtain the minimum and maximum values ​​along the three axes. Based on the side length of the unit volume and the distance between the maximum and minimum values ​​along the three axes, obtain the sampling count along each axis. Starting from the minimum value along the three axes, according to the side length of the unit volume, iterate through each axis using the following formula to obtain sampling points until the required sampling count for each axis is reached: , in, Indicates the sampling coordinates. Amin , Bmin and Cmin They represent x axis, y shaft and z Minimum value of the axis, , and They represent x axis, y shaft and z The sampling count index on the axis, b This represents the side length per unit volume.

[0011] Based on further improvements to the above method, the three-dimensional mesh cell containing the current initial particle is identified, including: It sequentially determines whether the current initial particle is within the bounding box of any three-dimensional mesh cell in each three-dimensional mesh volume. If it is, it obtains one or more bounding boxes containing the current initial particle and uses the three-dimensional mesh cells within each bounding box as the mesh cells to be analyzed. Take out each mesh cell to be analyzed in sequence, obtain the centroid of each face of the current mesh cell to be analyzed, calculate the solid angle of the triangle formed by the two adjacent vertices and the centroid of each face from the current initial mass point, and sum the solid angles obtained from each face of the mesh cell to be analyzed. If the sum of the angles is greater than or equal to 2π, then the current mesh cell to be analyzed is the mesh cell where the current initial mass point is located; otherwise, it is not.

[0012] Based on a further improvement to the above method, the vector field data of the current initial particle is obtained according to the vector field data of the grid points in the three-dimensional grid cell, including: Based on the volume of the three-dimensional mesh cell in which it is located, obtain the volume coordinates of the current initial particle. By using volume-weighted interpolation, the vector field data of the current initial particle is obtained based on the vector field data of the grid points in the three-dimensional grid cell and the volume coordinates of the current initial particle.

[0013] Based on a further improvement to the above method, the integration step size is dynamically adjusted according to the rate of change of the vector field data of adjacent particles, including: Normalize the vector field data of the current particle to obtain the unit vector; multiply the global initial step size by the unit vector to obtain the integration step size; Starting from the current particle, obtain the next particle based on the integration step size and integration direction; obtain the vector field data of the next particle based on the vector field data of the grid points in the 3D grid cell where the next particle is located; The current particle and the next particle are considered as adjacent particles. If the rate of change of the vector field data of the adjacent particles is greater than the threshold, the next particle is cleared, the integration step size is multiplied by the preset reduction factor and the integration step size is updated. The next particle is repositioned until the rate of change of the vector field data of the adjacent particles is less than or equal to the threshold, and the next particle is recorded.

[0014] Further improvements to the above method include termination conditions such as: the vector data of the next particle is 0; or the next particle has no 3D mesh cell; or the total number of integration steps from the initial particle exceeds the step threshold.

[0015] On the other hand, embodiments of the present invention provide a three-dimensional streamline generation system based on an unstructured mesh for flow field visualization, comprising: The data preparation module is used to acquire unstructured mesh data and vector field data. The unstructured mesh data includes three-dimensional mesh volumes and two-dimensional boundary surfaces; each three-dimensional mesh volume includes multiple three-dimensional mesh elements; the vector field data comes from numerical simulations and includes velocity data and / or pressure data. The initial mass point sampling module is used to obtain sampling points as initial mass points based on the selected boundary surface and / or mesh volume. This includes: when a boundary surface is selected, if the current boundary surface is planar, sampling points are obtained by averaging based on the quadrilateral bounding box of the current boundary surface and according to the set number of sampling points; if the current boundary surface is curved, sampling points are obtained by sampling at equal steps based on the mesh points of the surface mesh elements; when a mesh volume is selected, sampling points are obtained by averaging based on the three axial directions of the axis-aligned bounding box of each mesh volume and according to the set number of sampling points. The streamlined particle localization module is used to sequentially extract each initial particle, identify the three-dimensional mesh cell in which the current initial particle is located, and obtain the vector field data of the current initial particle based on the vector field data of the mesh points in the three-dimensional mesh cell. Starting from the current initial particle, the module sequentially locates the next particle forward and backward according to the integration direction and the integration step size until the termination condition is met. The integration step size is dynamically adjusted according to the rate of change of the vector field data of adjacent particles. The streamline generation module generates streamlines for each initial mass point and all its next located mass points, resulting in a three-dimensional streamline set that can be converted into a flow field image.

[0016] Compared with existing technologies, this invention can achieve at least one of the following beneficial effects: it proposes a relatively uniform sampling initial particle arrangement method to ensure that the initial position of the streamline is uniform and aesthetically pleasing; and based on the initial particles, to improve the generation speed and accuracy, a variable step size integral calculation method is adopted; using the initial step size as a trial step size, the rate of change of vector field data between two adjacent particles is compared. If the rate of change is within a threshold range, the obtained particle is considered to be the next point on the streamline; otherwise, the step size is reduced again to search for and calculate the next particle, so as to ensure that the change of velocity vector of the found particle is not too large, thereby improving the accuracy of the streamline.

[0017] In this invention, the above-described technical solutions can be combined with each other to achieve more preferred combinations. Other features and advantages of this invention will be set forth in the following description, and some advantages may become apparent from the description or be learned by practicing the invention. The objects and other advantages of this invention can be realized and obtained from what is particularly pointed out in the description and drawings. Attached Figure Description

[0018] The accompanying drawings are for illustrative purposes only and are not intended to limit the invention. Throughout the drawings, the same reference numerals denote the same parts. Figure 1 This is a flowchart of a three-dimensional streamline generation method based on unstructured mesh for flow field visualization according to Embodiment 1 of the present invention; Figure 2 A streamline diagram generated for the tee pipe model in Embodiment 1 of the present invention; Figure 3 This is a schematic diagram of a three-dimensional streamline generation system based on an unstructured mesh for flow field visualization, as shown in Embodiment 2 of the present invention. Detailed Implementation

[0019] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0020] Example 1 A specific embodiment of the present invention discloses a method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization, such as... Figure 1 As shown, it includes the following steps: S11: Obtain mesh data and vector field data of unstructured meshes, which include 3D mesh volumes and 2D boundary surfaces; each 3D mesh volume includes multiple 3D mesh elements.

[0021] It should be noted that, in this embodiment, each three-dimensional mesh cell includes the following types: tetrahedron, triangular prism, hexahedron, pyramid, or polyhedron; each three-dimensional mesh volume includes one or more types of three-dimensional mesh cells; and the two-dimensional boundary surface includes one or more types of triangles and various polygons.

[0022] Grid data includes geometric structure data and topological structure data, where geometric structure data is the spatial location information of grid points, i.e. x axis, y shaft and z Axis coordinates; topological data represents the connection relationships between grid points corresponding to each grid cell. During data acquisition, each grid cell and its grid points are stored in a specific order.

[0023] Vector field data originates from numerical simulations of vector fields and is typically discrete sampled data defined on discrete grid data. Vector field data includes vector field data defined at grid points and grid cells, such as velocity and pressure data.

[0024] S12: Obtain sampling points as initial mass points based on the selected boundary surface and / or mesh volume.

[0025] It should be noted that in the field of fluid dynamics, the focus is often on streamlines that begin at the inlet and terminate at the outlet boundary, as well as streamlines distributed throughout the volume. The initial particles are the basis for generating streamlines. This embodiment uses one or more boundary surfaces and / or grid volumes selected by the user as inlets to achieve two relatively uniform sampling methods based on surfaces and volumes, which are explained in steps S121 and S122 respectively.

[0026] S121: Based on the selected boundary surface, obtain the sampling points as the initial mass points.

[0027] Specifically, if the current boundary surface is a plane, sampling points are obtained by averaging the sampling points based on the quadrilateral bounding box of the current boundary surface and according to the set number of sampling points; if the current boundary surface is a curved surface, sampling points are obtained by sampling at equal steps based on the grid points of the surface grid unit.

[0028] It should be noted that for the surface mesh elements of the boundary surface, the normals of two adjacent surface mesh elements are identified in turn. If all the normals are the same, it is a plane; otherwise, it is a curved surface.

[0029] Furthermore, if the current boundary surface is a plane, based on the quadrilateral bounding box of the current boundary surface, sampling points are obtained by averaging according to the set number of sampling points, including: ① Triangulate the face mesh elements of the current boundary surface into triangular mesh patches; for example, the ear-cutting method is used to triangulate the non-triangular face mesh elements of the current boundary surface into triangular mesh patches.

[0030] ② Calculate the area of ​​each triangle and sum them up to get the total area of ​​the current boundary surface; based on the total area and the number of sampling points set, obtain the unit area of ​​each sampling point, and take the square root of the unit area to get the side length of the unit area; It should be noted that the unit area is the area of ​​a single square, and the side length of a single square is obtained by taking the square root.

[0031] ③ Based on the current bounding box of the quadrilateral, obtain two sampling directions and their sampling lengths starting from the origin of the bounding box. Based on the sampling length and the side length per unit area, obtain the number of samplings in each sampling direction. Starting from the origin of the bounding box, according to the side length per unit area, traverse and obtain sampling points according to the two sampling directions until the number of samplings in each sampling direction is reached.

[0032] It should be noted that in this embodiment, a parallelogram bounding box is obtained for each boundary surface. Two sampling directions and their sampling lengths are obtained starting from the origin of the bounding box. That is, the two sides where the origin of the parallelogram bounding box is located are taken as the two sampling directions, and the side length is taken as the sampling length.

[0033] Set the origin P 0, the endpoints of the two sampling edges P1 and endpoints P 2. Then, based on the sampling length and the side length per unit area, the sampling direction is obtained. Number of samplings N 1 and sampling direction Number of samples N 2. Expressed using the following formula: , , Where |·| represents taking the modulus of the vector to obtain the sampling length. This represents the side length per unit area.

[0034] Starting from the origin of the bounding box, sampling points are obtained by traversing along the side length of a unit area in two sampling directions until the sampling count for each direction is reached. This involves a two-level traversal process, starting from 1 and proceeding to the respective sampling count for each direction. The coordinates of the obtained sampling points are represented by the following formula: , in, Indicates the coordinates of the sampling point. Represents the coordinates of the origin. and This represents a vector representing two sampling directions starting from the origin. norm (·) denotes a normalized function. and These represent the sampling indexes in the two sampling directions, , .

[0035] Furthermore, if the current boundary surface is curved, sampling points are obtained based on the grid points of the surface mesh elements using equal-step sampling, including: The grid points of the surface mesh cells of the current boundary surface are obtained as the sampling points. The total number of sampling points is divided by the set number of sampling points to obtain the interval number. r ; Every [number] sampling points r- One grid point is extracted as a sampling point.

[0036] S122: Based on the selected grid volume, obtain sampling points as initial mass points.

[0037] Specifically, when a mesh volume is selected, sampling points are obtained by averaging the sampling points based on the three axial directions of the bounding box according to the axis alignment of each mesh volume, including: ① Take out each mesh body in sequence and discretize each three-dimensional mesh element of the current mesh body into a tetrahedral element; ② Calculate the volume of each tetrahedral element and sum them to obtain the total volume of the current mesh; based on the total volume and the number of sampling points set, obtain the unit volume of each sampling point, and take the cube root of the unit volume to obtain the side length of the unit volume; It should be noted that the unit volume is the area of ​​a single small cube, and the side length of a single small cube is obtained by taking the cube root.

[0038] ③ Align the bounding box with the current mesh axis, obtain the minimum and maximum values ​​in the three axes, obtain the number of samplings in the three axes based on the side length of the unit volume and the distance between the maximum and minimum values ​​in the three axes, and start from the minimum value in the three axes to obtain sampling points according to the side length of the unit volume, until the number of samplings in each axis is reached.

[0039] It should be noted that the three axes ( x , y , z The minimum value on ) is ( Amin, Bmin, Cmin ), the maximum value is ( (Amax, Bmax, Cmax) Then the number of samples along the three axes , and Represented by the following formulas: , , , in, b This represents the side length per unit volume.

[0040] Starting from the minimum value, sampling points are obtained by traversing the three axes according to the side length of the unit volume until the sampling number for each axis is reached. This is a three-level traversal process, starting from 1 and going up to the respective sampling number for each axis. The coordinates of the sampling points are represented by the following formula: , in, Indicates the sampling coordinates. , and They represent x axis, y shaft and z The sampling count index on the axis, , , .

[0041] Compared with the prior art, the initial particles in this embodiment are relatively evenly distributed, making the generated streamlines more uniform and aesthetically pleasing.

[0042] S13: Sequentially extract each initial particle, identify the three-dimensional mesh cell where the current initial particle is located, and obtain the vector field data of the current initial particle based on the vector field data of the mesh points in the three-dimensional mesh cell. Starting from the current initial particle, locate the next particle one by one in the order of forward and backward according to the integration direction and the integration step size, until the termination condition is met. The integration step size is dynamically adjusted according to the rate of change of the vector field data of the adjacent particles.

[0043] It should be noted that this step is a traversal process, which will be explained through steps S130-S134 respectively.

[0044] S130: Take out each initial particle in sequence.

[0045] S131: Identify the 3D mesh cell where the current initial particle resides, including: ① Determine sequentially whether the current initial particle is within the bounding box of any three-dimensional mesh cell in each three-dimensional mesh volume. If it is, obtain one or more bounding boxes containing the current initial particle and use the three-dimensional mesh cells within each bounding box as the mesh cells to be analyzed. It should be noted that if the current initial particle is not within the bounding box of any three-dimensional mesh element, it means that the current initial particle is not in the entire geometric model. The subsequent operation will not be performed, and the process will return to step S130 to retrieve the next initial particle as the current initial particle and re-evaluate.

[0046] ② Take out each grid cell to be analyzed in sequence, obtain the centroid of each face of the current grid cell to be analyzed, calculate the solid angle of the triangle formed by the two adjacent vertices and the centroid of each face from the current initial mass point, and sum the solid angles obtained from each face of the grid cell to be analyzed. If the sum of the angles is greater than or equal to 2π, then the current grid cell to be analyzed is the grid cell where the current initial mass point is located; otherwise, it is not.

[0047] It should be noted that calculating the solid angle from the current initial mass point to the triangle formed by the two consecutive adjacent vertices and their centroids on each face is equivalent to forming a triangle from the two consecutive adjacent vertices and their centroids on each face, and then connecting the current initial mass point to the three vertices of the triangle to form the solid angle.

[0048] Specifically, the angle of each solid angle angle The following formula is used to calculate: , , , in, P sIndicates the current initial particle. V 1. V 2 and V 3 represents the three vertices of the triangle formed by two consecutive adjacent vertices and the centroid on each face.

[0049] If the sum of angles obtained for each grid cell to be analyzed is less than 2π, it means that the current initial particle is outside each grid cell to be analyzed. In this case, no further operations are performed, and the process returns to step S130 to retrieve the next initial particle as the current initial particle and re-evaluate.

[0050] S132: Based on the vector field data of the grid points in the current 3D grid cell, obtain the vector field data of the current initial particle, including: Based on the volume of the three-dimensional mesh cell in which it is located, obtain the volume coordinates of the current initial particle. By using volume-weighted interpolation, the vector field data of the current initial particle is obtained based on the vector field data of the grid points in the three-dimensional grid cell and the volume coordinates of the current initial particle.

[0051] It should be noted that if the current initial particle exists inside multiple grid cells to be analyzed, that is, there may be multiple 3D grid cells, the vector field data of the current initial particle is obtained separately and the average is taken as the final vector field data; if there is no vector field data for any grid point in the 3D grid cell where the current initial particle is located, the subsequent operation is not performed, and the process returns to step S130, the next initial particle is taken as the current initial particle, and the judgment is performed again.

[0052] S133: Starting from the current initial particle, locate the next particle one by one forward and backward according to the integration direction and the integration step size, until the termination condition is met; the integration step size is dynamically adjusted according to the rate of change of the vector field data of the adjacent particles.

[0053] It should be noted that, starting from the current initial particle, the next particle is located sequentially forward and backward according to the integration direction and the integration step size, until the termination condition is met, including: Current initial particle P s0 Based on the integration direction and the integration step size, locate the next particle forward. Position the next particle backward. ,if and If all termination conditions are met, then the next initial particle is selected and the judgment is repeated; otherwise, if... If the termination condition is not met, then... As the current particle in the forward direction of integration, the next particle is located by continuing forward according to the integration step size. Continue until the next particle obtained by forward positioning satisfies the termination condition; if If the termination condition is not met, then... As the current particle in the backward direction of integration, the next particle is located further backward according to the integration step size. The process continues until the next particle obtained by backward positioning meets the termination condition. When the next particle obtained by forward and backward positioning both meet the termination condition, it means that all particles on the streamline of the current initial particle have been located. Then, the next initial particle is taken out, and the judgment is repeated to obtain all particles on the streamline of the next initial particle.

[0054] It should be noted that for each initial particle, the next particle is located simultaneously both forward and backward according to the integration direction. When locating a new particle from the next particle, it is only necessary to acquire data along the integration direction until the particles located in both integration directions meet the termination conditions. The termination conditions include: the vector data of the acquired next particle is 0; or, the acquired next particle has no grid volume; or the total number of integration steps from the initial particle exceeds the step threshold.

[0055] The integration step size is dynamically adjusted based on the rate of change of the vector field data of adjacent particles, including: ① Normalize the vector field data of the current mass point to obtain the unit vector; multiply the global initial step size by the unit vector to obtain the integration step size; for example, the global initial step size is 0.02 mm.

[0056] ② Starting from the current particle, obtain the next particle based on the integration step size and integration direction; obtain the vector field data of the next particle based on the vector field data of the grid points in the three-dimensional grid cell where the next particle is located; It should be noted that when the integration direction is forward, the integration step size plus the coordinates of the current particle is used as the coordinates of the next particle; when the integration direction is backward, the integration step size minus the coordinates of the current particle is used as the coordinates of the next particle.

[0057] If the next particle located by both the forward and backward integration satisfy the termination condition, then return to step S130, retrieve the next initial particle as the current initial particle, and re-evaluate.

[0058] ③The current particle and the next particle are considered as adjacent particles. If the rate of change of the vector field data of the adjacent particles is greater than the threshold, the next particle is cleared, the integration step size is multiplied by the preset reduction factor and the integration step size is updated. The next particle is repositioned until the rate of change of the vector field data of the adjacent particles is less than or equal to the threshold, and the next particle is recorded.

[0059] It should be noted that the vector field data of the next particle is also obtained using the volume-weighted interpolation method in step S132. The rate of change of the vector field data of adjacent particles is: the difference between the vector field data of the next particle and the vector field data of the current particle divided by the vector field data of the current particle. Preferably, the threshold is set to 0.3. If it is greater than 0.3, the change of the vector field of the next particle is considered to be extreme, and the integration step size is recalculated with a reduction factor.

[0060] S134: Determine whether all the initial particles have been collected. If not, return to step S130; otherwise, end the entire process.

[0061] Compared with the prior art, this embodiment uses variable step size integration. After integrating with the initial step size in each step, the rate of change of the vector field is calculated. If it exceeds the threshold, it is dynamically reduced and recalculated to ensure that the change of the velocity vector of the found particle is not too large, thus balancing accuracy and speed.

[0062] S14: Generate streamlines for each initial mass point and all its next located mass points to obtain a set of three-dimensional streamlines.

[0063] It should be noted that for each initial mass point and all the next mass points located thereafter, connecting them sequentially to draw multiple lines results in a streamline generated from the initial mass point, thus obtaining a set of three-dimensional streamlines.

[0064] Step S14 generates three-dimensional streamlines after all the particles have been acquired. It can also be performed during the traversal process of step S13, that is, before executing step S134, to generate the streamlines of the current initial particle.

[0065] For example, based on the T-junction model, select y Towards the boundary surface of the entrance and z When the sampling quantity is set to 25 at the boundary surface of the entrance, the generated streamline diagram is as follows: Figure 2 As shown.

[0066] Compared with existing technologies, this embodiment provides a three-dimensional streamline generation method based on unstructured meshes for flow field visualization. It proposes a relatively uniform sampling initial particle arrangement method to ensure that the initial position of the streamline is uniform and aesthetically pleasing. Based on the initial particles, a variable step-size integral calculation method is adopted to improve the generation speed and accuracy. The initial step size is used as an exploratory step size to compare the rate of change of vector field data between two adjacent particles. If the rate of change is within a threshold range, the obtained particle is considered to be the next point on the streamline. Otherwise, the step size is reduced again to find and calculate the next particle. This ensures that the change of velocity vector of the found particle is not too large, thus improving the accuracy of the streamline.

[0067] Example 2 Another embodiment of the present invention discloses a three-dimensional streamline generation system based on unstructured meshes for flow field visualization, thereby implementing the three-dimensional streamline generation method based on unstructured meshes for flow field visualization in Embodiment 1. The specific implementation of each module is described in the corresponding description in Embodiment 1. Figure 3 As shown, the system includes: The data preparation module 101 is used to acquire unstructured mesh data and vector field data. The unstructured mesh data includes three-dimensional mesh volumes and two-dimensional boundary surfaces; each three-dimensional mesh volume includes multiple three-dimensional mesh elements. The initial mass sampling module 102 is used to obtain sampling points as initial mass points based on the selected boundary surface and / or mesh volume; The streamlined particle localization module 103 is used to sequentially extract each initial particle, identify the three-dimensional mesh cell where the current initial particle is located, and obtain the vector field data of the current initial particle based on the vector field data of the mesh points in the three-dimensional mesh cell. Starting from the current initial particle, the module locates the next particle one by one forward and backward according to the integration direction and the integration step size, until the termination condition is met. The integration step size is dynamically adjusted according to the rate of change of the vector field data of adjacent particles. The streamline generation module 104 is used to generate streamlines for each initial mass point and all the next mass points located thereafter, thus obtaining a set of three-dimensional streamlines.

[0068] Since the three-dimensional streamline generation system based on unstructured meshes for flow field visualization in this embodiment and the aforementioned three-dimensional streamline generation method based on unstructured meshes for flow field visualization can be mutually referenced, this description is redundant and will not be repeated here. Because this system embodiment shares the same principle as the above method embodiment, it also possesses the corresponding technical effects of the above method embodiment.

[0069] Those skilled in the art will understand that all or part of the processes of the methods described in the above embodiments can be implemented by a computer program instructing related hardware, and the program can be stored in a computer-readable storage medium. The computer-readable storage medium may be a disk, optical disk, read-only memory, or random access memory, etc.

[0070] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization, characterized in that, Includes the following steps: Obtain mesh data and vector field data of an unstructured mesh, which includes a three-dimensional mesh volume and a two-dimensional boundary surface; each three-dimensional mesh volume includes multiple three-dimensional mesh elements; the vector field data is derived from numerical simulation and includes velocity data and / or pressure data. Based on the selected boundary surface and / or mesh volume, sampling points are obtained as initial mass points, including: when a boundary surface is selected, if the current boundary surface is planar, sampling points are obtained by averaging based on the quadrilateral bounding box of the current boundary surface and according to the set number of sampling points; if the current boundary surface is curved, sampling points are obtained by sampling at equal steps based on the mesh points of the surface mesh element; when a mesh volume is selected, sampling points are obtained by averaging based on the three axial directions of the axis-aligned bounding box of each mesh volume and according to the set number of sampling points. Each initial particle is extracted sequentially, and the three-dimensional mesh cell in which the current initial particle is located is identified. Based on the vector field data of the mesh points in the three-dimensional mesh cell, the vector field data of the current initial particle is obtained. Starting from the current initial particle, the next particle is located sequentially forward and backward according to the integration direction and the integration step size, until the termination condition is met. The integration step size is dynamically adjusted according to the rate of change of the vector field data of adjacent particles. Based on each initial mass point and all its next located mass points, streamlines are generated for each mass point, resulting in a three-dimensional streamline set, which is then converted into a flow field image.

2. The method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization according to claim 1, characterized in that, If the current boundary surface is a plane, sampling points are obtained by averaging the sampling points based on the quadrilateral bounding box of the current boundary surface and according to the set number of sampling points, including: Triangulate the surface mesh cells of the current boundary surface into triangular mesh patches; Calculate the area of ​​each triangle and sum them up to get the total area of ​​the current boundary surface; based on the total area and the number of sampling points set, obtain the unit area of ​​each sampling point, and take the square root of the unit area to get the side length of the unit area; Based on the current bounding box of the quadrilateral, obtain the two sampling directions and their sampling lengths starting from the origin of the bounding box. Based on the sampling length and the side length per unit area, obtain the number of samples in each sampling direction. Starting from the origin of the bounding box, according to the side length per unit area, traverse and obtain sampling points in each of the two sampling directions using the following formula until the number of samples in each sampling direction is reached: , in, Indicates the coordinates of the sampling point. Represents the coordinates of the origin. and This represents a vector representing two sampling directions starting from the origin. This represents the side length per unit area. norm (·) denotes a normalized function. and These represent the sampling count indices for the two sampling directions, respectively.

3. The method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization according to claim 1, characterized in that, If the current boundary surface is curved, the sampling points are obtained by sampling at equal steps based on the grid points of the surface mesh unit, including: The grid points of the surface mesh cells of the current boundary surface are obtained as the sampling points. The total number of sampling points is divided by the set number of sampling points to obtain the interval number. r ; Every [number] sampling points r- One grid point is extracted as a sampling point.

4. The method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization according to claim 1, characterized in that, When a mesh is selected, sampling points are obtained by averaging the sampling points based on the three axial directions of the bounding box of each mesh, according to the set number of sampling points, including: Extract each mesh volume in sequence, and discretize each 3D mesh element of the current mesh volume into a tetrahedral element; Calculate the volume of each tetrahedral element and sum them to obtain the total volume of the current mesh; based on the total volume and the number of sampling points set, obtain the unit volume of each sampling point, and take the cube root of the unit volume to obtain the side length of the unit volume; Based on the bounding box aligned with the current mesh axis, obtain the minimum and maximum values ​​along the three axes. Based on the side length of the unit volume and the distance between the maximum and minimum values ​​along the three axes, obtain the sampling count along each axis. Starting from the minimum value along the three axes, according to the side length of the unit volume, iterate through each axis using the following formula to obtain sampling points until the required sampling count for each axis is reached: , in, Indicates the sampling coordinates. Amin , Bmin and Cmin They represent x axis, y shaft and z Minimum value of the axis, , and They represent x axis, y shaft and z The sampling count index on the axis, b This represents the side length per unit volume.

5. The method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization according to claim 1, characterized in that, The process of identifying the three-dimensional mesh cell where the current initial particle is located includes: It sequentially determines whether the current initial particle is within the bounding box of any three-dimensional mesh cell in each three-dimensional mesh volume. If it is, it obtains one or more bounding boxes containing the current initial particle and uses the three-dimensional mesh cells within each bounding box as the mesh cells to be analyzed. Take out each mesh cell to be analyzed in sequence, obtain the centroid of each face of the current mesh cell to be analyzed, calculate the solid angle of the triangle formed by the two adjacent vertices and the centroid of each face from the current initial mass point, and sum the solid angles obtained from each face of the mesh cell to be analyzed. If the sum of the angles is greater than or equal to 2π, then the current mesh cell to be analyzed is the mesh cell where the current initial mass point is located; otherwise, it is not.

6. The method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization according to claim 5, characterized in that, The step of obtaining the vector field data of the current initial particle based on the vector field data of the grid points in the three-dimensional grid cell includes: Based on the volume of the three-dimensional mesh cell in which it is located, obtain the volume coordinates of the current initial particle. By using volume-weighted interpolation, the vector field data of the current initial particle is obtained based on the vector field data of the grid points in the three-dimensional grid cell and the volume coordinates of the current initial particle.

7. The method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization according to claim 6, characterized in that, The integration step size is dynamically adjusted based on the rate of change of the vector field data of adjacent particles, including: Normalize the vector field data of the current particle to obtain the unit vector; multiply the global initial step size by the unit vector to obtain the integration step size; Starting from the current particle, obtain the next particle based on the integration step size and integration direction; obtain the vector field data of the next particle based on the vector field data of the grid points in the 3D grid cell where the next particle is located; The current particle and the next particle are considered as adjacent particles. If the rate of change of the vector field data of the adjacent particles is greater than the threshold, the next particle is cleared, the integration step size is multiplied by the preset reduction factor and the integration step size is updated. The next particle is repositioned until the rate of change of the vector field data of the adjacent particles is less than or equal to the threshold, and the next particle is recorded.

8. The method for generating three-dimensional streamlines based on unstructured meshes for flow field visualization according to claim 7, characterized in that, The termination conditions include: the vector data of the next particle is 0; or the next particle has no corresponding 3D mesh cell; or the total number of integration steps from the initial particle exceeds the step threshold.

9. A three-dimensional streamline generation system based on unstructured meshes for flow field visualization, characterized in that, include: The data preparation module is used to acquire unstructured mesh data and vector field data. The unstructured mesh data includes three-dimensional mesh volumes and two-dimensional boundary surfaces. Each three-dimensional mesh volume includes multiple three-dimensional mesh elements. The vector field data comes from numerical simulation and includes velocity data and / or pressure data. The initial mass point sampling module is used to obtain sampling points as initial mass points based on the selected boundary surface and / or mesh volume. This includes: when a boundary surface is selected, if the current boundary surface is planar, sampling points are obtained by averaging based on the quadrilateral bounding box of the current boundary surface and according to the set number of sampling points; if the current boundary surface is curved, sampling points are obtained by sampling at equal steps based on the mesh points of the surface mesh elements; when a mesh volume is selected, sampling points are obtained by averaging based on the three axial directions of the axis-aligned bounding box of each mesh volume and according to the set number of sampling points. The streamlined particle localization module is used to sequentially extract each initial particle, identify the three-dimensional mesh cell in which the current initial particle is located, and obtain the vector field data of the current initial particle based on the vector field data of the mesh points in the three-dimensional mesh cell. Starting from the current initial particle, the module sequentially locates the next particle forward and backward according to the integration direction and the integration step size until the termination condition is met. The integration step size is dynamically adjusted according to the rate of change of the vector field data of adjacent particles. The streamline generation module generates streamlines for each initial mass point and all its next located mass points, resulting in a three-dimensional streamline set that can be converted into a flow field image.

Citation Information

Patent Citations

  • Three-dimensional streamline dynamic visualization algorithm facing irregular ocean flow field data

    CN104658027A

  • Fragmentation parameterization-based feature-preserving surface structure grid generation method

    CN114332409A