Physical constraint fused graph structure UNet neural network for long-time time domain difference optical simulation method and system
By constructing a graph-structured UNet neural network that incorporates physical constraints, the problems of excessive data dependence and insufficient long-term prediction in existing technologies are solved, achieving efficient and accurate long-term electromagnetic field prediction that conforms to physical laws.
Patent Information
- Application Number
- CN202511529330.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-24
- Publication Date
- 2026-01-23
AI Technical Summary
Existing graph neural networks rely excessively on data training in finite-difference optical simulations and struggle to predict electromagnetic fields over long time scales, failing to effectively consider device parameters and physical laws.
A graph-structured UNet neural network incorporating physical constraints is constructed. Device parameter datasets are generated using the FDTD method. By combining TopKPooling and generalized graph convolutional layers and employing an end-to-end training approach, residual constraints from Maxwell's equations are introduced to achieve long-term electromagnetic field prediction.
It improves the robustness and prediction accuracy of the model, enables one-time long-term electromagnetic field prediction, conforms to physical laws, and reduces computation time.
Smart Images

Figure CN121389622A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a long-time time-domain finite-difference optical simulation method and system based on a graph structure UNet neural network with physical constraints, and belongs to the technical field of application of deep learning in the field of optics. BACKGROUND
[0002] In the study of photonics, neural networks have been proven to be an efficient and accurate method for forward modeling of photonic devices. Compared with the traditional finite-difference time-domain (FDTD) method, once trained, neural networks will solve the same computational problem in a shorter time. So far, most neural networks have adopted a data-driven approach, which uses the powerful ability of neural networks to capture nonlinear data relationships and a large number of data sets to accurately express the relationship between the geometric shape of a photonic device and its electromagnetic response. Researchers have created WaveT-Net based on Unet, which uses tens of thousands of training data pairs and physical enhancement techniques to predict the electromagnetic field distribution of dielectric nano-photonic structures.
[0003] However, when solving dynamic electromagnetic fields, most deep learning models require a large amount of training data, rarely consider device parameters, the physical laws of the interaction between the device and the source, and long-time scale prediction, or simply use step-by-step field calculation acceleration methods. To solve these problems, it is necessary to construct an artificial neural network that can solve Maxwell's equations in a general environment.
[0004] In summary, the main problems of existing technologies are: graph neural networks are less used in finite-difference time-domain and mostly rely on data training. In addition, most neural networks in the prediction of optical scattering electromagnetic fields stop at single-step prediction rather than one-time long-term prediction. SUMMARY
[0005] In view of the deficiencies of the prior art, the present application proposes a long-time time-domain finite-difference optical simulation method and system based on a graph structure UNet neural network with physical constraints.
[0006] Term explanation: 0、Finite-difference time-domain (FDTD): a numerical calculation method for solving Maxwell's equations. This method discretizes electromagnetic fields in space and time, converting continuous partial differential equations into difference equations, and then iteratively solving the evolution of electromagnetic fields over time.
[0007] 2、Maxwell's equations: a set of partial differential equations that describe the basic laws of electromagnetic fields, including Gauss's law, Gauss's magnetic law, Faraday's electromagnetic induction law, and Ampere's loop law. The mathematical form of the four basic equations is as follows:
[0008] Gauss's law states that the divergence of an electric field is proportional to the charge density, and is used to describe the relationship between charge and electric field. Gauss's law of magnetism states that the divergence of magnetic induction is always zero, meaning that there are no magnetic monopoles. Faraday's law of electromagnetic induction states that a time-varying magnetic field will induce an electric field in space. Ampere's circuital law (including the displacement current term): states that a time-varying electric field or current will produce a magnetic field. 3. TM Waves: These are waves in which the magnetic field has no component in the direction of propagation, while the electric field has a component in the same direction. In other words, the magnetic field of a TM wave is entirely transverse to the direction of propagation, while the electric field contains both transverse and longitudinal components. TM waves are commonly used to describe the field distribution characteristics of waveguides, optical thin films, and in electromagnetic simulations. In two-dimensional electromagnetic simulations (such as the FDTD method), TM waves generally represent electric fields with a longitudinal component (e.g., Ez), while the magnetic field components are distributed in the transverse plane (e.g., Hx, Hy). Their analysis is helpful in studying the propagation and scattering characteristics of electromagnetic waves in dielectric devices.
[0009] 4. PyTorch: PyTorch is an open-source machine learning framework for building deep learning models. It provides a flexible, dynamic computational graph model, making it simpler and more intuitive to build and train neural network models.
[0010] 5. Residual Function: In numerical calculations or neural network predictions, the residual function is the difference between the left and right sides of Maxwell's equations after substituting the predicted electromagnetic field components into the equations. This residual function measures whether the predicted electromagnetic field satisfies the physical constraints of Maxwell's equations, and its magnitude reflects the degree of physical consistency of the electromagnetic field solution. By introducing the Maxwell's equation residuals into the loss function, physical constraints can be imposed on the neural network training process, allowing the prediction results to better approximate the true solution while conforming to the fundamental laws of electromagnetism.
[0011] 6. TopKPooling: This is a downsampling method commonly used in graph neural networks. Its core idea is to rank nodes in the graph based on their importance scores and select the top K nodes with the highest scores for retention, thereby compressing the graph structure and aggregating features. TopKPooling not only reduces the size of the graph and improves model computational efficiency but also preserves key structural information and enhances the model's ability to focus on important local features. This method is widely used in graph classification, graph representation learning, and graph-based spatiotemporal modeling tasks. In the graph-structured UNet model, it is typically used as a downsampling operation during the encoding stage.
[0012] 7、Generalized graph convolution layer: an improved graph convolutional neural network layer, which introduces a learnable nonlinear mapping and a flexible normalization strategy in the information aggregation process to improve the model's adaptability to different graph structures and feature distributions. GENConv has higher expression ability and stronger robustness, and is suitable for large-scale heterogeneous graph and spatio-temporal graph modeling tasks. In the UNet model of the graph structure, the GENConv layer is often used for feature transformation in the encoding and decoding stages to achieve higher precision in electromagnetic field time series prediction and physical constraint modeling.
[0013] 8、4-neighbor connection rule: a basic concept in digital image processing, grid analysis and computer graphics for defining the adjacency of pixels or grid cells, which core idea is to only determine the center cell and the cells in the horizontal (left and right) and vertical (up and down) directions as adjacent, constructing the simplest local neighborhood connection mode.
[0014] The technical scheme of the present application is: The graph structure UNet neural network fusing physical constraints is used for a long-time time-domain difference optical simulation method, comprising: Step 1: using the FDTD method to construct a device parameter data set, i.e. device parameters and corresponding electromagnetic field distribution, to obtain FDTD uniform grid data, and performing data preprocessing on the FDTD uniform grid data; Step 2: constructing a graph structure Unet model with down-sampling, up-sampling and skip connection structure; Step 3: inputting the device parameter data set obtained in step 1 into the graph structure Unet model in step 2 for end-to-end training; Step 4: after preprocessing the dielectric constant distribution of the device to be predicted and the electromagnetic field at the initial time, converting them into a graph structure input format, inputting them into the graph structure UNet model trained and saved in step 3, using the trained weight file to predict the electromagnetic field scattering after a long-time light source encounter period for the given device parameters and initial electromagnetic field distribution; Step 5: comparing the electromagnetic field distribution of different device shapes predicted by the long-time prediction with the electromagnetic field values calculated by FDTD, and then judging the accuracy of the prediction of the graph structure Unet network model.
[0015] According to the present application, the device parameters include media and geometric shape.
[0016] According to the present application, the data preprocessing comprises: Converting the FDTD uniform grid data into a graph structure G = (V, E, X, E attr), the FDTD uniform grid data includes a dielectric constant, initial electromagnetic fields Ez, Hx and Hy, a relative position, a relative displacement vector (dx, dy); V is a node set, E is an edge set, X is a node feature matrix, E attr is an edge feature matrix; 1) Node mapping and definition: each discrete point (i, j) of the FDTD uniform grid data is uniquely mapped to a node v_i in the graph structure V; wherein i and j are the grid indexes of the discrete point in the X direction and the Y direction respectively; the total number of nodes is N = N_x * N_y, N_x and N_y are the number of grids in the X direction and the Y direction respectively; 2) Edge connection relationship confirmation: a 4-neighbor connection rule is used to construct an undirected graph, after traversing all grid points, i.e. the total number of nodes N_x * N_y, the connection relationship between each node and its left, right, upper and lower neighbors is naturally formed; 3) Node feature construction: each node v_i is assigned a multi-dimensional feature vector x_i in R^D_n, which is used to represent the physical property state of the space point; the node feature x_i is spliced from the following several dimensions of features: Material intrinsic feature: normalized dielectric constant ε_norm at node v_i; Absolute position feature: normalized spatial coordinates of node v_i; Electromagnetic field state feature: electromagnetic field component value of node v_i at a certain specific time step t_n; 4) Construction of edge feature: the edge feature e_uv between nodes u and v is assigned a multi-dimensional feature vector e_uv in R^D_e, which is used to represent the attribute of the physical relationship between the two adjacent nodes; the edge feature e_uv is spliced from the following several dimensions of features: Geometric relationship feature: used to describe the relative position vector of the two nodes in space; Physical field difference feature: the difference between the physical properties of the nodes at both ends of the edge is calculated to simulate the difference operator in FDTD.
[0017] Further preferably, for TM waves, the electromagnetic field state feature includes: electric field intensity Ez_i, magnetic field intensity Hx_i and magnetic field intensity Hy_i.
[0018] According to the application, preferably, the graph structure Unet network model includes a GraphDown module, a DoubleGEN module and a GraphUp module; the GraphDown module and the GraphUp module each further include a DoubleGEN module; The GraphDown module, i.e. the down-sampling module, is used for feature extraction and enhancement, and pooling and compression; The DoubleGEN module, i.e., a feature extraction module, is a double-layer graph convolution network module, which enables nodes in the graph structure to not only aggregate the information of direct neighbors, but also indirectly receive the neighbor features of neighbors through two consecutive message passing and feature transformation processes, so as to realize deeper spatial correlation modeling and feature extraction, thereby generating node feature representations with more physical meaning and spatiotemporal correlation. The GraphUp module, i.e., an upsampling / decoder module, is a graph upsampling and feature fusion module, which fuses the high-level semantic features compressed through pooling and the corresponding detailed spatial features in the encoder path, so as to gradually restore the spatial resolution of the graph and generate refined output.
[0019] Further preferably, the DoubleGEN module is a double-layer feature extraction structure composed of two layers of GENConv layers, i.e., generalized graph convolution layers, GraphNorm layers, i.e., graph normalization layers, and an activation function ELU. In the generalized graph convolution layer, message passing and feature aggregation between nodes are realized through GENConv operation. In the GraphNorm layer, the node features of each graph are standardized through GraphNorm normalization operation. In the activation function ELU, an exponential linear unit is used as a nonlinear activation function after the GraphNorm normalization operation.
[0020] Further preferably, the GraphDown module is stacked by the DoubleGEN module and an upsampling strategy TopKPooling. The preprocessed graph structure is input as input data into two layers of generalized graph convolution layers and GraphNorm layers, so as to perform layer-by-layer message passing, feature aggregation and normalization processing on the input node features, thereby generating high-dimensional node embedding representations. Subsequently, the TopKPooling upsampling strategy is used to retain the most important nodes in proportion and discard the remaining nodes according to the importance scores of the node features, and then the edge set, edge feature matrix and index information of the graph are updated based on the retained nodes.
[0021] Further preferably, the forward propagation of the generalized graph convolution layer follows the message passing neural network (MPNN) paradigm, which specifically includes three steps: 1) Message construction: for each edge (j, i) from the source node j to the target node i, the generalized graph convolution layer constructs a message, and the default message function is addition, which fuses the state of the source node and the attribute of the edge together to generate a message passing along the edge. 2) Message aggregation: the set of neighbor nodes of the target node i is N(i), and all messages from the neighbor nodes j e N(i) are collected, that is, the node feature values of the neighbor nodes; The softmax normalization function is selected as the aggregation function of the message, that is, aggr='softmax'; an attention weight a_{j-i} is calculated for each message; a_{j-i}=softmax(MLP( x_i || x_j || edge_attr_{j-i} ) ); wherein, x_i represents the node feature vector of the target node i, x_j represents the node feature vector of the source node i, edge_attr_{j-i} represents the edge feature vector connecting the source node j and the target node i, and MLP represents a multi-layer perception machine; The softmax function is normalized, that is, m_i =Σ( a_{j-i} * message_{j-i} ); wherein, message_{j-i} represents the message sent from the source node j to the target node i, and the message is generated by fusing the source node feature and the edge feature; a_{j-i} corresponds to the weight of the message message_{j-i}, which is obtained by normalizing the neighbor message score by the softmax function; m_i is the final aggregated feature vector of the target node i, which is obtained by summing the weighted messages of all neighbors; 3) Node update: the current feature x_i of the target node i is directly added to the aggregated message m_i, and the node feature is updated through a learnable function; x_i' = update( x_i, m_i ); Finally, all updated node features are output, that is, the updated electromagnetic field value Ez, the magnetic field intensity Hx and the magnetic field intensity Hy.
[0022] According to the application, the GraphUp module includes an up-sampling operation and a DoubleGEN module; the GraphUp module reconstructs the node feature and the image quality upwards, including: Firstly, the tensor outputted after the convolution of the bottom layer of the graph or the tensor up-sampled from the previous layer, i.e. the low-resolution semantic feature [B, C, H, W], B represents the batch size, C represents the number of channels, i.e. the node feature of the node, H represents the height of the image after grid, i.e. the original vertical grid number Ny, and W represents the width of the image after grid, i.e. the original horizontal grid number Nx, is aligned in dimension through a linear layer Linear, and at the same time, the corresponding high-order feature skip_x from the encoder path and its graph structure skip_edge_index and skip_edge_attr are reserved, wherein skip_x refers to the high-order feature tensor of the corresponding level, i.e. the node feature, reserved through the skip connection before the encoder downsampling; skip_edge_index defines the connection relationship between the nodes of the level, i.e. the image grid points; and skip_edge_attr defines the attribute of each edge in the graph, i.e. the edge feature. Then, the aligned feature vector x_align is up-sampled according to the pooling index perm in the downsampling operation until the same node dimension as skip_x is obtained, to obtain the tensor up_x; wherein x_align refers to the output tensor obtained after the low-resolution semantic feature tensor is subjected to a linear layer for channel dimension transformation; perm is the sorting index of the node importance recorded when the graph downsampling operation is performed in the encoder path; skip_x is the high-order feature tensor, i.e. the node feature, directly referenced from the intermediate layer of the encoder path through the skip connection without downsampling; and up_x is the feature tensor with the same node dimension as skip_x obtained by up-sampling the aligned low-resolution feature x_align using the pooling index perm. Then, the up-sampled feature vector up_x and the skip connection feature tensor skip_x are spliced in the node dimension and in the feature channel dimension C, and the formula is as follows: (1); Wherein, up_x is of shape [N, C1], N represents the number of nodes, and C represents the number of channels, i.e. the node feature; skip_x is of shape [N, C2]; fused_x is the feature vector combining global information and local information, and is of shape [N, C1+C2]; Finally, the fused feature fused_x is input into the DoubleGEN module together with the original graph structure (skip_edge_index, skip_edge_attr) for feature optimization and refinement, to finally form the refined node feature with restored resolution, and all formulas are as follows: (2); (3); (4); (5); wherein formula (2) is dimension alignment of feature channels through a linear transformation layer; is a trainable parameter matrix for feature dimension alignment; formula (3) describes an upsampling process, and Zeros creates a full zero tensor with a shape of [N_skip, D_align], which is a node feature initialization matrix of a high-resolution graph, N_skip represents the number of nodes of the original high-resolution graph in the skip connection layer, and D_align represents the number of feature channels; formula (5) describes the process of feature refinement of the DoubleGEN module.
[0023] According to the application, the TopKPooling using the up-sampling and down-sampling strategy is adopted, the most important nodes are reserved in proportion according to the importance score of the node features, and the remaining nodes are discarded. The calculation process is as follows: (6); In formula (6), denotes the score value of the i-th node, ∈ denotes the feature vector of the i-th node, ∈ is a learnable projection parameter; The score values of all nodes are arranged in descending order, select the first k = ⌈r⋅N⌉, N represents the number of nodes in the current graph, and r ∈ (0, 1] is the node retention rate. The selected nodes and related edges jointly constitute the pooled subgraph, and the unselected nodes are discarded.
[0024] According to the application, the total loss calculation method of the graph structure Unet network model is as follows: (7); wherein, is the real electromagnetic field distribution, is the value of the long-time electromagnetic field distribution predicted by the graph structure Unet network model, is the equation residual generated by substituting the predicted long-time sequence electromagnetic field value into the written Maxwell equation set; is the mean square error loss, which is a difference measure of the predicted value and the real value; Equation residual function The calculation is as follows: (8); (9); (10); (11); wherein formula (8) describes the calculation process of electromagnetic field residual equation , describes the electric field residual at position x at the n time instant, represents the vacuum permittivity, represents the relative permittivity, represents the value of the electric field z direction component at the n+1, n time step, represents the time step, represents the conductivity term in the PML absorbing layer along the x and y directions, is the x direction partial derivative of the magnetic field , is the y direction partial derivative of , * represents the model prediction value; formula (9) describes the magnetic field residual equation, represents the residual of the x direction magnetic field component, represents the vacuum permeability, represents the value of the magnetic field x component at the n+1, n time step, represents the loss term of the magnetic field in the absorbing boundary, represents the partial derivative term of the electric field along the y direction; formula (10) describes the residual equation of , represents the residual of the y direction magnetic field component, the dissipation term of the magnetic field in the x direction, represents the partial derivative term of the electric field along the x direction; formula (11) is , , the sum, which represents the residual obtained by substituting the entire Maxwell equation set.
[0025] According to the present application, preferably, in the training process of the graph structure Unet network model, a phased adaptive learning rate adjustment strategy, i.e., a polynomial decay learning rate scheduling strategy with warm-up, is adopted; in the initial training stage, a low learning rate is used to warm up the model to stabilize the convergence direction; in the later training stage, the learning rate is gradually reduced through polynomial decay; the entire training process is divided into two core stages, including: The first stage: learning rate warm-up stage: in the initial warmup_steps training steps, wherein warmup_steps represents the number of iterations for learning rate warm-up, in this stage, the learning rate starts from an extremely small initial value warmup_start_lr and increases exponentially to the preset benchmark learning rate lr0; as follows: (12); wherein, denotes the current learning rate value corresponding to the t-th iteration step in the training process; denotes the initial learning rate of the warm-up stage, denotes the exponential growth coefficient of the learning rate, and the calculation formula is as follows: (13); wherein, lr0 is the target learning rate at the end of the warm-up stage, and warmup_steps is the total number of iterations in the warm-up stage; Second stage: polynomial decay stage: after the end of the warm-up stage, the learning rate is gradually decayed from the base learning rate lr0 to close to 0 by using a polynomial decay strategy; the learning rate is decayed according to the following formula: (14); wherein, denotes the learning rate value at the t-th iteration in the decay stage; t represents the global iteration step number of the current training, denotes the number of steps of the learning rate warm-up stage, i.e., the position where the exponential growth ends; r denotes the maximum iteration step number of the entire training process, is a decay control index, used to adjust the rate of learning rate drop.
[0026] According to the present application, the device parameter data set obtained after step 1 data preprocessing is used to train the graph structure Unet network model constructed in step 2 in an end-to-end manner; including: input randomly generated device structure and initial electromagnetic field distribution: the device structure includes ellipse, rectangle and irregular shape; During training, the device structure and the initial electromagnetic field distribution are input into the graph structure Unet network model after data preprocessing, and pass through the GraphDown module, the DoubleGEN module and the GraphUp module to obtain the electromagnetic field prediction value of long-time electromagnetic field scattering, while calculating the data-driven error and the physical constraint error, including the data-driven error MSE and the physical constraint error; The calculation method of the data-driven error MSE is: comparing the electromagnetic field prediction value with the true electromagnetic field value calculated by the FDTD method node by node and step by step, and calculating the mean square error; The calculation method of the physical constraint error is: substituting the electromagnetic field prediction value into the pre-set discretized Maxwell equation set to calculate the residual sum of squares; The data-driven error and the physical constraint error are weighted to form a total loss function, the parameter gradient of the graph structure Unet network model is calculated through back propagation of a calculation graph structure, and the weight of the graph structure Unet network model is updated by using an optimizer.
[0027] According to the application, in step 5, the trained graph structure UNet network model in step 4 is applied to a test data set, that is, the device structure and the initial electromagnetic field distribution not participating in the training are input, and the graph structure UNet network model outputs the long-time electromagnetic field prediction result.
[0028] A computer device comprises a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method for long-time time-domain difference optical simulation of the graph structure UNet neural network fusing physical constraints when executing the computer program.
[0029] A computer readable storage medium stores a computer program, and the computer program implements the steps of the method for long-time time-domain difference optical simulation of the graph structure UNet neural network fusing physical constraints when executed by a processor.
[0030] The system for long-time time-domain difference optical simulation of the graph structure UNet neural network fusing physical constraints comprises: The data set acquisition and preprocessing module is configured to use the FDTD method to construct the device parameter data set, that is, the device parameters and the corresponding electromagnetic field distribution, obtain the FDTD uniform grid data, and perform data preprocessing on the FDTD uniform grid data. The model construction module is configured to construct the graph structure Unet model with a down-sampling, up-sampling and skip connection structure. The model training module is configured to input the obtained device parameter data set into the graph structure Unet model for end-to-end training. The prediction module is configured to preprocess the dielectric constant distribution of the device to be predicted and the electromagnetic field at the initial time, convert them into a graph structure input format, input them into the trained and saved graph structure UNet model, use the trained weight file to predict the electromagnetic field scattering after the long-time light source encounters for the given device parameters and initial electromagnetic field distribution. The accuracy prediction module is configured to compare the electromagnetic field distribution of different device shapes predicted by the graph structure Unet network model with the electromagnetic field values calculated by the FDTD method, and then judge the accuracy of the prediction of the graph structure Unet network model.
[0031] The application has the following advantages: 1. The application can use the graph neural network to predict electromagnetic scattering simulation.
[0032] 2、The application can explore the physical law contained in electromagnetic prediction, the physical equation residual constraint in addition to the true value constraint can improve the robustness of the model, and the result is more in line with the real physical law.
[0033] 3、The application uses the Unet neural network of the graph structure to complete the one-time long time sequence prediction of electromagnetic scattering instead of FDTD or other neural network single-step prediction or iterative prediction. BRIEF DESCRIPTION OF DRAWINGS
[0034] Figure 1 It is the whole flow schematic diagram of the long time time domain difference optical simulation method of the application fusion physical constraint graph structure UNet neural network; Figure 2 It is the network structure schematic diagram of the graph structure Unet network model of the application; Figure 3 It is the application complete schematic diagram of the graph structure Unet network model of the application; Figure 4 It is the data preprocessing flow schematic diagram; Figure 5 It is the test loss schematic diagram of the long time electromagnetic field prediction of the graph structure Unet network model elliptical device; Figure 6 It is the Ez value schematic diagram of the electromagnetic field prediction of the graph structure Unet network model to the elliptical device at t=0 moment; Figure 7 It is the real Ez value schematic diagram of FDTD calculation elliptical device at t=0 moment; Figure 8 It is the Ez value schematic diagram of the electromagnetic field prediction of the graph structure Unet network model to the elliptical device at t=80 moment; Figure 9 It is the real Ez value schematic diagram of FDTD calculation elliptical device at t=80 moment; Figure 10 It is the test loss schematic diagram of the long time electromagnetic field prediction of the graph structure Unet network model arbitrary device (ellipse and rectangle); Figure 11 It is the Ez value schematic diagram of the electromagnetic field prediction of the graph structure Unet network model to arbitrary device (taking rectangle as an example) at t=80 moment; Figure 12 It is the real Ez value schematic diagram of FDTD calculation rectangular device at t=80 moment; Figure 13 It is the specific application schematic diagram of the long time sequence electromagnetic field value based on the graph structure Unet model fusion physical information supervision. DETAILED DESCRIPTION
[0035] The application will be further limited by the following description and examples with reference to the accompanying drawings, but is not limited thereto.
[0036] Example 1 The fusion physical constraint graph structure UNet neural network is used for long-time time-domain difference optical simulation method, such as Figure 1 As shown in the figure, it comprises: Step 1: using FDTD method to construct device parameter data set, i.e. device parameters and corresponding electromagnetic field distribution, to obtain FDTD uniform grid data, and to pre-process the FDTD uniform grid data; make it suitable for the input format of the graph neural network; convert the FDTD uniform grid data into a graph structure, each grid cell is mapped to a node in the graph, the edges between the nodes are established based on the spatial adjacency relationship, and the edge attributes (such as spatial distance, dielectric constant gradient, etc.) are attached. At the same time, the electromagnetic field value is normalized, and the dielectric constant distribution and the initial time electromagnetic field component are spliced to form an input feature matrix, which is used as the input of the graph structure Unet model;
[0037] Step 2: construct a graph structure Unet model with down-sampling, up-sampling and skip connection structure; Step 3: input the device parameter data set obtained in step 1 into the graph structure Unet model in step 2 for end-to-end training; the training loss is composed of data supervision term (mean square error of predicted field and FDTD true value) and physical constraint term (Maxwell residual error). By back propagation, the model parameters are optimized, so that the model can not only fit the sample data, but also maintain physical consistency. The training of the model is completed in this step.
[0038] Step 4: pre-process the dielectric constant distribution and the initial time electromagnetic field (Ez0, Hx0, Hy0) of the device to be predicted, convert it into a graph structure input format, obtain the input node feature matrix X_in and the edge index Edge_index, edge feature Edge_attr; input X_in into the graph structure UNet model trained and saved in step 3, use the trained weight file to predict the electromagnetic field scattering after the long-time light source encounters the given device parameters and initial electromagnetic field distribution; the model performs the following calculation process in the inference process: Step 4.1: encoding stage: the graph structure UNet model extracts the spatial correlation features of the input electromagnetic field and the device structure, obtains the deep hidden representation, and captures the local and global medium distribution features; Step 4.2: time expansion prediction: decoding stage, the multi-time step prediction module (such as convolution module, etc.) inside the graph structure UNet model will predict the continuous electromagnetic field distribution from the initial time t0 to t T based on the initial electromagnetic field and the learned time evolution law.
[0039] The predicted value of each time step is obtained by propagating the spatial features and the spatial convolution of the field component at the previous time.
[0040] The model implicitly follows the propagation characteristics of Maxwell's equations during prediction, ensuring the mutual coupling relationship between the electric field and the magnetic field.
[0041] Step 4.3: Multi-branch decoding output: The model outputs the electromagnetic field distribution of different time intervals through multiple decoding branches. The final output is an electromagnetic field tensor with the shape of [Nx, Ny, T, 3], corresponding to the Ez, Hx, and Hy field distribution prediction results in spatial dimensions and long time steps T. This process does not require time-consuming FDTD simulation calculations, and the model can quickly complete the prediction of long-time electromagnetic propagation behavior in complex device structures, significantly improving simulation efficiency.
[0042] Step 5: Compare the electromagnetic field distribution of different device shapes for long-time prediction with the electromagnetic field values calculated by FDTD, and then judge the accuracy of the graph structure Unet network model prediction.
[0043] Embodiment 2 The graph structure UNet neural network fusing physical constraints according to Embodiment 1 is used for long-time time-domain difference optical simulation method, which is different in that: The device parameters include medium and geometric shape.
[0044] Data preprocessing, including: Convert FDTD uniform grid data into a graph structure G = (V, E, X, E attr ) with physical meaning, where FDTD uniform grid data includes permittivity, initial electromagnetic fields Ez, Hx, and Hy, relative position (normalized coordinates), and relative displacement vector (dx, dy); V is the node set, E is the edge set, X is the node feature matrix, and E attr is the edge feature matrix; 1) Node mapping and definition: Each discrete point (i, j) of FDTD uniform grid data is uniquely mapped to a node v_i ∈ V in the graph structure; where i and j are the grid indices of the discrete point in the X and Y directions, respectively; the total number of nodes is N = N_x × N_y, and N_x and N_y are the number of grids in the X and Y directions, respectively; 2) Edge connection relationship confirmation: A 4-neighbor connection rule is adopted to construct an undirected graph. After traversing all grid points, i.e., the total number of nodes N x * N y, the connection relationship between each node and its left, right, top, and bottom neighbors is naturally formed. This connection method ensures that the topology of the graph is completely consistent with the spatial difference path used to calculate the curl in FDTD, providing the correct inductive bias for the graph neural network to learn the evolution rules of the electromagnetic field.
[0045] 3) Node feature construction: Each node v_i is assigned a multi-dimensional feature vector x_i ∈ R^D_n, which represents the physical attribute state of the space point. The node feature x_i is composed of the following dimensions: Material intrinsic features: The normalized permittivity ε_norm at node v_i; the normalization method is: ε_norm = 2*(ε_i - 0) / (ε_max - 0)-1, where ε_i is the original value of the permittivity at this point, and ε_max is the maximum permittivity in the entire calculation region.
[0046] Absolute position feature: The normalized spatial coordinates of node v_i; the normalization method is: pos_x = i / x_max, pos_y = j / y_max. This feature provides the absolute position information of the node, which helps the model learn the boundary conditions and excitation source position related to the spatial position.
[0047] Electromagnetic field state feature: The electromagnetic field component value of node v_i at a certain time step t_n; 4) Edge feature construction: Each edge feature e_uv ∈ E connecting nodes u and v is assigned a multi-dimensional feature vector e_uv ∈ R^D_e, which represents the attributes of the physical relationship between the two adjacent nodes. The edge feature e_uv is composed of the following dimensions: Geometric relationship feature: used to describe the relative position vector of two nodes in space; for a horizontal edge (connecting (i, j) and (i+1, j)), its feature is [1, 0]. If the edge is a vertical edge (connecting (i, j) and (i, j+1)), its feature is [0, 1]. This feature clearly indicates the direction of the edge, which is crucial for reconstructing the differential relationship of electromagnetic field components in different directions.
[0048] Physical field difference feature: calculate the difference of physical attributes of nodes at both ends of the edge to simulate the difference operator in FDTD. Permittivity difference (Δε = ε_u - ε_v, this feature reveals the existence and strength of the material interface) and electromagnetic field component difference (calculate the difference between the field values of the connected two nodes at the same time step).
[0049] For TM waves, the electromagnetic field state features include: electric field intensity Ez_i, magnetic field intensity Hx_i and magnetic field intensity Hy_i. The electromagnetic field state features are the core input of the dynamic evolution of the graph structure Unet network model.
[0050] As shown in Figure 2 , the graph structure Unet network model includes a GraphDown module, a DoubleGEN module and a GraphUp module; the GraphDown module and the GraphUp module each further include a DoubleGEN module. The GraphDown module, i.e. a down-sampling module, is used for feature extraction and enhancement (using a graph convolution network to aggregate information of nodes and their neighbors in a graph to learn and enhance node feature representation) and pooling and compression (based on learned new features, important information is retained, the calculation scale and complexity are reduced, and higher-level semantic features are extracted); The DoubleGEN module, i.e. a feature extraction module, is a double-layer graph convolution network module, and its core purpose is to enable nodes to not only aggregate information of direct neighbors in the graph structure, but also indirectly receive neighbor features of neighbors through two consecutive message passing and feature transformation processes, to realize deeper spatial correlation modeling and feature extraction, thereby generating node feature representation with more physical meaning and spatiotemporal correlation; The GraphUp module, i.e. an up-sampling / decoder module, is a graph up-sampling and feature fusion module, and its core purpose is to fuse high-level semantic features after pooling and compression with corresponding detailed spatial features in the encoder path, thereby gradually restoring the spatial resolution of the graph and generating refined output.
[0051] The DoubleGEN module is a double-layer feature extraction structure composed of two layers of GENConv layers, i.e. generalized graph convolution layers, GraphNorm layers, i.e. graph normalization layers, and an activation function ELU. In the generalized graph convolution layer, message passing and feature aggregation between nodes are realized through GENConv operation; for each node in the graph, the features of its adjacent nodes and edge features are input, the weighted features of the neighbor nodes are calculated through GENConv operation, and information fusion is performed using an aggregation function (softmax aggregation) to obtain the local aggregation representation of the node. This model can learn the physical correlation and feature coupling relationship between the node and its direct neighbors.
[0052] In the graph normalization layer, the node features of each graph are standardized by the GraphNorm normalization operation. In graph structure data, the number of nodes and feature distribution of different graphs differ greatly, which can easily cause numerical instability in the training process. Graph normalization (GraphNorm) is introduced after each convolution operation to standardize the node features of each graph, thereby improving the stability and convergence speed of model training.
[0053] In the activation function ELU, after the GraphNorm normalization operation, the exponential linear unit is used as the nonlinear activation function to enhance the nonlinear expression ability of the model and alleviate the gradient vanishing problem.
[0054] The structure of each layer in the double-layer feature extraction structure (GENConv-GraphNorm-ELU structure) is the same, which is used to further propagate and fuse features in a deeper neighborhood. Through the superposition of two layers, nodes can aggregate information from a wider local subgraph, achieving multi-level feature abstraction.
[0055] In summary, the DoubleGEN module realizes progressive extraction of node physical features from low-order to high-order through the combination of two-level GENConv message passing, GraphNorm normalization, and ELU nonlinear activation, effectively improving the feature expression ability and stability of the model in long-time electromagnetic propagation modeling.
[0056] The GraphDown module is stacked by the DoubleGEN module and the up-down sampling strategy TopKPooling; The first input channel of the generalized graph convolution layer is , and the output is , with edge_dim=6; The second input channel of the generalized graph convolution layer is , and the output is , with edge_dim=6; The core design philosophy of GENConv is to provide a highly flexible framework that allows users to build a variety of graph neural network models by specifying different aggr (aggregation function) and msg (message function). Moreover, its strength lies in its ability to support and handle edge features.
[0057] The preprocessed graph structure is input as input data to two layers of generalized graph convolution layers and GraphNorm layers to perform layer-by-layer message passing, feature aggregation, and normalization processing on the input node features to generate high-dimensional node embedding representations; as shown in Figure 3 , the specific implementation process is as follows: First, in the GENConv graph convolution of the first GraphNorm layer, the node feature moments X and the edge feature matrix E are used. attr As input, a message-passing mechanism is used to achieve neighborhood feature fusion. Each node receives information from its neighboring nodes, maps neighbor node features and edge features into message vectors through a message function (built into GEN), and integrates neighborhood information through an aggregation function (softmax) to obtain the local feature representation of the node. Subsequently, GraphNorm normalization is applied to the features to calculate the mean and standard deviation of node features at the graph level, ensuring that the feature distribution of different nodes and different graph samples is consistent, thereby improving the numerical stability and generalization performance of the network during training. The normalized features are then activated by the ELU activation function, which helps to ensure the continuity and smoothness of the feature representation and avoid gradient vanishing.
[0058] In the second GraphNorm layer, node features undergo another round of message passing and aggregation. Unlike the first GraphNorm layer, the second GraphNorm layer captures the relationships between nodes within a deeper neighborhood (i.e., neighbors of neighbors), enabling higher-order feature fusion and semantic modeling. Through this layer, nodes not only retain their own physical properties but also incorporate electromagnetic field propagation characteristics and material distribution information across a wider spatial area. Finally, the node features after passing through the second GraphNorm layer and being activated by the ELU activation function are defined as the final node features.
[0059] Next, a TopKPooling upsampling strategy is employed. Based on the importance score of node features, the most important nodes are retained proportionally (50% in this case), while the remaining nodes are discarded. Subsequently, the edge set, edge feature matrix, and index information of the graph are updated based on the retained nodes. The specific process is as follows:
[0060] (1) Node importance score calculation: A scalar score is calculated for each node to measure its relative importance in the graph structure and subsequent tasks. The score can be generated by linear mapping of node features or by a small multilayer perceptron (MLP).
[0061] (2) Node selection: Select nodes in the graph, retain 50% of the nodes with the highest scores, and discard the rest. This step yields the index set P of the nodes to be retained.
[0062] (3) Node number remapping: In order to generate consecutive new node indices, a mapping table (map) is constructed for the retained nodes. The retained P nodes are renumbered starting from 0. The discarded nodes are mapped to a value of -1. This mapping ensures that the downsampled graph can correctly reference the node indices and provides a basis for recovery for subsequent upsampling or skip connections.
[0063] (4) Edge set update: traverse each edge of the original graph, if both endpoints of the edge are in the preserved node set P, then preserve the edge; otherwise, discard the edge; for the preserved edge, update the node index to the new number, form the edge index set S.
[0064] (5) Edge feature update: the feature vector of the preserved edge is directly copied to the new edge feature matrix, the feature of the discarded edge is deleted with the edge, if a new edge is added in the downsampling process, the feature of the new edge needs to be calculated.
[0065] (6) Batch index update: generate a new batch index vector according to the new number of preserved nodes.
[0066] (7) Down-sampling metadata preservation: save the original index list perm of the preserved nodes, the mapping table map of the preserved nodes, and optionally the score value of the preserved nodes for subsequent weighted processing.
[0067] This module is used as a building block to capture information at different levels from micro to macro by gradually reducing the size of the graph and increasing the dimension of the node feature.
[0068] The forward propagation of the generalized graph convolution layer follows the message passing neural network (MPNN) paradigm, which consists of three steps: 1) Message construction: for each edge (j, i) connecting the source node j (message sender, representing the starting node of the information) to the target node i (message receiver, representing the end node of the information), the generalized graph convolution layer constructs a message, and the default message function is addition, which combines the state of the source node and the attribute of the edge to generate a message passing along the edge;
[0069] 2) Message aggregation: the set of neighbor nodes of the target node i is N(i), and all messages from the neighbor nodes j ∈ N(i) are collected, which are the node feature values (including dielectric constant, electromagnetic field initial value, relative position information) of the neighbor nodes; In the message aggregation function inside the generalized graph convolution layer, there is an aggregation function selection parameter aggr, which defaults to the softmax normalization function as the aggregation function of the message, i.e. aggr='softmax'; an attention weight α_{j-i} is calculated for each message; α_{j-i}=softmax(MLP( x_i || x_j || edge_attr_{j-i} )) ; where x_i represents the node feature vector of the target node i (electromagnetic field value, dielectric constant, relative position), x_j represents the node feature vector of the source node i (electromagnetic field value, dielectric constant, relative position), edge_attr_{j-i} represents the edge feature vector connecting the source node j and the target node i (including, dielectric constant difference, relative position offset, electromagnetic field difference), MLP represents a multi-layer perceptron; it is a learnable nonlinear mapping function composed of several linear layers and nonlinear activation functions, which maps the connected joint features to a scalar score representing the preliminary importance of the message. The weights and biases are learned through backpropagation during the training process to adapt to the task requirements.
[0070] The softmax function performs normalization to give higher weights to important neighbor node messages and weaken the influence of unimportant messages, achieving weighted aggregation. That is, m_i =Σ(α_{j-i} * message_{j-i} ); where message_{j-i} represents the message sent from the source node j to the target node i, which is generated by fusing the source node features and edge features; α_{j-i} corresponds to the weight of the message message_{j-i}, which is obtained by normalizing the neighbor message score by the softmax function; m_i is the final aggregated feature vector of the target node i, which is obtained by summing the weighted messages of all neighbors;
[0071] This makes the aggregation process adaptive, and important neighbors have a greater impact on the target node.
[0072] 3) Node update: add the current feature x_i of the target node i and the aggregated message m_i directly (because the obtained message m_i node feature and the current feature x_i of the target node i are of the same dimension, the most naive method is adopted), and update the node feature through a learnable function (such as linear transformation + activation function); x_i' = update( x_i, m_i );The specific steps are as follows: (8) The input information is the original node feature x_i and the aggregated message m_i (weighted aggregated message from neighbor nodes).
[0073] (9) Feature combination, x_i+m_i, after linear transformation and activation function, here we use the built-in multi-layer perception MLP to complete, the internal learning parameters W and bias b are automatically optimized in training.
[0074] (10) Gated update: using a learnable gating vector to control the contribution ratio of aggregated messages to node updates, preserving the node's own information while fusing neighbor information, and achieving adaptive updates.
[0075] Finally, output all the updated node features, that is, the updated electromagnetic field value Ez, magnetic field strength Hx, and magnetic field strength Hy.
[0076] GraphUp module is the key component of the decoder, forming a symmetric "compression-recovery" structure. The skip connection in it is the core idea of the U-Net architecture. It solves the problem of gradient disappearance in deep networks and ensures that the decoder does not lose important low-level detail information when recovering the resolution. The learnable up-sampling, unlike simple interpolation up-sampling, is a data-driven up-sampling that can learn how to best use the skip connection information to fill in the features of the nodes discarded by pooling.
[0077] The GraphUp module includes up-sampling operation (Upsample / ConvTranspose2d) and DoubleGEN module; its core purpose is to: through the up-sampling operation to expand the size of the deep feature map, and with the corresponding shallow features in the encoder path to jump connection fusion, both retain the spatial detail information of the shallow features, and also integrate the semantic abstract information of the deep features, effectively integrate and restore the resolution of multi-scale features, so as to provide features with both spatial precision and semantic richness for subsequent segmentation or reconstruction tasks.
[0078] Up-sampling operation: the core function is to realize the spatial resolution enhancement of the feature map. Two up-sampling methods are provided:
[0079] Bilinear up-sampling (bilinear): using bilinear interpolation algorithm to perform 2 times up-sampling on the input feature map, which has high computational efficiency and can maintain feature smoothness.
[0080] Convolution transpose up-sampling (ConvTranspose2d): through the learnable convolution transpose kernel to realize 2 times up-sampling, which can adaptively learn feature reconstruction parameters while restoring the resolution.
[0081] Feature alignment and concatenation: Due to the possible slight differences in the size of the feature maps in the encoder and decoder paths, a symmetric padding operation is used after upsampling to accurately align the feature map size, ensuring that the spatial dimensions of the feature maps are completely matched when performing a skip connection. By aligning the shallow features with the upsampled deep features along the channel dimension, the deep fusion of multi-level features is achieved.
[0082] Double convolution feature extraction (DoubleConv): composed of two consecutive 3x3 convolution layers, normalization layers and activation functions. Taking the above concatenated features as input, the fused features are nonlinearly transformed and feature channel compressed through two-level convolution operations, effectively extracting the core information of cross-level features, eliminating feature redundancy, and outputting enhanced feature representations with regularized channel numbers.
[0083] In summary, the GraphUp module constructs a key information transmission path in the encoder-decoder architecture through three stages of resolution recovery, cross-level feature concatenation and fusion, and double convolution feature extraction, achieving the complementary advantages of low-level spatial details and high-level semantic information, and significantly improving the edge preservation ability and feature representation quality of the model in image segmentation, electromagnetic field reconstruction and other tasks.
[0084] The GraphUp module reconstructs node features and image quality upwards, including: First, the tensor output by the bottom graph convolution after downsampling or the tensor upsampled by the previous layer, i.e., low-resolution semantic features [B, C, H, W], B represents the batch size, which is always 1 since only one graph is trained at a time, C represents the number of channels, i.e., node features of nodes, H represents the height of the image after gridization, i.e., the original vertical grid number Ny, W represents the width of the image after gridization, i.e., the original horizontal grid number Nx, is aligned in dimension through a linear layer Linear, at the same time, the corresponding high-order features skip_x and their graph structure skip_edge_index, skip_edge_attr from the encoder path are retained, where skip_x refers to the high-order feature tensor of the corresponding level retained by the skip connection before the encoder downsampling, i.e., node features; it contains more rich spatial details and local features; skip_edge_index defines the connection relationship between level nodes, i.e., the COO format of the adjacency matrix; skip_edge_attr defines the attributes of each edge in the graph, i.e., edge features; Then, the aligned feature vector x align is up-sampled according to the pooling index perm in the down-sampling operation until the same node dimension as skip x, to obtain a tensor up x; wherein x align refers to the output tensor obtained after the low-resolution semantic feature tensor is subjected to a channel dimension transformation by a linear layer; perm is the sorting index of the node importance recorded when the graph down-sampling operation is performed in the encoder path; skip x is a high-order feature tensor, i.e., a node feature, directly referenced from the middle layer of the encoder path by the skip connection without being down-sampled; up x is a feature tensor with the same node dimension as skip x, obtained by up-sampling the aligned low-resolution feature x align using the pooling index perm; the calculation process of the tensor up x is as follows: 1) Initialize the output tensor: create a tensor of all zeros on the device, with the same node dimension as skip x and the same feature channel number as x align.
[0085] 2) Index mapping and feature filling: use the saved pooling index perm. The first K values of perm (K is the number of nodes retained after down-sampling) indicate which position in the "blank" high-resolution feature map each node in x align should be placed.
[0086] 3) Process the pooled nodes: for the nodes that exist in the original high-resolution graph but are pooled out during down-sampling (i.e., nodes whose indexes are not in perm [:K]), their corresponding positions in up x will remain the initial zero value. These zero value areas can subsequently propagate and aggregate information from their neighbor nodes that have recovered features through graph convolution operations, thereby gradually reconstructing meaningful features.
[0087] Then, the up-sampled feature vector up x and the skip connection feature tensor skip x are concatenated in the feature channel dimension C under the premise of the same node dimension (i.e., the same number of nodes), as follows: (1); Wherein, up x has a shape of [N, C1] (up-sampled high-level semantic features, i.e., containing global context and structure information, large-scale electromagnetic patterns, macroscopic propagation direction, etc.), N represents the number of nodes, and C represents the channel number, i.e., the node feature; skip x has a shape of [N, C2] (down-sampled low-level spatial detail features, i.e., local texture, boundary, medium distribution, etc.); fused x is a feature vector combining global information and local information, with a shape of [N, C1+C2]; Finally, the fused feature fused_x is input into the DoubleGEN module together with the original graph structure (skip_edge_index, skip_edge_attr) for feature optimization and refinement. The refinement refers to the process of re-optimizing the node features after upsampling and feature fusion. Through the neighborhood aggregation mechanism of graph convolution, the feature achieves spatial consistency and semantic balance on the graph structure. This process not only corrects the distribution difference between different feature sources, but also enhances the local association between nodes, thereby restoring the detailed information lost in the downsampling process. After the feature propagation and update of the DoubleGEN module, the output node features not only maintain high-level semantic information, but also have clearer spatial structure and physical continuity, finally forming refined node features with restored resolution, providing high-quality input for the subsequent decoder stage. All formulas are as follows:
[0088] (2); (3); (4); (5); wherein formula (2) is a dimension alignment of feature channels through a linear layer; since the input feature X in the upsampling stage comes from the deep graph convolution output of the downsampling path or the upsampling result of the previous layer, its feature dimension (channel number) is usually different from that of the skip connection feature skip_x, so a linear layer is needed for feature dimension matching. is a trainable parameter matrix for feature dimension alignment; formula (3) describes the upsampling process. In the downsampling stage, each graph layer selects important nodes through TopKPooling or other methods and records their indexes perm. Now, in the upsampling stage, the low-resolution node features are "put back" to the positions of the high-resolution graph using perm to restore the original number of nodes; Zeros creates a full-zero tensor with a shape of [N_skip, D_align] to initialize the matrix of node features of the high-resolution graph, N_skip represents the number of nodes of the original high-resolution graph in the skip connection layer (i.e. the target number of nodes after upsampling), and D_align represents the number of feature channels; formula (5) describes the process of feature refinement of the DoubleGEN module. The DoubleGEN module is a trainable parameter matrix for effective fusion and resolution recovery of high-level semantic features and low-level detailed features.
[0089] TopKPooling, which uses an up-and-down sampling strategy, retains the most important nodes in proportion (50% here) according to the importance score of the node features, and discards the rest; including: The TopKPooling pooling strategy based on score ranking learns the score value of each node, selects the most important top-k nodes according to the score size to form a subgraph, thereby reducing the computational complexity while ensuring the information expression ability.
[0090] The calculation process is as follows: ; (6) In formula (6), represents the score value of the i-th node, ∈ represents the feature vector of the i-th node, ∈ is a learnable projection parameter; The score values of all nodes { } are arranged in descending order, and the top k = ⌈r⋅N⌉ are selected, N represents the number of nodes in the current graph, r ∈ (0, 1] is the node retention rate, the selected nodes and their related edges together constitute the pooled subgraph, and the nodes not selected are discarded.
[0091] In the training process of the graph structure Unet network model, a physical equation residual loss function is added on the basis of MSE (mean square error loss) to expand the constraints on the graph structure Unet network, so that it evolves more in line with physical laws and to a certain extent enhances the robustness of the model. The total loss calculation method of the graph structure Unet network model is as follows:
[0092] (7) Where, is the true electromagnetic field distribution, is the value of the long-time electromagnetic field distribution predicted by the graph structure Unet network model (from t=t0 to t=t pred ), is the equation residual generated by substituting the predicted long-time sequence electromagnetic field value into the written Maxwell equation set; is the mean square error loss, which is a measure of the difference between the predicted value and the true value; the specific algorithm is given in the formula, that is, the mean square error value of the true electromagnetic field and the predicted electromagnetic field value of each grid point.
[0093] Equation residual function The calculation is as follows: (8) (9) (10); (11); where equation (8) describes the calculation process of the electromagnetic field residual equation , describes the electric field residual at position x at the nth moment (corresponding to Faraday's law in Maxwell's equations), represents the vacuum permittivity, represents the relative permittivity, represents the value of the z-direction component of the electric field at the n+1, n time step (predicted or real), represents the time step, represents the conductivity term in the PML absorbing layer along the x and y directions (indicating the strength of loss absorption), is the x-direction partial derivative of the magnetic field , is the y-direction partial derivative of , and * represents the model prediction value; equation (9) describes the magnetic field residual equation, represents the residual of the x-direction magnetic field component (corresponding to Ampere's law), represents the vacuum permeability, represents the value of the x-component of the magnetic field at the n+1, n time step, represents the loss term of the magnetic field in the absorbing boundary (PML dissipation), represents the partial derivative of the electric field along the y direction (corresponding to part of the curl term); equation (10) describes the residual equation of , represents the residual of the y-direction magnetic field component, the dissipation term of the magnetic field in the x direction, represents the partial derivative of the electric field along the x direction (corresponding to part of the curl term); equation (11) is , , the sum, which represents the entire residual obtained by substituting into the Maxwell equation set.
[0094] In the training process of the graph structure Unet network model, a phased adaptive learning rate adjustment strategy is adopted, that is, a Warm-up polynomial decay learning rate scheduling strategy. The core goal is to stabilize the model convergence direction through low learning rate warm-up in the early training stage to avoid gradient shock; and gradually reduce the learning rate through polynomial decay in the later training stage; so that the model can be fine-tuned and converge to a better local optimum. The entire training process is divided into two core stages, including:
[0095] First stage: learning rate warm-up stage: in the initial warm-up_steps training steps, where warm-up_steps represents the number of iteration steps for learning rate warm-up, which is generally several hundred to several thousand steps (here it is predetermined to be 1000 steps), which is used to ensure the stability of the early training. In this stage, the learning rate starts from an extremely small initial value warm-up_start_lr (for example, the value is 1x10 -6 ) and rapidly and smoothly increases to the preset baseline learning rate lr0 (for example, the value is 1x10⁻³) according to the exponential growth strategy; where "rapidly" means that the learning rate can be effectively improved from the initial extremely small value to the baseline level within a relatively short warm-up step range, so that the model can enter an effective learning state in the early stage; "smoothly" means that the curve of the learning rate changing with the step number is continuous, monotonic and without mutation, which ensures the stability of the gradient change and avoids the phenomenon of training divergence caused by the sharp fluctuation of the learning rate. As follows:
[0096] (12); where, represents the current learning rate value corresponding to the t-th iteration step in the training process; it is the instantaneous learning rate output by the training scheduling function at time step t, which is used to update the model parameters by the optimizer. warm-up_start_lr represents the initial learning rate of the warm-up stage, that is, the minimum learning rate value adopted by the model at the beginning of training (t = 0). This parameter usually takes a value much smaller than the baseline learning rate lr0 (1x10⁻ 6 ), which is used to avoid the situation of too large gradient or unstable model in the early training. warm-up_factor represents the exponential growth coefficient of the learning rate, which is a constant greater than 1, used to control the growth rate of the learning rate at each step, and the calculation formula is as follows:
[0097] (13); where lr0 is the target learning rate at the end of the warm-up stage (1x10⁻³), and warm-up_steps is the total number of iterations in the warm-up stage; therefore, warm-up_factor determines the exponential change speed of the learning rate from warm-up_start_lr to lr0, so that the learning rate presents a continuous, gradual and non-mutational growth trend in the whole warm-up stage.
[0098] The role of this stage is that in the initial stage of training, the model parameters have not yet stabilized and the randomly initialized full connection layer / convolution layer module will produce unstable gradients. Starting from a very small learning rate can avoid the model deviating from the optimal solution direction due to gradient explosion in the initial few steps, thereby stabilizing the training process and laying a good foundation for the subsequent stage.
[0099] Second stage: polynomial decay stage: after the warm-up stage, the learning rate is gradually decayed from the base learning rate lr0 to near 0 using the polynomial decay strategy; the learning rate is decayed according to the following formula: (14); wherein, represents the learning rate value at the t-th iteration in the decay stage; t represents the global iteration step number of the current training, represents the number of steps of the learning rate warm-up stage, i.e. the position where the exponential growth ends; r represents the maximum iteration step number of the entire training process, is the decay control index, used to adjust the rate of learning rate decline. Here, 0.9 is taken. The smaller the value, the faster the decay, and vice versa.
[0100] The role of this stage is that as the training progresses, the model gradually approaches the local optimal solution of the loss function. At this time, a larger learning rate may cause oscillation around the optimal point and fail to converge. By gradually decaying the learning rate, the model's update step size becomes smaller and smaller, so that fine parameter tuning can be performed at the end of training, and finally converge to a more accurate and robust optimal point.
[0101] The device parameter data set obtained after data preprocessing in step 1 is used to train the graph structure Unet network model constructed in step 2 in an end-to-end manner; including: Input randomly generated device structure and initial electromagnetic field distribution: the device structure includes ellipse, rectangle and irregular shape; During training, the device structure and the initial electromagnetic field distribution are input into the graph structure Unet network model after data preprocessing, and the GraphDown module, DoubleGEN module and GraphUp module are used to obtain the electromagnetic field prediction value of long-time electromagnetic field scattering, while calculating the data-driven error and the physical constraint error, including the data-driven error MSE and the physical constraint error (physical residual); The calculation method of the data-driven error MSE is to compare the electromagnetic field prediction value with the true electromagnetic field value calculated by the FDTD method node by node and time step by time step, and calculate the mean square error; The calculation method of the physical constraint error is: substituting the electromagnetic field prediction value into the pre-set discrete Maxwell equation set to calculate the residual sum of squares; thereby ensuring that the predicted field satisfies the physical law of electromagnetic wave propagation.
[0102] The data-driven error and the physical constraint error are weighted to form a total loss function, the parameter gradient of the graph structure Unet network model is calculated through back propagation, and the weights of the graph structure Unet network model are updated by using an optimizer. The total loss is gradually reduced. Through multiple iterations of training, the long-time electromagnetic field prediction capability of the model for the input device structure and the initial electromagnetic field is optimized. During the training process, learning rate scheduling strategies can be combined, including exponential growth in the warm-up stage and polynomial decay in the later stage, to accelerate convergence and improve training stability. In the training process, the optimized weight parameter file is saved to directly load in the subsequent verification or prediction stage, realizing efficient model reuse and long-time electromagnetic field prediction.
[0103] First, the shape and dielectric constant of the device are generated by a random generation function, and the initial electromagnetic field value and the electromagnetic field value at N future time points are calculated using the FDTD algorithm according to the device parameter information. The initial electromagnetic field value and the device parameters are preprocessed into a graph data structure, and real-time processing and prediction are performed through step 4 described above to obtain long-time sequence electromagnetic field scattering results.
[0104] In step 5, the graph structure UNet network model trained in step 4 is applied to the test data set, i.e., the device structure and initial electromagnetic field distribution that did not participate in the training are input, and the graph structure UNet network model outputs the long-time electromagnetic field prediction results. Including node-level Ez, Hx, Hy, and other time-domain information, the model prediction results are compared with the real electromagnetic field results calculated by the FDTD method node by node and time step by time step, the mean square error (MSE) is calculated, and the error value of each test sample is obtained. The errors of all test samples are averaged to obtain the test loss value corresponding to the training iteration step. The test loss value of each iteration step is recorded in sequence to form the loss curve in the test phase, i.e., the horizontal axis is the number of iteration steps, and the vertical axis is the curve of the average MSE value. This curve directly reflects the trend of the prediction accuracy of the model for unseen data changing with the iteration step during the training process. When the curve value tends to be stable and fluctuates a little, i.e., when the test phase loss curve changes by less than a preset threshold ε1 (ε1=0.2) in consecutive multiple iteration steps (20 steps), it means that the graph structure Unet network model is trained. After that, to predict other device structures, only the device parameters and the initial electromagnetic field value need to be input, and the trained model parameters are loaded to directly complete the prediction of the electromagnetic field values at N time points after the initial time.
[0105] Example 3 The fusion physical constraint graph structure UNet neural network according to the embodiment 1 or 2 is used for a long time time-domain difference optical simulation method, which is different in that: The device parameters generated by the random function for the data set include device shape and dielectric constant, and the FDTD is under the condition of a Gaussian light source Under the condition, the initial electromagnetic field value after 40dt is the input electromagnetic field value, because at this time the light source intensity area is stable, and has not touched the medium.
[0106] In this embodiment, the change process of Ez, Hx and Hy after the light source touches the medium and scattering occurs after 100 time is predicted. Although the experimental results predict the full-field Ez, Hx and Hy, the result graph only shows the numerical change of Ez.
[0107] The related results are shown in Table 1: Table 1
[0108] Wherein Loss true Because it is difficult to obtain the actual electromagnetic field value or to use the 2D FDTD calculation, and Loss Physical Represents the residual error of the Maxwell equation.
[0109] As Figure 4 Shown, the data set or real-time data is preprocessed, including: First, the random function generates the dielectric constant (normalized) and the initial electromagnetic field value after 40dt is the input electromagnetic field value Ez, Hx and Hy. The two-dimensional regular grid points are numbered [i,j].
[0110] Second, the space area is discretized according to the preset grid parameters, divided into Nx grid points in the horizontal direction and Ny grid points in the vertical direction, to obtain the space coordinate tensor pos[Nx×Ny,2], wherein each node contains its normalized coordinate information in the x and y directions.
[0111] Based on the two-dimensional grid, the edge index of the graph structure is constructed: In the horizontal direction, (Nx×(Ny−1)) edges are established, forming horizontal edges; In the vertical direction, ((Nx−1)×Ny) edges are established, forming vertical edges; The horizontal edges and the vertical edges are merged to obtain the edge index matrix edge_index[2,E] of the graph, wherein E is the total number of edges; In the node feature construction process, each node is assigned a dielectric constant value, an electromagnetic field component (Ez, Hx, Hy) and its normalized space coordinates, thereby forming a node feature tensor x[N,6], wherein N=Nx×Ny.
[0112] In the edge feature construction process, in addition to introducing the relative displacement information of the horizontal edge and the vertical edge, the difference of the endpoints of the edge in the dielectric constant, the electric field and the magnetic field component is calculated, and the above information is combined to obtain the edge feature tensor edge_attr[E, 6].
[0113] Finally, the node features, edge indexes, edge features and position tensors are uniformly packaged into the graph data format Data(x, edge_index, edge_attr, pos) in the PyTorchGeometric framework, and mapped to the GPU device, providing input data for the end-to-end training of the subsequent graph structure UNet neural network.
[0114] As shown in Figure 2 , the graph structure Unet network model includes a GraphDown module, a DoubleGEN module and a GraphUp module. DoubleGEN module: The graph convolution of this module is different from the original Graph Unet point in that the GCN layer is replaced by the GEN layer to process the graph data as input node features x, edge indexes edge_index and edge features edge_attr. The module first encodes the node features through double-layer graph convolution (DoubleGEN), where each layer of graph convolution uses the GENConv operation combined with edge feature information, and applies GraphNorm normalization and ELU activation function after convolution output, so as to extract the local topological features between nodes and the semantic features of the nodes themselves, and suppress gradient disappearance. Through this encoding module, the input node features are mapped to a high-dimensional feature space Fout, not only retaining the node information itself, but also capturing the association between nodes in the graph structure, providing rich node semantic representation for subsequent graph down-sampling, graph aggregation or graph up-sampling modules.
[0115] The output tensor dimension is [N, Fout], where N is the number of nodes and Fout is the feature dimension after encoding GraphDown module: This module down-samples the encoded node features through TopKPooling to retain the most important node information in the graph, while updating the edge index, edge feature and batch information. Finally, the output contains the down-sampled node features, edge index, edge feature, batch information and pooling mapping relationship, realizing high-dimensional feature compression and information aggregation of the input graph.
[0116] The output tensor can be represented as [N', F], where N' is the number of nodes after downsampling, and F is the feature dimension after encoding. This module can be used for subsequent graph upsampling or multi-scale graph feature fusion, similar to the encoding embedding representation in time series tasks, which maps the topology and feature information of the nodes to a unified high-dimensional feature space.
[0117] As shown in Figure 4 , the graph structure Unet completes the prediction of the electromagnetic field values Ez, Hx, and Hy of the grid points according to the input processed graph structure data. Figure 4 The error curve between the predicted value Ez' and the Ez calculated by FDTD in the test phase is shown in the middle. In the training phase, the loss function takes into account both the MSE with the true value calculated by FDTD and the residual when the prediction result is substituted into the Maxwell equation set. The model uses a warm-up polynomial decay learning rate scheduling strategy to further increase the difference between the predicted value and the true value and the residual of the equation that conforms to the physical law.
[0118] The Yee grid discretization of two-dimensional finite-difference time-domain (2D FDTD) calculates the difference update equation of the electromagnetic field as: ; ; ; In addition, in order to ensure numerical stability, the stability (CFL) condition must be met, that is, the time step must satisfy: ; The numerator is 0.5.
[0119] The FDTD calculation result vector [B, C, H, W] and the dielectric constant [Nx, Ny] are mapped to the graph structure vector [N, F]. N is the total number of grid nodes, which is 100*100, and F is the feature number, which is 6.
[0120] The processed data is first passed through four GraphDown (DoubleGEN + TOPKPooling downsampling) to obtain the tensor [N1', F1']. Then, it is passed through four GraphUp modules for upsampling, and the process is as follows:
[0121] Linear alignment: ; Upsampling recovery: ; Splicing fusion: ; After DoubleGEN feature extraction, it is ready; The final [N'', F''] is reconstructed as [B, C, H, W].
[0122] In the training process of the graph structure Unet network model, a Maxwell equation residual error is added based on the MSE (Mean Square Error), and its calculation method is shown in the formula: ; Among them represents the residual error of Ez, represents the residual error of Hx, represents the residual error of Hy, and the specific calculation is given above.
[0123] In the training process, the loss decreases, causing the electromagnetic field value of the node to tend to the correct electromagnetic field value, and the prediction of the long time series of electromagnetic field values is also gradually completed. The finally trained model can be regarded as a mapping function, which can directly obtain the long time series of scattered electromagnetic field values by inputting.
[0124] The data set obtained after step 1 preprocessing is trained end-to-end on the graph structure Unet constructed in step 2. The specific training process is as follows: The input test set and training set are both device information generated by a random function and initial electromagnetic field values calculated by FDTD.
[0125] During training, the dielectric constant and initial electromagnetic field value are preprocessed and input into the graph structure Unet neural network model. After passing through the GraphDown module, DoubleGEN module, and GraphUp module, the MSE value of the prediction result and the FDTD calculation result and the residual error of the prediction result substituted into Maxwell's equation are used as the loss function, and then back propagation is performed to optimize the weight size and update the weight file.
[0126] First, the device shape and dielectric constant data are generated by a random function, and the electromagnetic field value of 40dt under a Gaussian light source is calculated by FDTD as the initial electromagnetic field value. Then, the graph structure data is processed and input into the trained neural network in step 4 to complete the long time series prediction of the device under the specific initial electromagnetic field condition.
[0127] In step 5, according to the prediction value sequence obtained in step 4, the FDTD can be calculated, and the accuracy can be compared. If the accuracy error is within the appropriate range <0.5, it is considered that the model achieves the expected effect.
[0128] Hardware environment: CPU: Intel(R) Core(TM) i7-10700F GPU: NVIDIA GeForce RTX 1660 Memory: 16G The software environment is as follows: OS: Windows 10 Python: Anaconda3 python3.8 CUDA: 11.3 Torch: 1.12.1 Figure 5 The test error curve for long-term prediction is given as an example of an ellipse. The horizontal axis is the period of the test (x 1000 times), and the vertical axis is the training loss in training; Figure 6 The Ez value diagram of the graph structure Unet network model for predicting the electromagnetic field of the ellipse device at t=0. Figure 7 The real Ez value diagram of the FDTD calculation of the ellipse device at t=0. Figure 8 The Ez value diagram of the graph structure Unet network model for predicting the electromagnetic field of the ellipse device at t=80. Figure 9 The real Ez value diagram of the FDTD calculation of the ellipse device at t=80. The horizontal axis is time, and the vertical axis is the actual Ez value; Figure 13 The specific application diagram of the long-time sequence electromagnetic field value based on the fusion of physical information supervised graph structure Unet model.
[0129] Example 4 The graph structure UNet neural network fusing physical constraints according to example 3 is used for long-time time-domain difference optical simulation method, which is different in that: In order to test the robustness of the network to the device structure, a rectangular device is added here, that is, not only the ellipse device is generated in the data generation stage. The subsequent preprocessing, network training and testing part are consistent with example 2.
[0130] Figure 10 The test loss diagram of the graph structure Unet network model for long-time electromagnetic field prediction of any device (ellipse and rectangle); The horizontal axis is the period of the test (x 1000 times), and the vertical axis is the training loss in training; Figure 11 The Ez value diagram of the graph structure Unet network model for predicting the electromagnetic field of any device (taking rectangle as an example) at t=80. Figure 12 The real Ez value diagram of the FDTD calculation of the rectangular device at t=80. The horizontal axis is time, and the vertical axis is the actual Ez value; Example 5 The graph structure UNet neural network fusing physical constraints according to example 3 is used for long-time time-domain difference optical simulation method, which is different in that: A kind of simulation domain change under the scattering of electromagnetic field of fusion physical information graph structure Unet model.Model is trained in the range of [100,100] to [140,140] with the number of grid Nx and Ny, and the grid size dx=dy=0.05cm is unchanged, can complete the prediction of electromagnetic field scattering under the condition of simulation domain change.
[0131] Example 6 A computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the long-time time-domain difference optical simulation method of the fusion physical constraint graph structure UNet neural network according to any one of embodiments 1-5 when executing the computer program.
[0132] Example 7 A computer-readable storage medium having a computer program stored thereon, the computer program is executed by a processor to implement the steps of the long-time time-domain difference optical simulation method of the fusion physical constraint graph structure UNet neural network according to any one of embodiments 1-5.
[0133] Example 8 The long-time time-domain difference optical simulation system of the fusion physical constraint graph structure UNet neural network includes: The data set acquisition and preprocessing module is configured to: use the FDTD method to construct the device parameter data set, i.e., the device parameters and the corresponding electromagnetic field distribution, to obtain the FDTD uniform grid data, and to preprocess the FDTD uniform grid data; The model construction module is configured to: construct a graph structure Unet model with down-sampling, up-sampling and skip connection structure; The model training module is configured to: input the obtained device parameter data set into the graph structure Unet model for end-to-end training; The prediction module is configured to: after preprocessing the dielectric constant distribution of the device to be predicted and the electromagnetic field at the initial time, convert it into a graph structure input format, input it into the graph structure UNet model saved after training, and use the trained weight file to predict the electromagnetic field scattering after the long-time light source encounters for the given device parameters and initial electromagnetic field distribution; The accuracy prediction module is configured to: compare the electromagnetic field distribution of different device shapes predicted by the long-time prediction with the electromagnetic field value calculated by the FDTD, and then judge the accuracy of the prediction of the graph structure Unet network model.
Claims
1. A graph-structured UNet neural network incorporating physical constraints is used for long-term temporal differential optical simulation methods, characterized in that... include: Step 1: Use the FDTD method to randomly construct a device parameter dataset, i.e., device parameters and corresponding electromagnetic field distributions, to obtain FDTD uniform grid data, and perform data preprocessing on the FDTD uniform grid data; Step 2: Construct a graph-structured Unet model with downsampling, upsampling, and skip connection structures; Step 3: Input the device parameter dataset obtained in Step 1 into the graph structure Unet model described in Step 2 for end-to-end training; Step 4: After preprocessing the dielectric constant distribution of the device to be predicted and its electromagnetic field at the initial moment, convert it into a graph structure input format and input it into the graph structure UNet model trained and saved in Step 3. Use the trained weight file to predict the electromagnetic field scattering after a long time of light source encounter for the given device parameters and initial electromagnetic field distribution. Step 5: Compare the electromagnetic field distributions of different device shapes predicted over a long period of time with the electromagnetic field values calculated by FDTD to determine the accuracy of the graph structure Unet network model prediction.
2. The graph-structured UNet neural network with fused physical constraints described in claim 1 for long-term temporal differential optics simulation method, characterized in that, The device parameters include dielectric and geometry; Further preferred data preprocessing includes: The FDTD uniform grid data is converted into a physically meaningful graph structure G = (V, E, X, E attr FDTD uniform grid data includes dielectric constant, initial electromagnetic fields Ez, Hx, and Hy, relative positions, and relative displacement vectors (dx, dy); V is the set of nodes, E is the set of edges, X is the node feature matrix, and E... attr It is the edge feature matrix; 1) Node mapping and definition: Each discrete point (i, j) in the FDTD uniform grid data is uniquely mapped to a node v_i ∈ V in the graph structure; where i and j are the grid indices of the discrete point in the X and Y directions, respectively; the total number of nodes is N = N_x × N_y, where N_x and N_y are the number of grids in the X and Y directions, respectively. 2) Confirmation of edge connection relationships: An undirected graph is constructed using the 4-neighborhood connection rule. After traversing all grid points, i.e., the total number of nodes N_x × N_y, the connection relationships between each node and its four neighbors (left, right, top, and bottom) are naturally formed. 3) Node Feature Construction: Each node v_i is assigned a multi-dimensional feature vector x_i∈ R^D_n to characterize the physical attribute state of this spatial point; the node feature x_i is composed of features from the following dimensions: Intrinsic characteristics of the material: normalized dielectric constant ε_norm at node v_i; Absolute position feature: the normalized spatial coordinates of node v_i; Electromagnetic field state characteristics: the electromagnetic field component values at node v_i at a specific time step t_n; 4) Construction of edge features: Each edge feature e_uv ∈ E connecting nodes u and v is assigned a multi-dimensional feature vector e_uv ∈ R^D_e, which is used to characterize the physical relationship between two adjacent nodes; the edge feature e_uv is composed of features from the following dimensions: Geometric relationship characteristics: used to describe the relative position vectors of two nodes in space; Physical field difference characteristics: Calculate the difference in physical properties between the nodes at both ends of an edge to simulate the difference operator in FDTD; More preferably, for TM waves, the electromagnetic field state characteristics include: electric field strength Ez_i, magnetic field strength Hx_i, and magnetic field strength Hy_i.
3. The graph-structured UNet neural network with fused physical constraints described in claim 1 for long-term temporal differential optical simulation method, characterized in that, The graph-structured Unet network model includes the GraphDown module, the DoubleGEN module, and the GraphUp module; the GraphDown module and the GraphUp module also include the DoubleGEN module. The GraphDown module, or downsampling module, is used for feature extraction and enhancement, as well as pooling and compression. The DoubleGEN module, or feature extraction module, is a two-layer graph convolutional network module. Through two consecutive message passing and feature transformation processes, nodes in the graph structure can not only aggregate information from their direct neighbors, but also indirectly receive features from their neighbors' neighbors. This enables deeper spatial association modeling and feature extraction, thereby generating node feature representations that are more physically meaningful and spatiotemporally relevant. The GraphUp module, or upsampling / decoder module, is a graph upsampling and feature fusion module that fuses high-level semantic features that have been pooled and compressed with the corresponding detailed spatial features in the encoder path, thereby gradually restoring the spatial resolution of the graph and generating a refined output.
4. The graph-structured UNet neural network with fused physical constraints described in claim 3 for long-term temporal differential optical simulation method, characterized in that, The DoubleGEN module is a two-layer feature extraction structure consisting of two layers: a GENConv layer (generalized graph convolutional layer), a GraphNorm layer (graph normalization layer), and an activation function ELU. In generalized graph convolutional layers, message passing and feature aggregation between nodes are achieved through the GENConv operation; In the graph normalization layer, the node features of each graph are standardized through the GraphNorm normalization operation. In the activation function ELU, after the GraphNorm normalization operation, the exponential linear unit is used as the non-linear activation function; Furthermore, the GraphDown module is composed of the DoubleGEN module and the TopKPooling upsampling strategy; The preprocessed graph structure is used as input data and fed into a two-layer generalized graph convolutional layer and a GraphNorm layer. Layer-by-layer message passing, feature aggregation and normalization are performed on the input node features to generate a high-dimensional node embedding representation. Next, the TopKPooling upsampling strategy is adopted. Based on the importance score of node features, the most important nodes are retained proportionally, and the remaining nodes are discarded. Then, the edge set, edge feature matrix and index information of the graph are updated based on the retained nodes. Furthermore, the forward propagation of the generalized graph convolutional layer follows the message-passing neural network (MPNN) paradigm, specifically consisting of three steps: 1) Message construction: For each edge (j, i) from source node j to target node i, the generalized graph convolutional layer constructs a message. The default message function is addition, which combines the state of the source node and the attributes of the edge to generate a message that is passed along the edge. 2) Message aggregation: The set of neighboring nodes of target node i is N(i). Collect all messages from neighboring nodes j ∈ N(i), which are the node feature values of the neighboring nodes; The softmax normalization function is chosen as the aggregation function for message, i.e., aggr='softmax'; an attention weight α_{ji} is calculated for each message; α_{ji}=softmax(MLP( x_i || x_j || edge_attr_{ji} ) ) ; where x_i represents the node feature vector of the target node i, x_j represents the node feature vector of the source node i, edge_attr_{ji} represents the edge feature vector connecting the source node j and the target node i, and MLP represents a multilayer perceptron; The Softmax function performs normalization, i.e., m_i = Σ(α_{ji} * message_{ji} ); where message_{ji} represents the message sent from source node j to target node i, and the message is generated by fusing source node features and edge features; α_{ji} corresponds to the weight of message_{ji}, which is obtained by normalizing the neighbor message scores using the softmax function; m_i is the final aggregated feature vector of target node i, which is obtained by summing the weighted messages of all neighbors; 3) Node update: The current feature x_i of the target node i is directly summed with the aggregated message m_i, and the node feature is updated through a learnable function; x_i' = update( x_i, m_i ); Finally, the updated node features are output, namely the updated electromagnetic field value Ez, magnetic field strength Hx, and magnetic field strength Hy. More preferably, the GraphUp module includes an upsampling operation and a DoubleGEN module; the GraphUp module reconstructs node features and image quality upwards, including: First, the tensor output from the bottom-level graph convolution after downsampling, or the tensor from the previous upsampling layer, i.e., the low-resolution semantic features [B,C,H,W], where B represents the batch size, C represents the number of channels (i.e., the node features), H represents the height of the image after meshing (i.e., Ny of the initial vertical grid number), and W represents the width of the image after meshing (i.e., Nx of the initial horizontal grid number), is dimensionally aligned using a linear layer. Simultaneously, the corresponding high-order features skip_x from the encoder path and its graph structures skip_edge_index and skip_edge_attr are retained. skip_x refers to the high-order feature tensor of the corresponding level (i.e., node features) retained through skip connections before encoder downsampling; skip_edge_index defines the connection relationship between level nodes (i.e., image grid points); and skip_edge_attr defines the attribute of each edge in the graph (i.e., edge features). Then, the aligned feature vector x_align is upsampled according to the pooling index perm in the downsampling operation until it has the same node dimension as skip_x, resulting in the tensor up_x. Here, x_align refers to the output tensor obtained after the low-resolution semantic feature tensor undergoes channel dimension transformation through a linear layer; perm is the ranking index of node importance recorded during graph downsampling operations in the encoder path; skip_x is the unsampled high-order feature tensor, i.e., node features, directly referenced from intermediate layers of the encoder path through skip connections; up_x is the feature tensor with the same node dimension as skip_x obtained after upsampling the aligned low-resolution feature x_align using the pooling index perm. Next, the upsampled feature vector up_x and the skip connection feature tensor skip_x are concatenated along the feature channel dimension C, with the same node dimension, as shown in the following formula: (1); Among them, up_x has a shape of [N,C1], where N represents the number of nodes and C represents the number of channels, which represents the node features; skip_x has a shape of [N,C2]; fused_x is a Zeiss feature vector that combines global and local information, with a shape of [N,C1+C2]. Finally, the fused feature fused_x and the original graph structure (skip_edge_index, skip_edge_attr) are input into the DoubleGEN module for feature optimization and refinement, ultimately forming refined node features after restoring resolution. All formulas are shown below: ;(2); ;(3); ;(4); (5); Equation (2) is used to align the dimensions of the feature channels through a linear transformation layer; It is a trainable parameter matrix used for feature dimension alignment; Equation (3) describes the upsampling process. Zeros creates a zero tensor of shape [N_skip, D_align], which corresponds to the node feature initialization matrix of the high-resolution image. N_skip represents the number of nodes in the original high-resolution image in the skip connection layer, and D_align represents the number of feature channels; Equation (5) describes the feature refinement process of the DoubleGEN module. A further preferred embodiment employs a TopKPooling upsampling strategy, which scores nodes based on the importance of their features, proportionally retains the most important nodes, and discards the remaining nodes; including: The calculation process is as follows: ;(6); In equation (6), This represents the rating value of the i-th node. ∈ This represents the feature vector of the i-th node. ∈ These are learnable projection parameters; All node ratings { Sort the nodes in descending order and select the first k = ⌈r⋅N⌉ nodes, where N represents the number of nodes in the current graph and r∈(0,1] is the node retention rate. The selected nodes and their related edges together form the pooled subgraph, while the unselected nodes are discarded.
5. The graph-structured UNet neural network with fused physical constraints described in claim 1 for long-term temporal differential optical simulation method, characterized in that, The total loss of the graph-structured Unet network model is calculated as follows: (7); in, For the true electromagnetic field distribution, The values represent the long-term electromagnetic field distribution predicted by the graph-structured Unet network model. It is the residual of the equations generated by substituting the predicted electromagnetic field values of a long time series into the written Maxwell's equations; It is the mean squared error loss, which is a measure of the difference between the predicted value and the actual value; Equation residual function The calculation is as follows: (8); (9); (10); (11); Equation (8) describes the electromagnetic field residual equation. The calculation process, This describes the electric field residual at position x and time n. Represents the vacuum permittivity. Represents the relative permittivity. This represents the value of the z-direction component of the electric field at time steps (n+1, n). Represents the time step. Represents the conductivity terms along the x and y directions in the PML absorber layer. It is a magnetic field The x-direction partial derivative, Yes The y-direction partial derivative, * represents the model prediction value; Equation (9) describes the magnetic field. Residual equation, Represents the residual of the magnetic field component in the x-direction. Represents the vacuum permeability. This represents the value of the magnetic field x component at time step n+1,n. This represents the loss term of the magnetic field in the absorbing boundary. The partial derivative of the electric field along the y-direction is represented by equation (10). The residual equation, Represents the residual of the magnetic field component in the y-direction. The dissipation term of the magnetic field in the x-direction, The partial derivative of the electric field along the x-direction is represented by ; Equation (11) is... , , The summation represents the residual obtained by substituting the entire Maxwell's equations.
6. The graph-structured UNet neural network with fused physical constraints as described in claim 1 for long-term temporal differential optics simulation method, characterized in that, During the training of the graph-structured Unet network model, a phased adaptive learning rate adjustment strategy, namely a multinomial decay learning rate scheduling strategy with warm-up, is adopted; in the early stage of training, a low learning rate is used to warm up and stabilize the convergence direction of the model. In the later stages of training, the learning rate is gradually reduced using polynomial decay. The entire training process is divided into two core phases, including: Phase 1: Learning Rate Warm-up Phase: During the initial training steps of `warmup_steps`, where `warmup_steps` represents the number of iterations used for learning rate warm-up, the learning rate starts from a very small initial value `warmup_start_lr` and grows exponentially to a preset baseline learning rate `lr0`; as shown below: (12); in, This represents the current learning rate value corresponding to the t-th iteration step during training; This represents the initial learning rate during the warm-up phase. The exponential growth factor representing the learning rate is calculated using the following formula: (13); Where lr0 is the target learning rate at the end of the warm-up phase, and warmup_steps is the total number of iterations in the warm-up phase; Phase Two: Polynomial Decay Phase: After the warm-up phase, a polynomial decay strategy is used to gradually decrease the learning rate from the base learning rate lr0 to near 0; the learning rate is decayed according to the following formula: (14); in, This represents the learning rate value at the t-th iteration of the decay phase; t represents the current global iteration number of the training. This indicates the number of steps in the learning rate warm-up phase, i.e., the position where exponential growth ends; r represents the maximum number of iterations in the entire training process. This is the decay control index, used to adjust the rate at which the learning rate decreases.
7. The graph-structured UNet neural network with fused physical constraints according to any one of claims 1-6 for long-term temporal differential optical simulation method, characterized in that, The device parameter dataset obtained after data preprocessing in step 1 is used to train the graph-structured Unet network model constructed in step 2 end-to-end; including: Input the randomly generated device structure and initial electromagnetic field distribution: the device structure includes elliptical, rectangular and irregular shapes; During training, the device structure and initial electromagnetic field distribution are preprocessed and input into the graph structure Unet network model. After passing through the GraphDown, DoubleGEN and GraphUp modules, the electromagnetic field prediction value of long-term electromagnetic field scattering is obtained. At the same time, the data-driven error and physical constraint error are calculated, including the data-driven error MSE and the physical constraint error. The data-driven error (MSE) is calculated by comparing the predicted electromagnetic field value with the actual electromagnetic field value calculated by the FDTD method node by node and time step by time, and then calculating the mean square error. The method for calculating physical constraint error is as follows: substitute the predicted electromagnetic field value into the pre-defined discretized Maxwell's equations and calculate the sum of squared residuals; The total loss function is formed by weighting the data-driven error and the physical constraint error. The gradient of the graph structure Unet network model parameters is calculated through backpropagation, and the weights of the graph structure Unet network model are updated using the optimizer. In a further preferred embodiment, in step 5, the graph structure UNet network model trained in step 4 is applied to the test dataset, that is, the input is the device structure and the initial electromagnetic field distribution that were not trained, and the graph structure UNet network model outputs the long-term electromagnetic field prediction results.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of using the graph-structured UNet neural network with fused physical constraints as described in any one of claims 1-7 for long-term temporal differential optical simulation.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the graph-structured UNet neural network with fused physical constraints as described in any one of claims 1-7 for long-term temporal differential optical simulation.
10. A graph-structured UNet neural network incorporating physical constraints for long-term temporal differential optical simulation systems, characterized in that, include: The dataset acquisition and preprocessing module is configured to: randomly construct a device parameter dataset, i.e., device parameters and corresponding electromagnetic field distributions, using the FDTD method to obtain FDTD uniform grid data, and preprocess the FDTD uniform grid data. The model building module is configured to build a graph-structured Unet model with downsampling, upsampling, and skip connection structures. The model training module is configured to input the obtained device parameter dataset into the graph structure Unet model for end-to-end training. The prediction module is configured to: preprocess the dielectric constant distribution of the device to be predicted and its initial electromagnetic field, convert it into a graph structure input format, input it into the trained and saved graph structure UNet model, and use the trained weight file to predict the electromagnetic field scattering after a long period of time when the given device parameters and initial electromagnetic field distribution are encountered by a light source. The accuracy prediction module is configured to compare the electromagnetic field distribution of different device shapes predicted over a long period of time with the electromagnetic field values calculated by FDTD, and then determine the accuracy of the prediction by the graph structure Unet network model.
Citation Information
Cited By
Diamagnetic material motion control data driving optimization method and system
CN121835445A
Physical field-based device performance prediction method and device, server and medium
CN122242272A