Machine learning system for predicting evolution state of multi-class fluid equation
By using a unified four-dimensional spatiotemporal encoding and a hierarchical spatiotemporal Transformer structure, a machine learning system, UniFluids, for predicting the evolutionary state of multiple types of fluid equations was constructed. This system solves the problems of low model reusability and high computational complexity in existing technologies, and achieves efficient and stable prediction of fluid equation simulation while reducing costs.
Patent Information
- Application Number
- CN202610000356.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-04
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2046-01-04
AI Technical Summary
Existing artificial intelligence methods for fluid equation simulation suffer from problems such as low model reusability, high transfer difficulty, difficulty in handling multiple spatial dimensions and grid scales, large long-term prediction errors, and high computational complexity, making it difficult to achieve stable predictions while ensuring accuracy and efficiency.
By employing a unified four-dimensional spatiotemporal coding and a hierarchical spatiotemporal Transformer structure, multiple types of fluid data are mapped to a unified vector space. Through self-encoded compressed representation and block partitioning, a machine learning system with multi-problem modeling capabilities, UniFluids, is constructed to achieve efficient and stable prediction of fluid temporal evolution.
It achieves efficient and stable numerical prediction of the same model under different fluid equations, spatial dimensions and boundary conditions, reduces development and maintenance costs, improves prediction accuracy and long-term stability, and reduces the computational load in high-resolution 3D scenes.
Smart Images

