Knowledge distillation-based flux reconstruction method, device, equipment, medium and product
By constructing an anti-forgetting neural network based on knowledge distillation and utilizing loss functions based on continuous learning and physical constraints, the problems of high cost and low accuracy of flux calculation in the finite volume method are solved, achieving efficient and stable flux prediction that adapts to changes in flow field parameters.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA AERODYNAMICS RES AND DEV CENT ULTRA-HIGH SPEED AERODYNAMICS RES INST
- Filing Date
- 2026-04-14
- Publication Date
- 2026-06-23
AI Technical Summary
In existing technologies, numerical flux calculation using the finite volume method is computationally expensive in high-precision CFD simulations, making it difficult to meet the needs of rapid analysis and design in engineering practice. Furthermore, traditional neural networks suffer from low accuracy, low efficiency, and insufficient physical constraints in flux reconstruction.
By employing a knowledge distillation-based approach, an anti-forgetting neural network is constructed, and a loss function based on physical constraints and an incremental training paradigm of continuous learning is used to achieve dynamic adaptation to the flow field parameter space and high-precision flux prediction.
It achieves high-precision and high-efficiency flux prediction when flow field parameters change, alleviates the catastrophic forgetting problem in incremental training, and improves the computational efficiency and stability of CFD simulation.
Smart Images

