A cabin flooding flow field real-time prediction method based on a hierarchical block attention physical information neural network
Patent Information
- Application Number
- CN202611117940.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-27
- Publication Date
- 2026-10-16
AI Technical Summary
[0006]综上,现有技术中存在难以兼顾舱室浸水流场全局主流与局部次生流动的多尺度特征提取、全域逐点物理残差计算开销较大以及缺少能量耗散约束的缺陷
将舱室浸水时空网格划分为一级粗粒度主块、二级子块和三级精细小块,并使各层空间块按照由粗到细的尺度递进关系完整覆盖浸水全域,使网络在统一时空网格基础上形成多尺度空间表示。粗粒度主块保留舱室整体进水方向和大范围流动结构,精细小块保留局部涡旋、回流及速度梯度等细节,减少单一尺度表示偏向整体主流而弱化局部次生流动的问题。
Smart Images

Figure CN122925878A_ABST
Abstract
Description
Technical Field
[0001] This paper relates to the field of real-time prediction of flooded flow fields in ship compartments, specifically a method for real-time prediction of flooded flow fields in ship compartments based on a hierarchical block attention physical information neural network. Background Technology
[0002] When a ship's compartment is breached and flooded, the fluid within the compartment undergoes an unsteady flow process that evolves over time, influenced by factors such as the location of the breach, changes in the compartment boundaries, and variations in the free surface. Predicting the flow velocity and pressure at different locations during the flooding process is crucial for analyzing the flooding evolution and providing flow field data for emergency anti-sinking decisions. Existing technologies typically employ computational fluid dynamics (CFD) methods, establishing numerical models based on the compartment's geometric model, fluid parameters, boundary conditions, and initial conditions. The flooded flow field is obtained by discretizing and solving the mass and momentum conservation equations. While this approach can describe the flooding flow process, it requires repeated grid calculations and iterative solutions in applications demanding continuous updates to the flow field, making it difficult to directly meet the need for rapid flow field prediction.
[0003] To reduce the computational burden of numerical solutions, existing technologies also employ data-driven prediction methods based on neural networks. These methods train flow field prediction models using spatiotemporal grid data obtained from numerical simulations and output flow field variables such as velocity and pressure based on spatial coordinates and temporal information. Among these, attention-based prediction models can establish correlations between different spatial regions, making them suitable for extracting long-range dependent features in the immersion flow field of a compartment. Physical information neural networks, by introducing the residuals of the mass and momentum conservation equations into the training loss, constrain the prediction results to the fluid control equations. Existing solutions can also combine attention mechanisms with physical constraints to balance flow field feature learning and physical constraints.
[0004] However, the flooded flow field in the compartment simultaneously includes the overall mainstream structure formed by water ingress through the breach, as well as secondary flow structures such as vortices, backflows, and local velocity gradients. Existing attention prediction models typically employ a single-scale spatial representation or a uniform attention calculation method across the entire computational domain. This makes it difficult to extract overall mainstream features and local secondary flow features separately according to different spatial scales. The model training process tends to favor mainstream information with larger amplitudes and wider distributions, thus weakening its ability to represent local flow structures and secondary directional velocity changes. While some multi-scale models can generate flow field features at different scales, they lack a processing mechanism that guides the interaction of local features with global flow information, making it difficult to form corresponding global-local flow field representations.
[0005] Furthermore, existing physical information neural networks typically calculate the residuals of the governing equations separately at all spatiotemporal grid points, or highly couple the calculation of physical residuals with the entire prediction network. For a flooded flow field in a cabin with a large number of spatial sampling points, this point-by-point automatic differentiation method generates a large amount of gradient calculation and makes the physical constraint training process consume a lot of computational resources, affecting the model's training convergence and inference deployment. Existing physical constraints are also mainly based on mass and momentum conservation, lacking specific constraints on the viscous dissipation and kinetic energy decay processes in the flooded flow field, which may lead to energy changes during the prediction process that are inconsistent with the actual dissipation laws.
[0006] In summary, existing technologies suffer from several drawbacks, including difficulty in extracting multi-scale features of both the global mainstream and local secondary flows in the immersion flow field of a cabin, high computational overhead for point-by-point physical residuals across the entire domain, and a lack of energy dissipation constraints. Summary of the Invention
[0007] To address the shortcomings of existing technologies, such as difficulty in extracting multi-scale features of both the global mainstream and local secondary flows in the flooded cabin flow field, high computational overhead for point-by-point physical residuals across the entire domain, and lack of energy dissipation constraints, the technical solution provided by this invention is as follows: A method for real-time prediction of cabin flooding flow field based on hierarchical block attention physical information neural network includes: The steps involve dividing the spatiotemporal grid of the flooded compartment into blocks at different levels to obtain a coarse-grained master block sequence and a fine-grained sub-block sequence. The steps include: performing self-attention calculation on the coarse-grained main block sequence to obtain global flow features, and using the global flow features as query features to perform cross-attention calculation on the fine-grained sub-block sequence to obtain local flow features; The step of fusing the global flow features and local flow features based on learnable weighted coefficients to obtain hierarchical fused features; The process involves decoding the layered fusion features to obtain the predicted flow field of the immersion chamber, and calculating the mass conservation residual, momentum conservation residual, and energy dissipation residual only for the smallest fine sub-block. Based on the deviation between the predicted flow field of the immersion chamber and the reference flow field and each residual, a composite loss is constructed to update the learnable weighting coefficients and prediction parameters. Based on the updated prediction parameters, the steps are as follows: hierarchical block division, self-attention calculation, cross-attention calculation, feature fusion and decoding of the spatiotemporal grid of the compartment to be predicted to be flooded, and output of the flooded flow field of the compartment.
[0008] Furthermore, in a preferred embodiment, the hierarchical segmentation divides the cabin flooding spatiotemporal grid into coarse-grained master blocks according to a spatial scale from coarse to fine. Each coarse-grained master block is then divided into secondary sub-blocks, and each secondary sub-block is further divided into tertiary fine blocks. The coarse-grained master blocks, secondary sub-blocks, and tertiary fine blocks do not overlap and completely cover the cabin flooding spatiotemporal grid. The fine sub-block sequence includes a secondary sub-block sequence and a tertiary fine block sequence.
[0009] Furthermore, in a preferred embodiment, the spatial coordinates and temporal information of each grid point in the immersion grid of the compartment are embedded as features, and the embedded features are reorganized according to the spatial arrangement relationship of the grid points contained in each coarse-grained master block, secondary sub-block and tertiary fine small block to form the coarse-grained master block sequence and the fine sub-block sequence, respectively.
[0010] Furthermore, in a preferred embodiment, the self-attention computation forms query features, key features, and value features using coarse-grained principal block sequences, and performs weighted aggregation of value features based on the correlation between query features and key features; the cross-attention computation forms query features using global flow features, and key features and value features using fine-grained sub-block sequences, and performs weighted aggregation of value features based on the correlation between global flow features and fine-grained sub-block sequences.
[0011] Furthermore, in a preferred embodiment, the global flow features and local flow features are converted to the same spatial resolution and feature dimension, and the fusion ratio of global flow features and local flow features is determined according to the learnable weighting coefficients and their complementary coefficients, respectively, and the global flow features and local flow features at corresponding positions are weighted and merged.
[0012] Furthermore, in a preferred embodiment, only the predicted flow field of the compartment immersion within the three-level fine blocks is differentiated relative to spatial coordinates and time information, and the mass conservation residual and momentum conservation residual are determined respectively. The mass conservation residual and momentum conservation residual within the same three-level fine block are then aggregated to obtain the physical residual corresponding to each three-level fine block.
[0013] A real-time prediction device for the flooding flow field of a compartment based on a hierarchical block attention physical information neural network includes: The spatiotemporal grid of the flooded compartment is divided into modules at different levels to obtain a coarse-grained master block sequence and a fine-grained sub-block sequence. A module is obtained by performing self-attention calculation on the coarse-grained main block sequence to obtain global flow features, and using the global flow features as query features to perform cross-attention calculation on the fine-grained sub-block sequence to obtain local flow features. The global flow features and local flow features are fused based on learnable weighting coefficients to obtain a module with hierarchical fused features; The layered fusion features are decoded to obtain the predicted flow field of the compartment immersion. The mass conservation residual, momentum conservation residual, and energy dissipation residual are calculated only for the smallest fine sub-block. The composite loss is constructed based on the deviation between the predicted flow field of the compartment immersion and the reference flow field and each residual to update the module of the learnable weighting coefficient and prediction parameters. Based on the updated prediction parameters, a module is used to perform hierarchical block division, self-attention calculation, cross-attention calculation, feature fusion and decoding on the spatiotemporal grid of the compartment to be predicted to be flooded, and output the flooded flow field of the compartment.
[0014] A computer storage medium for storing a computer program, which, when read by the computer, is executed by the computer using the method described thereon.
[0015] A computer, including a processor and a storage medium, executes the method when the processor reads a computer program stored in the storage medium.
[0016] A computer program product, which, as a computer program, implements the method when the computer program is executed.
[0017] Compared with the prior art, the advantages of the technical solution provided by the present invention are as follows: The spatiotemporal grid for the flooding of the compartment is divided into first-level coarse-grained master blocks, second-level sub-blocks, and third-level fine-grained blocks. Each layer of spatial blocks fully covers the entire flooded area according to a progressive scale from coarse to fine, enabling the network to form a multi-scale spatial representation based on a unified spatiotemporal grid. The coarse-grained master blocks retain the overall flooding direction and large-scale flow structure of the compartment, while the fine-grained blocks retain details such as local eddies, backflows, and velocity gradients, reducing the problem of single-scale representation biasing towards the overall mainstream while weakening local secondary flows.
[0018] The spatial coordinates and temporal information of each grid point are linearly embedded and reorganized into a hierarchical spatial input sequence according to different block scales, transforming the original low-dimensional spatiotemporal coordinates into block-level temporal features with a unified feature dimension. The features at different levels thus maintain their corresponding spatial and temporal evolution relationships, providing a data foundation for subsequent global flow analysis, local flow analysis, and cross-scale information exchange within the same feature space.
[0019] Coarse-grained master block features are input into a multi-head self-attention branch, enabling the flow information within each master block and between different master blocks to be correlated through attention weights. This extracts the overall flow direction, mainstream propagation range, and large-scale pressure distribution formed by the breach ingress. Compared to prediction methods that rely solely on local sensing ranges, this feature allows the network to identify flow connections between distant areas across the entire compartment, maintaining the consistency of the overall predicted flow field structure.
[0020] The input of secondary sub-blocks and tertiary fine-grained blocks features cross-attention branches, using global flow features as queries and local sub-block features as keys and values. This guides local feature extraction to be influenced by the overall flow state of the compartment. Local vortices, backflows, velocity changes near boundaries, and secondary directional flows can thus be identified within the context of the global mainstream relationship, avoiding directional deviations or non-physical fluctuations caused by local features detaching from the overall flow field topology.
[0021] The self-attention branch features and cross-attention branch features are fused using learnable weighted coefficients, enabling the network to adaptively adjust the proportions of global mainstream features and local secondary flow features in the fusion result based on training data. This fusion relationship reduces the scale imbalance caused by fixed weights or simple splicing, allowing the fused features to simultaneously retain the overall inflow trend and local flow changes, thus improving the problem of dominant mainstream velocity prediction while insufficient secondary velocity prediction.
[0022] Mass and momentum residuals are calculated only on the third-level fine-grained blocks, while the first-level coarse-grained principal blocks and second-level sub-blocks are excluded from automatic differentiation. This concentrates physical constraints on regions with high spatial resolution and significant local variations. Compared to calculating the residuals of the governing equations point-by-point for all grid points, this configuration reduces the number of spatial units involved in automatic differentiation and the gradient propagation range, thereby reducing the computational cost required for embedding physical information.
[0023] For the physical residuals within the three-level fine blocks, a block averaging approach is used for regional aggregation. This allows the governing equation constraints to act on the local flow field at a block scale, rather than directly relying on the residual values of individual grid points. Regional averaging can reduce the high-frequency numerical disturbances generated by discrete grids and automatic differentiation, avoid excessive influence of abnormal residuals at individual grid points on the training direction, and allow mass and momentum conservation constraints to participate more smoothly in network parameter updates.
[0024] In addition to mass and momentum residuals, an energy dissipation loss composed of kinetic energy change and viscous dissipation is introduced. Residuals that do not conform to the law of irreversible energy dissipation are screened and penalized, ensuring that the network not only fits velocity and pressure data but is also constrained by the energy evolution law of the immersion flow field. This feature can suppress non-physical energy growth, abrupt changes, and oscillations during the prediction process, making the relationship between kinetic energy decay and viscous dissipation in the flow field over time more reasonable.
[0025] The composite loss function comprises data loss, mass and momentum physical loss, and energy dissipation loss, which simultaneously constrains model training by both reference flow field data and fluid physics laws. Data loss ensures that the prediction results are close to the simulation samples, mass and momentum residuals limit the flow field from deviating from the governing equations, and energy dissipation loss limits energy evolution anomalies, thereby reducing local errors caused by relying solely on data fitting and training difficulties caused by relying solely on physical equations.
[0026] The fused multi-scale features are synchronously mapped into transverse velocity, longitudinal velocity, and static pressure in the global grid through the decoding layer, enabling different physical quantities to be jointly generated by the same fused features. The correlation between velocity components and pressure distribution is thus preserved in the unified prediction process, avoiding inconsistencies in spatial location or temporal state caused by predicting different physical quantities separately, and providing complete flow field data for compartment flooding evolution analysis and emergency anti-sinking decision-making. Attached Figure Description
[0027] Figure 1 This is a schematic diagram of the overall framework of the immersion flow field network model.
[0028] Figure 2 This is a visualization of the velocity u prediction results of our proposed model compared with other comparative models.
[0029] Figure 3 This is a visualization of the velocity v prediction results of our proposed model compared with other comparative models.
[0030] Figure 4 This is a visualization of the velocity u in the ablation experiment of this scheme model.
[0031] Figure 5 This is a visualization of the velocity v in the ablation experiment of this scheme model.
[0032] Figure 6 This is a visualization of the pressure p in the ablation experiment of this scheme model. Detailed Implementation
[0033] To make the advantages and benefits of the technical solution provided by the present invention clearer, the technical solution provided by the present invention will now be described in further detail with reference to the accompanying drawings, specifically: Implementation Method 1: This implementation method provides a real-time prediction method for the flooding flow field of a compartment based on a hierarchical block attention physical information neural network, including: The steps involve dividing the spatiotemporal grid of the flooded compartment into blocks at different levels to obtain a coarse-grained master block sequence and a fine-grained sub-block sequence. The steps include: performing self-attention calculation on the coarse-grained main block sequence to obtain global flow features, and using the global flow features as query features to perform cross-attention calculation on the fine-grained sub-block sequence to obtain local flow features; The step of fusing the global flow features and local flow features based on learnable weighted coefficients to obtain hierarchical fused features; The process involves decoding the layered fusion features to obtain the predicted flow field of the immersion chamber, and calculating the mass conservation residual, momentum conservation residual, and energy dissipation residual only for the smallest fine sub-block. Based on the deviation between the predicted flow field of the immersion chamber and the reference flow field and each residual, a composite loss is constructed to update the learnable weighting coefficients and prediction parameters. Based on the updated prediction parameters, the steps are as follows: hierarchical block division, self-attention calculation, cross-attention calculation, feature fusion and decoding of the spatiotemporal grid of the compartment to be predicted to be flooded, and output of the flooded flow field of the compartment.
[0034] The hierarchical segmentation is based on a spatial scale from coarse to fine. The spatiotemporal grid of the flooded compartment is divided into coarse-grained master blocks, each coarse-grained master block is divided into secondary sub-blocks, and each secondary sub-block is divided into tertiary fine blocks. The coarse-grained master blocks, secondary sub-blocks, and tertiary fine blocks do not overlap and completely cover the spatiotemporal grid of the flooded compartment. The fine sub-block sequence includes a secondary sub-block sequence and a tertiary fine block sequence.
[0035] The spatial coordinates and temporal information of each grid point in the flooded compartment spatiotemporal grid are embedded with features. The embedded features are then reorganized according to the spatial arrangement of the grid points contained in each coarse-grained master block, secondary sub-block, and tertiary fine small block to form the coarse-grained master block sequence and the fine sub-block sequence, respectively.
[0036] The self-attention computation uses coarse-grained main block sequences to form query features, key features, and value features respectively, and performs weighted aggregation of value features based on the correlation between query features and key features; the cross-attention computation uses global flow features to form query features, uses fine-grained sub-block sequences to form key features and value features, and performs weighted aggregation of value features based on the correlation between global flow features and fine-grained sub-block sequences.
[0037] The global flow features and local flow features are converted to the same spatial resolution and feature dimension, and the fusion ratio of global flow features and local flow features is determined according to the learnable weighting coefficients and their complementary coefficients, respectively. The global flow features and local flow features at corresponding positions are then weighted and merged.
[0038] The predicted flow field of the immersion in the compartment within the three-level fine-grained block is differentiated relative to the spatial coordinates and time information, and the mass conservation residual and momentum conservation residual are determined respectively. The mass conservation residual and momentum conservation residual within the same three-level fine-grained block are then aggregated to obtain the physical residual corresponding to each three-level fine-grained block.
[0039] A real-time prediction device for the flooding flow field of a compartment based on a hierarchical block attention physical information neural network includes: The spatiotemporal grid of the flooded compartment is divided into modules at different levels to obtain a coarse-grained master block sequence and a fine-grained sub-block sequence. A module is obtained by performing self-attention calculation on the coarse-grained main block sequence to obtain global flow features, and using the global flow features as query features to perform cross-attention calculation on the fine-grained sub-block sequence to obtain local flow features. The global flow features and local flow features are fused based on learnable weighting coefficients to obtain a module with hierarchical fused features; The layered fusion features are decoded to obtain the predicted flow field of the compartment immersion. The mass conservation residual, momentum conservation residual, and energy dissipation residual are calculated only for the smallest fine sub-block. The composite loss is constructed based on the deviation between the predicted flow field of the compartment immersion and the reference flow field and each residual to update the module of the learnable weighting coefficient and prediction parameters. Based on the updated prediction parameters, a module is used to perform hierarchical block division, self-attention calculation, cross-attention calculation, feature fusion and decoding on the spatiotemporal grid of the compartment to be predicted to be flooded, and output the flooded flow field of the compartment.
[0040] A computer storage medium for storing a computer program, which, when read by the computer, is executed by the computer using the method described thereon.
[0041] A computer, including a processor and a storage medium, executes the method when the processor reads a computer program stored in the storage medium.
[0042] A computer program product, which, as a computer program, implements the method when the computer program is executed.
[0043] Implementation Method Two: This implementation method is a further detailed description of the technical solution provided in Implementation Method One, specifically: It includes the following steps.
[0044] S1. Construct a flooded flow field sample for the compartment. A numerical model of the compartment flooding is established based on the compartment's geometric region, damage boundary, and flooding evolution period. Fluid simulation of the flooding process is performed, and spatiotemporal grid data for each moment is exported at preset time intervals. The spatiotemporal grid data includes the spatial coordinates and time information of each grid point, as well as the corresponding transverse velocity, longitudinal velocity, and static pressure. The spatial coordinates and time information are used as model input data, and the transverse velocity, longitudinal velocity, and static pressure are used as reference flow field data. A flooded flow field sample for the compartment is formed according to the same spatial arrangement. This sample is used for subsequent hierarchical block encoding and model training.
[0045] S2 involves hierarchical and block-based encoding of the flooded flow field samples in the compartment. Based on the spatial coordinates of each grid point, the entire flooded area of the compartment at the same time is divided into multiple non-overlapping, fully covering primary coarse-grained master blocks. Each primary coarse-grained master block is then progressively divided into secondary sub-blocks and tertiary fine-grained blocks, creating a spatial hierarchy from coarse to fine. Features are embedded from the spatial coordinates and temporal information of each grid point. Following the spatial arrangement order of the grid points within each level of spatial block, the embedded grid point features are reorganized to generate primary coarse-grained master block sequences, secondary sub-block sequences, and tertiary fine-grained block sequences. The generated spatial input sequences at each level maintain their corresponding spatial positions and are input into a hierarchical heterogeneous attention network.
[0046] S3. Extract global and local flow features of the immersion flow field in the compartment. The first-level coarse-grained master block sequence is input into the self-attention branch. Attention weights are assigned based on the feature correlations between grid points within each first-level coarse-grained master block and between different first-level coarse-grained master blocks. The embedded features of each first-level coarse-grained master block are weighted and aggregated to obtain global flow features characterizing the overall water inflow direction, mainstream propagation relationship, and global pressure changes of the compartment. These global flow features are used as query features for the cross-attention branch. The second-level sub-block sequence and the third-level fine-grained block sequence are used as key and value features, respectively. Based on the correlation between the global flow features and the features of each local spatial block, the local spatial block features are selectively aggregated to obtain local flow features guided by the global flow state. These global and local flow features are then input into subsequent feature fusion processing.
[0047] S4. Adaptive fusion of global and local flow features. Global and local flow features are converted to the same spatial resolution and feature dimension, and learnable weighting coefficients are set to balance the two types of features. The proportions of global and local flow features in the fusion result are determined according to these learnable weighting coefficients, and then the two types of features are weighted and merged at corresponding positions to obtain a hierarchical fused feature that simultaneously contains overall mainstream information and local secondary flow information of the compartment. During model training, the learnable weighting coefficients are updated according to the direction of change of the composite loss relative to the learnable weighting coefficients, and the updated hierarchical fused feature is input to the flow field decoding layer.
[0048] S5. Generate the predicted flow field based on the layered fusion features. The flow field decoding layer performs feature mapping on the layered fusion features according to the spatial arrangement of the compartment immersion spatiotemporal grid, and simultaneously generates lateral velocity prediction values, longitudinal velocity prediction values, and static pressure prediction values at each grid position. The predicted values at each grid position are recombined according to the grid order of the original compartment immersion domain to obtain the compartment immersion predicted flow field corresponding to the current input time. During the training phase, the compartment immersion predicted flow field is used for composite loss calculation, and during the inference phase, the compartment immersion predicted flow field is output as the prediction result.
[0049] S6. Construct a composite loss and update the model based on the predicted flow field and the reference flow field. Compare the lateral velocity, longitudinal velocity, and static pressure at corresponding grid points in the chamber immersion predicted flow field with those in the reference flow field, and determine the data loss based on the deviation between each predicted physical quantity and the corresponding reference physical quantity. Perform automatic differentiation based on the change relationship of the chamber immersion predicted flow field with respect to spatial coordinates and time information. Calculate the mass conservation residual, lateral momentum residual, and longitudinal momentum residual only for the predicted flow field within the third-level fine-grained block, and perform region aggregation on the residuals within the same third-level fine-grained block to obtain the governing equation residual loss corresponding to the third-level fine-grained block.
[0050] Based on the transverse and longitudinal velocities and their spatiotemporal variations in the predicted flow field during compartment immersion, the kinetic energy change and viscous dissipation within each three-level fine block are determined. The energy dissipation residual is then obtained based on the relationship between the kinetic energy change and the viscous dissipation. The energy dissipation residual, representing non-physical energy changes, is filtered and penalized to obtain the energy dissipation loss. The data loss, governing equation residual loss, and energy dissipation loss are combined into a composite loss according to preset weights. This composite loss is then used to update the feature embedding parameters, self-attention branch parameters, cross-attention branch parameters, learnable weighted coefficients, and flow field decoding layer parameters in reverse order. The hierarchical block encoding, feature extraction, feature fusion, flow field decoding, and parameter updates are repeated until a preset training termination condition is met, resulting in the compartment immersion flow field prediction model.
[0051] S7 utilizes the trained chamber immersion flow field prediction model for real-time prediction. It reads the chamber's spatial coordinates and time information corresponding to the time to be predicted, and generates a first-level coarse-grained main block sequence, a second-level sub-block sequence, and a third-level fine-grained small block sequence according to the same spatial partitioning rules as during model training. Global flow feature extraction, local flow feature extraction, adaptive fusion, and flow field decoding are then performed sequentially to obtain the lateral velocity, longitudinal velocity, and static pressure at the time to be predicted. The prediction results are then restored according to the physical quantity transformation rules of the training data, and the restored physical quantities are arranged according to the global chamber immersion grid to output the complete chamber immersion prediction flow field.
[0052] In one alternative implementation, the flow field samples of the immersion chamber are obtained through computational fluid dynamics simulation. The simulation model uses a two-dimensional rectangular chamber with a full-width breach in the chamber wall, and employs a free surface capture method to simulate the flow process of seawater entering the chamber through the breach. At each simulation moment, grid coordinates, lateral velocity, longitudinal velocity, and static pressure are derived, and samples are divided into training, validation, and test sets. The lateral velocity, longitudinal velocity, and static pressure are normalized respectively. The validation set is used to determine the model retention state during the training process, and the test set is used to verify the prediction results of the trained model.
[0053] In one optional implementation, the entire flooded area of the compartment is represented by a regular grid. The first-level coarse-grained master block consists of a preset number of adjacent grid points; the second-level sub-blocks are obtained by halving the side length of the first-level coarse-grained master block; and the third-level fine-grained blocks are obtained by halving the side length of the second-level sub-blocks again. There is no overlap between the various levels of spatial blocks, and the nesting relationship is maintained: the first-level coarse-grained master block contains the corresponding second-level sub-block, and the second-level sub-block contains the corresponding third-level fine-grained block. For a flooded area of the compartment with 64 x 32 grid points, the first-level coarse-grained master block can be set to 8 x 8 grid points, the second-level sub-block to 4 x 4 grid points, and the third-level fine-grained block to 2 x 2 grid points.
[0054] In one optional implementation, the horizontal coordinates, vertical coordinates, and time information of each grid point are input into a linear embedding layer and mapped to hidden features of a preset dimension. The block processing first restores the two-dimensional spatial arrangement of the hidden features according to the row and column relationships of the compartment grid, then extracts the hidden features within each spatial block according to the corresponding spatial block size, and subsequently adjusts the order of the spatial block index, intra-block position index, and feature dimension to form a spatial input sequence at each level with spatial blocks as the processing unit.
[0055] In one optional implementation, both the self-attention branch and the cross-attention branch include multiple attention layers connected in sequence. Each attention layer includes a multi-head attention unit, a layer normalization unit, a residual connection, and a feedforward processing unit. The self-attention branch generates query features, key features, and value features based on first-level coarse-grained principal block features, and weights the value features according to the correlation between the query features and the key features. The cross-attention branch generates query features based on global flow features, and generates key features and value features based on second-level sub-block features and third-level fine-grained small block features, thereby determining the aggregation direction of local features by global flow features.
[0056] In one alternative implementation, the learnable weighting coefficients are set with initial values and an allowed update range. At the start of training, global flow features and local flow features are given the same or similar initial proportions. During model parameter updates, the learnable weighting coefficients are adjusted based on the backpropagation results of the composite loss, and the updated values are restricted within the allowed update range to prevent any attention branch from being completely suppressed in the fusion result.
[0057] In one optional implementation, the governing equation residuals include mass conservation residuals, transverse momentum residuals, and longitudinal momentum residuals. Partial derivatives of the predicted transverse velocity, predicted longitudinal velocity, and predicted static pressure with respect to transverse coordinates, longitudinal coordinates, and time are obtained through automatic differentiation, and these partial derivatives are combined according to the mass and momentum conservation relationships for incompressible fluids. The residuals of each grid point within each tertiary fine-grained block are averaged integrally or arithmetically, and the governing equation residual loss is determined based on the average residuals of each tertiary fine-grained block. The automatic differentiation process is not performed on the primary coarse-grained master block and the secondary sub-blocks.
[0058] In one alternative implementation, the energy dissipation residual is determined jointly by the kinetic energy change and viscous dissipation of the predicted flow field. The kinetic energy change is determined based on the predicted transverse velocity, the predicted longitudinal velocity, and their time-varying relationships, while the viscous dissipation is determined based on the gradient relationships of the predicted transverse and longitudinal velocities relative to spatial coordinates. After combining the kinetic energy change and the viscous dissipation, the portion representing an abnormal increase in energy is retained, while the remaining portion is not penalized. The energy dissipation loss is then determined based on the size of the retained portion.
[0059] In one optional implementation, data loss, control equation residual loss, and energy dissipation loss are each assigned corresponding loss weights, with the weight of energy dissipation loss being higher than that of a single control equation residual. The model parameters are iteratively updated using gradient optimization, and the validation loss is calculated using the validation set at preset training intervals. When the current validation loss is lower than the previous validation losses, the current model parameters are saved. After training, the model parameters corresponding to the lowest validation loss are used as the parameters of the chamber immersion flow field prediction model.
[0060] In one alternative implementation, the flow field decoding layer is a linear prediction head or a prediction head composed of multiple fully connected layers. The flow field decoding layer maps the layered fusion features of each grid location into a vector of physical quantities including lateral velocity, longitudinal velocity, and static pressure, and restores it to the global grid of the immersion compartment according to the index relationship before spatial block reorganization, so that the three predicted physical quantities have consistent spatial coordinates and temporal information.
[0061] Implementation Method 3: This implementation method is described in detail with reference to the accompanying drawings. Specific embodiments are provided to further illustrate the technical solutions offered above. Specifically: To address the shortcomings of existing immersion flow field prediction networks, such as high computational overhead and imbalance between primary and secondary flows, this implementation method employs the following technical solution: S1. Read the spatiotemporal grid of the flooded compartment and use the hierarchical block coding module to perform three-level hierarchical block division on the entire flooded area: first-level coarse-grained main block, second-level sub-block, and third-level fine-grained small block, to generate a hierarchical spatial input sequence. S2. The self-attention branch of the coarse-grained sequence input network and the cross-attention branch of the fine-grained sub-block input network extract global mainstream and local secondary flow features respectively. This function is implemented using a hierarchical heterogeneous attention extraction module. S3, the adaptive fusion module uses learnable weighted coefficients to fuse dual-branch attention features, and fuses the flow features in S2 based on the weighted fusion formula to obtain the final fused features; S4, Lightweight Physical Constraint Calculation Module, reduces computational consumption by using block-averaged NS residuals, and adds a composite loss of energy dissipation loss and data loss to the network model, and updates the network in reverse. S5. The feature input decoding layer is fused, and the real-time flow field prediction output module is used to synchronously output the global flow field prediction results.
[0062] The hierarchical representation method and rules in S1: In the hierarchical block representation method, the flow field space is discretized into several spatial blocks, and each spatial block at any given time contains the same number of discrete spatial points. The model no longer processes each point independently, but instead introduces a hierarchical block representation method to explicitly model multi-scale spatial interactions. The first layer is called the principal layer, and the side length of the principal layer spatial block is... n The number of points contained is n 2 The number of spatial points is reduced by one-quarter. The side lengths of the secondary and tertiary blocks within the secondary and tertiary layers are halved, resulting in a one-quarter number of spatial points. In this way, a complete watershed to be predicted is decomposed into three hierarchical sets of spatial blocks.
[0063] Input of this method It is a continuous sequence of spatiotemporal coordinates: , in, Represents batch size. The total number of spatial points within the corresponding computational domain. This refers to the dimension of the input data (which typically includes information such as spatial coordinates and time steps). The spatial dimensions representing the flooded compartments are respectively and direction. This represents the evolution time of the flooded flow field in the compartment. To map the original coordinates to a more representative hidden feature space, the model first introduces a linear embedding layer, the transformation process of which is as follows: , This outputs the dimension for linear layers. It also embeds features to explicitly model multi-scale spatial interactions. The data needs to be reorganized using a block operator. This operator takes a sequence of one-dimensional spatial points of the flow field as input and divides the complete flow field mesh into spatial blocks of equal size through four steps: spatial reconstruction, block size reorganization, dimensional rearrangement, and block flattening. The final output is the block-based flow field feature tensor. This operator provides the foundation for global-local feature fusion in subsequent multi-scale heterogeneous attention mechanisms. Specifically, the operator first discretizes the entire spatial domain into several regular and non-overlapping spatial blocks, each containing an equal number of spatial points. Then, a block operator reconstructs the originally sequentially arranged embedded features into a block-based representation. , Where b is the side length of a single block. The total number of space blocks (N must be N) (Integer multiples thereof to ensure the regularity of block partitioning).
[0064] The construction of the hierarchical structure follows a progressive scale logic from large to small: the main layer consists of larger blocks, designed to capture the overall structure of the flow field; the secondary and tertiary layers are generated by successively halving the side length of the blocks, eventually forming a nested set of blocks. As the hierarchy deepens, the spatial resolution of the blocks gradually increases, covering more refined local flow field features.
[0065] The attention module is uniformly 3 layers and 4 heads, with 128 hidden dimensions. Each layer is equipped with layer normalization and residual connections.
[0066] The joint prediction method of self-attention branch and cross-attention branch in S2 is as follows: Figure 1 As shown. Within the main layer spatial blocks, the model independently performs self-attention computation for each spatial block: (1) This mechanism allows for the full modeling of flow patterns within each spatial block, including fine flow features such as symmetrical vortex structures and broken regions. After passing through multi-head self-attention, residual connections, and a feedforward network, the features within the primary attention layer are rearranged back to the original resolution. (2) in For the rearranged features, feature rearrangement ensures that the primary features retain a spatial structure consistent with the input, laying the foundation for subsequent cross-scale interactions. To further capture dependencies between different scales, the model introduces secondary cross-attention. Here, the primary scale features serve as the query, and the original embedded features serve as key-value pairs: (3) Cross attention in the formula This allows the model to integrate flow field information at different scales from a more global perspective, such as the influence of large-scale flow structures on local regions. Since primary and secondary features have the same resolution and dimensionality, they can be effectively merged using a learnable weighted fusion strategy. Only the third-level fine blocks perform NS residual and energy dissipation calculations, while the first and second-level blocks do not participate in differential operations, thus achieving lightweight design.
[0067] After adopting a lightweight physical regularization training strategy, the model loss is composed of a weighted average of data loss and physical loss: (4) Among them, data loss The standard mean square error is used to measure the deviation between the predicted flow field and the reference data. (5) HBA-PINN introduces a spatial domain-based differential computation method based on the concept of coarse-grained control volumes. Physical residuals are no longer calculated point-by-point, but rather on a three-level block basis. This design allows physical constraints to be weakly applied to the smallest possible spatial block structure. Specifically, spatial derivatives are automatically differentiated and then averaged using a block averaging operator. In each third-level block Integral average: (6) in, For the measure of a three-level block, This is the residual term after automatic differentiation. This approach not only aligns with the principles of the finite volume method in fluid mechanics but also effectively suppresses high-frequency numerical noise through aggregation, improving model stability. Physical loss It consists of two parts, and its calculation method is expressed as follows: (7) In the formula, The mass and momentum residuals representing the physical equations ensure that the predicted flow field satisfies the Navier-Stokes equations; their calculation method is described in Section 3.2.4. Set the baseline value to 1 to ensure the network satisfies the original control equations; weight of the energy dissipation term. Set it to 10 to give it a higher priority in the optimization process. The water-filled flow field in ship compartments has significant viscous dissipation and kinetic energy decay characteristics, and the energy evolution directly reflects the physical rationality of the flow field evolution.
[0068] By appropriately increasing the weight of the energy dissipation residual, the model can be guided to prioritize the conservation and dissipation laws of momentum and mass during training, suppressing non-physical energy mutations and oscillations, while maintaining its ability to fit the details of the spatial flow field. This improves the rationality and stability of the prediction results while ensuring overall physical consistency.
[0069] The energy dissipation term is used to constrain the energy conservation properties of the flow field, avoiding non-physical mass growth or insufficient calculation of turbulent dissipation. The energy dissipation term is discretized to obtain the energy dissipation residual. This term is jointly dominated by the change in kinetic energy and viscous dissipation, and the three physical quantities can be expressed by the following formula: (8) (9) (10) in, The kinetic energy change rate term characterizes the rate of change of the kinetic energy of a fluid element with time. This is a viscous dissipation function used to quantify the intensity of mechanical energy dissipation caused by viscous forces. To... This is transformed into a physical constraint loss term that can be directly used in model training, and further, an energy dissipation loss function is introduced. The calculation method is expressed as follows: (11) The formula first applies the ReLU function to the residual. The process involves filtering to retain only non-negative values, reflecting the physical law of irreversible energy dissipation in the real flow field, thus avoiding excessive constraints on the model's normal predictions. Subsequently, the filtered results are squared to amplify the penalty intensity for physical deviations, guiding the model to focus on correcting predictions that severely violate the law of energy dissipation. Finally, the high-dimensional flow field data is compressed into a scalar loss term through a mean operation, enabling it to be weighted and integrated with other constraint terms such as data loss and boundary loss, and jointly participate in the model's backpropagation optimization process.
[0070] The initial value of the fusion weight α is 0.5, and the training adaptive update interval is 0.1~0.9.
[0071] Since primary and secondary features have the same resolution and dimensionality, they can be effectively merged using a learnable weighted fusion strategy: (12) in, It is a learnable parameter, and in this implementation, the value range is designed to be [0.1, 0.2, 0.3…,0.9]. It is used to balance the proportion of primary self-attention and secondary cross-attention in the neural network model, and it is also a parameter used by the model to help balance the prediction accuracy of primary and secondary flows.
[0072] Features after fusion It incorporates both the flow structure within secondary blocks and the global relationships of the primary spatial blocks, thus achieving a consistent multi-scale representation of the flow field. Finally, the fused features are mapped to the target flow field variables through a lightweight prediction head. : (13) The real-time prediction method for the ship compartment flooding flow field using a hierarchical block attention physical information neural network described in this embodiment has the following beneficial effects: (1) A three-level hierarchical architecture is paired with two sets of hierarchical attention calculation formulas to simultaneously characterize the global mainstream inflow and local secondary flow, and to balance the two types of features through an adaptive fusion formula; (2) Block averaging and regional differentiation reduce the computational cost of the NS equations, and point-by-point differentiation is abandoned, thus reducing the computational cost of embedding physical laws. (3) A new energy dissipation loss formula is added to force the flow field to satisfy the viscous dissipation law, and the prediction results are more consistent with the actual flow field law.
[0073] In a specific embodiment: The complete execution of all prediction steps from S1 to S6 in Scheme 1, with clearly defined and reproducible hardware environment, simulation dataset, network hyperparameters, training strategy, and inference process, represents the optimal implementation method for this method.
[0074] S1. Hardware and Software Environment Training and Inference Hardware: NVIDIA Quadro RTX 5000 dedicated graphics card, 16GB video memory; Software framework: Python 3.9, PyTorch 2.2.1, CUDA 12.1, and STAR-CCM+ 2022 fluid simulation software.
[0075] S2. Dataset Construction (SFG-Wide Full-Width Breach Dataset) 1) Compartment geometric model: Two-dimensional rectangular compartment, 4.8m long and 1.6m wide, with the full-width breach opened along the compartment wall; 2) Simulation settings: Fluid medium: seawater, ρ=1000kg / m³, ν=10 -6 m²; two-layer k-ε turbulence model, VOF free surface capture method; time step 0.01s, total simulation time 2.0~5.0s; 3) Mesh generation: Uniform mesh across the entire domain, with 64 sampling points in the x-direction and 32 sampling points in the y-direction, for a total of 2048 meshes at a single time. 4) Data preprocessing: Export grid coordinates, x-velocity u, y-velocity v, and static pressure p at each time step; divide the training set / validation set / test set into a ratio of 7:1.5:1.5; 5) Data normalization: Perform Min-Max normalization on u, v, and p to the 0~1 range to eliminate dimensional differences.
[0076] S3, Three-level hierarchical block execution steps (corresponding to S1): Global grid base block side length n=8; Main layer coarse block: 8×8 grid single block, 32 blocks in total; Secondary medium block: split the main block in half, single block 4×4 grid; Third-level fine small block: the secondary block is split in half again, single block 2×2 grid; All blocks are non-overlapping and completely cover the entire domain; Perform 128-dimensional linear embedding on each grid coordinate (x, y, t) to generate multi-scale temporal feature sequences.
[0077] S4. Construction of a hierarchical heterogeneous attention network (corresponding to S2) 1) Main layer global self-attention branch: Input 8×8 block embedded features from the main layer, 3 layers of 4-head multi-head self-attention, feature dimension 128, each layer is configured with layer normalization + residual connection, output global flow features; 2) Secondary cross-attention branch: Input 4×4 and 2×2 fine sub-block features, use global features as queries and local sub-blocks as keys, perform 3 layers of 4-head cross-attention, and output local turbulence features; 3) Adaptive fusion layer: The learnable parameter α is initially set to 0.5, and the training iterations automatically optimize it in the range of 0.1 to 0.9, and execute the fusion formula (12).
[0078] S5, Lightweight Composite Loss Training Process (corresponding to S4) 1) Automatic differentiation is performed only on 2×2 tertiary blocks to calculate mass residuals, x and y momentum residuals, and viscous energy dissipation losses; primary and secondary blocks do not participate in the differentiation operation; 2) The total loss weight is fixed, the data loss weight is 1, the physical loss weight is 1, and the energy dissipation loss weight is 10; 3) The optimizer used is Adam, with a base learning rate of 0.001 and a weight decay coefficient of 1e-5; 4) Training batch size = 8, total number of iterations = 1000; validation is performed every 50 rounds, and the optimal model weights with the lowest validation loss are saved.
[0079] S6. Model Inference and Prediction Process (corresponding to S5 and S6) 1) Input the training set samples according to the S5 method; 2) Forward propagation: hierarchical block encoding → dual attention feature extraction → adaptive fusion → linear prediction head outputs a set of 64×32 grids (u, v, p); 3) Reverse normalization restores the true physical quantities and outputs the complete flow field of the entire cabin; S7. Prediction Results and Ablation Experiment Results Table 1 shows the speed of each model in this implementation case on the SFG-Wide dataset. u ,speed v and pressure p The prediction error comparison results are analyzed from the perspectives of prediction accuracy of physical quantities and model generalization, with L2 relative norm error, root mean square error and loss function value as the core indicators.
[0080] In terms of the accuracy of physical quantity prediction, the method proposed in this implementation achieves optimal performance across multiple indicators. For the velocity component... u The model proposed in this embodiment has an error of only 1.18%, which is half that of the suboptimal model (2.95%), and nearly 4% lower than the error of neural operator models such as FNO and PINO. For the velocity component... v The model's error was 4.48%, slightly higher than the TNO model's prediction result (2.93%), but better than other comparative models, indicating its stable ability to model secondary flows. (Comparative pressure) p The model's error is the smallest among all models, decreasing by 4.18% and 0.47% compared to KAN and TNO, respectively, considering the three physical quantities, especially velocity. v The improved prediction accuracy indicates that the method proposed in this embodiment alleviates the imbalance in the prediction of the primary and secondary flow directions of the immersion flow field.
[0081] From the perspective of root mean square error, the HBA-PINN model proposed in this embodiment has speed... u and pressure p The RMSE values are all minimized, and the speed is [missing information]. v The root mean square error of the TNO model is slightly higher than the best level of the latest model; the root mean square error of the KAN model is significantly higher, reflecting the problem of local error accumulation in high-dimensional flow field nonlinear mapping of traditional methods. Furthermore, the loss control of the model in this embodiment is more efficient, with a loss value of only 1.33 × 10⁻⁶. -5 Compared to PINNformer (114×10 -5 The loss is significantly reduced. This result stems from the model's hierarchical block attention + quantized physical regularization strategy: the block structure reduces the computational complexity of attention, while the block-scale physical constraints avoid gradient oscillations in point-by-point differentiation, ultimately achieving rapid convergence and stable reduction of the loss.
[0082] Next, using the SFG-Wide dataset as an example, we will visualize and display the prediction results of several models with good prediction performance. Figure 2 and Figure 3 . Figure 2 It is speed u The visualization results, specifically, Figure 2 The speed is set above. u A magnified view of a section. The image shows the speed in detail. u Some detailed hydrodynamic features are shown. Below, the three models with the best experimental results and label data plots are displayed respectively, and the three models with the best prediction results are selected for intuitive comparison with the real model.
[0083] As can be seen from the figure, the model proposed in this embodiment can accurately reproduce the velocity field. u Furthermore, the model accurately characterizes the relationship between small-scale eddies and the mainstream in the corner regions of the flow field, and its velocity gradient conforms to the boundary constraints. The model also successfully predicted the saddle-shaped flow field characteristics in the magnified local view. In contrast, TNO provides a simple prediction of the overall flow field direction, while KAN incorrectly calculates the regional velocity amplitude, resulting in poor overall consistency. Regarding velocity... v The model proposed in this embodiment accurately predicted the opposite velocity region inside the cabin. Only the model in this embodiment successfully predicted the blue spindle-shaped region in its local plot; the other two better-performing models failed to do so. Combining the local and overall prediction results, it can be concluded that HBA-PINN, due to its layered block attention mechanism matching the characteristics of the immersion flow field, achieves the effect of accurately capturing multi-scale flows and balancing the velocities of the main and secondary flows.
[0084] Ablation experiments were conducted to verify how the core architecture functions. The model in this implementation uses a fusion of primary-scale block self-attention and secondary-scale cross-attention; therefore, the following experimental schemes were designed: Scheme 1 uses self-attention only in the primary layer; Scheme 2 uses cross-attention only in the secondary layer; Scheme 3 uses self-attention in both the primary and secondary layers and fuses them. Experimental results are shown in Table 2. All schemes employ a unified lightweight physics regularization and energy dissipation loss strategy to ensure fairness in the comparison.
[0085] Experimental results demonstrate the effectiveness of simultaneously using self-attention in the main layer and cross-attention in the secondary layer. The model in Scheme 1 captures flow patterns well in the immersion scenarios corresponding to the SFG-Wide dataset; the model in Scheme 2 performs poorly on the SFG-Wide dataset, especially at medium and fast speeds. vThe prediction error was as high as 19.43%, proving that local interactions lacking global feature guidance cannot establish correct flow field topology relationships. Although the dual self-attention fusion scheme 3 is better than the single-scale model, it still lags behind HBA-PINN, indicating that simple feature splicing cannot effectively bridge the flow features between different scales, while HBA-PINN uses a cross-attention mechanism to achieve a more advanced feature alignment.
[0086]
[0087] In addition, this implementation also visualizes the prediction results on the SFG-Wide dataset. Since the 4.5-second timeframe was already selected previously, this time 4.9 seconds, which is the later stage of the immersion flow field evolution, is chosen for display. (Velocity) u , v and pressure p Visualization such as Figures 4-6 The top of each image shows the flow field contour map, and the bottom image shows the prediction error contour map.
[0088] speed u In the prediction results, the HBA-PINN model exhibits the smoothest and most uniform flow field distribution, with its red high-speed region closely matching physical expectations. The error cloud map below shows the smallest and most uniformly distributed residuals. In contrast, the model of Scheme 2 shows significant color distortion in the edge regions, with prominent highlighted error points in the corresponding error cloud map, indicating that non-physical fluctuations are easily generated when local features lack global guidance. Although the other two models predict the overall trend correctly, the color transition at the boundary layer is not smooth enough, and there are many scattered error regions in the error cloud map. This phenomenon reflects the difficulty of single self-attention or dual self-attention fusion models in accurately characterizing local details.
[0089] speed v The visualization results more intuitively reveal the performance differences of different attention mechanisms. The flow field predicted by HBA-PINN shows distinct layers in the green-yellow transition zone near the breach, clearly reflecting the gradient change of lateral velocity. Its error cloud map is generally a low-intensity blue, indicating that the residuals are effectively controlled globally. The error cloud map corresponding to Scheme 2 shows a significant dark blue high-error area on the left, verifying that local interactions lacking global constraints can lead to serious prediction bias. The color transition of Scheme 1 near the breach is blurred, and there are some yellow highlighted areas in the error cloud map. Although the error distribution of Scheme 3 is improved, it is still not as accurate as HBA-PINN.
[0090] pressure pThe visualization results highlight the advantages of the HBA-PINN model proposed in this embodiment in maintaining physical consistency. The pressure field predicted by HBA-PINN shows a clear red high-pressure zone at the breach, transitioning naturally to the blue low-pressure zone inside the compartment. The error cloud map below is predominantly green, indicating that the error is at a low level. The pressure field high-pressure zone range of the model in Scheme 2 shows a significant deviation, and the error cloud map contains the most yellow high-error area among the four models, reflecting its insufficient predictive ability for locally sensitive physical quantities such as pressure. Although the high-pressure zone positions of the models in Schemes 1 and 3 are basically correct, the internal pressure prediction is not uniform enough, and there are many scattered bright error points in the error cloud map, indicating that relying solely on self-attention is insufficient to achieve global physical consistency of the pressure field.
[0091] The above description of several specific embodiments further details the technical solution provided by the present invention in order to highlight the advantages and benefits of the technical solution provided by the present invention. However, the above-described specific embodiments are not intended to limit the present invention. Any reasonable modifications and improvements to the present invention, combinations of embodiments, and equivalent substitutions based on the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for real-time prediction of cabin flooding flow field based on a hierarchical block attention physical information neural network, characterized in that, include: The steps involve dividing the spatiotemporal grid of the flooded compartment into blocks at different levels to obtain a coarse-grained master block sequence and a fine-grained sub-block sequence. The steps include: performing self-attention calculation on the coarse-grained main block sequence to obtain global flow features, and using the global flow features as query features to perform cross-attention calculation on the fine-grained sub-block sequence to obtain local flow features; The step of fusing the global flow features and local flow features based on learnable weighted coefficients to obtain hierarchical fused features; The process involves decoding the layered fusion features to obtain the predicted flow field of the immersion chamber, and calculating the mass conservation residual, momentum conservation residual, and energy dissipation residual only for the smallest fine sub-block. Based on the deviation between the predicted flow field of the immersion chamber and the reference flow field and each residual, a composite loss is constructed to update the learnable weighting coefficients and prediction parameters. Based on the updated prediction parameters, the steps are as follows: hierarchical block division, self-attention calculation, cross-attention calculation, feature fusion and decoding of the spatiotemporal grid of the compartment to be predicted to be flooded, and output of the flooded flow field of the compartment.
2. The method for real-time prediction of cabin flooding flow field based on a hierarchical block attention physical information neural network according to claim 1, characterized in that, The hierarchical segmentation is based on a spatial scale from coarse to fine. The spatiotemporal grid of the flooded compartment is divided into coarse-grained master blocks, each coarse-grained master block is divided into secondary sub-blocks, and each secondary sub-block is divided into tertiary fine blocks. The coarse-grained master blocks, secondary sub-blocks, and tertiary fine blocks do not overlap and completely cover the spatiotemporal grid of the flooded compartment. The fine sub-block sequence includes a secondary sub-block sequence and a tertiary fine block sequence.
3. The method for real-time prediction of cabin flooding flow field based on a hierarchical block attention physical information neural network according to claim 1, characterized in that, The spatial coordinates and temporal information of each grid point in the flooded compartment spatiotemporal grid are embedded with features. The embedded features are then reorganized according to the spatial arrangement of the grid points contained in each coarse-grained master block, secondary sub-block, and tertiary fine small block to form the coarse-grained master block sequence and the fine sub-block sequence, respectively.
4. The method for real-time prediction of cabin flooding flow field based on a hierarchical block attention physical information neural network according to claim 1, characterized in that, The self-attention computation uses coarse-grained main block sequences to form query features, key features, and value features respectively, and performs weighted aggregation of value features based on the correlation between query features and key features; the cross-attention computation uses global flow features to form query features, uses fine-grained sub-block sequences to form key features and value features, and performs weighted aggregation of value features based on the correlation between global flow features and fine-grained sub-block sequences.
5. The method for real-time prediction of cabin flooding flow field based on a hierarchical block attention physical information neural network according to claim 1, characterized in that, The global flow features and local flow features are converted to the same spatial resolution and feature dimension, and the fusion ratio of global flow features and local flow features is determined according to the learnable weighting coefficients and their complementary coefficients, respectively. The global flow features and local flow features at corresponding positions are then weighted and merged.
6. The method for real-time prediction of cabin flooding flow field based on a hierarchical block attention physical information neural network according to claim 1, characterized in that, The predicted flow field of the immersion in the compartment within the three-level fine-grained block is differentiated relative to the spatial coordinates and time information, and the mass conservation residual and momentum conservation residual are determined respectively. The mass conservation residual and momentum conservation residual within the same three-level fine-grained block are then aggregated to obtain the physical residual corresponding to each three-level fine-grained block.
7. A real-time prediction device for the immersion flow field of a cabin based on a hierarchical block attention physical information neural network, characterized in that, include: The spatiotemporal grid of the flooded compartment is divided into modules at different levels to obtain a coarse-grained master block sequence and a fine-grained sub-block sequence. A module is obtained by performing self-attention calculation on the coarse-grained main block sequence to obtain global flow features, and using the global flow features as query features to perform cross-attention calculation on the fine-grained sub-block sequence to obtain local flow features. The global flow features and local flow features are fused based on learnable weighting coefficients to obtain a module with hierarchical fused features; The layered fusion features are decoded to obtain the predicted flow field of the compartment immersion. The mass conservation residual, momentum conservation residual, and energy dissipation residual are calculated only for the smallest fine sub-block. The composite loss is constructed based on the deviation between the predicted flow field of the compartment immersion and the reference flow field and each residual to update the module of the learnable weighting coefficient and prediction parameters. Based on the updated prediction parameters, a module is used to perform hierarchical block division, self-attention calculation, cross-attention calculation, feature fusion and decoding on the spatiotemporal grid of the compartment to be predicted to be flooded, and output the flooded flow field of the compartment.
8. A computer storage medium for storing computer programs, characterized in that, When the computer program is read by the computer, the computer executes the method of claim 1.
9. A computer, comprising a processor and a storage medium, characterized in that, When the processor reads the computer program stored in the storage medium, the computer executes the method of claim 1.
10. A computer program product, as a computer program, is characterized by: When the computer program is executed, it implements the method of claim 1.