Figure CN121435786A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of data processing technology, specifically relating to a machine learning system for predicting the evolution state of multiple types of fluid equations. Background Technology
[0002] Fluid equation simulation has wide applications in engineering design and scientific research, such as aircraft design and numerical weather prediction. Currently, using artificial intelligence (AI) methods to solve partial differential equations has brought paradigmatic advantages. Compared to traditional methods, this paradigm offers advantages such as extremely fast inference speed (e.g., FourCastNet achieves a 45,000-fold speedup in medium-range weather forecasting), seamless integration of data and physics (e.g., Aardvark Weather provides an end-to-end meteorological modeling framework), and a unified framework for handling various problems (e.g., DPOT, OmniArch, and other PDE foundation models). Although AI methods provide a unified framework and offer convenience in inference speed when handling various fluid simulation problems, their learning accuracy and prediction performance remain insufficient and somewhat crude.
[0003] Specifically, existing artificial intelligence methods for simulating fluid equations still have the following technical problems: First, for different fluid control equations (such as incompressible Navier-Stokes equations, compressible fluid equations, shallow water equations, reaction-diffusion equations, etc.), existing deep learning-based solution or prediction models generally require separate design of network structures and feature representations for each problem and each dimension, resulting in low model reusability, high development costs, and great difficulty in transfer.
[0004] Secondly, there is a lack of a unified spatiotemporal representation and modeling framework for numerical simulation data of two-dimensional / three-dimensional (2D / 3D), different resolutions and different time steps. Existing methods are difficult to handle multiple spatial dimensions and grid scales in a single model, resulting in complex engineering deployment and a fragmented training and inference process.
[0005] Third, in medium- and long-term time evolution prediction tasks, existing data-driven methods often suffer from problems such as large cumulative errors, numerical divergence, or non-conservation of physical quantities, making it difficult to balance prediction accuracy and long-term stability.
[0006] Fourth, in high-resolution 3D flow field scenarios, existing global spatiotemporal attention models have high computational complexity, making it difficult to balance inference efficiency and computing cost while ensuring accuracy. Summary of the Invention
[0007] To address the aforementioned technical problems, this invention provides UniFluids, a machine learning system for predicting the evolutionary states of multiple fluid equations. This system uses 2D / 3D, multi-equation, and multi-scale fluid data to learn model parameters, mapping various data types to a unified vector space. By innovatively introducing unified four-dimensional spatiotemporal encoding, autoencoder compressed representation, and a hierarchical spatiotemporal Transformer structure, it improves the accuracy, long-term stability, and cross-scenario generalization ability of fluid temporal evolution prediction while controlling computational complexity. This enables the same model to achieve efficient and stable numerical prediction and inference under different fluid equations, spatial dimensions, and boundary conditions. Furthermore, UniFluids' multi-problem modeling capabilities reduce the workload of iterative design and parameter tuning for different problems, lowering overall development and maintenance costs.
[0008] To achieve the above objectives, the present invention provides the following solution: a machine learning system for predicting the evolution state of multiple types of fluid equations, comprising: Fluid data preprocessing and unified representation module, used to transform raw data into a four-dimensional spacetime tensor; A unified spatiotemporal autoencoder module is used to compress and reconstruct the four-dimensional spatiotemporal tensor to obtain compressed features. The spatiotemporal evolution prediction module is used to model the fluid state of multiple historical frames. It obtains the flow field prediction result for the next time step by calling the fluid data preprocessing and unified representation module and the unified spatiotemporal autoencoder module.
[0009] More preferably, the fluid data preprocessing and unified representation module includes: a raw data import submodule, a dimension unification and dimension complementation submodule, a divisibility check and zero-filling submodule, and a channel normalization submodule; The raw data import submodule is used to import raw data and stack the raw data according to time steps to obtain a data sample set. The dimension unification and dimension supplementation submodule is used to perform dimension transformation on the data samples to obtain the transformation result; The divisibility check and zero-filling submodule is used to perform zero-filling or boundary extrapolation on the conversion result to obtain a filled result. The channel normalization submodule is used to normalize the filling result to obtain the four-dimensional spacetime tensor.
[0010] More preferably, the unified spatiotemporal autoencoder module includes: a block partitioning submodule, a block feature encoding submodule, a four-dimensional position encoding and spatiotemporal Transformer encoding submodule, and a decoding and reconstruction submodule; The block partitioning submodule is used to partition the four-dimensional spatiotemporal tensor into blocks to obtain feature vector blocks; The block feature encoding submodule is used to perform linear mapping on the feature vector block to obtain a block feature sequence; The four-dimensional position encoding and spatiotemporal Transformer encoding submodule is used to perform position embedding and compression on the block feature sequence to obtain a compressed block feature sequence. The decoding and reconstruction submodule is used to decode the feature sequence of the compressed block to obtain the reconstructed tensor.
[0011] More preferably, the spatiotemporal evolution prediction module includes: a historical window construction submodule, a spatiotemporal attention modeling submodule, a time aggregation submodule, a spatiotemporal global modeling and multi-expert feedforward submodule, and an output mapping and next step reconstruction submodule; The history window construction submodule is used to construct and process the input flow field at several time steps to obtain a four-dimensional tensor of historical feature combination. The spatiotemporal attention modeling submodule is used to perform spatiotemporal joint modeling on the four-dimensional tensor of historical feature combination to obtain the enhanced historical feature tensor. The spatiotemporal aggregation submodule is used to aggregate the enhanced historical feature tensors to obtain aggregated feature tensors; The spatiotemporal global modeling and multi-expert feedforward submodule is used to perform global modeling on the aggregated feature tensor to obtain the modeled spatial feature sequence. The output mapping and next-step reconstruction submodule is used to compress and reconstruct the modeled spatial feature sequence to obtain the flow field prediction result for the next time step.
[0012] More preferably, the process by which the four-dimensional positional encoding and spatiotemporal Transformer encoding submodule performs positional embedding and compression on the block feature sequence to obtain a compressed block feature sequence includes: Position encoding is embedded in the feature sequence of each block to obtain the block input embedding with position encoding; Attention is computed on the block input embedding through a multi-head self-attention layer to obtain the self-attention output; The self-attention output is added to the block input embedding using residual connections and layer normalization to obtain the first normalized output; The first normalized output is processed using a multi-expert feedforward network to obtain the feedforward output; The feedforward output and the block input are then added together using residual connection and layer normalization to obtain the compressed block feature sequence.
[0013] More preferably, the spatiotemporal attention modeling submodule performs spatiotemporal joint modeling on the four-dimensional tensor of historical feature combinations to obtain the enhanced historical feature tensor, including: For each position of the four-dimensional tensor of the historical feature combination, construct a four-dimensional positional encoding and superimpose them to obtain the superimposed feature vector; Perform multi-head self-attention within a local window to obtain local spatiotemporal correlations, and perform translational or cross-window attention on the window to obtain an enhanced historical feature tensor.
[0014] More preferably, the process by which the output mapping and the next reconstruction submodule compress and reconstruct the modeled spatial feature sequence to obtain the flow field prediction result for the next time step includes: Linear mapping is performed on each position of the modeled spatial feature sequence to obtain the compressed features for the next time step; The compressed features of the next time step are input into the decoding and reconstruction submodule to obtain the flow field prediction result of the next time step.
[0015] Compared with existing technologies, this invention, through unified four-dimensional spatiotemporal representation, self-encoding compression, and hierarchical spatiotemporal modeling, achieves the following beneficial effects while solving the aforementioned technical problems: (1) Unified modeling and reuse of multiple equations: By unifying fluid data of two-dimensional, three-dimensional, different meshes and different physical quantities into a single model, the model can be reconstructed and improved. The model employs a unified spatiotemporal coding and network structure, allowing a single model to be applied to various problems, including incompressible flow, compressible flow, shallow water equations, and reaction-diffusion equations. Compared to the approach of "designing a separate network for each equation," this significantly reduces the workload of network construction and parameter tuning, thereby lowering development and maintenance costs.
[0016] (2) Improved prediction accuracy and long-term stability: This invention first uses an autoencoder to compress the fluid field into a structured feature space, then performs joint modeling of multiple historical moments in this space, and comprehensively utilizes long-term window information through temporal aggregation and spatial global modeling. Compared with the simple autoregressive method that only relies on the most recent frame, it can effectively mitigate the phenomenon of gradual error amplification, reduce numerical divergence and results that obviously violate physical constraints, and improve the stability and physical rationality of long-term rolling prediction.
[0017] (3) Reduced computational load in high-resolution 3D scenes: By using block partitioning and autoencoder compression, this invention transfers the computation of the original high-resolution mesh to a low-dimensional feature space; at the same time, a spatiotemporal attention structure with local windows can be used in evolutionary prediction to control the scale of attention computation. Compared with the scheme of directly using global attention on the original mesh, this invention can significantly reduce computational load and memory usage in 3D high-resolution flow fields, improve inference efficiency while ensuring prediction accuracy, and facilitate engineering deployment.
[0018] (4) Enhance the expressive power of complex flows: Introducing a multi-expert feedforward structure in the spatial modeling stage, the gating network selects different expert subnetworks to participate in the calculation, so that the system has a stronger expressive power under controllable parameter scale and can better adapt to multi-scale and strongly nonlinear flow patterns. Combined with load balancing constraints, training stability can be maintained and the risk of "overfitting" a certain type of flow pattern by a single path can be reduced.
[0019] In summary, by combining the above-mentioned technical features, this invention significantly improves the uniformity, accuracy, long-term stability, and computational efficiency of time evolution prediction for various fluid equations, while maintaining acceptable implementation difficulty in the field. It has clear and direct technical effects and saves time and costs in practical engineering applications. Attached Figure Description
[0020] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a schematic diagram of the machine learning system structure for predicting the evolution state of multiple types of fluid equations according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the processing flow of 2D and 3D data in an embodiment of the present invention. Detailed Implementation
[0022] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0024] Example 1: like Figure 1 , Figure 2 As shown, this embodiment provides a machine learning system for predicting the evolutionary state of multiple types of fluid equations. Figure 1 middle, , Indicates the preceding Input at each time step, Indicates the first +1 time step prediction output. , , This represents the set of terms corresponding to the time step. Under a unified four-dimensional spatiotemporal representation, modeling is performed on two-dimensional / three-dimensional, multi-equation, and multi-scale fluid data. This mainly includes: a fluid data preprocessing and unified representation module, used to transform raw data from different sources, dimensions, and grids into a four-dimensional spatiotemporal tensor for easier subsequent processing; a unified spatiotemporal autoencoder module, used to compress and reconstruct the four-dimensional spatiotemporal tensor to obtain compressed features; and a spatiotemporal evolution prediction module, used to model the fluid state across multiple historical frames, obtaining the flow field prediction result for the next time step by calling the fluid data preprocessing and unified representation module and the unified spatiotemporal autoencoder module.
[0025] Further implementation involves the fluid data preprocessing and unified representation module including: a raw data import submodule, a dimension unification and dimension complementation submodule, a divisibility check and zero-filling submodule, and a channel normalization submodule.
[0026] The raw data import submodule is used to import raw data and stack the raw data according to time steps to obtain a data sample set.
[0027] The raw data sources include numerical solver output, public datasets, or experimental observation data. For a single example, the raw data for each time step is represented as follows: The two-dimensional flow field is... The three-dimensional flow field is ;in, Indicates the number of channels for a physical quantity (such as velocity, pressure, density, etc.); , , These represent the dimensions of the spatial grid in three dimensions. For each example, all time steps sorted by time are stacked, and the two-dimensional flow field is... The three-dimensional flow field is ;in, This represents the number of time steps. Subsequently, multiple examples are concatenated along the batch dimension to form a sequence containing... A set of samples.
[0028] To unify the processing of two-dimensional and three-dimensional data, the dimension unification and dimension supplementation submodule performs dimension transformation on the data samples to obtain the transformation results.
[0029] For two-dimensional data, adding a dimension of size 1 to the depth dimension yields... For three-dimensional data, keeping the original depth dimension unchanged, we obtain... Then, the unified tensors are stacked along the batch dimension to obtain... .
[0030] The divisibility check and zero-padding submodule is used to zero-padding or extrapolate the conversion results to obtain the filled results.
[0031] To facilitate subsequent block partitioning, both the time and space dimensions need to be divisible by the preset block size. Let: , , , These represent the block sizes in the time dimension and the three spatial dimensions, respectively. , , , In the formula, , , , These represent the new time and space dimensions after filling.
[0032] right Zero-filling or boundary extrapolation at time and space boundaries includes the following steps: like Then, several frames are added at the end of the time to make the new time length... Can be Divisible by.
[0033] like , , If the value is not divisible by the corresponding block size, zeros are added to the space boundary or interpolation is used to fill the space. , , After filling, the result is... ,in , , , It satisfies the divisibility constraint.
[0034] The channel normalization submodule is used to normalize the filling results to obtain a four-dimensional spacetime tensor.
[0035] Because different physical quantities have different dimensions and numerical ranges, this submodule performs independent normalization processing for each channel. For the first... For each channel, the channel mean is calculated on the training set. and standard deviation Standardize all data in this channel: ; In the formula, This represents the normalized channel value; This represents the channel value before normalization.
[0036] The normalized tensor is still denoted as This is used as a unified representation for subsequent modules.
[0037] Further implementation involves the unified spatiotemporal autoencoder module comprising: a block partitioning submodule, a block feature encoding submodule, a four-dimensional positional encoding and spatiotemporal Transformer encoding submodule, and a decoding and reconstruction submodule.
[0038] The block partitioning submodule is used to partition the four-dimensional spatiotemporal tensor into blocks to obtain feature vector blocks. Overlapping blocks, multi-scale blocks, or learnable downsampling structures can be used, as long as a processable block sequence is ultimately formed.
[0039] In this embodiment, the time and space block size are set ( , , , ),exist , , , In terms of step size, they are respectively , , , The spacetime blocks are divided into sections, and each section has the following shape: The total number of blocks is: Meanwhile, the integer coordinates of each block are recorded in the overall tensor: ( , , , ), used for subsequent location encoding and reconstruction.
[0040] The block feature encoding submodule is used to perform linear mapping on the feature vector block to obtain the block feature sequence.
[0041] For each spacetime block Flatten it into a one-dimensional vector: Encode into low-dimensional feature vectors through linear transformation or multilayer perceptron (MLP): ,in This represents the dimension of the encoded features; the feature vectors of all blocks together form the block feature sequence. .
[0042] The four-dimensional positional encoding and spatiotemporal Transformer encoding submodule is used to perform positional embedding and compression on the block feature sequence to obtain a compressed block feature sequence.
[0043] To display the relative position information in time and three-dimensional space, this submodule specifies the coordinates of each block ( , , , To construct the corresponding four-dimensional position vector, methods such as learnable embedding or four-dimensional rotation-based position encoding can be used. In this case, the position encoding is: Block input embedding is: .
[0044] Then, a spatiotemporal Transformer encoder is used, which consists of several stacked layers, each layer including: (1) Multi-Head Self-Attention Layer: Input is Attention is computed along the block sequence dimension to obtain a self-attention output. Four-dimensional positional encoding is used to construct the query and key, thereby simultaneously modeling the dependencies in time and three-dimensional space.
[0045] (2) Residual connection and layer normalization: The self-attention output is added to the input and normalized to obtain the first normalized output.
[0046] (3) Multi-expert feedforward network (MoE-FFN): The feedforward network adopts a multi-expert structure. For each block feature input, the gating network determines the combination method among different experts to obtain the feedforward output, thereby improving the modeling ability.
[0047] (4) Perform residual connection and layer normalization again.
[0048] After L layers of spatiotemporal Transformer encoding, the compressed block feature sequence is obtained: .
[0049] The decoding and reconstruction submodule is used to decode the feature sequence of the compressed block to obtain the reconstructed tensor.
[0050] The decoder structure of this submodule is symmetrical to the spatiotemporal Transformer encoder as a whole, consisting of multiple spatiotemporal Transformers and block-level decoders.
[0051] (1) with As input to the decoder, global context information is further fused through several layers of spatiotemporal Transformer encoding.
[0052] (2) For each block feature vector Map back to tensor form via a linear layer or MLP: .
[0053] (3) By block coordinates ( , , , ) All refactored blocks Fill in the original positions and concatenate to obtain the reconstructed tensor: .
[0054] If there is a filled area, the edge fill can be trimmed at the end to restore the original size.
[0055] The training objective of the unified spatiotemporal autoencoder module is to reconstruct a high-quality flow field under compression constraints. The loss function includes: ; In the formula, This indicates the total number of all elements.
[0056] Additionally, extra physical constraint losses, such as gradient loss and energy loss, can be added as needed. The trained encoder and decoder provide a stable low-dimensional representation for the spatiotemporal evolution prediction module.
[0057] Further implementation involves the following: the spatiotemporal evolution prediction module includes a historical window construction submodule, a spatiotemporal attention modeling submodule, a time aggregation submodule, a spatiotemporal global modeling and multi-expert feedforward submodule, and an output mapping and next step reconstruction submodule.
[0058] The history window construction submodule is used to construct and process the input flow field at several time steps to obtain a four-dimensional tensor of historical feature combination.
[0059] Given continuous Input flow field at each time step First, the fluid data is preprocessed and converted into a unified form by a unified representation module, and then encoded into compressed feature blocks by a trained encoder. Each of them Consider it as a spatial block grid: In the formula, , , For all historical event steps, combine these features into a four-dimensional tensor: .
[0060] The spatiotemporal attention modeling submodule is used to perform spatiotemporal joint modeling on the four-dimensional tensor of historical feature combination to obtain the enhanced historical feature tensor.
[0061] Using windowing or global self-attention structures Spatiotemporal joint modeling is performed, and the process includes: (1) Put ( , , , The coordinates are considered as a unified spatiotemporal grid. A four-dimensional positional code is constructed for each position and superimposed on the corresponding feature vector to obtain the superimposed feature vector.
[0062] (2) Within a local window (such as in , , (Dividing into sub-blocks in dimensions) Performing multi-head self-attention to characterize local spatiotemporal relationships.
[0063] (3) Facilitate information interaction between distant blocks by panning the window or focusing across windows.
[0064] (4) Stack several layers of spatiotemporal attention structures to obtain the enhanced historical feature tensor.
[0065] The spatiotemporal aggregation submodule is used to aggregate the enhanced historical feature tensors to obtain aggregated feature tensors.
[0066] After completing spatial attention modeling, information from multiple historical time steps needs to be compressed into a single time layer to predict the state of the next time step. In this embodiment, time aggregation can be achieved by simple average aggregation, weighted aggregation based on learnable weights, or dynamic aggregation based on attention mechanisms, with a time attention module adaptively allocating weights according to the current task.
[0067] The method for simple average aggregation is as follows: .
[0068] The weighted aggregation method based on learnable weights is as follows: .
[0069] The shape of the aggregated feature tensor is: .
[0070] The spatiotemporal global modeling and multi-expert feedforward submodule is used to perform global modeling on the aggregated feature tensor to obtain the modeled spatial feature sequence.
[0071] First, Flatten into a block sequence: A multi-head self-attention layer is applied to this sequence to capture long-range dependencies between different spatial locations. This is followed by a multi-expert feedforward network (MoE-FFN): multiple expert FFNs exist in parallel; the gating network determines which experts to activate and their weights based on the features of each spatial location; the output is a weighted sum of the results from each expert. Finally, several layers are stacked to obtain the globally modeled spatial feature sequence. .
[0072] The Output Mapping and Next Step Reconstruction submodule is used to compress and reconstruct the spatial feature sequence after modeling to obtain the flow field prediction results for the next time step.
[0073] After completing the global spatial modeling, the compression for the next time step is obtained through output mapping, and then reconstructed using the unified spatiotemporal autoencoder module. The specific process includes: (1) To Applying a linear mapping at each position yields the compressed features for the next time step: .
[0074] (2) Treated as spatiotemporal block features, these are input into a decoder that uniformly uses a unified spatiotemporal autoencoder module. They are then decoded and reconstructed according to the block structure to obtain the flow field prediction results for the next time step. ;in Indicates the time resolution of the current prediction step (usually) = Or a compressed single-step representation).
[0075] (3) If a filled region exists, then for Perform boundary clipping and remove the dimension (such as the depth dimension in the case of 2D) to restore the original mesh scale.
[0076] Example 2: This embodiment, based on the module structure given in Embodiment 1, provides a detailed explanation of the data processing flow of the machine learning system during the training and inference phases. The training phase includes training the unified spatiotemporal autoencoder module and the spatiotemporal evolution prediction module.
[0077] The training phase of the unified spatiotemporal autoencoder module includes the following steps: S1. Raw data collection and processing.
[0078] Flow field data were collected from numerical simulations or experimental observations using different physical equations and calculation examples. Each calculation example was then sorted by time to obtain... ;in It may be in two-dimensional or three-dimensional form.
[0079] S2, Dimensional Unification and Sample Organization.
[0080] Perform the following operations on all cases: Using the dimensionality unification and dimensionality complementation submodules, extend the two-dimensional data to a depth dimension while keeping the three-dimensional data unchanged. Convert each case into... Stacking multiple computational instances along the batch dimension yields... .
[0081] S3, divisibility check and zero-filling.
[0082] For each batch Check if the time and space dimensions can be reduced to the block size ( , , , Divisible by 0.5. If not, zero-padding or extrapolation is performed in the corresponding dimension to obtain the result. .
[0083] S4, Channel Normalization.
[0084] Calculate the mean and standard deviation of each channel on the training dataset. All channels in the process undergo standardization to obtain a normalized unified tensor, which is still denoted as . .
[0085] S5. Block partitioning and block feature coding.
[0086] Will The input to the unified spatiotemporal autoencoder module is first divided into several spatiotemporal blocks by the block partitioning submodule, and then each block is encoded into a low-dimensional feature vector by the block feature encoding submodule, forming a block feature sequence. .
[0087] S6. Spatiotemporal Transformer encoding and decoding reconstruction.
[0088] Will After superimposing four-dimensional positional encoding, the result is input into a spatiotemporal Transformer encoder to obtain a compressed block feature sequence. The data is then input into the decoder, and reconstructed through multiple layers of spatiotemporal Transformers and block-level decoders. .
[0089] S7. Calculate the reconstruction loss and update the parameters.
[0090] by and Based on the differences between them, the reconstruction loss is calculated. The total loss function can be constructed by combining additional physical loss. All trainable parameters of the unified spatiotemporal autoencoder module are updated through backpropagation until the reconstruction quality meets the requirements.
[0091] After the unified spatiotemporal autoencoder module has been trained or has reached a certain reconstruction accuracy, the spatiotemporal evolution prediction module is trained. The training phase of the spatiotemporal evolution prediction module includes the following steps: S8. Construct historical-future training samples.
[0092] Extract a length of [length] from the training data. +1 continuous time series: , among which the former The frame serves as historical input, the last frame. As a prediction target.
[0093] S9. Unified preprocessing and encoding.
[0094] The above sequences are preprocessed into tensors of uniform shape, and each frame is encoded using a trained autoencoder to obtain the historical compressed block sequence. and target compression features .
[0095] S10, Spatiotemporal Attention Modeling and Temporal Aggregation.
[0096] Combining historical compression features The input is processed by the spatiotemporal evolution prediction module, which extracts spatiotemporal dependency information through the spatiotemporal attention modeling submodule. Then, the time aggregation submodule compresses multi-step historical information into single-step spatial features, resulting in the aggregated feature tensor. .
[0097] S11, Spatial Global Modeling and Multi-Expert Feedforward.
[0098] Will Flatten into a sequence The spatial structure is modeled in depth by sequentially passing through a global self-attention layer and a multi-expert feedforward network, resulting in a globally enhanced spatial feature sequence. .
[0099] S12, Output the next compression features and decoding.
[0100] By mapping the output and refactoring the submodule in the next step, Mapped to compressed features of the next time step Then, through the decoder of the unified spatiotemporal autoencoder module, Decoded as the flow field prediction result for the next time step .
[0101] S13. Calculate the prediction loss and train the evolution module.
[0102] by With real flow field Constructing predictive loss based on differences It can also be weighted and combined with reconstruction loss to form joint loss: ; In the formula, , These represent the reconstruction loss coefficient and the prediction loss coefficient, respectively.
[0103] The parameters of the spatiotemporal evolution prediction module are updated by backpropagation, and some parameters of the unified spatiotemporal autoencoder module are fine-tuned as needed until the expected performance is achieved on the validation set.
[0104] The inference phase is used to predict the evolution process over multiple time steps given several initial real flow fields. The data processing steps in the inference phase include: P1. Input the initial historical flow field and preprocess it.
[0105] Obtain the length from numerical simulation or observation system. Initial historical flow field: The data is then input into the preprocessing module for operations such as dimension unification, divisibility checking and padding, and channel normalization to obtain a unified representation. .
[0106] P2, the encoded historical flow field is a compressed feature.
[0107] Using a trained unified spatiotemporal autoencoder module, Encode each time step to obtain a set of historical compressed feature blocks: .
[0108] P3. Predict the compression features of the next time step.
[0109] The historical compressed features are input into the spatiotemporal evolution prediction module, which first performs spatiotemporal attention modeling and temporal aggregation, then performs spatial global modeling and multi-expert feedforward, and outputs the compressed features for the next time step. .
[0110] P4. Decode to obtain the flow field prediction for the next time step.
[0111] Will The decoder of the unified spatiotemporal autoencoder module is input, and the code is decoded and reconstructed in a block structure to obtain the flow field prediction result for the next time step. For the 2D case, the added depth dimension is removed, and the filled area of the spatial boundary is clipped. Then, inverse normalization is performed (multiplied by the standard deviation and added to the mean) to restore the original dimensions of the physical quantities.
[0112] P5, Multi-step rolling prediction.
[0113] Will Consider it a new end to history: After further preprocessing, encoding, evolutionary prediction, and decoding, the result is... Repeat the above process to achieve the desired result. , And subsequent multi-step rolling forecasts until the required forecast time range is covered.
[0114] Example 3: This embodiment presents a scenario for predicting the time evolution of the two-dimensional incompressible Navier-Stokes equations.
[0115] I. Data Acquisition and Preprocessing.
[0116] (1) Select several typical examples, such as flow driven by a square cavity and flow around a cylinder, and obtain the numerical solutions of the velocity field and pressure field evolution over time using traditional numerical methods (such as the finite volume method) to obtain the original data sequence. .
[0117] (2) Organize the data for each time step into a format of size [size missing]. The tensor, in which Take 3 as an example (horizontal speed, vertical speed, pressure). , The grid size is determined by stacking different time steps in chronological order. .
[0118] (3) Organize multiple samples along the batch dimension to obtain a shape of The data. Since it is a two-dimensional flow field, this embodiment adds one dimension in the depth direction to construct a unified four-dimensional spacetime tensor. ,in =1.
[0119] (4) Based on the time and space block size of the subsequent block division, in this embodiment, =2, =4、 =4、 =1, for , , Perform a divisibility check, if , , If the value is not divisible by the corresponding block size, zeros are padded at the time or space boundaries until the value becomes divisible.
[0120] (5) Normalize each physical quantity channel. In this embodiment, the mean and standard deviation of each channel on the training set are normalized to make their numerical ranges close.
[0121] Through the above steps, all two-dimensional incompressible flow data were uniformly converted into... The four-dimensional spacetime tensor provides a unified input for subsequent module processing.
[0122] II. Configuration and Working Process of the Unified Spatiotemporal Autoencoder Module.
[0123] (1) Block partitioning and encoding vector construction: The unified spatiotemporal autoencoder module first divides the block into blocks and constructs the encoding vector. tensor according to ( , , , The division is performed as follows. In this embodiment, =16, =64, =64, =1; if the block size is (2, 4, 4, 1), then the time direction is divided into 8 segments, and the spatial direction is divided into 16×16 blocks, for a total of 1. =8×16×16. The shape of each four-dimensional block is [2, ... [4, 4, 1], flattened into a one-dimensional vector, and mapped to a fixed-length "block feature sequence" through a linear transformation. In this embodiment, the dimension is 256.
[0124] (2) Four-dimensional positional encoding and spatiotemporal attention encoding: For each block, its time index and three spatial indices are recorded, and these four integer coordinates are fed into the four-dimensional positional encoding unit. In the multi-head self-attention operation, the query vector and key vector are segmented and rotated along the time and three-dimensional spatial axes to achieve unified injection of temporal and spatial relative positional information. The block feature sequence passes through several layers of spatiotemporal attention structure in sequence. Each layer includes multi-head self-attention with four-dimensional positional encoding, a feedforward network, and residual connections, thereby establishing the association between different time steps and different spatial locations in the block sequence.
[0125] (3) Decoding and reconstruction: After several layers of encoding, the compressed block feature sequence is obtained. The decoding part adopts a structure symmetrical to the encoding part, and the compressed block feature sequence is restored to a small block tensor through several layers of spatiotemporal attention decoding and linear transformation, and then concatenated according to the original time and space coordinates. The flow field is reconstructed in a specific form. The reconstruction loss (e.g., mean squared error) is calculated between the reconstructed result and the input flow field. A unified spatiotemporal autoencoder module is trained via backpropagation to preserve the main structural features of the flow field as much as possible while compressing it. After training, the unified spatiotemporal autoencoder module can be used to compress any two-dimensional incompressible flow field into a set of 256-dimensional block feature sequences (i.e., "compressed features"), and to recover the original flow field from the compressed features.
[0126] III. Configuration and Working Process of the Spatiotemporal Evolution Prediction Module.
[0127] (1) Construction of historical multi-frame compression features, selecting continuous Using 8 time steps as a historical window, these steps are encoded into compressed feature block sequences by a pre-trained encoder. After rearranging according to time and spatial location, a sequence with the following shape is obtained. The characteristics, among which This represents the number of spatial blocks at each time step.
[0128] (2) Spatiotemporal modeling and temporal aggregation: rearrange the above features according to time and space dimensions. ,in =1. Based on this, a spatiotemporal attention structure is used for modeling: a local window approach can be adopted, dividing the space into several sub-regions, performing self-attention operations within each sub-region, and achieving cross-regional information interaction through window translation; alternatively, a global approach can be used, performing a one-time self-attention operation on all spatiotemporal locations. After several layers of spatiotemporal attention, the time dimension is aggregated, such as using a simple weighted average or a weighted method with time encoding, fusing information from multiple historical time steps into a single-time-layer spatial feature map, with the shape of... .
[0129] (3) Spatial global modeling and multi-expert feedforward: The spatial features after temporal aggregation are flattened into a sequence and input into several layers of spatial attention structure. Each layer includes a global self-attention network and a feedforward network. The feedforward network adopts a multi-expert structure, which consists of several expert sub-networks and a gating network. The gating network automatically selects some experts to participate in the calculation based on the current features, so as to achieve a trade-off between model capacity and computational cost.
[0130] (4) Output generation and decoding: After spatial modeling, the obtained feature sequence is mapped to the “next time step compressed feature block” with the same output dimension as the unified spatiotemporal autoencoder module through linear transformation, and then sent to the decoding part of the unified spatiotemporal autoencoder module to obtain the two-dimensional flow field distribution of the next time step.
[0131] IV. Training and Reasoning Process.
[0132] (1) Joint training: During the training phase, real flow fields at several consecutive time steps are used to obtain historical compressed features by passing them sequentially through a unified spatiotemporal autoencoder module. These features are then input into a spatiotemporal evolution prediction module to predict the compressed features for the next step, and the decoder restores the flow field for the next step. The predicted flow field is compared with the real flow field for the next step to obtain the prediction loss. At the same time, the reconstruction loss of the autoencoder is superimposed to perform joint or phased training on the entire system.
[0133] (2) Multi-step rolling inference: In the inference stage, given the flow field of the previous several real time steps, the historical compressed features are first obtained through the unified spatiotemporal autoencoder module, and then the spatiotemporal evolution prediction module predicts the compressed features of the next time step and decodes them into the flow field. The prediction result is used as one of the new historical inputs, and the above steps are repeated to complete the rolling prediction of any number of steps.
[0134] Through this embodiment, the present invention achieves unified representation, unified modeling, and efficient time evolution prediction in a two-dimensional incompressible fluid scenario.
[0135] Example 4: This embodiment illustrates the application of the present invention in a three-dimensional compressible flow scenario, demonstrating that the processing methods for two-dimensional and three-dimensional problems are basically the same under a unified framework, with differences only in the input dimension and specific parameter configuration.
[0136] I. Data Acquisition and Preprocessing.
[0137] (1) Select three-dimensional compressible fluid examples, such as three-dimensional jets and three-dimensional flow around a target, and obtain numerical solutions for the evolution of physical quantities such as density, velocity components, pressure, and temperature over time using traditional numerical methods. Each time step is organized as follows: Tensor, where It is 5. , , This refers to the size of the 3D mesh.
[0138] (2) Similarly, stacked by time as Then organize by batch At this point, it is not necessary to add dimensions in the depth direction.
[0139] (3) Based on the preset time and space block size, in this embodiment, ( , , , ) = (2, 4, 4, 4), for , , , Perform divisibility checks and zero-fill as needed.
[0140] (4) Standardize the channels for each physical quantity such as density, velocity, and pressure.
[0141] After the above processing is completed, the three-dimensional compressible stream data enters the subsequent modules in the same form as in Example 1.
[0142] II. Configuration of the unified spatiotemporal autoencoder module and the spatiotemporal evolution prediction module.
[0143] In the three-dimensional case, the structures of the unified spatiotemporal autoencoder module and the spatiotemporal evolution prediction module remain consistent with those in the two-dimensional case, except that additional partitioning is performed in the depth direction during block division, and the block size is ( , , , = (2, 4, 4, 4), the corresponding number of blocks increases.
[0144] (1) The unified spatiotemporal autoencoder module will The block is divided into several four-dimensional blocks according to the above block size. Each block is flattened and linearly transformed to obtain a block encoding vector. Then, it is compressed, encoded and decoded and reconstructed through several layers of spatiotemporal attention structures with four-dimensional positional encoding.
[0145] Since the number of voxels in a 3D mesh is much greater than in a 2D mesh, this invention significantly reduces the computational complexity of performing global modeling directly on a 3D full mesh through autoencode compression and block partitioning.
[0146] (2) The spatiotemporal evolution prediction module first rearranges the compressed feature blocks of several historical time steps into a four-dimensional block grid according to time and three-dimensional spatial coordinates. After spatiotemporal attention modeling and time aggregation, the compressed feature blocks of the next time step are generated through spatial global modeling and multi-expert feedforward structure. Finally, the unified spatiotemporal autoencoder module decodes it into a three-dimensional flow field.
[0147] III. Training and Reasoning Process.
[0148] The training and inference process is the same as in Example 3, except for the training data, the number of physical quantity channels, and the spatial resolution. Through a unified network structure and training process, this invention can switch between two-dimensional incompressible flow and three-dimensional compressible flow problems without modifying the overall network architecture, verifying the applicability and reusability of the unified modeling framework of this invention.
[0149] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A machine learning system for predicting the evolutionary state of multiple types of fluid equations, characterized in that, include: Fluid data preprocessing and unified representation module, used to transform raw data into a four-dimensional spacetime tensor; A unified spatiotemporal autoencoder module is used to compress and reconstruct the four-dimensional spatiotemporal tensor to obtain compressed features. The spatiotemporal evolution prediction module is used to model the fluid state of multiple historical frames. It obtains the flow field prediction result for the next time step by calling the fluid data preprocessing and unified representation module and the unified spatiotemporal autoencoder module.
2. The machine learning system for predicting the evolution state of multiple fluid equations according to claim 1, characterized in that, The fluid data preprocessing and unified representation module includes: a raw data import submodule, a dimension unification and dimension complementation submodule, a divisibility check and zero-filling submodule, and a channel normalization submodule; The raw data import submodule is used to import raw data and stack the raw data according to time steps to obtain a data sample set. The dimension unification and dimension supplementation submodule is used to perform dimension transformation on the data samples to obtain the transformation result; The divisibility check and zero-filling submodule is used to perform zero-filling or boundary extrapolation on the conversion result to obtain a filled result. The channel normalization submodule is used to normalize the filling result to obtain the four-dimensional spacetime tensor.
3. The machine learning system for predicting the evolution state of multiple fluid equations according to claim 1, characterized in that, The unified spatiotemporal autoencoder module includes: a block partitioning submodule, a block feature encoding submodule, a four-dimensional position encoding and spatiotemporal Transformer encoding submodule, and a decoding and reconstruction submodule; The block partitioning submodule is used to partition the four-dimensional spatiotemporal tensor into blocks to obtain feature vector blocks; The block feature encoding submodule is used to perform linear mapping on the feature vector block to obtain a block feature sequence; The four-dimensional position encoding and spatiotemporal Transformer encoding submodule is used to perform position embedding and compression on the block feature sequence to obtain a compressed block feature sequence. The decoding and reconstruction submodule is used to decode the feature sequence of the compressed block to obtain the reconstructed tensor.
4. The machine learning system for predicting the evolution state of multiple fluid equations according to claim 3, characterized in that, The spatiotemporal evolution prediction module includes: a historical window construction submodule, a spatiotemporal attention modeling submodule, a time aggregation submodule, a spatiotemporal global modeling and multi-expert feedforward submodule, and an output mapping and next step reconstruction submodule; The history window construction submodule is used to construct and process the input flow field at several time steps to obtain a four-dimensional tensor of historical feature combination. The spatiotemporal attention modeling submodule is used to perform spatiotemporal joint modeling on the four-dimensional tensor of historical feature combination to obtain the enhanced historical feature tensor. The spatiotemporal aggregation submodule is used to aggregate the enhanced historical feature tensors to obtain aggregated feature tensors; The spatiotemporal global modeling and multi-expert feedforward submodule is used to perform global modeling on the aggregated feature tensor to obtain the modeled spatial feature sequence. The output mapping and next-step reconstruction submodule is used to compress and reconstruct the modeled spatial feature sequence to obtain the flow field prediction result for the next time step.
5. A machine learning system for predicting the evolutionary state of multiple fluid equations according to claim 3, characterized in that, The process by which the four-dimensional positional encoding and spatiotemporal Transformer encoding submodule performs positional embedding and compression on the block feature sequence to obtain the compressed block feature sequence includes: Position encoding is embedded in the feature sequence of each block to obtain the block input embedding with position encoding; Attention is computed on the block input embedding through a multi-head self-attention layer to obtain the self-attention output; The self-attention output is added to the block input embedding using residual connections and layer normalization to obtain the first normalized output; The first normalized output is processed using a multi-expert feedforward network to obtain the feedforward output; The feedforward output and the block input are then added together using residual connection and layer normalization to obtain the compressed block feature sequence.
6. A machine learning system for predicting the evolutionary state of multiple fluid equations according to claim 4, characterized in that, The spatiotemporal attention modeling submodule performs spatiotemporal joint modeling on the four-dimensional tensor of historical feature combinations to obtain the enhanced historical feature tensor. The process includes: For each position of the four-dimensional tensor of the historical feature combination, construct a four-dimensional positional encoding and superimpose them to obtain the superimposed feature vector; Perform multi-head self-attention within a local window to obtain local spatiotemporal correlations, and perform translational or cross-window attention on the window to obtain an enhanced historical feature tensor.
7. A machine learning system for predicting the evolutionary state of multiple fluid equations according to claim 4, characterized in that, The process by which the output mapping and the next-step reconstruction submodule compress and reconstruct the modeled spatial feature sequence to obtain the flow field prediction result for the next time step includes: Linear mapping is performed on each position of the modeled spatial feature sequence to obtain the compressed features for the next time step; The compressed features of the next time step are input into the decoding and reconstruction submodule to obtain the flow field prediction result of the next time step.
Citation Information
Patent Citations
Dam break flow rapid prediction method and system adopting Transform-ResUNet model
CN120524818A
Unsteady flow field dimension reduction and prediction method fusing physical modeling and deep learning
CN120849911A
Flow behavior prediction system, flow behavior prediction method, prediction model generation method, and learned prediction model
JP2023127035A