Figure CN122021472B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of computational fluid dynamics and artificial intelligence, and in particular to a flux reconstruction method, apparatus, equipment, medium and product based on knowledge distillation. Background Technology
[0002] With the rapid development of high-performance computing, numerical simulation has become a core pillar of scientific research and engineering design. Computational Fluid Dynamics (CFD) is a typical physical scenario involving strong nonlinearity, discontinuities, and multi-scale interactions, making the demand for high-precision numerical methods and efficient computing power particularly urgent. High-precision computational schemes based on the finite volume method are the mainstream techniques for solving Euler equations and Navier-Stokes equations.
[0003] The Finite Volume Method (FMD) and its classic numerical flux schemes have long been the mainstream tools for calculating conservation equations in stability calculations in engineering and science. To address different flow problems and varying accuracy requirements for flux calculations, researchers have developed various numerical flux schemes, including the central difference method, upwind scheme, Rusanov scheme, and AUSM scheme. Within a single time step, the main steps of the FMD include physical quantity reconstruction, gradient reconstruction, and numerical flux calculation. First, physical quantity reconstruction is used to obtain the distribution of physical quantities on the grid cell surfaces. Second, gradient calculation is used to calculate the changing trends of physical quantities within the cells. Finally, the numerical flux is calculated based on the results of reconstruction and gradient calculation.
[0004] As a crucial component of the finite volume method, numerical flux reflects the exchange of physical quantities on the surface of the control volume. Its accuracy and efficiency directly determine the numerical stability and convergence speed of the entire simulation. Considering that flux calculation is required for each face of each mesh element, the computational cost of flux calculation increases exponentially with the increase in mesh size. Especially in high-fidelity CFD simulations, extremely fine meshes and tiny time steps are typically required, leading to high computational costs and making it difficult to meet the urgent needs of rapid analysis and design in engineering practice. Statistics show that flux calculation accounts for 50% of the total computation time of the finite volume method. Solving this problem is a key focus of current CFD research.
[0005] Therefore, it is necessary to provide a high-precision and high-efficiency flux reconstruction method. Summary of the Invention
[0006] This invention provides a flux reconstruction method, apparatus, equipment, medium, and product based on knowledge distillation, which can solve the problems of low accuracy and low efficiency in related technologies. The technical solution is as follows:
[0007] On the one hand, a flux reconstruction method based on knowledge distillation is provided, the method comprising:
[0008] Based on the given flow field conditions, a dataset is generated using a numerical flux format. The dataset covers a preset target working domain and includes tasks with multiple flow states. The dataset for each task consists of a set of input variables paired with the corresponding real numerical flux to form a sample pair. The datasets of adjacent tasks overlap in parameter space and extend outward.
[0009] Construct a neural network for knowledge distillation and generate a loss function with physical constraints;
[0010] Based on the knowledge distillation mechanism that resists forgetting, the neural network is continuously trained by using the dataset and the loss function, so that the neural network can continuously adapt to new flow states as the flow field parameter space changes, while maintaining the ability to predict old tasks.
[0011] The trained neural network is deployed in the CFD solver. At each time step, the data flux is predicted in real time based on the physical state on both sides of the grid cell interface to complete the flow field evolution.
[0012] On the other hand, a flux reconstruction apparatus based on knowledge distillation is provided, the apparatus comprising:
[0013] The generation unit is used to generate a dataset in numerical flux format according to the given flow field conditions. The dataset covers a preset target working domain and includes tasks with multiple flow states. The dataset of each task consists of a set of input variables paired with the corresponding real numerical flux to form a sample pair. The datasets of adjacent tasks overlap in parameter space and extend outward.
[0014] The building blocks are used to construct neural networks for knowledge distillation and generate loss functions with physical constraints.
[0015] The training unit is used to incrementally train the neural network based on the anti-forgetting knowledge distillation mechanism, using the dataset and the loss function to continuously learn, so that the neural network can continuously adapt to new flow states as the flow field parameter space changes, while maintaining its predictive ability for old tasks.
[0016] The prediction unit is used to deploy the trained neural network in the CFD solver. At each time step, it predicts the data flux in real time based on the physical state on both sides of the grid unit interface, thus completing the flow field evolution.
[0017] On the other hand, a computer device is provided, the computer device including a memory and a processor, the memory for storing computer programs, and the processor for executing the computer programs stored in the memory to implement the steps of the knowledge distillation-based flux reconstruction method described above.
[0018] On the other hand, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements the steps of the flux reconstruction method based on knowledge distillation described above.
[0019] On the other hand, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the knowledge distillation-based flux reconstruction method described above.
[0020] The technical solution provided by this invention can bring at least the following beneficial effects:
[0021] By introducing an incremental training paradigm of continuous learning into numerical flux prediction, the model can dynamically adapt to new flow states and continuously absorb new knowledge without retraining on all historical data. Furthermore, an anti-forgetting knowledge distillation mechanism is used during training, enabling the model to maintain its predictive ability for old tasks while continuously adapting to new flow states. This effectively alleviates the catastrophic forgetting problem in incremental training. By employing deep neural networks to represent the nonlinear mapping between numerical flux and physical quantities on the unit interface, high accuracy and efficiency in flux prediction can be achieved. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart of a flux reconstruction method based on knowledge distillation provided in an embodiment of the present invention;
[0024] Figure 2 This is a schematic diagram of a dataset generation method provided in an embodiment of the present invention;
[0025] Figure 3 This is a structural diagram of a flux reconstruction device based on knowledge distillation provided in an embodiment of the present invention;
[0026] Figure 4 This is a hardware architecture diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, 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 some embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0028] Please refer to Figure 1 The present invention provides a flux reconstruction method based on knowledge distillation, the method comprising:
[0029] Step 100: Generate a dataset using a numerical flux format based on the given flow field conditions; the dataset covers a preset target working domain and includes tasks with multiple flow states. The dataset for each task consists of a set of input variables paired with the corresponding real numerical flux to form a sample pair; the datasets of adjacent tasks overlap in the parameter space and extend outward.
[0030] Step 102: Construct a neural network for knowledge distillation and generate a loss function with physical constraints;
[0031] Step 104: Based on the knowledge distillation mechanism to resist forgetting, the neural network is continuously trained using the dataset and the loss function to learn incrementally, so that the neural network can continuously adapt to new flow states as the flow field parameter space changes, and maintain its predictive ability for old tasks.
[0032] Step 106: Deploy the trained neural network in the CFD solver. At each time step, predict the data flux in real time based on the physical state on both sides of the grid cell interface to complete the flow field evolution.
[0033] In this embodiment of the invention, by introducing a continuous learning incremental training paradigm into numerical flux prediction, the model can dynamically adapt to new flow states and continuously absorb new knowledge without retraining on all historical data. Furthermore, an anti-forgetting knowledge distillation mechanism is used during training, enabling the model to maintain its predictive ability for old tasks while continuously adapting to new flow states. This effectively alleviates the catastrophic forgetting problem during incremental training. By employing a deep neural network to represent the nonlinear mapping between numerical flux and physical quantities on the unit interface, high accuracy and efficiency in flux prediction can be achieved.
[0034] The following description Figure 1 The execution method for each step is shown.
[0035] First, for step 100, a dataset is generated using a numerical flux format based on the given flow field conditions.
[0036] Flow field conditions refer to the various physical and geometric parameters that determine the flow state. In flux calculations using the finite volume method, flow field conditions specifically manifest as the physical states on both sides of the mesh interface, as well as other parameters that may affect the characteristics of the flux function, such as specific heat ratio and turbulence model constants. Flow field conditions can include at least several of the following: density, velocity, pressure, Mach number, and specific heat ratio.
[0037] Once the flow field conditions are determined, a numerical flux scheme can be used to generate a dataset. The numerical flux scheme is a numerical method in the finite volume method used to calculate interfacial fluxes. Given the physical states on both sides of the interface, it can generate the mass, momentum, and energy fluxes passing through that interface.
[0038] In this embodiment of the invention, to enable the training of a deep neural network and allow it to learn the nonlinear mapping relationship between flux and input variables, the generated dataset includes multiple sample pairs. Each sample pair includes a set of input variables as input and a real numerical flux as output. The set of input variables consists of defined flow field conditions, such as density, velocity, pressure, Mach number, and specific heat ratio; the real numerical flux output includes mass, momentum, and energy flux. Given a set of input variables, it is paired with the real numerical flux generated under that set of input variables as a single sample pair for subsequent neural network training.
[0039] Furthermore, in order for the trained neural network to adapt to different flow conditions, the generated dataset needs to cover the preset target working domain. The target working domain refers to the range of flow field parameters that the model is applicable to. When generating the dataset, it is necessary to ensure that the sampling covers this range so that the model has sufficient generalization ability when applied.
[0040] Specifically, the dataset includes tasks with multiple flow states. Each task's dataset consists of sample pairs formed by pairing the set of input variables with the corresponding real numerical flux. The datasets of adjacent tasks overlap in parameter space and extend outward.
[0041] In this embodiment of the invention, for incremental learning scenarios, the target working domain can be divided into multiple overlapping subdomains, each subdomain corresponding to a task, so that the model can gradually expand its knowledge.
[0042] For example, when the flow field conditions include density, pressure, and Mach number, please refer to Table 1 to obtain the tasks for the three flow states:
[0043] Table 1: Set of input variables for different tasks
[0044] parameter Subsonic mission (T1) Transonic Mission (T2) Supersonic mission (T3) Mach number [0,0.6] [0.4,1.2] [1.0,3.0] density [0.5,5] [0.7,7] [0.1,1.0] pressure [0.5,5] [0.7,7] [0.1,1.0] Number of sampling points 5×104 8×104 1×105
[0045] By dividing the target working domain into multiple flow states of tasks, a dataset sequence covering different flow states, with progressively expanding parameter space and overlapping adjacent tasks can be constructed, thus providing a training foundation for subsequent knowledge distillation and continuous learning.
[0046] Each task can correspond to a dataset, and so on, with multiple tasks corresponding to multiple datasets. The datasets for different tasks are used for incremental training in different batches.
[0047] Then, steps 102 to 106 will be explained simultaneously.
[0048] In this embodiment of the invention, to fit the highly nonlinear relationship between numerical flux and physical quantities at the interface of local flow field units, it is necessary to construct a neural network capable of calculating numerical flux. This neural network has the following characteristics:
[0049] 1. The input represents the set of input variables on the left and right sides of the unit interface, which can be represented by the following physical quantity vector: .in, For the set of input variables, The density of the cells on the left side of the cell interface. The density of the cells on the right side of the cell interface. This refers to the Mach number of the cells on the left side of the cell interface. This refers to the Mach number of the cells on the right side of the cell interface. For the pressure of the unit on the left side of the unit interface, The pressure of the unit on the right side of the unit interface.
[0050] 2. The output is the actual numerical flux, for example, .in, For numerical flux, , , These are mass flux, momentum flux, and energy flux, respectively.
[0051] 3. The network structure adopts a multi-layer fully connected structure, which can have strong nonlinear fitting ability. The activation function can be a nonlinear function such as ReLU or LeakeyReLU. The network structure can also include modules such as normalization layers.
[0052] That is, the constructed neural network is a multi-layer fully connected neural network, using a non-linear activation function, with the input layer dimension corresponding to the set of input variables and the output layer dimension corresponding to the numerical flux. The neural network is constructed to achieve end-to-end mapping from physical quantities to numerical fluxes at the interface of local flow field units, satisfying nonlinear mapping relationships and maintaining high-precision prediction.
[0053] In this embodiment of the invention, only one neural network can be constructed for subsequent training; alternatively, two neural networks can be constructed, one as a teacher model and the other as a student model.
[0054] Currently, there is no solution for reconstructing numerical flux using neural networks. Existing technologies that use neural networks to map input-output relationships employ a pure data fitting approach, training the network with a large number of samples to approximate the output of a certain high-precision format. Using this pure data fitting method for numerical flux calculation has at least the following drawbacks: 1. Strong data dependency: For flow field regions not covered by the training samples, the model may produce non-physical predictions, even causing CFD simulation divergence. 2. Lack of physical guarantees: The network only simulates the results of the numerical format, making it prone to accumulating prediction biases, which can compromise the conservation and stability of the entire simulation.
[0055] Based on this, physical constraints can be added to the loss function.
[0056] In one embodiment of the present invention, the loss function with physical constraints includes at least a loss term constrained by interface flux antisymmetry and a loss term constrained by entropy increase condition.
[0057] In one implementation, using the finite volume method, the flux through the same interface must satisfy antisymmetry, meaning that the fluxes become opposites after swapping the left and right states.
[0058]
[0059] Treating this as a soft constraint, we can obtain the loss term for the interface flux antisymmetry constraint as follows:
[0060]
[0061] in, The loss term is the interface flux antisymmetry constraint; N is the number of samples in the current training batch. , Let be the original set of input variables on the left and right sides of the interface in the i-th sample; This is the numerical flux predicted by the neural network. This loss term is used to force the network output to automatically satisfy antisymmetry after exchanging inputs, thereby ensuring global conservation.
[0062] In one implementation, based on the second law of thermodynamics, the numerical flux must satisfy the entropy inequality. Using Harten's entropy correction method, the entropy generation rate of the interface is defined as follows:
[0063]
[0064] in, The entropy generation rate of the interface. , Let be the entropy function of the left and right sides of the interface. For an ideal gas, it is usually taken as , γ For specific heat ratio, , For pressure, density; , , , Let be the density and velocity on the left and right sides of the interface. Therefore, the loss term for the entropy increase condition constraint is:
[0065]
[0066] in, The loss term is the one constrained by the entropy increase condition; N is the number of samples in the current training batch. Let be the entropy generation rate at the interface in the i-th sample. Physically, the entropy generation rate should be non-negative; otherwise, it implies a decrease in entropy, violating the second law of thermodynamics. This loss term penalizes samples that generate negative entropy, guiding the network to learn the flux that satisfies entropy stability and avoiding non-physical phenomena such as expansion shock waves.
[0067] Based on the loss terms of the two physical constraints mentioned above, the loss function in this embodiment of the invention can be:
[0068]
[0069] in, Total loss; The data fitting loss is specifically the mean squared error between the student model prediction and the true numerical flux. The distillation loss is specifically the mean squared error between the student model output and the teacher model output. , , The weighting coefficients are used to balance the various losses.
[0070] In this embodiment of the invention, physical constraints are directly applied to the distillation process, so that the student model not only moves closer to the output of the teacher model, but also inherits the implicit physical conservation properties of the teacher model, thereby more stably maintaining the knowledge of the old task in incremental learning.
[0071] Furthermore, this embodiment of the invention also employs an anti-forgetting knowledge distillation mechanism for incremental training of the neural network, and the introduction of physical constraints also has the following considerations and effects:
[0072] While knowledge distillation mechanisms can resist catastrophic forgetting, they can only maintain the input-output mapping of the old task, and cannot guarantee the physical consistency of the old task. For example, after a model learns a supersonic task, its predictions on a subsonic task may still meet the data error requirements, but may violate the entropy increase condition (generating expanding shock waves), leading to instability in subsequent simulations. Therefore, jointly optimizing physical constraints and distillation loss can achieve the following dual guarantees: First, distillation transfers the data mapping knowledge of the old task; second, physical constraints force the model to satisfy conservation laws and entropy conditions at any stage, thereby naturally locking in the physical behavior of the old task during parameter updates, further reducing the risk of forgetting.
[0073] Furthermore, in traditional CFD, while high-precision schemes can accurately capture discontinuities, they are computationally expensive; while low-precision schemes are computationally fast but consume a lot of resources. If the training process of a neural network only aims at data fitting, it will sacrifice physical realism in pursuit of accuracy. Therefore, by introducing a loss function with physical constraints, the antisymmetric constraint loss term ensures that the flux predicted by the model strictly satisfies the conservation law, and the entropy increase condition constraint loss term ensures that the model will not generate non-physical expansion waves at discontinuities such as shock waves, thus maintaining numerical stability.
[0074] After constructing the neural network and generating the loss function, the neural network can be trained.
[0075] Since the datasets for each task are used for incremental training in batches, to avoid forgetting knowledge from historical tasks during incremental training, this embodiment of the invention employs an anti-forgetting knowledge distillation mechanism for incremental training. Furthermore, in one embodiment of the invention, a neural network can be constructed, and a self-knowledge distillation mechanism can be used to train the teacher model and the student model, specifically:
[0076] The neural network was trained in the first round using the first task dataset. The neural network trained in the first round was used as the student model and teacher model for the second round of incremental training.
[0077] Determine whether incremental training is complete. If not, proceed to the current round of incremental training. During this round, the student model is incrementally trained using the task dataset of this round, and knowledge distillation is performed from the teacher model to the student model to obtain the trained student model. The trained student model is used as the teacher and student models for the next round of incremental training. The teacher model does not participate in the training of the student model during this round of incremental training. If incremental training is complete, the currently trained student model is used as the trained neural network.
[0078] In this embodiment of the invention, a self-knowledge distillation mechanism is employed to transfer knowledge from the teacher model (old model) to the student model (new model), thereby enabling the learning of new knowledge without forgetting old knowledge. This is specifically reflected in the following three points:
[0079] First, the teacher model has already learned the flux mapping of previously trained tasks, and its output can be regarded as a soft label for the old tasks. Second, when training a new task, distillation loss forces the student model's output to be consistent with the teacher model, thereby constraining the offset of the student model's parameters in the direction of the old tasks. Third, since the teacher model is always the model trained in the previous round, this chain distillation allows knowledge to be transferred step by step without the need to store multiple teacher models or a large amount of old data, achieving lightweight resistance to forgetting.
[0080] In one embodiment of the present invention, based on self-knowledge distillation, a buffer replay mechanism can be introduced to further enhance the anti-forgetting ability. It may also include: after each round of training, selecting a first proportion of sample pairs from the dataset used in this round of training and storing them in a buffer, and before the next round of training, mixing the task dataset of the next round with the sample pairs in the buffer according to a second proportion, and using the mixed dataset as the task dataset of the next round.
[0081] In one implementation, the first ratio is 10%-20%, and the second ratio is 8:2.
[0082] Furthermore, when selecting sample pairs stored in the buffer, clustering can be performed based on the discontinuity strength of the left and right states and the difference in Mach number between the left and right states to ensure coverage of various interface states in the task dataset.
[0083] The following uses the datasets for tasks T1, T2, and T3 in Table 1 above as examples to illustrate the process of training a neural network using the knowledge distillation mechanism to resist forgetting.
[0084] First round of training:
[0085] The neural network is initially trained using the dataset from task T1. This trained neural network is then used as the student and teacher models for the second round of incremental training. After this round of training is complete, 10% of the samples (e.g., 5000) can be selected from the dataset from task T1 and stored in a buffer.
[0086] Second round of incremental training:
[0087] In the second round of incremental training, the model needs to be incrementally trained using the dataset of task T2. At the same time, the neural network trained in the first round is used as the teacher model for this round to perform knowledge distillation, so as to avoid forgetting the knowledge of task T1.
[0088] Specifically, the samples in the T2 task dataset and the buffer are first mixed proportionally to form a mixed dataset. The teacher model for this round is loaded, and all its parameters are frozen to prevent it from participating in gradient updates. Then, the student model for this round is initialized and incrementally trained using the mixed dataset. After training, the student model obtained in this round is used as the teacher and student models for the third round. 10% of the samples from the T2 task dataset are then selected and stored in the buffer, which now contains samples selected from both the T1 and T2 task datasets.
[0089] Third round of incremental training:
[0090] In the third round of incremental training, the model needs to be incrementally trained using the dataset of task T3. At the same time, the student model trained in the second round is used as the teacher model in this round for knowledge distillation, so as to maintain the prediction accuracy for tasks T1 and T2.
[0091] Specifically: First, mix the samples in the T3 task dataset with those in the buffer according to a certain ratio to form a mixed dataset; load the teacher model for this round and freeze all parameters of the teacher model so that it does not participate in gradient updates; then, initialize the student model for this round and use the mixed dataset to incrementally train the student model for this round; use the student model trained in this round as the final trained neural network.
[0092] After completing the third round of training, the final trained neural network can be deployed in the CFD solver. At each time step, for each grid interface, the left and right states can be input into the neural network for a forward computation to obtain the numerical flux, replacing the iterative computation of traditional flux formats, thus achieving a significant speedup.
[0093] The neural network trained through the embodiments of the present invention can predict the numerical flux to be calculated for the flow field data under target conditions. That is, the physical quantity on the unit interface of the target conditions is input, and the neural network continuously infers by combining the new and old knowledge it has learned. The network stably outputs high-precision numerical flux values. When new flow field data appears, incremental learning training can continue to be performed to continuously improve the coverage of the network model.
[0094] The embodiments of the present invention will be described below using a practical task as an example.
[0095] In practical tasks, taking the Rusanov numerical flux calculation scheme as an example, based on the given flow field conditions, the set of flow field parameters and their value ranges, such as density, are clearly defined. ,Mach number ,pressure And the dataset is generated using the Rusanov numerical flux solver or Rusanov numerical flux computation code. The overall parameter space is divided into... Incremental subdomains Each round is responsible for generating the dataset for a subdomain, and r incremental subdomains correspond one-to-one to obtain r datasets. Please see. Figure 2 This is a schematic diagram of a method for generating a dataset.
[0096] Based on the dataset, determine the dimensions of the input and output layers of the neural network, and construct the RusanovNet neural network with a 6-dimensional input. The output is 3D ( The network core adopts a multi-layer fully connected MLP structure with batch normalization in the middle. The activation function is ReLU to fit the highly nonlinear relationship between numerical flux and physical quantities on the interface of the flow field units.
[0097] The training process is treated as multi-task incremental learning, with each task t using its corresponding dataset. During training, when training task t, the model parameters obtained from the previous round of training task t-1 are fine-tuned instead of training from scratch.
[0098] After training for each task t is completed, the dataset for that task is used... A certain proportion of samples are sampled and stored in a buffer. When training subsequent tasks, a certain number of historical samples are randomly selected from the buffer and mixed with the current task's dataset for joint training. In the t-th round of training, the model from the previous round is used as the teacher network T, and regularization constraints are provided on the output of the t-th round of training through knowledge distillation.
[0099] After completing all training, the model finally possesses robust predictive capabilities for numerical fluxes across the entire flow field parameter range. The incremental learning error is shown in Table 2, representing the experimental results.
[0100] Table 2: Incremental Learning Error Table
[0101] Training rounds Round 1 Second round Third round Mean square error 0.02659 0. 02079 0. 01861
[0102] Please refer to Figure 3 This invention provides a flux reconstruction device based on knowledge distillation, the device comprising:
[0103] The generation unit 300 is used to generate a dataset in numerical flux format according to the given flow field conditions. The dataset covers a preset target working domain and includes tasks with multiple flow states. The dataset of each task consists of a set of input variables paired with the corresponding real numerical flux to form a sample pair. The datasets of adjacent tasks overlap in parameter space and extend outward.
[0104] Construction unit 302 is used to construct a neural network for knowledge distillation and generate a loss function with physical constraints;
[0105] Training unit 304 is used to incrementally train the neural network based on the anti-forgetting knowledge distillation mechanism, using the dataset and the loss function to continuously learn, so that the neural network can continuously adapt to new flow states as the flow field parameter space changes, and maintain its predictive ability for old tasks.
[0106] Prediction unit 306 is used to deploy the trained neural network in the CFD solver and predict the data flux in real time at each time step based on the physical state on both sides of the grid cell interface to complete the flow field evolution.
[0107] In one embodiment of the present invention, the loss function with physical constraints includes at least a loss term constrained by interface flux antisymmetry and a loss term constrained by entropy increase condition.
[0108] In one embodiment of the present invention, the loss term of the interface flux antisymmetry constraint is:
[0109]
[0110] in, The loss term is the interface flux antisymmetry constraint; N is the number of samples in the current training batch. , Let be the original set of input variables on the left and right sides of the interface in the i-th sample; This refers to the numerical flux predicted by the neural network.
[0111] In one embodiment of the present invention, the loss term of the entropy increase condition constraint is:
[0112]
[0113] in, The loss term is the one constrained by the entropy increase condition; N is the number of samples in the current training batch. Let be the entropy generation rate on the interface in the i-th sample.
[0114] In one embodiment of the present invention, the dataset for each task is used for incremental training in batches.
[0115] The incremental training of the neural network includes:
[0116] The neural network was trained in the first round using the first task dataset. The neural network trained in the first round was used as the student model and teacher model for the second round of incremental training.
[0117] Determine whether incremental training is complete. If not, proceed to the current round of incremental training. During this round, the student model is incrementally trained using the task dataset of this round, and knowledge distillation is performed from the teacher model to the student model to obtain the trained student model. The trained student model is used as the teacher and student models for the next round of incremental training. The teacher model does not participate in the training of the student model during this round of incremental training. If incremental training is complete, the currently trained student model is used as the trained neural network.
[0118] In one embodiment of the present invention, the method further includes: after each round of training, selecting a first proportion of sample pairs from the dataset used in the current round of training and storing them in a buffer; and before the next round of training, mixing the task dataset of the next round with the sample pairs in the buffer according to a second proportion, and using the mixed dataset as the task dataset of the next round.
[0119] It should be noted that the knowledge distillation-based flux reconstruction device provided in the above embodiments is only an example of the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the knowledge distillation-based flux reconstruction device and the knowledge distillation-based flux reconstruction method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.
[0120] Embodiments of this application also provide a computer device, please refer to... Figure 4 The computer device includes a processor and a memory, the memory storing at least one instruction, at least one program, code set, or instruction set, the at least one instruction, at least one program, code set, or instruction set being loaded and executed by the processor to implement the knowledge distillation-based flux reconstruction method provided in the above-described method embodiments.
[0121] Embodiments of this application also provide a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the knowledge distillation-based flux reconstruction method provided in the above-described method embodiments.
[0122] Embodiments of this application also provide a computer program product, which includes a computer program. A processor of a computer device reads the computer program from a computer-readable storage medium and executes the computer program, causing the computer device to perform any of the knowledge distillation-based flux reconstruction methods described in the above embodiments.
[0123] For ease of description, the above systems or devices are described separately as various modules or units based on their functions. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware components.
[0124] As can be seen from the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0125] Finally, it should be noted that in this document, relational terms such as first, second, third, and fourth are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus.
[0126] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A flux reconstruction method based on knowledge distillation, characterized in that, The method includes: Based on the given flow field conditions, a dataset is generated using a numerical flux format. The dataset covers a preset target working domain and includes tasks with multiple flow states. The dataset for each task consists of a set of input variables paired with the corresponding real numerical flux to form a sample pair. The datasets of adjacent tasks overlap in parameter space and extend outward. Construct a neural network for knowledge distillation and generate a loss function with physical constraints; Based on the knowledge distillation mechanism that resists forgetting, the neural network is continuously trained by using the dataset and the loss function, so that the neural network can continuously adapt to new flow states as the flow field parameter space changes, while maintaining the ability to predict old tasks. The trained neural network is deployed in the CFD solver. At each time step, the data flux is predicted in real time based on the physical state on both sides of the grid cell interface to complete the flow field evolution. The loss function with physical constraints includes at least a loss term for interface flux antisymmetry constraints and a loss term for entropy increase constraints. The loss term for the interface flux antisymmetry constraint is: in, The loss term is the interface flux antisymmetry constraint; N is the number of samples in the current training batch. , Let be the original set of input variables on the left and right sides of the interface in the i-th sample; The numerical flux predicted by the neural network; The loss term for the entropy increase condition constraint is: in, The loss term is the one constrained by the entropy increase condition; N is the number of samples in the current training batch. Let be the entropy generation rate on the interface in the i-th sample.
2. The method according to claim 1, characterized in that, The dataset for each task is used for incremental training in batches. The incremental training of the neural network includes: The neural network was trained in the first round using the first task dataset. The neural network trained in the first round was used as the student model and teacher model for the second round of incremental training. Determine whether incremental training is complete. If not, proceed to the current round of incremental training. During this round, the student model is incrementally trained using the task dataset of this round, and knowledge distillation is performed from the teacher model to the student model to obtain the trained student model. The trained student model is used as the teacher and student models for the next round of incremental training. The teacher model does not participate in the training of the student model during this round of incremental training. If incremental training is complete, the currently trained student model is used as the trained neural network.
3. The method according to claim 2, characterized in that, Also includes: After each training round, a first proportion of sample pairs are selected from the dataset used in this training round and stored in the buffer. Before the next training round, the task dataset of the next round is mixed with the sample pairs in the buffer according to a second proportion, and the mixed dataset is used as the task dataset of the next round.
4. A flux reconstruction device based on knowledge distillation, characterized in that, The apparatus for performing the method as described in any one of claims 1-3 above, comprising: The generation unit is used to generate a dataset in numerical flux format according to the given flow field conditions. The dataset covers a preset target working domain and includes tasks with multiple flow states. The dataset of each task consists of a set of input variables paired with the corresponding real numerical flux to form a sample pair. The datasets of adjacent tasks overlap in parameter space and extend outward. The building blocks are used to construct neural networks for knowledge distillation and generate loss functions with physical constraints. The training unit is used to incrementally train the neural network based on the anti-forgetting knowledge distillation mechanism, using the dataset and the loss function to continuously learn, so that the neural network can continuously adapt to new flow states as the flow field parameter space changes, while maintaining its predictive ability for old tasks. The prediction unit is used to deploy the trained neural network in the CFD solver. At each time step, it predicts the data flux in real time based on the physical state on both sides of the grid unit interface, thus completing the flow field evolution.
5. A computer device, characterized in that, The computer device includes a memory and a processor. The memory is used to store computer programs, and the processor is used to execute the computer programs stored in the memory to implement the steps of the method according to any one of claims 1-3.
6. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the steps of the method described in any one of claims 1-3.
7. A computer program product, characterized in that, Includes a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1-3.
Citation Information
Patent Citations
CN120654567A
US20250181928A1