An intelligent streamline clustering and extraction method and system for CFD simulation post-processing
By employing a confidence-based deep sensing streamline clustering method, utilizing LSTM autoencoders and DBSCAN clustering, the consistency and uniformity issues in streamline extraction are resolved, achieving fast and effective streamline extraction while maintaining the representativeness and structural integrity of the flow field.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU DIANZI UNIV
- Filing Date
- 2026-05-09
- Publication Date
- 2026-06-05
Smart Images

Figure CN122156697A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of computer graphics and computer-aided engineering technology, specifically relating to an intelligent streamline clustering and extraction method and system for CFD simulation post-processing. Background Technology
[0002] Understanding large and complex 3D flow fields is crucial for many dynamic systems that underpin a wide range of physical and natural phenomena. Applications in fields such as computational fluid dynamics, automotive and aircraft design, and weather forecasting often generate large amounts of vector field data that require effective analysis and visualization. Streamline visualization has long been an important analytical method, enabling detailed qualitative and quantitative exploration of flow behavior.
[0003] However, how to derive streamlines that better represent the flow field has always been a hot topic in related research. However, current traditional methods and deep learning-based methods have their limitations. Traditional methods rely on hand-designed features or geometric metrics, which often struggle to maintain consistency in highly complex regions and fail to achieve a good balance between structural integrity and global distribution uniformity. Deep learning methods suffer from excessively high input dimensionality and long training times. Furthermore, most existing deep learning methods operate on the entire streamline, which causes significant local structures to be masked by less informative parts of the same trajectory, resulting in the loss of important flow features. Summary of the Invention
[0004] In view of the above-mentioned deficiencies of the prior art, the present invention provides an intelligent streamline clustering and extraction method and system for CFD simulation post-processing, which can take into account both the completeness of the results and the uniformity of global distribution, and is applicable to the streamline extraction method in complex regions. While the time cost is acceptable, it ensures that the extracted streamlines are highly representative of the original flow field.
[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0006] Firstly, an intelligent streamline clustering and extraction method for CFD simulation post-processing includes the following steps:
[0007] S1. Obtain the streamline set; segment and interpolate the streamlines to generate a streamline segment sequence;
[0008] S2. Input the streamline segment sequence into the autoencoder of the LSTM to generate the streamline segment latent vector corresponding to each streamline segment; the decoder generates the reconstructed output and confidence sequence based on the streamline segment latent vector; construct the loss function based on the reconstructed output and confidence sequence, and correct and train the model.
[0009] S3. Based on the latent vector and confidence level of each streamline segment, generate the modified latent vector of each streamline segment; perform dimensionality reduction and clustering on each modified latent vector to generate clustering results;
[0010] S4. Based on the clustering results, calculate the distance and density between streamline segments after the streamline set is decomposed; filter according to the distance and density to generate a key streamline set.
[0011] Preferably, S1 includes:
[0012] S11. Based on the preset minimum turning angle threshold and cumulative turning angle threshold, pre-segment each streamline; calculate the average segment length based on the number of segments generated by the pre-segmentation;
[0013] S12. After dividing each streamline based on the average segment length, the number of points is interpolated to generate a streamline segment sequence.
[0014] Preferably, S2 includes:
[0015] The streamline sequence includes the vector and vorticity of the corresponding points after interpolation to a fixed number of points; the encoder includes a two-layer LSTM network for sequence feature extraction, a masked average pooling layer for length-invariant aggregation, and a linear projection layer for dimensionality reduction.
[0016] Preferably, S2 includes: the decoder generating a reconstruction output and a confidence sequence based on the streamline segment latent vector; and calculating the model loss based on the reconstruction output and the confidence output.
[0017] The streamline segment latent vector and the corresponding point's normalized position are encoded and then input into the decoder's LSTM network to generate the reconstructed output. and confidence sequence The loss function formula is as follows:
[0018]
[0019] in, A mask representing the effective time step. The number of fixed points for the defined streamline. is the regularization coefficient; the first term of the loss function formula adaptively scales the squared reconstruction error by the predicted confidence level to suppress the influence of uncertain regions; the second term of the loss function formula is used to penalize excessive confidence inflation. Indicates reconstruction output subscript, Indicates the corresponding dimension of the vector.
[0020] Preferably, S3 includes:
[0021] For each streamline segment, based on its confidence sequence and streamline latent vector Obtain the corrected latent vector:
[0022]
[0023] in, This represents the average confidence level calculated from the confidence level sequence. These are preset coefficients used to control the strength of the weighting. It is a numerically stable term.
[0024] As a preferred option, S3 also includes:
[0025] After dimensionality reduction of each modified latent vector, DBSCAN clustering is performed. Based on the preset values, unrepresentative streamline segments are deleted; the retained streamline segments are restored to the original streamlines.
[0026] Preferably, S4 includes:
[0027] The streamline set is decomposed to generate an ordered list of segments. , of which each Contains its point sequence and position index within the streamline; calculate any two segments and The distance between them is the minimum point-to-point Euclidean distance between the sample sets:
[0028]
[0029] Where p is a segment point sequence In the middle, q is a point, and q is a segment point sequence The point in the middle;
[0030] Based on the average coordinates of all points within the segment Calculate the density value that reflects the density of its vicinity:
[0031]
[0032] in, For a Gaussian kernel, For the set bandwidth, Let the geometric center of the k-th segment be... This represents the number of all streamline segments.
[0033] As a preferred option, the screening in S4 based on distance and density includes:
[0034] An initial min-heap is built based on the distance between streamline segments. , storage tuple ( ); Initialize the segment set using the first streamline segment of the beginning and end of each streamline. Then prune the data, popping the tuple with the smallest distance each time, if none of its segments belong to the set. Skip if they all belong to the set. Delete the segments with higher density; add the next adjacent streamline segment on the same streamline as the deleted segment to the set. In the process, the pruning ends after the number of deletions meets the requirement, and a set of key streamlines is generated.
[0035] Secondly, a smart streamline clustering and extraction method system for CFD simulation post-processing includes:
[0036] The segmented interpolation module is used to obtain a set of streamlines, segment and interpolate the streamlines, and generate a sequence of streamline segments.
[0037] The feature extraction module is used to input the streamline segment sequence into the autoencoder of the LSTM to generate the streamline segment latent vector corresponding to each streamline segment; the decoder generates the reconstruction output and confidence sequence based on the streamline segment latent vector.
[0038] The training module is used to construct a loss function based on the reconstructed output and confidence sequence, and to refine and train the model.
[0039] The clustering module is used to generate modified latent vectors for each streamline segment based on the streamline segment latent vectors and confidence scores; and to perform dimensionality reduction and clustering on each modified latent vector to generate clustering results.
[0040] The filtering module is used to calculate the distance and density between streamline segments after the streamline set is decomposed based on the clustering results; and to filter according to the distance and density to generate a set of key streamlines.
[0041] The streamline extraction system based on confidence-aware deep clustering is used to implement the intelligent streamline clustering and extraction method and its steps for CFD simulation post-processing as described in the first aspect.
[0042] Compared with the prior art, the beneficial effects of the present invention are reflected in:
[0043] 1. Unlike traditional streamline extraction techniques that rely on manual features or convolutional autoencoders for feature extraction and clustering, this invention employs a confidence-based deep perception clustering approach. A confidence branch is added to the traditional autoencoder structure for the evaluation and clustering of streamlines, enabling the clustering algorithm to truly focus on representative dynamic structures.
[0044] 2. Unlike traditional deep learning techniques for streamline extraction that use voxels or entire streamlines as input, this invention employs a technique of segmenting streamlines before inputting them into the model. This makes it less likely that key local structures in the streamlines will be obscured by longer, less information-rich smooth sections in the same trajectory, thus enabling better extraction of streamlines with important flow characteristics and faster model training speed. Attached Figure Description
[0045] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention;
[0046] Figure 2 This is the pseudocode for step S4 of embodiment 1 of the present invention;
[0047] Figure 3 This is a schematic diagram of the original streamline assembly in Embodiment 1 of the present invention;
[0048] Figure 4 This is a schematic diagram of the streamline set result after processing by this method in Embodiment 1 of the present invention. Specific implementation methods
[0049] To make the technical means, inventive features, objectives, and effects of the invention readily understandable, the invention is further described below with reference to specific illustrations. However, the invention is not limited to the embodiments described below.
[0050] It should be noted that the structures, proportions, sizes, etc., illustrated in the accompanying drawings of this specification are only used to complement the content disclosed in the specification for those skilled in the art to understand and read, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0051] This invention first segments and interpolates streamlines based on cumulative turning angles; then, the results are input into a confidence-guided improved LSTM (Long Short-Term Memory) autoencoder for training; after training, the latent vectors obtained from the autoencoder are adjusted according to the confidence of the corresponding streamlines; the adjusted results are then dimensionality-reduced, clustered, and pruned to finally obtain a uniform and representative set of key streamlines.
[0052] Example 1:
[0053] like Figure 1 The intelligent streamline clustering and extraction method shown here for CFD simulation post-processing includes the following steps:
[0054] S1. Obtain the streamline set; segment and interpolate the streamlines to generate a streamline segment sequence;
[0055] Obtain the initial large-scale streamline set and the original flow field vector data used to calculate the streamlines, process the data, and apply the preset minimum turning angle threshold. and cumulative turning threshold The streamlines are pre-segmented, the average segment length of the pre-segmentation results is calculated, the streamline set is then segmented according to this segment length, and the segmented streamline segments are interpolated to ensure that each streamline segment has the same number of streamline points. Specifically, this includes:
[0056] S11. Pre-segment each streamline and calculate the average segment length;
[0057] For each streamline, each streamline point starting from the second point Use the following formula to calculate the line connecting the points before and after it. and And calculate its local rotation angle. :
[0058]
[0059]
[0060] when < When the change is high, the corresponding point is considered part of the low-change region and no operation is performed; otherwise, it is added to the cumulative rotation angle. In, and its length and Add cumulative length (If previous valid points have already been accumulated, skip this step) If at this point... ≥ Then the number of partitions Add 1, and Reset to 0; when there are remaining segments at the end of the streamline, the number of segments is... Increment by 1 to end the processing of this streamline. After processing all streamlines, this invention calculates the global average segment length. .
[0061] S12. After dividing each streamline based on the average segment length, the interpolation is a fixed number of points, and the vorticity of each corresponding point is calculated to generate a streamline segment sequence.
[0062] Reuse Each streamline is segmented. Since the number of streamline points within each streamline segment is different, this invention also needs to use Hermit interpolation to interpolate to a fixed number of points. (Preset values), and calculate the vorticity at the corresponding position, thereby generating a sequence of streamline segments with a fixed number of points containing vorticity data for use by S2.
[0063] S2. Input the streamline segment sequence into the autoencoder of the LSTM to generate streamline segment latent vectors; the decoder generates the reconstructed output and confidence sequence based on the streamline segment latent vectors; calculate the model loss based on the reconstructed output and confidence sequence.
[0064] The corresponding data of each streamline is input into the autoencoder of the LSTM, and the output is divided into two parallel branches: reconstruction and confidence. The model loss is calculated by combining the two branches, and the subsequent model training is performed. The latent vector of the streamline segment and the corresponding confidence after training are output to S3. Specifically, S21: Input the streamline segment sequence into the autoencoder of the LSTM to generate the latent vector of the streamline segment.
[0065] The streamline segment sequence in S1 In the input encoder, where The encoder consists of the vector and vorticity of the corresponding points in the streamline segment sequence after interpolation to a fixed number of points. It comprises a two-layer LSTM network for sequence feature extraction, a masked average pooling network for length-invariant aggregation, and a linear projection network for dimensionality reduction. After passing through the encoder, the streamline segment is mapped to a latent vector, which is... Figure 1 The middle represents .
[0066] S22. The decoder generates the reconstructed output and confidence sequence based on the streamline segment latent vector; the model loss is calculated based on the reconstructed output and confidence output.
[0067] This latent vector is then combined with the corresponding normalized position code to form a new vector, which is input into the LSTM network of the decoder. This network will produce two parallel outputs: a reconstruction output. And confidence output The current loss is calculated using the following loss function:
[0068]
[0069] in A mask representing the effective time step. This refers to the fixed number of points for each segment as previously set, and This is a regularization coefficient. The first term adaptively scales the squared reconstruction error by the predicted confidence level, emphasizing the accurate region while suppressing the influence of uncertain regions. The second term penalizes over-inflation of the confidence level, preventing the model from simply increasing... To reduce weighted losses, express subscript, This represents the corresponding dimension of the vector. After calculating the current loss, the model is then adjusted, and this process is iterated until training terminates, at which point the final latent vector is obtained. and confidence sequence For use by S3.
[0070] S3. Generate modified latent vectors based on the latent vectors and confidence levels of each streamline segment; perform dimensionality reduction and clustering on the modified latent vectors to generate clustering results.
[0071] The streamline latent vectors in S2 are inversely weighted according to their corresponding confidence levels, then the weighted results are reduced to 2 dimensions, and finally clustering is performed based on the dimensionality reduction results, specifically including:
[0072] For each streamline segment, based on its confidence sequence and latent vector Obtain its corrected latent vector ,in This represents the average confidence level calculated from the confidence level sequence. These are pre-set coefficients used to control the strength of the weighting. This is the numerically stable term. This inverse confidence weighting enhances the contribution of structurally complex or uncertain streamlines while suppressing overly smooth or simple streamlines, thereby improving separability in the latent feature space.
[0073] Correcting the latent vector yields Next, t-SNE (t-Distributed Stochastic Neighbor Embedding) is applied to reduce its dimensionality to a two-dimensional vector. Then, the DBSCAN clustering algorithm is executed on the processed streamline segment set. Based on the set values, representative streamline segments are selected, and unrepresentative streamline segments are deleted. After processing, the retained streamline segments are restored to their original streamlines. That is, when a streamline segment is retained, all its corresponding streamlines are retained. The restored results are then used by S4.
[0074] S4. Based on the clustering results, calculate the distance and density between streamline segments after the ordered decomposition of the streamline set; filter according to the distance and density to generate a key streamline set.
[0075] Based on the clustering results in step 3, streamline segments are removed according to the distance and density between segments until the results meet the requirements. The results are then used as the final set of key streamlines, which includes:
[0076] Decompose the streamline set into an ordered list of segments. Each of them Contains its point sequence And its position index within the streamline. For any two segments... and This invention calculates the distance between them, that is, the minimum point-to-point Euclidean distance between their sample sets:
[0077]
[0078] Next, calculate the geometric center of each segment, which is the average coordinate of all points within the segment. ,according to Calculate the density value that reflects the density of its vicinity:
[0079]
[0080] in, For a Gaussian kernel, That is the pre-set bandwidth. Let the geometric center of the k-th segment be... For the number of all streamline segments, this invention omits the normalization constant because pruning is performed using only relative density. Segments in dense streamline clusters naturally acquire higher density.
[0081] Finally, an initial min-heap is constructed using the distances between all streamline segments. (Due to this, distance pairs are not calculated between streamline segments within each streamline itself), and the first and second parts of each streamline segment are added to the initial segment set. In the process, pruning is performed, and each time the smallest pair in the heap is selected and removed, i.e., a tuple is stored. The pair with the smallest d in () is the pair in which all segments do not belong to If both segments belong to a stream, skip them. If both belong, delete the segment with the higher density; otherwise, delete the segment that belongs to the stream. This involves determining whether the two selected segments with the smallest distance are currently the beginning and end segments of a stream. After deleting a segment, add the segments connected to it. In the algorithm, pruning ends after the required number of deletions is reached, and the remaining streamline is the final result of this algorithm. For detailed algorithm information, see [link to algorithm details]. Figure 2 The pseudocode in the text. Figure 3 The original streamlines were displayed, and their overall distribution was dense and chaotic, making it difficult to intuitively identify key flow characteristics. Figure 4 The resulting set of key streamlines, filtered by the method of this invention, significantly improves the global uniformity of streamline distribution compared to the original streamlines, while maintaining the integrity of the overall flow structure. Especially in complex flow regions, this invention effectively extracts representative local structures through confidence-perceived clustering, avoiding the loss of important flow features and making the streamline distribution more sparse and orderly, facilitating subsequent analysis and visualization. This comparison verifies the superiority of this invention in balancing structural integrity and uniform distribution.
[0082] Example 2:
[0083] A smart streamline clustering and extraction system for CFD simulation post-processing includes:
[0084] The segmented interpolation module is used to obtain a set of streamlines, segment and interpolate the streamlines, and generate a sequence of streamline segments.
[0085] The feature extraction module is used to input the streamline segment sequence into the autoencoder of the LSTM to generate the streamline segment latent vector corresponding to each streamline segment; the decoder generates the reconstruction output and confidence sequence based on the streamline segment latent vector.
[0086] The training module is used to construct a loss function based on the reconstructed output and confidence sequence, and to refine and train the model.
[0087] The clustering module is used to generate modified latent vectors for each streamline segment based on the streamline segment latent vectors and confidence scores; and to perform dimensionality reduction and clustering on each modified latent vector to generate clustering results.
[0088] The filtering module is used to calculate the distance and density between streamline segments after the streamline set is decomposed based on the clustering results; and to filter according to the distance and density to generate a set of key streamlines.
[0089] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein. It should be understood that the invention is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.
Claims
1. A smart streamline clustering and extraction method for CFD simulation post-processing, characterized in that, Includes the following steps: S1. Obtain the streamline set; segment and interpolate the streamlines to generate a streamline segment sequence; S2. Input the streamline segment sequence into the autoencoder of the LSTM to generate the streamline segment latent vector corresponding to each streamline segment; the decoder generates the reconstructed output and confidence sequence based on the streamline segment latent vector; construct the loss function based on the reconstructed output and confidence sequence, and correct and train the model. S3. Generate the corrected latent vector for each streamline segment based on the streamline segment latent vector and confidence level. Dimensionality reduction and clustering are performed on each modified latent vector to generate clustering results; S4. Based on the clustering results, calculate the distance and density between streamline segments after the streamline set is decomposed; filter according to the distance and density to generate a key streamline set.
2. The intelligent streamline clustering and extraction method for CFD simulation post-processing according to claim 1, characterized in that, S1 includes: S11. Pre-segment each streamline according to the preset minimum turning angle threshold and cumulative turning angle threshold; Calculate the average segment length based on the number of segments generated by pre-segmentation; S12. After dividing each streamline based on the average segment length, the number of points is interpolated to generate a streamline segment sequence.
3. The intelligent streamline clustering and extraction method for CFD simulation post-processing according to claim 1, characterized in that, S2 include: The streamline sequence includes the vector and vorticity of the corresponding points after interpolation to a fixed number of points; the encoder includes a two-layer LSTM network for sequence feature extraction, a masked average pooling layer for length-invariant aggregation, and a linear projection layer for dimensionality reduction.
4. The intelligent streamline clustering and extraction method for CFD simulation post-processing according to claim 1, characterized in that, S2 includes: the decoder generating a reconstruction output and a confidence sequence based on the streamline segment latent vector; and calculating the model loss based on the reconstruction output and the confidence output. The streamline segment latent vector and the corresponding point's normalized position are encoded and then input into the decoder's LSTM network to generate the reconstructed output. and confidence sequence The loss function formula is as follows: in, A mask representing the effective time step. The number of fixed points for the defined streamline. is the regularization coefficient; the first term of the loss function formula adaptively scales the squared reconstruction error by the predicted confidence level to suppress the influence of uncertain regions; the second term of the loss function formula is used to penalize excessive confidence inflation. Indicates reconstruction output subscript, Represents the corresponding dimension of the vector.
5. The intelligent streamline clustering and extraction method for CFD simulation post-processing according to claim 4, characterized in that, S3 includes: For each streamline segment, based on its confidence sequence and streamline latent vector Obtain the corrected latent vector: in, This represents the average confidence level calculated from the confidence level sequence. These are preset coefficients used to control the strength of the weighting. It is a numerically stable term.
6. The intelligent streamline clustering and extraction method for CFD simulation post-processing according to claim 5, characterized in that, S3 also includes: After dimensionality reduction of each modified latent vector, DBSCAN clustering is performed. Based on the preset values, unrepresentative streamline segments are deleted; the retained streamline segments are restored to the original streamlines.
7. The intelligent streamline clustering and extraction method for CFD simulation post-processing according to claim 1, characterized in that, S4 include: The streamline set is decomposed to generate an ordered list of segments. , of which each Contains its point sequence and position index within the streamline; calculate any two segments and The distance between them is the minimum point-to-point Euclidean distance between the sample sets: Where p is a segment point sequence In the middle, q is a point, and q is a segment. point sequence The point in the middle; Based on the average coordinates of all points within the segment Calculate the density value that reflects the density of its vicinity: in, For a Gaussian kernel, For the set bandwidth, Let the geometric center of the k-th segment be... This represents the number of all streamline segments.
8. The intelligent streamline clustering and extraction method for CFD simulation post-processing according to claim 7, characterized in that, S4 includes filtering based on distance and density, including: An initial min-heap is built based on the distance between streamline segments. , storage tuple ( ); Initialize the segment set using the first streamline segment of the beginning and end of each streamline. Then pruning is performed, popping the storage tuple with the smallest distance each time, if none of its segments belong to the segment set. Skip if they all belong to the segment set. Delete the segments with higher density; add the next adjacent streamline segment on the same streamline as the deleted segment to the segment set. In the process, the pruning ends after the number of deletions meets the requirement, and a set of key streamlines is generated.
9. A smart streamline clustering and extraction system for CFD simulation post-processing, characterized in that, include: The segmented interpolation module is used to obtain a set of streamlines, segment and interpolate the streamlines, and generate a sequence of streamline segments. The feature extraction module is used to input the streamline segment sequence into the autoencoder of the LSTM to generate the streamline segment latent vector corresponding to each streamline segment; the decoder generates the reconstruction output and confidence sequence based on the streamline segment latent vector. The training module is used to construct a loss function based on the reconstructed output and confidence sequence, and to refine and train the model. The clustering module is used to generate the corrected latent vectors for each streamline segment based on the streamline segment latent vectors and confidence levels corresponding to each streamline segment. Dimensionality reduction and clustering are performed on each modified latent vector to generate clustering results; The filtering module is used to calculate the distance and density between streamline segments after the streamline set is decomposed based on the clustering results; and to filter according to the distance and density to generate a set of key streamlines. The streamline extraction system based on confidence-aware deep clustering is used to implement the intelligent streamline clustering and extraction method and its steps for CFD simulation post-processing as described in claim 1.